ESP32 부팅 시퀀스(booting sequence), 부트로더(bootloader)
IDF의 Application startup Flow에서 보다 자세한 사항을 보실 수 있습니다.
여기서는 간단한 bootloader의 역활에 대하여만 설명 하겠습니다.
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/startup.html
Application Startup Flow - ESP32 - — ESP-IDF Programming Guide latest documentation
Application startup covers everything that happens after the app starts executing and before the app_main function starts running inside the main task. This is split into three stages: Running the main task After all other components are initialized, the m
docs.espressif.com
ESP32는 2개의 Bootloader를 가지고 있습니다.
1st stage bootloader (ROM bootloader)
- 이 Bootloader는 칩안에 있습니다. 즉, Firmware에 있는 Bootloader가 아닙니다.
- Reset, 초기화 관련 된 작업을 진행하며, Reset reason관련 Log를 프린트 해 줍니다.
- Firmware download모드로 진입할수 있게 해줍니다.
- 2nd stage bootloader를 로딩 합니다.
- Secure boot 와 같은 보안관련 부팅에 대한 판단을 합니다.
- IC자체에 Hard coding되어 있어 수정이 안됩니다.
2nd stage bootloader
- Firmware에 있는 bootloader로 빌드 하면 bootloader.bin같은 바이너리 형태로 나오고, Flash에 0x1000으로 라이팅 합니다.
- 소스코드
https://github.com/espressif/esp-idf/tree/master/components/bootloader
- Secure boot, Flash encryption 처리를 합니다.
- OTA관련 처리를 합니다.
- Partition table을 read하고, 해당 APP image로 부팅을 해줍니다. (IRAM/DRAM에 load하고 실행)