To append a CRC to my microcontroller application I need to run the linker twice. I have it doing all the build steps and calculating the CRC from the artifacts, but I’m struggling with how to run the linker a second time with the CRC included. Before cmake the scripts copied the Makefile, edited it and ran the new file as a post compile step. Is there any way to obtain the exact command line cmake ran to run the linker (through the compiler)? I could edit that command line to add the CRC and execute it. Or is there a better way?
You probably want
<LANG>_LINKER_LAUNCHER to be a script that does the double linking internally using the arguments given.
That worked great, thank you. It was easy to write a script that ran the linker with a dummy CRC, ran a CRC calculation and then re-ran the linker to add the correct CRC value.