Capturing build commands to file

I would like to capture the command used by the build process in a file so that I can incorporate it into a command line script that can be used at a later date to flash a new firmware outside of the vscode/platformio IDE.

First, is this necessary? I see it flashes a bootloader, partitions, boot, and firmware binaries. Are these going to change in future builds? Why would they change? Also, for now, I can flash just the new firmware.bin to the 0x10000 address. Do I need to worry about this address changing? I would like to ignore the rest of the bin files, and the possibility of moving addresses, but don’t know if this is a safe assumption.

CLIpio run -t cleanpio run -v -j1 > build.log

Or also: Compilation database compile_commands.json — PlatformIO latest documentation

Compile commands are one thing. They of course reference the framework files use use the toolchain installed by PlatformIO (C:\Users\<user>\.platformio\packages\), so without those going to work.

In any case, you’ll be reinventing a build system there.

If you keep the target boad constant (same flash size, same chip type, …) and your partition scheme is not going to change (as in, size of application, size of filesystem, OTA partition, …), the addresses will be the same.

Thanks. Of particular interest is the flashing portion, not the actual build. My interest would be in grepping out the esptool line: --chip esp32s3 --port "/dev/ttyACM0" --baud 460800 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0x10000 .pio/build/esp32-s3/firmware.bin

I can get this from a verbose upload. Is there a platformio.ini option to log this to file? This file would be kept with the firmware.

As far as platform stability, right now, I like the ESP32S3N8R8. With my supply chain luck, I will probably be forced to move to a different chip in the future.

Perhaps I need to ask a different question, like given a firmware.bin file, and the ESP to flash, how would I interrogate it to find out what address the new firmware should be loaded? I guess this is a general question for how to flash any firmware.bin file.