Hello again :) I want to do a ROM-CRC-Check (C167CR-LM, 1 MB ext.Flash-ROM). The following steps are already done: (see Thread "Locating the end of the used FlashROM" for more details) 1. Keil's OH166 creates an Intel-Hex-File 2. Keil's HEX2BIN converts it to a BIN-File 3. My own CRC-Proggie appends a CRC-Sum to this BIN-File 4. Keil's BIN2HEX converts it this BIN-File back to Intel-Hex-Format 5. Flash-Download 6. The Application gets the appended CRC-Sum out of the Flash-Memory 7. The Application calculates the CRC-Sum over the USED Flash-Memory The Memory-Map looks something like this: 00:0000 - 00:7xxx Program-Code 00:7xxx - 00:DFFF unused 00:E000 - 00:FFFF reserved for internal RAM / CAN-Registers / SFR etc. 01:0000 - 01:1xxx Constants / last Part of the Program Code / CRC 10:0000 - 13:FFFF 256K RAM Now my Problem: The appended CRC-Sum is located at the and of the USED ROM-Area anywhere around 01:1xxx and was calculated over the BIN-File (Size approx. 66kB). In that BIN-File unused Bytes do have the Value 0x00 (so the whole Area 00:8000 .. 00:FFFF consists of 0x00's). At the target Dialog of Keil's uVision2 the Flash-Fillbyte is set to 0xFF, but this value is only used to fill up the last line to 16 Bytes. But in the Flash-ROM the unused Bytes have the value 0xFF and so I cannot calculate the same CRC-Checksum as over the BIN-File :( Is there any possibility a) to set unused/reserved Bytes in the HEX-File and so in the BIN-File to 0xFF or b) to get the area of unused space between 00:7xxx and 00:FFFF ? Thanks Torsten
I suspect the 0x00:E000 -- 0x00:FFFF region is your problem. It's not ROM, so it could contain anything. I think you'll have to change your CRC computation to only run over ranges 0x00:0000 .. 0x00:dfff and 0x01:0000 .. END. While at it, maybe you can skip the unused area, too. The key to doing that is to use a linker directive to position a symbol at the exact end of all executable code, so you know where that is.
@Mike: Yes ... it doesn't ... :( If I use
HEX2BIN.EXE /P16 test.h86
:020000020000FC :10000000FA000401FFFFFFFFFFFFFFFFECFDF0C858 ... (Program Code) ... :106B1000F7F820A1DB00FFFFFFFFFFFFFFFFFFFFD4 :020000021000EC :1000000001403DA3000001403EA3000015403FA376 :1000100020202020202020202020202020202020E0 :00000001FF
00:0000 FA000401FFFFFFFFFFFFFFFFECFDF0C8 ... (Program Code) ... 00:6B10 F7F820A1DB00FFFFFFFFFFFFFFFFFFFF 00:6B20 00000000000000000000000000000000 00:6B30 00000000000000000000000000000000 ... (filled up with 0x00) ... 00:FFF0 00000000000000000000000000000000 01:0000 01403DA3000001403EA3000015403FA3 01:0010 20202020202020202020202020202020
... and how should the CRC-Append-Program "know", where the first used area ends and wherefrom the 0x00's are just fillbytes in the BIN-File?
View all questions in Keil forum