I'm working on creating a custom bootloader host program. I need to compute the checksums of the .cyacd file and to verify against the checksum calculated by the PSoC. I've seen some mixed descriptions and implementations in calculating this checksum and wonder if anyone could help.
To help guide the answers here is a list of what I'm confused about and what I understand.
1. The .cyacd is in ASCII and has to be parsed into hex values. I've done this in my code using help from btldrutils.
2. Format of the header in the .cyacd file is [4-byte silicon ID][1-byte Silicon Rev][1-byte checksum type]
Format of row in the .cyacd file is [1-byte array ID][2-byte row number][2-byte data length][64 data bytes][1 byte checksum]
3. The start of the program row is marked by a ':' and the end of the row is marked by '..'.
4. I'm using the basic summation (type 00 in header) from the data sheet this adds up every byte sent (besides the checksum) and takes the 2's complement of this value. Note- App note AN86526 attaches example code to run a bootloader host on a PSoC kit board and in the code the checksum for each row is calculated without taking the 2's complement.
My questions revolve around 4.
1. Is the header included in the checksum calculation?
2. Are the semi colons and periods part of this calculation?
3. Is the checksum calculated for each row or is it a running checksum for the entire file?
4. If its a running checksum do you take the 2's complement each row and then add it to the continuous checksum or do you take the 2's complement to verify that row and then add the number before you took the 2's complement to the continuous checksum?
5. Do you just add everything up and check the data after each row?
Any help or directions toward a file that would help me out would be great.