This commit is contained in:
rebane 2016-08-22 14:28:21 +03:00
parent 0cf1ebbce2
commit 2b07e47fb8
3 changed files with 55 additions and 40 deletions

View file

@ -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"
```

View file

@ -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

View file

@ -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