mirror of
https://github.com/sandeepmistry/rtl8710-openocd.git
synced 2024-12-04 12:10:28 +00:00
finetuning
This commit is contained in:
parent
f2c202861a
commit
98c58c7e2c
3 changed files with 21 additions and 10 deletions
11
Makefile
11
Makefile
|
@ -24,14 +24,17 @@ clean:
|
|||
rm -rf rtl8710_flasher.elf rtl8710_flasher.bin make_array rtl8710.ocd
|
||||
|
||||
test:
|
||||
openocd -f interface/stlink-v2-1.cfg -f rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_flash_read_id" -c "shutdown"
|
||||
openocd -f interface/stlink-v2-1.cfg -f script/rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_flash_read_id" -c "shutdown"
|
||||
|
||||
dump:
|
||||
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 script/rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_flash_read_id" -c "rtl8710_flash_read dump.bin 0 1048576" -c "shutdown"
|
||||
|
||||
restore:
|
||||
openocd -f interface/stlink-v2-1.cfg -f rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_flash_auto_erase 1" -c "rtl8710_flash_write dump.bin 0" -c shutdown
|
||||
openocd -f interface/stlink-v2-1.cfg -f script/rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_flash_auto_erase 1" -c "rtl8710_flash_write dump.bin 0" -c shutdown
|
||||
|
||||
verify:
|
||||
openocd -f interface/stlink-v2-1.cfg -f script/rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_flash_verify dump.bin 0" -c shutdown
|
||||
|
||||
reset:
|
||||
openocd -f interface/stlink-v2-1.cfg -f rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_reboot" -c shutdown
|
||||
openocd -f interface/stlink-v2-1.cfg -f script/rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_reboot" -c shutdown
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ proc rtl8710_flasher_init {} {
|
|||
global rtl8710_flasher_code
|
||||
|
||||
if {[expr {$rtl8710_flasher_ready == 0}]} {
|
||||
echo "initializing RTL8710 SPI programmer"
|
||||
echo "initializing RTL8710 flasher"
|
||||
halt
|
||||
mww [expr {$rtl8710_flasher_buffer + 0x08}] 0x00000000
|
||||
mww [expr {$rtl8710_flasher_buffer + 0x00}] 0x00000001
|
||||
|
@ -32,6 +32,7 @@ proc rtl8710_flasher_init {} {
|
|||
set id [rtl8710_flasher_mrw [expr {$rtl8710_flasher_buffer + 0x0C}]]
|
||||
set rtl8710_flasher_capacity [expr {2 ** [expr {($id >> 16) & 0xFF}]}]
|
||||
set rtl8710_flasher_ready 1
|
||||
echo "RTL8710 flasher initialized"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
@ -112,7 +113,7 @@ proc rtl8710_flash_read_id {} {
|
|||
set manufacturer_id [format "0x%02X" [expr {$id & 0xFF}]]
|
||||
set memory_type [format "0x%02X" [expr {($id >> 8) & 0xFF}]]
|
||||
set memory_capacity [expr {2 ** [expr {($id >> 16) & 0xFF}]}]
|
||||
echo "manufacturer ID: $manufacturer_id, memory type: $memory_type, memory capacity: $memory_capacity byte(s)"
|
||||
echo "manufacturer ID: $manufacturer_id, memory type: $memory_type, memory capacity: $memory_capacity bytes"
|
||||
}
|
||||
|
||||
proc rtl8710_flash_mass_erase {} {
|
||||
|
@ -150,6 +151,7 @@ proc rtl8710_flash_read {local_filename loc size} {
|
|||
rtl8710_flasher_read_block $flash_offset $len
|
||||
dump_image /tmp/_rtl8710_flasher.bin [expr {$rtl8710_flasher_buffer + 0x20}] $len
|
||||
exec dd conv=notrunc if=/tmp/_rtl8710_flasher.bin "of=$local_filename" bs=1 "seek=$offset"
|
||||
echo "read $len bytes"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,6 +170,7 @@ proc rtl8710_flash_write {local_filename loc} {
|
|||
set len $rtl8710_flasher_buffer_size
|
||||
}
|
||||
set flash_offset [expr {$loc + $offset}]
|
||||
echo "write offset $flash_offset"
|
||||
rtl8710_flasher_load_block $local_filename $offset $len
|
||||
if {[expr {$rtl8710_flasher_auto_erase != 0}]} {
|
||||
for {set i $flash_offset} {$i < [expr {$flash_offset + $len}]} {incr i} {
|
||||
|
@ -179,8 +182,8 @@ proc rtl8710_flash_write {local_filename loc} {
|
|||
}
|
||||
}
|
||||
}
|
||||
echo "write offset $flash_offset"
|
||||
rtl8710_flasher_write_block $flash_offset $len
|
||||
echo "wrote $len bytes"
|
||||
if {[expr {$rtl8710_flasher_auto_verify != 0}]} {
|
||||
echo "verify offset $flash_offset"
|
||||
rtl8710_flasher_verify_block $flash_offset $len
|
||||
|
@ -198,6 +201,7 @@ proc rtl8710_flash_verify {local_filename loc} {
|
|||
set len $rtl8710_flasher_buffer_size
|
||||
}
|
||||
set flash_offset [expr {$loc + $offset}]
|
||||
echo "read offset $flash_offset"
|
||||
rtl8710_flasher_load_block $local_filename $offset $len
|
||||
echo "verify offset $flash_offset"
|
||||
rtl8710_flasher_verify_block $flash_offset $len
|
||||
|
|
|
@ -118,7 +118,7 @@ proc rtl8710_flasher_init {} {
|
|||
global rtl8710_flasher_code
|
||||
|
||||
if {[expr {$rtl8710_flasher_ready == 0}]} {
|
||||
echo "initializing RTL8710 SPI programmer"
|
||||
echo "initializing RTL8710 flasher"
|
||||
halt
|
||||
mww [expr {$rtl8710_flasher_buffer + 0x08}] 0x00000000
|
||||
mww [expr {$rtl8710_flasher_buffer + 0x00}] 0x00000001
|
||||
|
@ -131,6 +131,7 @@ proc rtl8710_flasher_init {} {
|
|||
set id [rtl8710_flasher_mrw [expr {$rtl8710_flasher_buffer + 0x0C}]]
|
||||
set rtl8710_flasher_capacity [expr {2 ** [expr {($id >> 16) & 0xFF}]}]
|
||||
set rtl8710_flasher_ready 1
|
||||
echo "RTL8710 flasher initialized"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
@ -211,7 +212,7 @@ proc rtl8710_flash_read_id {} {
|
|||
set manufacturer_id [format "0x%02X" [expr {$id & 0xFF}]]
|
||||
set memory_type [format "0x%02X" [expr {($id >> 8) & 0xFF}]]
|
||||
set memory_capacity [expr {2 ** [expr {($id >> 16) & 0xFF}]}]
|
||||
echo "manufacturer ID: $manufacturer_id, memory type: $memory_type, memory capacity: $memory_capacity byte(s)"
|
||||
echo "manufacturer ID: $manufacturer_id, memory type: $memory_type, memory capacity: $memory_capacity bytes"
|
||||
}
|
||||
|
||||
proc rtl8710_flash_mass_erase {} {
|
||||
|
@ -249,6 +250,7 @@ proc rtl8710_flash_read {local_filename loc size} {
|
|||
rtl8710_flasher_read_block $flash_offset $len
|
||||
dump_image /tmp/_rtl8710_flasher.bin [expr {$rtl8710_flasher_buffer + 0x20}] $len
|
||||
exec dd conv=notrunc if=/tmp/_rtl8710_flasher.bin "of=$local_filename" bs=1 "seek=$offset"
|
||||
echo "read $len bytes"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,6 +269,7 @@ proc rtl8710_flash_write {local_filename loc} {
|
|||
set len $rtl8710_flasher_buffer_size
|
||||
}
|
||||
set flash_offset [expr {$loc + $offset}]
|
||||
echo "write offset $flash_offset"
|
||||
rtl8710_flasher_load_block $local_filename $offset $len
|
||||
if {[expr {$rtl8710_flasher_auto_erase != 0}]} {
|
||||
for {set i $flash_offset} {$i < [expr {$flash_offset + $len}]} {incr i} {
|
||||
|
@ -278,8 +281,8 @@ proc rtl8710_flash_write {local_filename loc} {
|
|||
}
|
||||
}
|
||||
}
|
||||
echo "write offset $flash_offset"
|
||||
rtl8710_flasher_write_block $flash_offset $len
|
||||
echo "wrote $len bytes"
|
||||
if {[expr {$rtl8710_flasher_auto_verify != 0}]} {
|
||||
echo "verify offset $flash_offset"
|
||||
rtl8710_flasher_verify_block $flash_offset $len
|
||||
|
@ -297,6 +300,7 @@ proc rtl8710_flash_verify {local_filename loc} {
|
|||
set len $rtl8710_flasher_buffer_size
|
||||
}
|
||||
set flash_offset [expr {$loc + $offset}]
|
||||
echo "read offset $flash_offset"
|
||||
rtl8710_flasher_load_block $local_filename $offset $len
|
||||
echo "verify offset $flash_offset"
|
||||
rtl8710_flasher_verify_block $flash_offset $len
|
||||
|
|
Loading…
Reference in a new issue