"This reminds me of a project i once factorized into "system" and "application". The system was to load/update the application over the host interface."
Yes that is pretty well exactly what I am doing here. Except that the binary generated for the debugger is the same as I am writing into the .bin file, with a CRC appended, and which can be sent to the target where it is stored (in a serial FLASH) and then, on next reboot, flashed into the CPU.
I don't need a second project for that.
The "second project" requirement is that there is a need to update a part of the program. This has a well defined interface. It will involve the generation of a .o library file which is linked to (often a very small) program, and this will be sent to the target. I don't yet know how to generate this library (most likely another "post build step" batch file running some GCC commands, to collect a list of the existing .o files into one). I was hoping to make this an entirely separate project, so avoid any risk of "contamination". The linkfile will also be different.
"You have to create separate build configurations for the same source. If you need to compile slightly different functions, you can define symbols in the build configuration that will be passed to the compiler as if they where defines."
That is really clever - thank you.
Cube has a vast number of build config options, variations of "C/C++ this or that", each with its own config, and its own debugger config, and usually only one of these works

Last night I went around and deleted all the ones not used. There are just two options now: Debug and Release.
This thing needs a course...
I will probably do it with a VM, and that way I can have another file also called main.c, and I can test new versions of Cube without breaking something.