Hello there!
I’ve got the following problem:
I am trying to generate a firmware.lss
file using avr-objdump
.
I am able to generate the .lss
file by manually executing the following command on the commandline:
avr-objdump -h -S .pio\build\uno\firmware.elf > .pio\build\uno\firmware.lss
I execute the command from the root of my platformio project.
This works because I added ${userhome}/.platformio/packages/toolchain-atmelavr/bin
to my Windows path variable.
Now I want to automate this step. So I looked at Advanced Scripting and I’ve come up with this simple script:
Import("env", "projenv")
env.AddPostAction(
"$BUILD_DIR/${PROGNAME}.elf",
env.VerboseAction("avr-objdump -h -S $BUILD_DIR/${PROGNAME}.elf > $BUILD_DIR/${PROGNAME}.lss",
"Creating $BUILD_DIR/${PROGNAME}.lss")
)
This script works like a charm. But now comes the part that I am stuck on.
As I am supposed to create a template for many users, I cannot take for granted that they’ve added the toolchain folder to their path. So I was looking for a way to access the toolchain folder automatically. I searched the documentation and found the variable $PLATFORMIO_PACKAGES_DIR
here.
But I don’t know how to use that variable in my script. I would use it as follows:
Import("env", "projenv")
env.AddPostAction(
"$BUILD_DIR/${PROGNAME}.elf",
env.VerboseAction("$PACKAGES_DIR/toolchain-atmelavr/bin/avr-objdump -h -S $BUILD_DIR/${PROGNAME}.elf > $BUILD_DIR/${PROGNAME}.lss",
"Creating $BUILD_DIR/${PROGNAME}.lss")
)
Note that $PACKAGES_DIR
is just a placeholder. The script above does not work.
TL;DR:
How do I access the Platformio package folder? (Or avr-objdump
directly for that matter)
Thank you in advance