greatscottgadgets / saturn-v

DFU bootloader for SAMD11 and SAMD21 microcontrollers
Other
20 stars 11 forks source link

Compilation failed with arm-none-eabi 9.2.1 #22

Closed knowic closed 5 days ago

knowic commented 1 week ago

tt@ubuntu:~/03-saturn/saturn-v-main$ make arm-none-eabi-gcc -Wall --std=gnu99 -Os -g3 -nostartfiles -fno-builtin -flto -fdata-sections -ffunction-sections -funsigned-char -funsigned-bitfields -mcpu=cortex-m0plus -mthumb -D SAMD21G18A -I . -Iboards/cynthion -D USB_PRODUCT_ID=0x615c -D USB_VENDOR_ID=0x1d50 -D USB_MANUFACTURER_STR='"Saturn-V Project"' -D USB_PRODUCT_STR='"Bootloader"' -D_BOARD_REVISIONMAJOR=1 -D_BOARD_REVISIONMINOR=4 -D VERSION_MAJOR=1 -D VERSION_MINOR=1 -Ideps/usb -Ideps/sam0/cmsis -Ideps/sam0/include -Ideps/sam0/cmsis/samd21/include -Ideps/sam0/cmsis/samd21/source -o bootloader.elf -flto -Wl,--gc-sections --specs=nano.specs -Wl,-Tlink-script.ld common/startup_samd21.o main.o usb.o common/clock.o deps/usb/class/dfu/dfu.o deps/usb/samd/usb_samd.o deps/usb/usb_requests.o /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: bootloader.elf section .text' will not fit in regionrom' /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: region `rom' overflowed by 136 bytes collect2: error: ld returned 1 exit status make: *** [Makefile:94: bootloader.elf] Error 1

Also, I also try some lower version, but still report overflow with different number bytes, So I wander to know which version of arm gcc should be used for success complilation ? thanks.

Jason

martinling commented 6 days ago

We build Saturn-V using the Arm GNU Toolchain packages.

This is currently the only way to get it to fit in 2KB, for some reason.

I've tried building it with several versions of the arm-none-eabi packages from Debian, and the binaries all come out a bit larger.

I'd love to know why, but I've not had time to investigate in detail.

knowic commented 5 days ago

Hi, Martin Yes, we can't get the smallest binary file with the system arm-none-eabi compiler tool , I have get expected firmware with your mentioned tool, Maybe I can change the bootloader code space a litter bit larger with the some sacrifice of Apollo's space.

Thanks for detailed explanation!

martinling commented 5 days ago

Maybe I can change the bootloader code space a litter bit larger with the some sacrifice of Apollo's space

Feel free to try, but you may find that this is very difficult.

The bootloader region can't just be any arbitrary size; it has to be one of a limited number of sizes supported by the SAMD11. We used to use a 4KB bootloader region, but we were running out of space for the Apollo firmware, and that forced us to switch to a 2KB region and very aggressively squeeze Saturn-V into that size.

So unless you cut features from Apollo, you're likely to find it very difficult to add anything to Saturn-V.

Is there something in particular you want to add? The purpose of Saturn-V is really just to make it possible to install and upgrade the main firmware without needing special programming hardware, so in theory it already does everything it should ever need to do.