Unable to Compile Adafruit Feather M4 Bootloader


I have recently been experimenting with the bootloader for my adafruit M4.

I have been able to successfully compile the bootloader using the Atmel Studio 7 Command Prompt. After navigating to the directory, I then enter the command "make".

However, the problem is that it always compiles the bootloader for the Metro M4.

So, I then tired to enter "make BOARD_ID=FEATHER_M4" as seen in the arduino samd core readme. After compiling this, the bootloader is called FEATHER_M4_sam_ba, however after I then bootload my feather with that (hex) (bin) (elf) file, the board still shows up as an Adafruit Metro M4 in the Arduino IDE Ports Manager.

Here is an output from my command prompt after I enter "make BOARD_ID=FEATHER_M4"

C:\Users\xxx\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.14\bootloaders\metroM4>make BOARD_ID=FEATHER_M4

Compiling bootloader using
BASE PATH = C:\Users\xxx\AppData\Local/Arduino15/packages/arduino
GCC PATH = C:\Users\xxx\AppData\Local/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-

Creating ELF binary
"C:\Users\xxx\AppData\Local/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-gcc" -L. -Lbuild -mthumb -mcpu=cortex-m4 -Wall -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols --specs=nano.specs --specs=nosys.specs -Os -Wl,--gc-sections -save-temps -Tbootloader_FEATHER_M4.ld -Wl,-Map,"build/.map" -o "build/FEATHER_M4_sam_ba.elf" -Wl,--start-group build/board_driver_led.o build/board_driver_serial.o build/board_driver_usb.o build/board_init.o build/board_startup.o build/main.o build/sam_ba_usb.o build/sam_ba_cdc.o build/sam_ba_monitor.o build/sam_ba_serial.o -lm -Wl,--end-group
"C:\Users\xxx\AppData\Local/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-nm" "build/FEATHER_M4_sam_ba.elf" >"build/_symbols.txt"
"C:\Users\xxx\AppData\Local/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-size" --format=sysv -t -x build/FEATHER_M4_sam_ba.elf
build/FEATHER_M4_sam_ba.elf :
section size addr
.vectors 0x40 0x0
.text 0x1bc8 0x40
.data 0x5c 0x20000000
.bss 0x348 0x2000005c
.ARM.attributes 0x2a 0x0
.comment 0x70 0x0
.debug_info 0x15721 0x0
.debug_abbrev 0x19ab 0x0
.debug_aranges 0x2b0 0x0
.debug_ranges 0x270 0x0
.debug_macro 0x24cc1 0x0
.debug_line 0x6c8f 0x0
.debug_str 0xdd8cd 0x0
.debug_frame 0x608 0x0
.debug_loc 0x1489 0x0
Total 0x1242e0

Creating flash binary
"C:\Users\xxx\AppData\Local/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-objcopy" -O binary build/FEATHER_M4_sam_ba.elf FEATHER_M4_sam_ba.bin

Creating flash binary
"C:\Users\xxx\AppData\Local/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-objcopy" -O ihex build/FEATHER_M4_sam_ba.elf FEATHER_M4_sam_ba.hex

As you can see, it does use the bootloader_FEATHER_M4.ld file, however, the board still shows up as an Adafruit Metro M4.

Does anyone know why this is happening? I want to be able to use all of the bootloader files for the Feather M4 and then for the board device in the ports manager to show up as an Adafruit Feather M4.

By the way, if you try doing this, first compile the bootloader by running the samdx1_sam_ba Atmel Studio 7 project in the metroM4 folder because it creates a bunch of files and adds them to a folder called "build". At first I didn't know this when using the CMD and I got a bunch of missing file issues. Also, in the Atmel Studio 7 project I got an error about a missing samd51_sam_ba.elf file. In order to fix this I renamed the METRO_M4_sam_ba.elf in the build folder to that name and then placed it in the metroM4 folder and it compiled correctly.

If you have any questions, I will try to respond ASAP. I would appreciate any help.