ESP32S3 Custom bootloader

karthikkrv85
Posts: 12
Joined: Tue May 24, 2022 10:46 am

ESP32S3 Custom bootloader

Postby karthikkrv85 » Sat Oct 01, 2022 9:39 am

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

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: ESP32S3 Custom bootloader

Postby ESP_igrr » Sat Oct 01, 2022 11:51 am

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!

karthikkrv85
Posts: 12
Joined: Tue May 24, 2022 10:46 am

Re: ESP32S3 Custom bootloader

Postby karthikkrv85 » Sat Oct 01, 2022 2:08 pm

@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

karthikkrv85
Posts: 12
Joined: Tue May 24, 2022 10:46 am

Re: ESP32S3 Custom bootloader

Postby karthikkrv85 » Sat Oct 01, 2022 4:59 pm

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

Who is online

Users browsing this forum: No registered users and 266 guests