Page 1 of 1

ESP32S3 Custom bootloader

Posted: Sat Oct 01, 2022 9:39 am
by karthikkrv85
Team,

I have copied bootloader folder from <esp_sdk>components to myproject/components. I modified the necessary changes so that it can generate pbl.bin in build/pbl/pbl.bin. But i could not avoid generating bootloader.bin. The assumption is to use this customized pbl.bin instead of bootloader.bin. Any suggestion how to avoid generating bootloader.bin without modifying esp_sdk components? i do not want to remove bootloader folder from components

Re: ESP32S3 Custom bootloader

Posted: Sat Oct 01, 2022 11:51 am
by ESP_igrr
The recommended way to customize the bootloader is shown in the bootloader_override example: https://github.com/espressif/esp-idf/tr ... r_override
This way all the build system logic related to the bootloader stays in place, but you can override the implementation. Please give this approach a try!

Re: ESP32S3 Custom bootloader

Posted: Sat Oct 01, 2022 2:08 pm
by karthikkrv85
@ESP_Igrr,

Thanks for your reply.

I tried custom bootloader override example but i face the below error.

c:/espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: appl.elf section `.dram0.bss' will not fit in region `dram_seg'
c:/espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: DRAM segment data does not fit.
c:/espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: region `dram_seg' overflowed by 125528 bytes

It appears the custom bootloader is trying to fit in application binary not in bootloader binary.

Here is my project structure which is different from the example (main CMakelist.txt is not at the root of all directory)


├── main
│ ├── CMakeLists.txt This is main Cmakelist.txt and it references bootloader_components as its EXTRA_COMPONENT_DIRS
│ └── main.c User application
├── bootloader_components
│ └── main
│ ├── component.mk
│ ├── CMakeLists.txt
│ ├── ld/
│ │ └── ...
│ └── bootloader_start.c Implementation of the second stage bootloader
└── README.md

Re: ESP32S3 Custom bootloader

Posted: Sat Oct 01, 2022 4:59 pm
by karthikkrv85
Unless if i update the build structure as below, then it is compiling without error. Because the CMakelist.txt inside bootloader/subproject is referring custom bootloader path as "${PROJECT_SOURCE_DIR}/bootloader_components".

├── main
│ ├── CMakeLists.txt This is main cmakelist.txt and it references the bootloader_components as its EXTRA_COMPONENT_DIRS
│ └── main.c User application
├ └── bootloader_components
│ └── main
│ ├── component.mk
│ ├── CMakeLists.txt
│ ├── ld/
│ │ └── ...
│ └── bootloader_start.c Implementation of the second stage bootloader
└── README.md This is the file you are currently reading