Actually I'm working on an embedded project which does electrical metering. One requirement is, to split the application in two different parts:
- metrological part (gets certiefied and "frozen")
- user application part (for in-/output tasks; will be updated from time to time to meet future requirements)
The whole application has to reside in the internal FLASH of the controller. Another requirement is, that each part has it's own checksum that must be displayed.
This requirements are given by the authorities - the technical solution is my challenge.
Does there exist a "best pratice" for such a task?
Easiest is just to ensure that you have a MCU with several flash banks. Store the certified part in one bank, and the rest elsewhere. If you are lucky, you can then have the flash programmer or similar tool generate the checksum and burn them into the same flash bank. This way you could program the "frozen" part separately from the application part, and even update the application without touching the "frozen".
I think the above would be the best practice. Otherwise, it gets much trickier, if you have to calculate the checksums on-chip. You'll have to write the CRC code and a flash burner driver etc.
So check what flash banks there are on your MCU to see if this is possible. Then check with the flash programmer tool vendor how they can help with generating a CRC, probably some CRC-32.