This commit is contained in:
pvvx 2018-01-22 08:58:17 +03:00
parent 52cdbed72a
commit a60bde21d0
20 changed files with 45 additions and 49 deletions

View file

@ -39,11 +39,11 @@
typedef struct _seg_header { typedef struct _seg_header {
uint32 size; uint32 size;
uint32 ldaddr; uint32 ldaddr;
uint32 sign[2];
} IMGSEGHEAD, *PIMGSEGHEAD; } IMGSEGHEAD, *PIMGSEGHEAD;
typedef struct _img2_header { typedef struct _img2_header {
IMGSEGHEAD seg; IMGSEGHEAD seg;
uint32 sign[2];
void (*startfunc)(void); void (*startfunc)(void);
uint8 rtkwin[7]; uint8 rtkwin[7];
uint8 ver[13]; uint8 ver[13];
@ -536,10 +536,10 @@ LOCAL uint32 BOOT_RAM_TEXT_SECTION get_seg_id(uint32 addr, int32 size) {
LOCAL uint32 BOOT_RAM_TEXT_SECTION load_img2_head(uint32 faddr, PIMG2HEAD hdr) { LOCAL uint32 BOOT_RAM_TEXT_SECTION load_img2_head(uint32 faddr, PIMG2HEAD hdr) {
flashcpy(faddr, hdr, sizeof(IMG2HEAD)); flashcpy(faddr, hdr, sizeof(IMG2HEAD));
uint32 ret = get_seg_id(hdr->seg.ldaddr, hdr->seg.size); uint32 ret = get_seg_id(hdr->seg.ldaddr, hdr->seg.size);
if (hdr->sign[1] == IMG_SIGN2_RUN) { if (hdr->seg.sign[1] == IMG_SIGN2_RUN) {
if (hdr->sign[0] == IMG_SIGN1_RUN) { if (hdr->seg.sign[0] == IMG_SIGN1_RUN) {
ret |= 1 << 9; // есть сигнатура RUN ret |= 1 << 9; // есть сигнатура RUN
} else if (hdr->sign[0] == IMG_SIGN1_SWP) { } else if (hdr->seg.sign[0] == IMG_SIGN1_SWP) {
ret |= 1 << 8; // есть сигнатура SWP ret |= 1 << 8; // есть сигнатура SWP
}; };
} }
@ -566,7 +566,7 @@ LOCAL uint32 BOOT_RAM_TEXT_SECTION load_segs(uint32 faddr, PIMG2HEAD hdr, uint8
} else if (seg_id) { } else if (seg_id) {
#if CONFIG_DEBUG_LOG > 2 #if CONFIG_DEBUG_LOG > 2
DBG_8195A("Skip Flash seg%d: 0x%08x -> %s: 0x%08x, size: %d\n", segnum, 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 #endif
fnextaddr += hdr->seg.size; fnextaddr += hdr->seg.size;
} else { } else {
@ -574,7 +574,7 @@ LOCAL uint32 BOOT_RAM_TEXT_SECTION load_segs(uint32 faddr, PIMG2HEAD hdr, uint8
fnextaddr -= 8; fnextaddr -= 8;
break; break;
} }
fnextaddr += flashcpy(fnextaddr, hdr, sizeof(IMGSEGHEAD)) + 8; fnextaddr += flashcpy(fnextaddr, hdr, sizeof(IMGSEGHEAD));
segnum++; segnum++;
} }
return fnextaddr; return fnextaddr;

View file

@ -1,6 +1,6 @@
h h
loadbin flasher/RTL00Console_ROM.bin 0x10000ba8 loadbin flasher/RTL00Console_ROM.bin 0x10000ba8
r r
w4 0x40000210,0x4011117 w4 0x40000210,0x4011113
g g
q q

View file

@ -4,6 +4,6 @@ r1
trst1 trst1
h h
r r
w4 0x40000210,0x111157 w4 0x40000210,0x0011113
g g
q q

View file

@ -97,3 +97,4 @@ proc load_ram_binary { local_filename address } {
boot_from_ram boot_from_ram
resume resume
} }

View file

@ -13,17 +13,17 @@ set mem inaccessible-by-default off
#set remote memory-write-packet-size 4096 #set remote memory-write-packet-size 4096
#set remote memory-write-packet-size fixed #set remote memory-write-packet-size fixed
# Boot Flash # Boot Flash
monitor long 0x40000210 = 0x211157 monitor long 0x40000210 = 0x00011113
# Boot RAM start_addr0() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x80000000 ) # Boot RAM start_addr0() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x80000000 )
#monitor long 0x40000210 = 0x80011117 #monitor long 0x40000210 = 0x80011113
# Boot RAM start_addr1() Run if ( v40000210 & 0x20000000 ) # Boot RAM start_addr1() Run if ( v40000210 & 0x20000000 )
#monitor long 0x40000210 = 0x20011117 #monitor long 0x40000210 = 0x20011113
# Boot RAM start_addr2() Run if ( v40000210 & 0x10000000 ) # Boot RAM start_addr2() Run if ( v40000210 & 0x10000000 )
#monitor long 0x40000210 = 0x10011117 #monitor long 0x40000210 = 0x10011113
# Boot RAM start_addr3() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x8000000 ) # Boot RAM start_addr3() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x8000000 )
#monitor long 0x40000210 = 0x8011117 #monitor long 0x40000210 = 0x8011113
# Boot RAM start_addr4() Init console, Run if ( v40000210 & 0x4000000 ) # Boot RAM start_addr4() Init console, Run if ( v40000210 & 0x4000000 )
monitor long 0x40000210 = 0x4011117 monitor long 0x40000210 = 0x4011113
# CPU CLK 166 MHz? # CPU CLK 166 MHz?
# monitor long 0x40000014 = 0x00000011 # monitor long 0x40000014 = 0x00000011
# CPU CLK 83 MHz? # CPU CLK 83 MHz?

View file

@ -43,32 +43,32 @@ end
# Boot_Flash # Boot_Flash
define SetBootFlash define SetBootFlash
printf "SetBoot = Flash:\n" printf "SetBoot = Flash:\n"
monitor long 0x40000210 = 0x211157 monitor long 0x40000210 = 0x011113
end end
# Boot RAM start_addr0() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x80000000 ) # Boot RAM start_addr0() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x80000000 )
define SetBootCall0 define SetBootCall0
printf "SetBoot = Call0:\n" printf "SetBoot = Call0:\n"
monitor long 0x40000210 = 0x80011117 monitor long 0x40000210 = 0x80011113
end end
# Boot RAM start_addr1() Run if ( v40000210 & 0x20000000 ) # Boot RAM start_addr1() Run if ( v40000210 & 0x20000000 )
define SetBootCall1 define SetBootCall1
printf "SetBoot = Call1:\n" printf "SetBoot = Call1:\n"
monitor long 0x40000210 = 0x20011117 monitor long 0x40000210 = 0x20011113
end end
# Boot RAM start_addr2() Run if ( v40000210 & 0x10000000 ) # Boot RAM start_addr2() Run if ( v40000210 & 0x10000000 )
define SetBootCall2 define SetBootCall2
printf "SetBoot = Call2:\n" printf "SetBoot = Call2:\n"
monitor long 0x40000210 = 0x10011117 monitor long 0x40000210 = 0x10011113
end end
# Boot RAM start_addr3() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x8000000 ) # Boot RAM start_addr3() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x8000000 )
define SetBootCall3 define SetBootCall3
printf "SetBoot = Call3:\n" printf "SetBoot = Call3:\n"
monitor long 0x40000210 = 0x8011117 monitor long 0x40000210 = 0x8011113
end end
# Boot RAM start_addr4() Init console, Run if ( v40000210 & 0x4000000 ) # Boot RAM start_addr4() Init console, Run if ( v40000210 & 0x4000000 )
define SetBootCall4 define SetBootCall4
printf "SetBoot = Call4:\n" printf "SetBoot = Call4:\n"
monitor long 0x40000210 = 0x4011117 monitor long 0x40000210 = 0x4011113
end end
# CPU CLK 166 MHz? # CPU CLK 166 MHz?
define SetClk166MHz define SetClk166MHz
@ -89,8 +89,7 @@ monitor long 0x40000304 = 0x1FC00002
monitor long 0x40000250 = 0x400 monitor long 0x40000250 = 0x400
monitor long 0x40000340 = 0x0 monitor long 0x40000340 = 0x0
monitor long 0x40000230 = 0xdcc4 monitor long 0x40000230 = 0xdcc4
monitor long 0x40000210 = 0x11117 monitor long 0x40000210 = 0x11113
monitor long 0x40000210 = 0x11157
monitor long 0x400002c0 = 0x110011 monitor long 0x400002c0 = 0x110011
monitor long 0x40000320 = 0xffffffff monitor long 0x40000320 = 0xffffffff
end end

View file

@ -4,7 +4,6 @@ source -v flasher/gdb_flasher.jlink
InitJlink InitJlink
SystemInit SystemInit
SPI_Init SPI_Init
monitor speed 12000
#FlashInfo #FlashInfo
# Read FullFlash # Read FullFlash
printf "Read FullFlash:\n" printf "Read FullFlash:\n"
@ -12,6 +11,6 @@ set $dumpstartaddr = $SPI_FLASH_BASE
set $dumpendaddr = $SPI_FLASH_BASE + 0x100000 set $dumpendaddr = $SPI_FLASH_BASE + 0x100000
printf "Start addr of dumping = 0x%08x\n", $dumpstartaddr printf "Start addr of dumping = 0x%08x\n", $dumpstartaddr
printf "End addr of dumping = 0x%08x\n", $dumpendaddr printf "End addr of dumping = 0x%08x\n", $dumpendaddr
dump binary memory ../fullflash.bin $dumpstartaddr $dumpendaddr dump binary memory ./build/bin/fullflash.bin $dumpstartaddr $dumpendaddr
printf "FullFlash saved in ./build/bin/fullflash.bin - OK.\n" printf "FullFlash saved in ./build/bin/fullflash.bin - OK.\n"
quit quit

View file

@ -134,12 +134,10 @@ end
end end
######################################### #########################################
source -v flasher/gdb_flasher.jlink source -v flasher/gdb_flasher.jlink
source -v flasher/file_info.jlink source -v flasher/file_info.jlink
InitJlink InitJlink
SystemInit SystemInit
SetClk166MHz SetClk83MHz
SPI_Init SPI_Init
FlasherInit FlasherInit
FlasherLoad flasher/rtl8710_flasher.bin FlasherLoad flasher/rtl8710_flasher.bin
@ -155,8 +153,4 @@ end
else else
printf "Error: Image size is zero!\n" printf "Error: Image size is zero!\n"
end end
FlashImagesInfo
monitor reset
SetBootFlash
monitor go
quit quit

View file

@ -353,3 +353,4 @@ proc boot_load_srdam {local_filename loc} {
# echo "# Go" # echo "# Go"
mww 0x1FFF0000 1 mww 0x1FFF0000 1
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,6 +1,6 @@
h h
loadbin flasher/RTL00Console_ROM.bin 0x10000ba8 loadbin flasher/RTL00Console_ROM.bin 0x10000ba8
r r
w4 0x40000210,0x4011117 w4 0x40000210,0x4011113
g g
q q

View file

@ -4,6 +4,6 @@ r1
trst1 trst1
h h
r r
w4 0x40000210,0x0211157 w4 0x40000210,0x0011113
g g
q q

View file

@ -97,3 +97,4 @@ proc load_ram_binary { local_filename address } {
boot_from_ram boot_from_ram
resume resume
} }

View file

@ -13,17 +13,17 @@ set mem inaccessible-by-default off
#set remote memory-write-packet-size 4096 #set remote memory-write-packet-size 4096
#set remote memory-write-packet-size fixed #set remote memory-write-packet-size fixed
# Boot Flash # Boot Flash
monitor long 0x40000210 = 0x211157 monitor long 0x40000210 = 0x00011113
# Boot RAM start_addr0() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x80000000 ) # Boot RAM start_addr0() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x80000000 )
#monitor long 0x40000210 = 0x80011117 #monitor long 0x40000210 = 0x80011113
# Boot RAM start_addr1() Run if ( v40000210 & 0x20000000 ) # Boot RAM start_addr1() Run if ( v40000210 & 0x20000000 )
#monitor long 0x40000210 = 0x20011117 #monitor long 0x40000210 = 0x20011113
# Boot RAM start_addr2() Run if ( v40000210 & 0x10000000 ) # Boot RAM start_addr2() Run if ( v40000210 & 0x10000000 )
#monitor long 0x40000210 = 0x10011117 #monitor long 0x40000210 = 0x10011113
# Boot RAM start_addr3() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x8000000 ) # Boot RAM start_addr3() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x8000000 )
#monitor long 0x40000210 = 0x8011117 #monitor long 0x40000210 = 0x8011113
# Boot RAM start_addr4() Init console, Run if ( v40000210 & 0x4000000 ) # Boot RAM start_addr4() Init console, Run if ( v40000210 & 0x4000000 )
monitor long 0x40000210 = 0x4011117 monitor long 0x40000210 = 0x4011113
# CPU CLK 166 MHz? # CPU CLK 166 MHz?
# monitor long 0x40000014 = 0x00000011 # monitor long 0x40000014 = 0x00000011
# CPU CLK 83 MHz? # CPU CLK 83 MHz?

View file

@ -43,32 +43,32 @@ end
# Boot_Flash # Boot_Flash
define SetBootFlash define SetBootFlash
printf "SetBoot = Flash:\n" printf "SetBoot = Flash:\n"
monitor long 0x40000210 = 0x211157 monitor long 0x40000210 = 0x011113
end end
# Boot RAM start_addr0() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x80000000 ) # Boot RAM start_addr0() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x80000000 )
define SetBootCall0 define SetBootCall0
printf "SetBoot = Call0:\n" printf "SetBoot = Call0:\n"
monitor long 0x40000210 = 0x80011117 monitor long 0x40000210 = 0x80011113
end end
# Boot RAM start_addr1() Run if ( v40000210 & 0x20000000 ) # Boot RAM start_addr1() Run if ( v40000210 & 0x20000000 )
define SetBootCall1 define SetBootCall1
printf "SetBoot = Call1:\n" printf "SetBoot = Call1:\n"
monitor long 0x40000210 = 0x20011117 monitor long 0x40000210 = 0x20011113
end end
# Boot RAM start_addr2() Run if ( v40000210 & 0x10000000 ) # Boot RAM start_addr2() Run if ( v40000210 & 0x10000000 )
define SetBootCall2 define SetBootCall2
printf "SetBoot = Call2:\n" printf "SetBoot = Call2:\n"
monitor long 0x40000210 = 0x10011117 monitor long 0x40000210 = 0x10011113
end end
# Boot RAM start_addr3() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x8000000 ) # Boot RAM start_addr3() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x8000000 )
define SetBootCall3 define SetBootCall3
printf "SetBoot = Call3:\n" printf "SetBoot = Call3:\n"
monitor long 0x40000210 = 0x8011117 monitor long 0x40000210 = 0x8011113
end end
# Boot RAM start_addr4() Init console, Run if ( v40000210 & 0x4000000 ) # Boot RAM start_addr4() Init console, Run if ( v40000210 & 0x4000000 )
define SetBootCall4 define SetBootCall4
printf "SetBoot = Call4:\n" printf "SetBoot = Call4:\n"
monitor long 0x40000210 = 0x4011117 monitor long 0x40000210 = 0x4011113
end end
# CPU CLK 166 MHz? # CPU CLK 166 MHz?
define SetClk166MHz define SetClk166MHz
@ -89,8 +89,7 @@ monitor long 0x40000304 = 0x1FC00002
monitor long 0x40000250 = 0x400 monitor long 0x40000250 = 0x400
monitor long 0x40000340 = 0x0 monitor long 0x40000340 = 0x0
monitor long 0x40000230 = 0xdcc4 monitor long 0x40000230 = 0xdcc4
monitor long 0x40000210 = 0x11117 monitor long 0x40000210 = 0x11113
monitor long 0x40000210 = 0x11157
monitor long 0x400002c0 = 0x110011 monitor long 0x400002c0 = 0x110011
monitor long 0x40000320 = 0xffffffff monitor long 0x40000320 = 0xffffffff
end end

View file

@ -353,3 +353,4 @@ proc boot_load_srdam {local_filename loc} {
# echo "# Go" # echo "# Go"
mww 0x1FFF0000 1 mww 0x1FFF0000 1
} }

View file

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