mirror of
https://github.com/pvvx/RTL00MP3.git
synced 2025-01-26 11:05:18 +00:00
update boot images validation
This commit is contained in:
parent
39a516cd39
commit
52cdbed72a
1 changed files with 8 additions and 5 deletions
|
@ -549,8 +549,7 @@ LOCAL uint32 BOOT_RAM_TEXT_SECTION load_img2_head(uint32 faddr, PIMG2HEAD hdr) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
LOCAL uint32 BOOT_RAM_TEXT_SECTION load_segs(uint32 faddr, PIMG2HEAD hdr,
|
||||
uint8 flgload) {
|
||||
LOCAL uint32 BOOT_RAM_TEXT_SECTION load_segs(uint32 faddr, PIMG2HEAD hdr, uint8 flgload) {
|
||||
uint32 fnextaddr = faddr;
|
||||
uint8 segnum = 0;
|
||||
while (1) {
|
||||
|
@ -560,7 +559,7 @@ LOCAL uint32 BOOT_RAM_TEXT_SECTION load_segs(uint32 faddr, PIMG2HEAD hdr,
|
|||
|| seg_id == SEG_ID_SDRAM)) {
|
||||
#if CONFIG_DEBUG_LOG > 1
|
||||
DBG_8195A("Load Flash seg%d: 0x%08x -> %s: 0x%08x, size: %d\n",
|
||||
segnum, faddr, txt_tab_seg[seg_id], hdr->seg.ldaddr,
|
||||
segnum, fnextaddr, txt_tab_seg[seg_id], hdr->seg.ldaddr,
|
||||
hdr->seg.size);
|
||||
#endif
|
||||
fnextaddr += flashcpy(fnextaddr, (void *)hdr->seg.ldaddr, hdr->seg.size);
|
||||
|
@ -571,9 +570,11 @@ LOCAL uint32 BOOT_RAM_TEXT_SECTION load_segs(uint32 faddr, PIMG2HEAD hdr,
|
|||
#endif
|
||||
fnextaddr += hdr->seg.size;
|
||||
} else {
|
||||
// seg_id == UNK
|
||||
fnextaddr -= 8;
|
||||
break;
|
||||
}
|
||||
fnextaddr += flashcpy(fnextaddr, &hdr->seg, sizeof(IMGSEGHEAD));
|
||||
fnextaddr += flashcpy(fnextaddr, hdr, sizeof(IMGSEGHEAD)) + 8;
|
||||
segnum++;
|
||||
}
|
||||
return fnextaddr;
|
||||
|
@ -589,6 +590,7 @@ LOCAL int BOOT_RAM_TEXT_SECTION loadUserImges(int imgnum) {
|
|||
DBG_8195A("Selected Image %d.\n", imgnum);
|
||||
|
||||
while (1) {
|
||||
// новая image только с нового сектора flash
|
||||
faddr = (faddr + FLASH_SECTOR_SIZE - 1) & (~(FLASH_SECTOR_SIZE - 1));
|
||||
uint32 img_id = load_img2_head(faddr, &hdr);
|
||||
if ((img_id >> 8) > 4 && (uint8) img_id != 0) { // есть подпись "RTKW" + RUN или SWP, сегмент != unknown
|
||||
|
@ -602,9 +604,10 @@ LOCAL int BOOT_RAM_TEXT_SECTION loadUserImges(int imgnum) {
|
|||
DBG_8195A("No Image%d! Trying Image0...\n", imgnum);
|
||||
// пробуем загрузить image по умолчанию, по записи в секторе установок
|
||||
flashcpy(FLASH_SYSTEM_DATA_ADDR, &faddr, sizeof(faddr));
|
||||
if (faddr < 0x8000000)
|
||||
if (faddr < 0x08000000)
|
||||
faddr += SPI_FLASH_BASE;
|
||||
if (get_seg_id(faddr, 0x100) == SEG_ID_FLASH) {
|
||||
// если указывает в область flash
|
||||
imagenum = 0;
|
||||
imgnum = 0;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue