Save assembler files during building

You could do worse than to add build_flags=--save-temps to your platformio.ini file but this applies to any variant of the gcc compiler, possibly clang if that’s in use – but don;t quote me. If you use a different compiler, then the docs should have details of the various flags, and you should be able to add it accordingly.

On an Arduino, gcc is used. The option will fill your project directory with *.i files, *.ii files and *.s files. You can get rid of the first two if as you only appear interested in the assembly source files.

I find this method a minor pain in the rear! What I do if I ever need the assembly source for an ArduinoUno project is to compile in the usual manner – I tend mostly to use the command line:

## Compile ...
pio run

## Switch to location for elf file.
cd .pio/build/uno

## Check...
ls *.elf
firmware.elf

## Dump assembly with C source...
/home/norman/.platformio/packages/toolchain-atmelavr/avr/bin/objdump -S -d firmware.elf > firmeware.s

## Firmware.s is the assembly source for the whole project.

## Change back to project directory.
cd -

The -S option says to mix the C/C++ source in to output alongside the assembly code. The -d option says to disassemble executable sections only. You need to redirect to a file as output from objdump is always to stdout.

HTH

Cheers,
Norm.