mirror of
https://github.com/pvvx/rtl00TstMinAmebaV35a.git
synced 2024-11-21 17:24:16 +00:00
update
This commit is contained in:
parent
e757d94e17
commit
891cbcb716
9 changed files with 381 additions and 126 deletions
3
JLink-RTL00ConsoleROM.bat
Normal file
3
JLink-RTL00ConsoleROM.bat
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
@echo off
|
||||||
|
PATH=D:\MCU\SEGGER\JLink_V610a;%PATH%
|
||||||
|
start JLink.exe -Device CORTEX-M3 -If SWD -Speed 4000 flasher\RTL00ConsoleROM.JLinkScript
|
|
@ -1,6 +1,6 @@
|
||||||
@echo off
|
@echo off
|
||||||
PATH=D:\MCU\GNU_Tools_ARM_Embedded\5.2_2015q4\bin;D:\MCU\SEGGER\JLink_V610a;%PATH%
|
PATH=D:\MCU\GNU_Tools_ARM_Embedded\5.2_2015q4\bin;D:\MCU\SEGGER\JLink_V610a;%PATH%
|
||||||
start JLinkGDBServer.exe -device Cortex-M3 -if SWD -ir -endian little -speed 1000
|
start JLinkGDBServer.exe -device Cortex-M3 -if SWD -ir -endian little -speed 3500
|
||||||
arm-none-eabi-gdb.exe -x flasher/gdb_wrflash.jlink
|
arm-none-eabi-gdb.exe -x flasher/gdb_wrflash.jlink
|
||||||
taskkill /F /IM JLinkGDBServer.exe
|
taskkill /F /IM JLinkGDBServer.exe
|
||||||
|
|
||||||
|
|
6
flasher/RTL00ConsoleROM.JLinkScript
Normal file
6
flasher/RTL00ConsoleROM.JLinkScript
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
h
|
||||||
|
loadbin flasher/RTL00Console_ROM.bin 0x10000ba8
|
||||||
|
r
|
||||||
|
w4 0x40000210,0x4011117
|
||||||
|
g
|
||||||
|
q
|
BIN
flasher/RTL00Console_ROM.bin
Normal file
BIN
flasher/RTL00Console_ROM.bin
Normal file
Binary file not shown.
198
flasher/gdb_flasher.jlink
Normal file
198
flasher/gdb_flasher.jlink
Normal file
|
@ -0,0 +1,198 @@
|
||||||
|
####################################
|
||||||
|
# J-LINK GDB SERVER initialization #
|
||||||
|
####################################
|
||||||
|
define InitJlink
|
||||||
|
printf "Jlink Init:\n"
|
||||||
|
set verbose off
|
||||||
|
set complaints 0
|
||||||
|
set confirm off
|
||||||
|
set exec-done-display off
|
||||||
|
show exec-done-display
|
||||||
|
set trace-commands off
|
||||||
|
#set debug aix-thread off
|
||||||
|
#set debug dwarf2-die 0
|
||||||
|
set debug displaced off
|
||||||
|
set debug expression 0
|
||||||
|
set debug frame 0
|
||||||
|
set debug infrun 0
|
||||||
|
set debug observer 0
|
||||||
|
set debug overload 0
|
||||||
|
#set debugvarobj 0
|
||||||
|
set pagination off
|
||||||
|
set print address off
|
||||||
|
set print symbol-filename off
|
||||||
|
set print symbol off
|
||||||
|
set print pretty off
|
||||||
|
set print object off
|
||||||
|
#set debug notification off
|
||||||
|
set debug parser off
|
||||||
|
set debug remote 0
|
||||||
|
target remote localhost:2331
|
||||||
|
set remotetimeout 10000
|
||||||
|
monitor device Cortex-M3
|
||||||
|
monitor endian little
|
||||||
|
monitor reset
|
||||||
|
# Set max speed
|
||||||
|
monitor speed 4000
|
||||||
|
set mem inaccessible-by-default off
|
||||||
|
# Setup GDB FOR FASTER DOWNLOADS
|
||||||
|
set remote memory-write-packet-size 8192
|
||||||
|
set remote memory-write-packet-size fixed
|
||||||
|
end
|
||||||
|
#############
|
||||||
|
# Boot_Flash
|
||||||
|
define SetBootFlash
|
||||||
|
printf "SetBoot = Flash:\n"
|
||||||
|
monitor long 0x40000210 = 0x211157
|
||||||
|
end
|
||||||
|
# Boot RAM start_addr0() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x80000000 )
|
||||||
|
define SetBootCall0
|
||||||
|
printf "SetBoot = Call0:\n"
|
||||||
|
monitor long 0x40000210 = 0x80011117
|
||||||
|
end
|
||||||
|
# Boot RAM start_addr1() Run if ( v40000210 & 0x20000000 )
|
||||||
|
define SetBootCall1
|
||||||
|
printf "SetBoot = Call1:\n"
|
||||||
|
monitor long 0x40000210 = 0x20011117
|
||||||
|
end
|
||||||
|
# Boot RAM start_addr2() Run if ( v40000210 & 0x10000000 )
|
||||||
|
define SetBootCall2
|
||||||
|
printf "SetBoot = Call2:\n"
|
||||||
|
monitor long 0x40000210 = 0x10011117
|
||||||
|
end
|
||||||
|
# Boot RAM start_addr3() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x8000000 )
|
||||||
|
define SetBootCall3
|
||||||
|
printf "SetBoot = Call3:\n"
|
||||||
|
monitor long 0x40000210 = 0x8011117
|
||||||
|
end
|
||||||
|
# Boot RAM start_addr4() Init console, Run if ( v40000210 & 0x4000000 )
|
||||||
|
define SetBootCall4
|
||||||
|
printf "SetBoot = Call4:\n"
|
||||||
|
monitor long 0x40000210 = 0x4011117
|
||||||
|
end
|
||||||
|
# CPU CLK 166 MHz?
|
||||||
|
define SetClk166MHz
|
||||||
|
printf "SetCLK 166.66MHz:\n"
|
||||||
|
monitor long 0x40000014 = 0x00000011
|
||||||
|
end
|
||||||
|
# CPU CLK 83 MHz?
|
||||||
|
define SetClk83MHz
|
||||||
|
printf "SetCLK 83.33MHz:\n"
|
||||||
|
monitor long 0x40000014 = 0x00000021
|
||||||
|
end
|
||||||
|
###############
|
||||||
|
# System Init #
|
||||||
|
###############
|
||||||
|
define SystemInit
|
||||||
|
printf "System Init:\n"
|
||||||
|
monitor long 0x40000304 = 0x1FC00002
|
||||||
|
monitor long 0x40000250 = 0x400
|
||||||
|
monitor long 0x40000340 = 0x0
|
||||||
|
monitor long 0x40000230 = 0xdcc4
|
||||||
|
monitor long 0x40000210 = 0x11117
|
||||||
|
monitor long 0x40000210 = 0x11157
|
||||||
|
monitor long 0x400002c0 = 0x110011
|
||||||
|
monitor long 0x40000320 = 0xffffffff
|
||||||
|
end
|
||||||
|
############
|
||||||
|
# SPI Init #
|
||||||
|
############
|
||||||
|
define SPI_Init
|
||||||
|
printf "Init SPI:\n"
|
||||||
|
#enable spi flash peripheral clock
|
||||||
|
set $Temp = {int}(0x40000230)
|
||||||
|
set $Temp = ($Temp | 0x300)
|
||||||
|
set {int}(0x40000230) = $Temp
|
||||||
|
#enable spi flash peripheral
|
||||||
|
set $Temp = {int}(0x40000210)
|
||||||
|
set $Temp = ($Temp | 0x10)
|
||||||
|
set {int}(0x40000210) = $Temp
|
||||||
|
#select spi flash pinout (0 - internal), enable spi flash pins
|
||||||
|
set $Temp = {int}(0x400002C0)
|
||||||
|
set $Temp = (($Temp & 0xFFFFFFF8) | 1)
|
||||||
|
set {int}(0x400002C0) = $Temp
|
||||||
|
#disable SPI FLASH operation
|
||||||
|
monitor long 0x40006008 = 0
|
||||||
|
#disable all interrupts
|
||||||
|
monitor long 0x4000602C = 0
|
||||||
|
#use first "slave select" pin
|
||||||
|
monitor long 0x40006010 = 1
|
||||||
|
#baud rate, default value
|
||||||
|
monitor long 0x40006014 = 2
|
||||||
|
#tx fifo threshold
|
||||||
|
monitor long 0x40006018 = 0
|
||||||
|
#rx fifo threshold
|
||||||
|
monitor long 0x4000601C = 0
|
||||||
|
#disable DMA
|
||||||
|
monitor long 0x4000604C = 0
|
||||||
|
set $SPI_FLASH_BASE = 0x98000000
|
||||||
|
end
|
||||||
|
###################
|
||||||
|
# SetFirwareSize #
|
||||||
|
###################
|
||||||
|
define SetFirwareSize
|
||||||
|
set $rambuffer = 0x10000300
|
||||||
|
printf "Get ImagesSize:\n"
|
||||||
|
restore $arg0 binary $rambuffer 0 0x20
|
||||||
|
set $Image1Size = {int}($rambuffer+0x10) + 32
|
||||||
|
set $Image1LoadAddr = {int}($rambuffer+0x14)
|
||||||
|
set $Image2Addr = {short}($rambuffer+0x18) * 1024
|
||||||
|
if $Image1Size != 0 && $Image1Size < 0x1000000
|
||||||
|
if $Image2Addr == 0
|
||||||
|
set $Image2Addr = $Image1Size + 32
|
||||||
|
end
|
||||||
|
printf "Image1Size = %d\n", $Image1Size
|
||||||
|
printf "Image1LoadAddr = 0x%08x\n", $Image1LoadAddr
|
||||||
|
printf "Image2FlashAddr = 0x%08x\n", $Image2Addr
|
||||||
|
set $parms1 = $rambuffer - $Image2Addr
|
||||||
|
set $parms3 = $Image2Addr + 0x08
|
||||||
|
restore $arg0 binary $parms1 $Image2Addr $parms3
|
||||||
|
set $Image2Size = {int}($rambuffer)
|
||||||
|
set $Image2LoadAddr = {int}($rambuffer+0x4)
|
||||||
|
if $Image2Size != 0xFFFFFFFF || $Image2Size != 0
|
||||||
|
set $Image2Size = $Image2Size + 16
|
||||||
|
printf "Image2Size = %d\n", $Image2Size
|
||||||
|
printf "Image2LoadAddr = 0x%08x\n", $Image2LoadAddr
|
||||||
|
set $FirmwareSize = $Image2Addr + $Image2Size
|
||||||
|
printf "FirmwareSize = %d\n", $FirmwareSize
|
||||||
|
else
|
||||||
|
set $Image2Size = 0
|
||||||
|
printf "Image2 - None\n"
|
||||||
|
set $FirmwareSize = $Image1Size
|
||||||
|
printf "FirmwareSize = %d\n", $FirmwareSize
|
||||||
|
end
|
||||||
|
else
|
||||||
|
set $Image1Size = 0
|
||||||
|
set $Image2Size = 0
|
||||||
|
set $Image2Addr = 0
|
||||||
|
set $FirmwareSize = 0
|
||||||
|
printf "Image not format Firmware!\n"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#####################
|
||||||
|
# Flash Images Info #
|
||||||
|
#####################
|
||||||
|
define FlashImagesInfo
|
||||||
|
printf "Flash Info:\n"
|
||||||
|
set $Image1Size = {int}($SPI_FLASH_BASE + 0x10) + 32
|
||||||
|
set $Image1LoadAddr = {int}($SPI_FLASH_BASE + 0x14)
|
||||||
|
if $Image1LoadAddr == 0xFFFFFFFF
|
||||||
|
printf "Image1 - None\n"
|
||||||
|
else
|
||||||
|
set $Image2FlashAddr = {short}($SPI_FLASH_BASE + 0x18) * 1024
|
||||||
|
if $Image2FlashAddr == 0
|
||||||
|
$Image2FlashAddr = $Image1Size
|
||||||
|
end
|
||||||
|
set $Image2Size = {int}($Image2FlashAddr + $SPI_FLASH_BASE)
|
||||||
|
set $Image2LoadAddr = {int}($Image2FlashAddr + $SPI_FLASH_BASE + 0x4)
|
||||||
|
printf "Image1Size = %d\n", $Image1Size
|
||||||
|
printf "Image1LoadAddr = 0x%08x\n", $Image1LoadAddr
|
||||||
|
printf "Image2FlashAddr = 0x%08x\n", $Image2FlashAddr
|
||||||
|
if $Image2Size != 0xFFFFFFFF
|
||||||
|
printf "Image2Size = %d\n", $Image2Size
|
||||||
|
printf "Image2LoadAddr = 0x%08x\n", $Image2LoadAddr
|
||||||
|
else
|
||||||
|
printf "Image2 - None\n"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,102 +1,16 @@
|
||||||
#Message display setting
|
# GDB Jlink read fullflash
|
||||||
#disable all messages
|
# Init
|
||||||
|
source -v flasher/gdb_flasher.jlink
|
||||||
set verbose off
|
InitJlink
|
||||||
set complaints 0
|
SystemInit
|
||||||
set confirm off
|
SPI_Init
|
||||||
set exec-done-display off
|
FlashInfo
|
||||||
show exec-done-display
|
|
||||||
set trace-commands off
|
|
||||||
#set debug aix-thread off
|
|
||||||
#set debug dwarf2-die 0
|
|
||||||
set debug displaced off
|
|
||||||
set debug expression 0
|
|
||||||
set debug frame 0
|
|
||||||
set debug infrun 0
|
|
||||||
set debug observer 0
|
|
||||||
set debug overload 0
|
|
||||||
#set debugvarobj 0
|
|
||||||
set pagination off
|
|
||||||
set print address off
|
|
||||||
set print symbol-filename off
|
|
||||||
set print symbol off
|
|
||||||
set print pretty off
|
|
||||||
set print object off
|
|
||||||
#set debug notification off
|
|
||||||
set debug parser off
|
|
||||||
set debug remote 0
|
|
||||||
#
|
|
||||||
# J-LINK GDB SERVER initialization
|
|
||||||
#
|
|
||||||
target remote localhost:2331
|
|
||||||
set remotetimeout 10000
|
|
||||||
monitor device Cortex-M3
|
|
||||||
monitor endian little
|
|
||||||
monitor reset
|
|
||||||
# Set max speed
|
|
||||||
monitor speed 4000
|
|
||||||
set mem inaccessible-by-default off
|
|
||||||
# Setup GDB FOR FASTER DOWNLOADS
|
|
||||||
set remote memory-write-packet-size 4096
|
|
||||||
set remote memory-write-packet-size fixed
|
|
||||||
#------------------------------------------------------------------
|
|
||||||
# Boot Flash
|
|
||||||
monitor long 0x40000210 = 0x211157
|
|
||||||
# CPU CLK 83 MHz?
|
|
||||||
monitor long 0x40000014 = 0x21
|
|
||||||
#------------------------------------------------------------------
|
|
||||||
# System init
|
|
||||||
monitor long 0x40000304 = 0x1FC00002
|
|
||||||
monitor long 0x40000250 = 0x400
|
|
||||||
monitor long 0x40000340 = 0x0
|
|
||||||
monitor long 0x40000230 = 0xdcc4
|
|
||||||
monitor long 0x40000210 = 0x11117
|
|
||||||
monitor long 0x40000210 = 0x11157
|
|
||||||
monitor long 0x400002c0 = 0x110011
|
|
||||||
monitor long 0x40000320 = 0xffffffff
|
|
||||||
#------------------------------------------------------------------
|
|
||||||
# SPI Init
|
|
||||||
#enable spi flash peripheral clock
|
|
||||||
set $Temp = {int}(0x40000230)
|
|
||||||
set $Temp = ($Temp | 0x300)
|
|
||||||
set {int}(0x40000230) = $Temp
|
|
||||||
#enable spi flash peripheral
|
|
||||||
set $Temp = {int}(0x40000210)
|
|
||||||
set $Temp = ($Temp | 0x10)
|
|
||||||
set {int}(0x40000210) = $Temp
|
|
||||||
#select spi flash pinout (0 - internal), enable spi flash pins
|
|
||||||
set $Temp = {int}(0x400002C0)
|
|
||||||
set $Temp = (($Temp & 0xFFFFFFF8) | 1)
|
|
||||||
set {int}(0x400002C0) = $Temp
|
|
||||||
#disable SPI FLASH operation
|
|
||||||
monitor long 0x40006008 = 0
|
|
||||||
#disable all interrupts
|
|
||||||
monitor long 0x4000602C = 0
|
|
||||||
#use first "slave select" pin
|
|
||||||
monitor long 0x40006010 = 1
|
|
||||||
#baud rate, default value
|
|
||||||
monitor long 0x40006014 = 2
|
|
||||||
#tx fifo threshold
|
|
||||||
monitor long 0x40006018 = 0
|
|
||||||
#rx fifo threshold
|
|
||||||
monitor long 0x4000601C = 0
|
|
||||||
#disable DMA
|
|
||||||
monitor long 0x4000604C = 0
|
|
||||||
#------------------------------------------------------------------
|
|
||||||
# Read FullFlash
|
# Read FullFlash
|
||||||
set $SPI_FLASH_BASE = 0x98000000
|
printf "Read FullFlash:\n"
|
||||||
set $dumpstartaddr = $SPI_FLASH_BASE
|
set $dumpstartaddr = $SPI_FLASH_BASE
|
||||||
set $dumpendaddr = $SPI_FLASH_BASE + 0x100000
|
set $dumpendaddr = $SPI_FLASH_BASE + 0x100000
|
||||||
printf "start addr of dumping"
|
printf "Start addr of dumping = 0x%08x\n", $dumpstartaddr
|
||||||
p /x $dumpstartaddr
|
printf "End addr of dumping = 0x%08x\n", $dumpendaddr
|
||||||
printf "end addr of dumping"
|
|
||||||
p /x $dumpendaddr
|
|
||||||
dump binary memory ./build/bin/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"
|
||||||
#------------------------------------------------------------------
|
|
||||||
# Boot Flash
|
|
||||||
monitor long 0x40000210 = 0x211157
|
|
||||||
# Reset
|
|
||||||
monitor reset
|
|
||||||
monitor go
|
|
||||||
quit
|
quit
|
||||||
|
|
|
@ -1,37 +1,11 @@
|
||||||
#
|
#
|
||||||
# J-LINK GDB SERVER initialization
|
# J-LINK GDB SERVER initialization
|
||||||
#
|
#
|
||||||
target remote localhost:2331
|
source -v flasher/gdb_flasher.jlink
|
||||||
set remotetimeout 10000
|
InitJlink
|
||||||
monitor device Cortex-M3
|
|
||||||
monitor endian little
|
|
||||||
monitor reset
|
|
||||||
# Set max speed
|
|
||||||
monitor speed 4000
|
|
||||||
#set mem inaccessible-by-default on
|
|
||||||
# Setup GDB FOR FASTER DOWNLOADS
|
|
||||||
set remote memory-write-packet-size 8192
|
|
||||||
set remote memory-write-packet-size fixed
|
|
||||||
# Boot Flash
|
|
||||||
#monitor long 0x40000210 = 0x211157
|
|
||||||
# Boot RAM start_addr0() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x80000000 )
|
|
||||||
#monitor long 0x40000210 = 0x80011117
|
|
||||||
# Boot RAM start_addr1() Run if ( v40000210 & 0x20000000 )
|
|
||||||
#monitor long 0x40000210 = 0x20011117
|
|
||||||
# Boot RAM start_addr2() Run if ( v40000210 & 0x10000000 )
|
|
||||||
monitor long 0x40000210 = 0x10011117
|
|
||||||
# Boot RAM start_addr3() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x8000000 )
|
|
||||||
#monitor long 0x40000210 = 0x8011117
|
|
||||||
# Boot RAM start_addr4() Init console, Run if ( v40000210 & 0x4000000 )
|
|
||||||
monitor long 0x40000210 = 0x4011117
|
|
||||||
# CPU CLK 166 MHz?
|
|
||||||
#monitor long 0x40000014 = 0x00000011
|
|
||||||
# CPU CLK 83 MHz?
|
|
||||||
#monitor long 0x40000014 = 0x00000021
|
|
||||||
# Load the program executable called "image.elf"
|
|
||||||
load build/obj/build.axf
|
load build/obj/build.axf
|
||||||
|
SetBootCall4
|
||||||
monitor reset
|
monitor reset
|
||||||
#continue
|
|
||||||
monitor go
|
monitor go
|
||||||
quit
|
quit
|
||||||
|
|
||||||
|
|
160
flasher/gdb_wrflash.jlink
Normal file
160
flasher/gdb_wrflash.jlink
Normal file
|
@ -0,0 +1,160 @@
|
||||||
|
###############
|
||||||
|
# FlasherInit #
|
||||||
|
###############
|
||||||
|
define FlasherInit
|
||||||
|
set $rtl8710_flasher_capacity = 0
|
||||||
|
set $rtl8710_flasher_auto_erase = 1
|
||||||
|
set $rtl8710_flasher_auto_verify = 1
|
||||||
|
set $rtl8710_flasher_firmware_ptr = 0x10001000
|
||||||
|
set $rtl8710_flasher_buffer = 0x10008000
|
||||||
|
#262144
|
||||||
|
set $rtl8710_flasher_buffer_size = 425984
|
||||||
|
set $rtl8710_flasher_sector_size = 4096
|
||||||
|
set $rtl8710_flasher_auto_erase_sector = 0xFFFFFFFF
|
||||||
|
end
|
||||||
|
###############
|
||||||
|
# FlasherWait #
|
||||||
|
###############
|
||||||
|
define FlasherWait
|
||||||
|
set $fresult = {int}($rtl8710_flasher_buffer)
|
||||||
|
while ($fresult != 0)
|
||||||
|
set $fresult = {int}($rtl8710_flasher_buffer)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
###############
|
||||||
|
# FlasherLoad #
|
||||||
|
###############
|
||||||
|
define FlasherLoad
|
||||||
|
if $rtl8710_flasher_capacity == 0
|
||||||
|
printf "initializing RTL8710 flasher\n"
|
||||||
|
restore $arg0 binary $rtl8710_flasher_firmware_ptr 0 968
|
||||||
|
monitor reset
|
||||||
|
set $pc = $rtl8710_flasher_firmware_ptr
|
||||||
|
set $sp = 0x1ffffffc
|
||||||
|
set {int}($rtl8710_flasher_buffer + 0x08) = 0
|
||||||
|
set {int}($rtl8710_flasher_buffer + 0x00) = 1
|
||||||
|
#continue
|
||||||
|
monitor go
|
||||||
|
FlasherWait
|
||||||
|
set $id = {int}($rtl8710_flasher_buffer + 0x0C)
|
||||||
|
if ($id == 0x1420c2)
|
||||||
|
set $rtl8710_flasher_capacity = 1 << (($id >> 16) & 0x0ff)
|
||||||
|
printf "Flash ID = 0x%08x : MX25L8006E (%d kbytes)\n", $id, $rtl8710_flasher_capacity>>10
|
||||||
|
else
|
||||||
|
set $rtl8710_flasher_capacity = 1024*1024)
|
||||||
|
error "Flash ID = 0x%08x : ?\n", $id
|
||||||
|
end
|
||||||
|
printf "RTL8710 flasher initialized\n"
|
||||||
|
else
|
||||||
|
printf "reinitializing RTL8710 flasher\n"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
##################
|
||||||
|
# FlasherWrBlock #
|
||||||
|
##################
|
||||||
|
define FlasherWrBlock
|
||||||
|
#printf "FlashWrBlock 0x%08x, 0x%08x\n", $arg0, $arg1
|
||||||
|
set {int}($rtl8710_flasher_buffer + 0x04) = 4
|
||||||
|
set {int}($rtl8710_flasher_buffer + 0x08) = 0
|
||||||
|
set {int}($rtl8710_flasher_buffer + 0x10) = $arg0
|
||||||
|
set {int}($rtl8710_flasher_buffer + 0x14) = $arg1
|
||||||
|
set {int}($rtl8710_flasher_buffer + 0x00) = 1
|
||||||
|
FlasherWait
|
||||||
|
set $status = {int}($rtl8710_flasher_buffer + 0x08)
|
||||||
|
if $status > 0
|
||||||
|
error "write error, offset 0x%08x", $arg0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
##################
|
||||||
|
# FlasherVrBlock #
|
||||||
|
##################
|
||||||
|
define FlasherVrBlock
|
||||||
|
#printf "FlashVrBlock 0x%08x, 0x%08x\n", $arg0, $arg1
|
||||||
|
set {int}($rtl8710_flasher_buffer + 0x04) = 5
|
||||||
|
set {int}($rtl8710_flasher_buffer + 0x08) = 0
|
||||||
|
set {int}($rtl8710_flasher_buffer + 0x10) = $arg0
|
||||||
|
set {int}($rtl8710_flasher_buffer + 0x14) = $arg1
|
||||||
|
set {int}($rtl8710_flasher_buffer + 0x00) = 1
|
||||||
|
FlasherWait
|
||||||
|
set $status = {int}($rtl8710_flasher_buffer + 0x08)
|
||||||
|
if $status > 0
|
||||||
|
set $status = {int}($rtl8710_flasher_buffer + 0x0C)
|
||||||
|
set $status = {int}($status + $arg0)
|
||||||
|
error "verify error, offset 0x%08x", $status
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#################
|
||||||
|
# FlashSecErase #
|
||||||
|
#################
|
||||||
|
define FlashSecErase
|
||||||
|
#printf "FlashSecErase 0x%08x, 0x%08x\n", $rtl8710_flasher_buffer, $arg0
|
||||||
|
set {int}($rtl8710_flasher_buffer + 0x04) = 2
|
||||||
|
set {int}($rtl8710_flasher_buffer + 0x08) = 0
|
||||||
|
set {int}($rtl8710_flasher_buffer + 0x10) = $arg0
|
||||||
|
set {int}($rtl8710_flasher_buffer + 0x00) = 1
|
||||||
|
FlasherWait
|
||||||
|
end
|
||||||
|
################
|
||||||
|
# FlasherWrite #
|
||||||
|
################
|
||||||
|
define FlasherWrite
|
||||||
|
set $sector = 0
|
||||||
|
set $offset = 0
|
||||||
|
set $size = $arg2
|
||||||
|
while $offset < $size
|
||||||
|
set $len = $size - $offset
|
||||||
|
if $len > $rtl8710_flasher_buffer_size
|
||||||
|
set $len = $rtl8710_flasher_buffer_size
|
||||||
|
end
|
||||||
|
set $flash_offset = $arg1 + $offset
|
||||||
|
printf "write offset 0x%08x\n", $flash_offset
|
||||||
|
set $parms1 = $rtl8710_flasher_buffer + 0x20 - $offset - $arg1
|
||||||
|
set $parms2 = $offset + $arg1
|
||||||
|
set $parms3 = $offset + $len + $arg1
|
||||||
|
restore $arg0 binary $parms1 $parms2 $parms3
|
||||||
|
if $rtl8710_flasher_auto_erase != 0
|
||||||
|
set $count_i = $flash_offset
|
||||||
|
while $count_i < ($flash_offset + $len)
|
||||||
|
set $sector = $count_i/$rtl8710_flasher_sector_size
|
||||||
|
if $rtl8710_flasher_auto_erase_sector != $sector
|
||||||
|
set $parms1 = $sector * $rtl8710_flasher_sector_size
|
||||||
|
printf "erase sector %d at 0x%08x\n", $sector, $parms1
|
||||||
|
FlashSecErase $parms1
|
||||||
|
set $rtl8710_flasher_auto_erase_sector = $sector
|
||||||
|
end
|
||||||
|
set $count_i = $count_i + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
FlasherWrBlock $flash_offset $len
|
||||||
|
printf "wrote %d bytes at 0x%08x\n", $len, $flash_offset
|
||||||
|
if $rtl8710_flasher_auto_verify != 0
|
||||||
|
printf "verify offset 0x%08x len %d\n", $flash_offset, $len
|
||||||
|
FlasherVrBlock $flash_offset $len
|
||||||
|
end
|
||||||
|
set $offset = $offset + $rtl8710_flasher_buffer_size
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#########################################
|
||||||
|
source -v flasher/gdb_flasher.jlink
|
||||||
|
InitJlink
|
||||||
|
SystemInit
|
||||||
|
SetClk166MHz
|
||||||
|
SPI_Init
|
||||||
|
FlashImagesInfo
|
||||||
|
SetFirwareSize build/bin/ram_all.bin
|
||||||
|
if $FirmwareSize == 0
|
||||||
|
error "FirmwareSize = 0!"
|
||||||
|
end
|
||||||
|
FlasherInit
|
||||||
|
FlasherLoad flasher/rtl8710_flasher.bin
|
||||||
|
if $Image1Size != 0
|
||||||
|
printf "Write Image1 size %d to Flash addr 0x00000000:\n", $Image1Size
|
||||||
|
FlasherWrite build/bin/ram_all.bin 0 $Image1Size
|
||||||
|
if $Image2Size != 0 && $Image2Addr >= $Image1Size
|
||||||
|
printf "Write Image2 size %d to Flash addr 0x%08x:\n", $Image2Size, $Image2Addr
|
||||||
|
FlasherWrite build/bin/ram_all.bin $Image2Addr $Image2Size
|
||||||
|
end
|
||||||
|
end
|
||||||
|
FlashImagesInfo
|
||||||
|
quit
|
||||||
|
|
BIN
flasher/rtl8710_flasher.bin
Normal file
BIN
flasher/rtl8710_flasher.bin
Normal file
Binary file not shown.
Loading…
Reference in a new issue