How to improve the ESP32 SD bootloader?

Sandgroper
Posts: 1
Joined: Thu Apr 28, 2022 1:50 am

How to improve the ESP32 SD bootloader?

Postby Sandgroper » Thu Apr 28, 2022 2:14 am

I use the SD bootloader used with Arduino Zero (SAMD21) variants on multiple systems successfully. I have tested the ESP32 SD bootloader and although it works as a basic bootloader it is not as easy to use as the SAMD21. The difference is that the ESP32 version is standalone. You program the ESP32 with the SD bootloader and then you can bootloader the user application via SD card. It is a two step operation. With the Arduino Zero implementation you can use the bootloader in the same way but you can also embed the bootloader into the application. It does this by converting the bootloader bin file into a ASCII hex representation in a header file which is then included in the application and is placed in the .sketch_boot section of program memory as defined in the standard SAMD21 linker script provided as part of the Arduino SAMD21 package.

Here is an example of how it is included:

Code: Select all


#include <Arduino.h>
__attribute__ ((section(".sketch_boot")))
unsigned char sduBoot[0x4000] = {
	#include "bootloader/My-BLDR.h"
};

The advantage with this system is that there is a single file to program into the Zero containing both the bootloader and the application. The SD_Boot code ignores any address that attempts to overwrite the location of the bootloader.

I could not work out how to implement this model with the ESP32. Any help welcome...

Who is online

Users browsing this forum: No registered users and 56 guests