How to setup post build action?

how to setup post build action?
I'd like generate disassembled instruction list of the ELF file after every build

Board: esp32c3
OS: Linux
Tool: arduino-cli

Hi @jsm8778.

First you have to find the location of the Arduino boards platform for the esp32c3 board. You can do that by running the following command:

arduino-cli config get directories.data

This will cause Arduino CLI to print the path of your data directory. The platform is installed under that path, at the following location:

<data directory>/packages/<vendor ID>/hardware/<architecture ID>/<version>/

For example:

/home/per/.arduino15/packages/esp32/hardware/esp32/3.0.7/

Now create a file named platform.local.txt in that folder. Open the file in any text editor and add your post build command pattern definition in the file:

https://arduino.github.io/arduino-cli/latest/platform-specification/#pre-and-post-build-hooks-since-arduino-ide-165

You can see an example of how this was done in the MightyCore boards platform here:

In that case, the post-build hook was defined in platform.txt instead of platform.local.txt, but it works the same regardless of which file you put it in.


Note that your platform.local.txt file will be deleted each time you update to a new version of the ESP32 boards platform. I recommend saving a copy of the file to a safe location somewhere outside the platform installation folder so that you can quickly apply your modifications again after an update by simply copying the file back into the platform folder.

This is the reason why it is better to make your modification in the dedicated platform.local.txt file instead of editing the platform's platform.txt file.