script read fullflash

This commit is contained in:
pvvx 2016-09-23 12:54:29 +03:00
parent 52466406bf
commit 564359a53b

102
flasher/gdb_rdflash.jlink Normal file
View file

@ -0,0 +1,102 @@
#Message display setting
#disable all messages
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
#
# 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
set $SPI_FLASH_BASE = 0x98000000
set $dumpstartaddr = $SPI_FLASH_BASE
set $dumpendaddr = $SPI_FLASH_BASE + 0x100000
printf "start addr of dumping"
p /x $dumpstartaddr
printf "end addr of dumping"
p /x $dumpendaddr
dump binary memory ./build/bin/fullflash.bin $dumpstartaddr $dumpendaddr
printf "FullFlash saved in ./build/bin/fullflash.bin - OK.\n"
#------------------------------------------------------------------
# Reset
monitor reset
# Boot Flash
monitor long 0x40000210 = 0x211157
monitor go
quit