blackmagic-debug / blackmagic

In application debugger for ARM Cortex microcontrollers.
GNU General Public License v3.0
3.29k stars 774 forks source link

v1.10.2 builds only with gcc-arm-embedded =< 12.2.rel1 #1978

Closed carlossless closed 3 weeks ago

carlossless commented 3 weeks ago

I've been struggling to build v1.10.2 firmware with the 12.3.rel1 toolchain. The resulting ELF for the native platform would be too large to fit into ROM.

  LD      blackmagic_dfu.elf
  LD      blackmagic.elf
  OBJCOPY blackmagic_dfu.bin
  OBJCOPY blackmagic_dfu.hex
/nix/store/kw32msdv2q6ykvwxnksswq72cwz73klh-gcc-arm-embedded-12.3.rel1/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: address 0x8020938 of blackmagic.elf section `.text' is not within region `rom'
/nix/store/kw32msdv2q6ykvwxnksswq72cwz73klh-gcc-arm-embedded-12.3.rel1/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: blackmagic.elf section `.ARM.exidx' will not fit in region `rom'
/nix/store/kw32msdv2q6ykvwxnksswq72cwz73klh-gcc-arm-embedded-12.3.rel1/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: address 0x8020938 of blackmagic.elf section `.text' is not within region `rom'
/nix/store/kw32msdv2q6ykvwxnksswq72cwz73klh-gcc-arm-embedded-12.3.rel1/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: region `rom' overflowed by 2908 bytes
Memory region         Used Size  Region Size  %age Used
             rom:      133980 B       128 KB    102.22%
             ram:        3904 B        20 KB     19.06%
collect2: error: ld returned 1 exit status

I did a bit of digging and found that using v12.2.rel1 (like in CI) results in a binary that still fits into ROM. Other later versions that I've tried (12.3.rel1, 13.2.rel1) all produce a build that's slightly over ROM capacity.

dragonmux commented 3 weeks ago

Please use the 12.2.rel1 toolchain or use main. This is a known issue that is addressed in v2.0 and there are no plans to backport the fix because usable compilers exist for that release and it doesn't affect the functionality of the firmware. It is caused by some changes that were made in newlib 4 which your chosen compiler build uses. It has nothing to do with the version of the actual compiler, but rather the newlib bundled with it.

See #1876 for details

carlossless commented 3 weeks ago

@dragonmux understood, thank you for the clarification!