This commit is contained in:
pvvx 2018-01-22 08:47:23 +03:00
parent daddfa6789
commit 1c773d745a
5 changed files with 10 additions and 9 deletions

View file

@ -559,14 +559,14 @@ LOCAL uint32 BOOT_RAM_TEXT_SECTION load_segs(uint32 faddr, PIMG2HEAD hdr, uint8
|| 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);
} else if (seg_id) {
#if CONFIG_DEBUG_LOG > 2
DBG_8195A("Skip Flash seg%d: 0x%08x -> %s: 0x%08x, size: %d\n", segnum,
faddr, txt_tab_seg[seg_id], hdr->seg.ldaddr, hdr->seg.size);
fnextaddr, txt_tab_seg[seg_id], hdr->seg.ldaddr, hdr->seg.size);
#endif
fnextaddr += hdr->seg.size;
} else {
@ -574,7 +574,7 @@ LOCAL uint32 BOOT_RAM_TEXT_SECTION load_segs(uint32 faddr, PIMG2HEAD hdr, uint8
fnextaddr -= 8;
break;
}
fnextaddr += flashcpy(fnextaddr, hdr, sizeof(IMGSEGHEAD)) + 8;
fnextaddr += flashcpy(fnextaddr, hdr, sizeof(IMGSEGHEAD));
segnum++;
}
return fnextaddr;
@ -590,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
@ -603,7 +604,7 @@ 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

View file

@ -97,9 +97,9 @@ int ram_libgloss_write(int file, const char *ptr, int len) {
//----- ram_libgloss_open()
int ram_libgloss_open(char *file, int flags, int mode) {
// file->_p
int result = rtl_strcmp(file, "/stdin");
int result;
if (result) {
if (rtl_strcmp(file, "/stdin")) {
if (rtl_strcmp(file, "/stdout")) {
if (rtl_strcmp(file, "/stderr"))
result = -1;

View file

@ -350,4 +350,3 @@ MON_RAM_TAB_SECTION COMMAND_TABLE console_cmd_wifi_api[] = {
{"ATSN", 0, fATSN, ": Scan networks"}
};

View file

@ -10,7 +10,7 @@ import os
import struct
import sys
__version__ = "20.01.18"
__version__ = "22.01.18"
PYTHON2 = sys.version_info[0] < 3 # True if on pre-Python 3
@ -295,7 +295,7 @@ def elf2image(args):
for s in image:
if s.hm & HM_IS_OTA:
chks = s.save_ota(f, fn, chks)
f.write(struct.pack('<L', chks))
f.write(struct.pack(b'<LLL', 0, 0, chks))
f.close()
except:
@ -311,6 +311,7 @@ def elf2image(args):
with open(fn, "wb") as f:
for s in image:
s.save_sram(f, fn)
f.write(struct.pack(b'<LL', 0, 0))
f.close()
except: