update boot images validation

This commit is contained in:
pvvx 2018-01-21 00:37:38 +03:00
parent 3a9b303c84
commit daddfa6789

View file

@ -549,8 +549,7 @@ LOCAL uint32 BOOT_RAM_TEXT_SECTION load_img2_head(uint32 faddr, PIMG2HEAD hdr) {
return ret; return ret;
} }
LOCAL uint32 BOOT_RAM_TEXT_SECTION load_segs(uint32 faddr, PIMG2HEAD hdr, LOCAL uint32 BOOT_RAM_TEXT_SECTION load_segs(uint32 faddr, PIMG2HEAD hdr, uint8 flgload) {
uint8 flgload) {
uint32 fnextaddr = faddr; uint32 fnextaddr = faddr;
uint8 segnum = 0; uint8 segnum = 0;
while (1) { while (1) {
@ -571,9 +570,11 @@ LOCAL uint32 BOOT_RAM_TEXT_SECTION load_segs(uint32 faddr, PIMG2HEAD hdr,
#endif #endif
fnextaddr += hdr->seg.size; fnextaddr += hdr->seg.size;
} else { } else {
// seg_id == UNK
fnextaddr -= 8;
break; break;
} }
fnextaddr += flashcpy(fnextaddr, &hdr->seg, sizeof(IMGSEGHEAD)); fnextaddr += flashcpy(fnextaddr, hdr, sizeof(IMGSEGHEAD)) + 8;
segnum++; segnum++;
} }
return fnextaddr; return fnextaddr;
@ -605,6 +606,7 @@ LOCAL int BOOT_RAM_TEXT_SECTION loadUserImges(int imgnum) {
if (faddr < 0x8000000) if (faddr < 0x8000000)
faddr += SPI_FLASH_BASE; faddr += SPI_FLASH_BASE;
if (get_seg_id(faddr, 0x100) == SEG_ID_FLASH) { if (get_seg_id(faddr, 0x100) == SEG_ID_FLASH) {
// если указывает в область flash
imagenum = 0; imagenum = 0;
imgnum = 0; imgnum = 0;
} else { } else {