I have a need to modify contents of the hex file for a psoc4 device. It is no problem to read the data and modify it. The data is put back into hex format correctly. (This was verified by just unpacking and repacking the file with no changes, then doing a file bit compare). This works down to the metadata line at 9050. This changes when the file data changes. The only description of this that I have found is in "PSoC 3 Device Programming Specifications, Document # 001-62391 Rev. *L " where it says "Internal Use: The 4-byte data is used internally by the PSoC Programmer software. It is not related to actual device programming and need not be used by programmers of third-party vendors.".
For the psoc4, this part seems to be 14 bytes and the psoc programmer certainly does care what it is. Any hex file changes change the metadata and the psoc programmer gives an "unknown record type error". Changing one bit in the file changes the line checksum and the 16 bit checksum and I have taken those into account properly. The one bit change in the source code changes the metadata value by 1 in the last digit as well as the line checksum so at least part of it is a checksum of sorts
Is there a detailed description of the contents of the metadata available?