This commit is contained in:
pvvx 2017-05-13 02:31:23 +03:00
parent f8c731241d
commit 955d1c6df6
29 changed files with 86 additions and 1386 deletions

View file

@ -1,153 +0,0 @@
AppVersion = 61001
FileVersion = 2
[GENERAL]
ConnectMode = 0
CurrentFile = ""
DataFileSAddr = 0x00000000
GUIMode = 0
HostName = ""
TargetIF = 1
USBPort = 0
USBSerialNo = 0x00000000
[JTAG]
IRLen = 0
MultipleTargets = 0
NumDevices = 0
Speed0 = 6000
Speed1 = 6000
TAP_Number = 0
UseAdaptive0 = 0
UseAdaptive1 = 0
UseMaxSpeed0 = 0
UseMaxSpeed1 = 0
[CPU]
NumInitSteps = 18
InitStep0_Action = "Reset"
InitStep0_Value0 = 0x00000000
InitStep0_Value1 = 0x00000000
InitStep0_Comment = "Reset and halt target"
InitStep1_Action = "Read 32bit"
InitStep1_Value0 = 0x40000230
InitStep1_Value1 = 0x00000000
InitStep1_Comment = "enable spi flash peripheral clock"
InitStep2_Action = "Var OR"
InitStep2_Value0 = 0x00000000
InitStep2_Value1 = 0x00000300
InitStep2_Comment = ""
InitStep3_Action = "Var Write 32bit"
InitStep3_Value0 = 0x40000230
InitStep3_Value1 = 0x00000000
InitStep3_Comment = ""
InitStep4_Action = "Read 32bit"
InitStep4_Value0 = 0x40000210
InitStep4_Value1 = 0x00000000
InitStep4_Comment = "enable spi flash peripheral"
InitStep5_Action = "Var OR"
InitStep5_Value0 = 0x00000000
InitStep5_Value1 = 0x00000010
InitStep5_Comment = ""
InitStep6_Action = "Var Write 32bit"
InitStep6_Value0 = 0x40000210
InitStep6_Value1 = 0x00000000
InitStep6_Comment = ""
InitStep7_Action = "Read 32bit"
InitStep7_Value0 = 0x400002C0
InitStep7_Value1 = 0x00000000
InitStep7_Comment = "select spi flash pinout (0 - internal), enable spi flash pins"
InitStep8_Action = "Var AND"
InitStep8_Value0 = 0x00000000
InitStep8_Value1 = 0xFFFFFFF8
InitStep8_Comment = ""
InitStep9_Action = "Var OR"
InitStep9_Value0 = 0x00000000
InitStep9_Value1 = 0x00000001
InitStep9_Comment = ""
InitStep10_Action = "Var Write 32bit"
InitStep10_Value0 = 0x400002C0
InitStep10_Value1 = 0x00000000
InitStep10_Comment = ""
InitStep11_Action = "Write 32bit"
InitStep11_Value0 = 0x40006008
InitStep11_Value1 = 0x00000000
InitStep11_Comment = "disable SPI FLASH operation"
InitStep12_Action = "Write 32bit"
InitStep12_Value0 = 0x4000602C
InitStep12_Value1 = 0x00000000
InitStep12_Comment = "disable all interrupts"
InitStep13_Action = "Write 32bit"
InitStep13_Value0 = 0x40006010
InitStep13_Value1 = 0x00000001
InitStep13_Comment = "use first 'slave select' pin"
InitStep14_Action = "Write 32bit"
InitStep14_Value0 = 0x40006014
InitStep14_Value1 = 0x00000002
InitStep14_Comment = "baud rate, default value"
InitStep15_Action = "Write 32bit"
InitStep15_Value0 = 0x40006018
InitStep15_Value1 = 0x00000000
InitStep15_Comment = "tx fifo threshold"
InitStep16_Action = "Write 32bit"
InitStep16_Value0 = 0x4000601C
InitStep16_Value1 = 0x00000000
InitStep16_Comment = "rx fifo threshold"
InitStep17_Action = "Write 32bit"
InitStep17_Value0 = 0x4000604C
InitStep17_Value1 = 0x00000000
InitStep17_Comment = "disable DMA"
NumExitSteps = 1
ExitStep0_Action = "Write 32bit"
ExitStep0_Value0 = 0x40000210
ExitStep0_Value1 = 0x00211157
ExitStep0_Comment = "Boot from Flash"
UseScriptFile = 0
ScriptFile = ""
UseRAM = 1
RAMAddr = 0x10000000
RAMSize = 0x00060000
CheckCoreID = 1
CoreID = 0x2BA01477
CoreIDMask = 0xFFFFFFFF
UseAutoSpeed = 0x00000001
ClockSpeed = 0x00000000
EndianMode = 0
ChipName = "Cortex-M3"
[FLASH]
aRangeSel[1] = 0-18
BankSelMode = 1
BaseAddr = 0x98000000
CheckId = 0
CustomRAMCode = "D:\MCU\SEGGER\JLink_V610a\Samples\JFlash\ProjectFiles\Atmel\AT91SAM9261_DataFlash_SPI0\RAMCodeV2_AT91SAM9261_DataFlash_SPI0_LE.mot"
DeviceName = "Am29F800BB"
NumBanks = 1
OrgNumBits = 16
OrgNumChips = 1
[PRODUCTION]
AutoBlankCheck = 1
AutoDisconnect = 0
AutoMode = 0
AutoPerformsErase = 0
AutoPerformsProgram = 0
AutoPerformsSecure = 0
AutoPerformsStartApp = 0
AutoPerformsUnsecure = 0
AutoPerformsVerify = 1
EnableTargetPower = 0
EraseType = 2
MonitorVTref = 0
MonitorVTrefMax = 0x0000157C
MonitorVTrefMin = 0x000003E8
OverrideTimeouts = 0
ProgramSN = 0
SerialFile = ""
SkipBlankOnRead = 0
SNAddr = 0x00000000
SNInc = 0x00000001
SNLen = 0x00000008
SNListFile = ""
SNValue = 0x00000001
StartAppType = 0
TargetPowerDelay = 0x00000014
TimeoutErase = 0x00003A98
TimeoutProgram = 0x00002710
TimeoutVerify = 0x00002710
VerifyType = 1

