From 2b07e47fb802d4d810fed0991c7cb9a78f7be530 Mon Sep 17 00:00:00 2001 From: rebane Date: Mon, 22 Aug 2016 14:28:21 +0300 Subject: [PATCH] doc --- README.md | 39 +++++++++++++++++++++++++++++---------- rtl8710_flasher.ocd | 28 +++++++++++++--------------- script/rtl8710.ocd | 28 +++++++++++++--------------- 3 files changed, 55 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 1f103d6..ac9818e 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,35 @@ OpenOCD support for RTL8710 and integrated flash. ## pins: ### SWD -SWDIO: GE3 -SWCLK: GE4 +* SWDIO: GE3 +* SWCLK: GE4 ### JTAG -TRST: GE0 -TDI: GE1 -TDO: GE2 -TMS: GE3 -CLK: GE4 +* TRST: GE0 +* TDI: GE1 +* TDO: GE2 +* TMS: GE3 +* TCK: GE4 ## building: make -## testing: -make test - +## available OpenOCD commands: +### rtl8710_flash_read_id +read and parse the jedec id bytes from flash +### rtl8710_flash_mass_erase +erase whole flash +### rtl8710_flash_read [filename] [offset] [size] +dump (size) bytes from flash offset (offset) to file (filename) +### rtl8710_flash_write [filename] [offset] +write file (filename) to flash offset (offset) +### rtl8710_flash_verify [filename] [offset] +compare file (filename) with flash offset (offset) +### rtl8710_flash_auto_erase [1/0] +set auto_erase option on/off. flash pages will be autoerased when writing +### rtl8710_flash_auto_verify [1/0] +set auto_verify on/off. each block of data will be auto verified when writing +## example: +``` +openocd -f interface/stlink-v2-1.cfg -f rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_flash_read_id" -c "rtl8710_flash_read dump.bin 0 1048576" -c "shutdown" +``` +``` +openocd -f interface/stlink-v2-1.cfg -f rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_flash_auto_erase 1" -c "rtl8710_flash_auto_verify 1" -c "rtl8710_flash_write dump.bin 0" -c "shutdown" +``` diff --git a/rtl8710_flasher.ocd b/rtl8710_flasher.ocd index b65d248..c7f04fe 100644 --- a/rtl8710_flasher.ocd +++ b/rtl8710_flasher.ocd @@ -16,6 +16,19 @@ set rtl8710_flasher_auto_erase 0 set rtl8710_flasher_auto_verify 0 set rtl8710_flasher_auto_erase_sector 0xFFFFFFFF +proc array2file {a local_filename loc} { + for {set offset 0} {$offset < [array size a]} {set offset [expr {$offset + 1}]} { + append bindata [binary format c $a([expr $offset])] + } + set fp [open $local_filename "a+"] + close $fp + set fp [open $local_filename "r+"] + fconfigure $fp -translation binary + seek $fp $loc + puts -nonewline $fp $bindata + close $fp +} + proc rtl8710_flasher_init {} { global rtl8710_flasher_firmware_ptr global rtl8710_flasher_buffer @@ -40,21 +53,6 @@ proc rtl8710_flasher_init {} { return "" } -proc array2file {a local_filename loc} { - echo $a - echo [array size a] - for {set offset 0} {$offset < [array size a]} {set offset [expr {$offset + 1}]} { - append bindata [binary format c $a([expr $offset])] - } - set fp [open $local_filename "a+"] - close $fp - set fp [open $local_filename "r+"] - fconfigure $fp -translation binary - seek $fp $loc - puts -nonewline $fp $bindata - close $fp -} - proc rtl8710_flasher_mrw {reg} { set value "" mem2array value 32 $reg 1 diff --git a/script/rtl8710.ocd b/script/rtl8710.ocd index 07e6994..f572fe2 100644 --- a/script/rtl8710.ocd +++ b/script/rtl8710.ocd @@ -114,6 +114,19 @@ set rtl8710_flasher_auto_erase 0 set rtl8710_flasher_auto_verify 0 set rtl8710_flasher_auto_erase_sector 0xFFFFFFFF +proc array2file {a local_filename loc} { + for {set offset 0} {$offset < [array size a]} {set offset [expr {$offset + 1}]} { + append bindata [binary format c $a([expr $offset])] + } + set fp [open $local_filename "a+"] + close $fp + set fp [open $local_filename "r+"] + fconfigure $fp -translation binary + seek $fp $loc + puts -nonewline $fp $bindata + close $fp +} + proc rtl8710_flasher_init {} { global rtl8710_flasher_firmware_ptr global rtl8710_flasher_buffer @@ -138,21 +151,6 @@ proc rtl8710_flasher_init {} { return "" } -proc array2file {a local_filename loc} { - echo $a - echo [array size a] - for {set offset 0} {$offset < [array size a]} {set offset [expr {$offset + 1}]} { - append bindata [binary format c $a([expr $offset])] - } - set fp [open $local_filename "a+"] - close $fp - set fp [open $local_filename "r+"] - fconfigure $fp -translation binary - seek $fp $loc - puts -nonewline $fp $bindata - close $fp -} - proc rtl8710_flasher_mrw {reg} { set value "" mem2array value 32 $reg 1