Looking for how to get GPRBuild within the Alire ecosystem to generate ASM for a cross compiled ARM program (bare metal). I tried passing the -S flag to the compiler but it fails at the linking stage, I tried it in the Linker flags but it also fails linking, I tried it in the builder flags but it complains it is not a builder flag.
Anyone have any insights?
-S in Compiler:
main object for main.adb does not exist
gprbuild: link of main.adb failed
-S in Linker:
arm-eabi-gcc.exe: warning: main.o: linker input file unused because linking not done
arm-eabi-gcc.exe: warning: b__main.o: linker input file unused because linking not done
-S in Builder: atsaml21.gpr:32:60: "-S" is not a builder switch. Consider moving it to Global_Compilation_Switches.
Generating ASM files is an intermediate step of compiling. You typically don’t see the generated file and the command to generate the binary .ofile. The switch -S makes the assembler file visible and stops the compile process.
I never needed the assembler output for all of the project, only for a specific file. That’s why I prefer using Makefiles. Here I can include the following lines:
@dmitry-kazakov@RREE
Thanks! That helps me generate them for individual files which is really helpful!
Second question (for anyone): For the case where I want to see the final combined ASM, I can use objdump --disassemble main.elf > main.asm if the correct objdump is on PATH.
With alire that seems a bit more tricky as toolchains are stored with a commit hash. So adding each one to the path can be troublesome longterm. I was wondering if there was a way to call the correct objdump from within alr.
Based on RREE’s comment, I tried alr exec -- objdump --disassemble main.elf > main.asm but it didn’t pull the objdump from the target alire uses in alr build and instead pulls from the path (which is just the native build for msys2). Is there a way for me to tell alire which target to use for objdump. I’m looking for a TOML parameter or similar where I don’t need to know the specific hash (so I don’t need to change it every time I update toolchains in alire).