View file

@ -1,7 +0,0 @@
define call1
set $ImageSize = 0x11000
set $ImageAddr = 0x0D0000
end
define call2
FlasherWrite build/bin/WEBFiles.bin $ImageAddr $ImageSize
end

View file

@ -1,156 +0,0 @@
###############
# 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
set $rtl8710_flasher_buffer_size = 421888
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)
set $rtl8710_flasher_capacity = 1 << (($id >> 16) & 0x0ff)
if ($id == 0x1420c2)
printf "Flash ID = 0x%08x : MX25L8006E (%d kbytes)\n", $id, $rtl8710_flasher_capacity>>10
else
printf "Flash ID = 0x%08x : (%d kbytes)\n", $id, $rtl8710_flasher_capacity>>10
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
set $parms2 = $offset
set $parms3 = $offset + $len
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
source -v flasher/file_info.jlink
InitJlink
SystemInit
SetClk83MHz
SPI_Init
FlasherInit
FlasherLoad flasher/rtl8710_flasher.bin
call1
if $ImageSize != 0
set $ImageEnd = $ImageSize + $ImageAddr + 0x4000
if $rtl8710_flasher_capacity >= $ImageEnd
printf "Write Image size %d to Flash addr 0x%08x:\n", $ImageSize, $ImageAddr
call2
else
printf "Error: Image size is too big!\n"
end
else
printf "Error: Image size is zero!\n"
end
quit

View file

@ -7,6 +7,7 @@ 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 = 421888
set $rtl8710_flasher_sector_size = 4096
set $rtl8710_flasher_auto_erase_sector = 0xFFFFFFFF
@ -36,11 +37,12 @@ if $rtl8710_flasher_capacity == 0
monitor go
FlasherWait
set $id = {int}($rtl8710_flasher_buffer + 0x0C)
set $rtl8710_flasher_capacity = 1 << (($id >> 16) & 0x0ff)
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
printf "Flash ID = 0x%08x : (%d kbytes)\n", $id, $rtl8710_flasher_capacity>>10
set $rtl8710_flasher_capacity = 1024*1024)
error "Flash ID = 0x%08x : ?\n", $id
end
printf "RTL8710 flasher initialized\n"
else
@ -106,9 +108,9 @@ while $offset < $size
end
set $flash_offset = $arg1 + $offset
printf "write offset 0x%08x\n", $flash_offset
set $parms1 = $rtl8710_flasher_buffer + 0x20 - $flash_offset
set $parms2 = $flash_offset
set $parms3 = $flash_offset + $len
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