Skip to content

Commit

Permalink
Handle case where CRC is relative to base address. Remove bootsector …
Browse files Browse the repository at this point in the history
…check from 8DO ini (redundant with multipoint checks)
  • Loading branch information
nyetwurk committed Jan 2, 2013
1 parent 078a145 commit 79a9c31
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
6 changes: 3 additions & 3 deletions 8D0907551C.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ rom_checksum_offset=0x01bfe6
rom_checksum_final=0x07ffe0

# boot sector validation
rom_boot_Startaddr=0x00800000
rom_boot_Endaddr=0x00803fff
rom_boot_Chksum=0x0fd90a11
#rom_boot_Startaddr=0x00800000
#rom_boot_Endaddr=0x00803fff
#rom_boot_Chksum=0x0fd90a11
24 changes: 12 additions & 12 deletions 8D0907551M.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ rom_checksum_offset=0x01e75a
rom_checksum_final=0x0fffe0

# boot sector validation
rom_boot_Startaddr=0x00800000
rom_boot_Endaddr=0x00803fff
rom_boot_Chksum=0x0ff728a4
#rom_boot_Startaddr=0x00800000
#rom_boot_Endaddr=0x00803fff
#rom_boot_Chksum=0x0ff728a4

rom_crc1_start=0x810002
rom_crc1_end=0x813FFE
rom_crc1=0x87A866
rom_crc2_start=0x814252
rom_crc2_end=0x817F4E
rom_crc2=0x87A86C
rom_crc3_start=0x818192
rom_crc3_end=0x81FBB0
rom_crc3=0x87A872
rom_crc1_start=0x10002
rom_crc1_end=0x13FFE
rom_crc1=0x7A866
rom_crc2_start=0x14252
rom_crc2_end=0x17F4E
rom_crc2=0x7A86C
rom_crc3_start=0x18192
rom_crc3_end=0x1FBB0
rom_crc3=0x7A872
14 changes: 12 additions & 2 deletions me7sum.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,11 +520,21 @@ static int ReadMainCRC(struct ImageHandle *ih)
if(Config.crc[i].r.start && Config.crc[i].r.end)
{
uint32_t nCalcCRC;
uint32_t nStart = Config.crc[i].r.start - Config.base_address;
uint32_t nStart = Config.crc[i].r.start;
size_t nLen = Config.crc[i].r.end - Config.crc[i].r.start + 1;
uint32_t nCRCAddr = Config.crc[i].offset - Config.base_address;
uint32_t nCRCAddr = Config.crc[i].offset;
uint32_t nCRC;

if (nStart>=Config.base_address)
{
nStart -= Config.base_address;
}

if (nCRCAddr>=Config.base_address)
{
nCRCAddr -= Config.base_address;
}

nCalcCRC = crc32(0, ih->d.p+nStart, nLen);
/* possibly unaligned, so we cant do tricks wtih ih->d.u32 */
#if __BYTE_ORDER == __LITTLE_ENDIAN
Expand Down

0 comments on commit 79a9c31

Please sign in to comment.