mirror of
https://github.com/pvvx/RTL00_WEB.git
synced 2026-07-08 12:15:38 +00:00
update
This commit is contained in:
parent
34d3652711
commit
39f77eb92b
1844 changed files with 899433 additions and 7 deletions
40
USDK/flasher/add_sample_bat/ameba_tools.py
Normal file
40
USDK/flasher/add_sample_bat/ameba_tools.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import jlinkarm as jl
|
||||
|
||||
def loaddll(dll_path):
|
||||
jl.loadJLinkARMdll(dll_path)
|
||||
jl.open()
|
||||
if jl.is_connected == 0:
|
||||
raise RuntimeError('Jlink not connected')
|
||||
jl.exec_command('device Cortex-M3', 0, 0)
|
||||
jl.exec_command('endian little', 0, 0)
|
||||
jl.tif_select(1)
|
||||
jl.set_speed(1000)
|
||||
jl.clear_RESET()
|
||||
jl.clear_TRST()
|
||||
time.sleep(0.01)
|
||||
jl.set_RESET()
|
||||
jl.set_TRST()
|
||||
jl.reset()
|
||||
jl.halt()
|
||||
jl.set_speed(3500)
|
||||
|
||||
def ram_all(binfile, image1=True, image2=True):
|
||||
bin = None
|
||||
with file(binfile, 'rb') as f:
|
||||
bin = f.read()
|
||||
get_dword = lambda address: struct.unpack('<L', bin[address:address + 4])[0]
|
||||
|
||||
if image1:
|
||||
i1_address = 0x0
|
||||
i1_length = get_dword(0x10)
|
||||
jl.write_mem(0x10000bc8, bin[i1_address + 0x20: i1_address + 0x20 + i1_length])
|
||||
|
||||
if image2:
|
||||
i2_address = (get_dword(0x18) & 0xffff) * 1024
|
||||
i2_length = get_dword(i2_address) + 0x10
|
||||
jl.write_mem(0x10006000, bin[i2_address + 0x10: i2_address + 0x10 + i2_length])
|
||||
|
||||
jl.reset()
|
||||
jl.write_u32(0x40000210, 0x20111113)
|
||||
jl.go()
|
||||
jl.close()
|
||||
Loading…
Add table
Add a link
Reference in a new issue