I have a question related to storing and changing the fields of structures. The situation is such that there is a microcontroller and flash memory. There are structures in the firmware of the microcontroller and they are used by the hardware device and interact with the higher level. The bottom line is that every time the microcontroller is restarted, it checks the flash memory and these structures (almost every structure has the last field is crc) on crc. How good is it here. But, when we do a firmware update and add new fields to the structures, they change and have a different crc. When flashing the microcontroller, it checks the flash memory and sees that crc is not correct, since the structure has added a new field in itself, after that it resets all data and settings (for security reasons).
The question is the following.
How can I change the fields of the structure (some kind of serialization protocol may be), so that with such an integrity check, the MK does not cause an integrity check error, or it “knows” that this is firmware and “passed past the eyes”. There was an idea to use the Protobuff (and msgpack) serialization protocol for the C language, but at the moment it may not be suitable due to the peculiarity of the firmware code device.
I will be glad to each of your ideas or think about it. There was also an option to consider Android updates, but I'm not sure if the same integrity checks are present, although if this is not the case, please also write about these Android updates