Building Bootloaders

Hello everyone,
Hope you're all doing great!

I'm looking into building a bootloader for my new designed board using the ATSAMD51G18A and, because of some problems running the uf2 make, I found this topic: ATSAMD51G18A compatibility with Adafruit Metro M4

There, @MartinL mentioned that

To account for this it's necessary to firstly change the location of the double tap (reset) address, that's stored in the the last RAM location. This is in the bootloader definition file (board_definitions_metro_m4.h) in the "bootloader" directory, you'll need to recompile the bootloader:

And I went to look for that file. This was when I found out that most boards have only the "basic" files, like

  • .bin
  • .elf
  • update.uf2

However, the metroM4 (from adafruit) and some other boards, like this one that Martin mentioned: board_definitions_metro_m4.h.

So, my question is: Why do some boards have only the first 3 while others have a lot more inside the bootloaders/<board-name> folder?

The directory for the original target board on which the bootloader was developed, usually contains all the files necessary to compile and build the bootloader binary.

In the case of the SAMD21 the original board was the Arduino Zero, so its folder contains all the bootloader build files. Likewise for Adafruit SAMD51 based Metro M4.

All the other board variants derived from orginals the just contain the "basic" bootloader binary instead, as it essentially saves having to store all the build files for each of them.

Thank you for your answer, I appreciate that!