Open d-c-d opened 5 months ago
if I add -fuse-ld=bfd
I don't get the link error, but the elf file text, data, or bss
e.g:
size build/main.elf
text data bss dec hex filename
0 0 0 0 0 build/main.elf
cpu_flags = cpu.get_arch_cflags(self)
link_flags = []
if print_memory_use:
+ link_flags.append("-fuse-ld=bfd") # if using clang/LLVM
link_flags.append("-Wl,--print-memory-usage")
if output_map_file:
link_flags.append("-Wl,-Map=" + str(output_file.with_suffix(".elf.map").relative_to(caller_directory)))
FYI: adding ENTRY(main)
and merging linker.ld
and common.ld
allowed the file to link
$ cat linker.ld <( echo "ENTRY(main)" ) common.ld > bar.ld
$ clang -mthumb --target=arm-none-eabi -mcpu=cortex-m0plus -fuse-ld=bfd -Wl,--print-memory-usage -Wl,-Map=build/main.elf.map -Wl,--gc-sections -nostdlib build/main.o -T bar.ld -o build/main.elf
Memory region Used Size Region Size %age Used
FLASH: 364 B 32 KB 1.11%
RAM: 52 B 8 KB 0.63%
(my_python_3.12_venv) dcd@pi5:~/git/StemmaG0-Template $ size build/main.elf
text data bss dec hex filename
312 52 0 364 16c build/main.elf
Please make a PR with the changes. Thanks for trying this out!
running
build.py
gets an error with respect to the-Wl,--print-memory-usage
being passed toclang
( oh,build.py
was part ofStemmaG0-Template
)including the rest of the traceback - though I don't think it applies