MAC address reading support

This commit is contained in:
rebane 2016-08-26 22:15:44 +03:00
parent e0e2b289d1
commit 0baf213844
3 changed files with 41 additions and 0 deletions

View file

@ -31,6 +31,9 @@ clean:
test: test:
openocd -f interface/stlink-v2-1.cfg -f script/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"
mac:
openocd -f interface/stlink-v2-1.cfg -f script/rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_flash_read_mac" -c "shutdown"
dump: dump:
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" 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"

View file

@ -5,6 +5,8 @@ set rtl8710_flasher_command_read 3
set rtl8710_flasher_command_write 4 set rtl8710_flasher_command_write 4
set rtl8710_flasher_command_verify 5 set rtl8710_flasher_command_verify 5
set rtl8710_flasher_mac_address_offset 0xA088
set rtl8710_flasher_ready 0 set rtl8710_flasher_ready 0
set rtl8710_flasher_capacity 0 set rtl8710_flasher_capacity 0
set rtl8710_flasher_auto_erase 0 set rtl8710_flasher_auto_erase 0
@ -208,6 +210,23 @@ proc rtl8710_flash_verify {local_filename loc} {
} }
} }
proc rtl8710_flash_read_mac {} {
global rtl8710_flasher_mac_address_offset
global rtl8710_flasher_buffer
rtl8710_flasher_init
rtl8710_flasher_read_block $rtl8710_flasher_mac_address_offset 6
set mac ""
mem2array mac 8 [expr {$rtl8710_flasher_buffer + 0x20}] 6
set res "MAC address: "
append res [format %02X $mac(0)]
append res ":" [format %02X $mac(1)]
append res ":" [format %02X $mac(2)]
append res ":" [format %02X $mac(3)]
append res ":" [format %02X $mac(4)]
append res ":" [format %02X $mac(5)]
echo $res
}
proc rtl8710_flash_auto_erase {on} { proc rtl8710_flash_auto_erase {on} {
global rtl8710_flasher_auto_erase global rtl8710_flasher_auto_erase
if {[expr {$on != 0}]} { if {[expr {$on != 0}]} {

View file

@ -101,6 +101,8 @@ set rtl8710_flasher_command_read 3
set rtl8710_flasher_command_write 4 set rtl8710_flasher_command_write 4
set rtl8710_flasher_command_verify 5 set rtl8710_flasher_command_verify 5
set rtl8710_flasher_mac_address_offset 0xA088
set rtl8710_flasher_ready 0 set rtl8710_flasher_ready 0
set rtl8710_flasher_capacity 0 set rtl8710_flasher_capacity 0
set rtl8710_flasher_auto_erase 0 set rtl8710_flasher_auto_erase 0
@ -304,6 +306,23 @@ proc rtl8710_flash_verify {local_filename loc} {
} }
} }
proc rtl8710_flash_read_mac {} {
global rtl8710_flasher_mac_address_offset
global rtl8710_flasher_buffer
rtl8710_flasher_init
rtl8710_flasher_read_block $rtl8710_flasher_mac_address_offset 6
set mac ""
mem2array mac 8 [expr {$rtl8710_flasher_buffer + 0x20}] 6
set res "MAC address: "
append res [format %02X $mac(0)]
append res ":" [format %02X $mac(1)]
append res ":" [format %02X $mac(2)]
append res ":" [format %02X $mac(3)]
append res ":" [format %02X $mac(4)]
append res ":" [format %02X $mac(5)]
echo $res
}
proc rtl8710_flash_auto_erase {on} { proc rtl8710_flash_auto_erase {on} {
global rtl8710_flasher_auto_erase global rtl8710_flasher_auto_erase
if {[expr {$on != 0}]} { if {[expr {$on != 0}]} {