PlatformIO Community

How to build and upload IAP and user application at the same time

When building an application that is supposed to get OTA-Updates on STM32 (as far as I understand) is to use In-Application-Programming (IAP) to write the new image to flash. But to prepare an Microcontroller for that I have to upload the IAP code to the device and after that the “first” user application code as well (which could be done OTA now but still two individual flash operations). Thus two pio run -t upload commands (and also two individual pio projects) are required to get up and running. I would like to be able to combine projects into one that handles both the IAP and application so a single upload is enough.

As far as I understand this would require two separate compile and linking runs and concatenation of the resulting .hex files (see st-forum) if it was done manually. But then still debugging would be difficult as one would need to combine debug symbols as well. And probably there are many more problems I didn’t even think of.

Is there a proper way to get the described result?