Skip to content

Instantly share code, notes, and snippets.

@oholiab
Last active July 30, 2020 15:01
Show Gist options
  • Save oholiab/27266c4d9528ad93fd8dbbf9b36b93b3 to your computer and use it in GitHub Desktop.
Save oholiab/27266c4d9528ad93fd8dbbf9b36b93b3 to your computer and use it in GitHub Desktop.
Dumping from a Tilda Mk 3

Start the session (obviously replacing jlink with whatever interface you're using)

> openocd -c 'interface jlink' -c 'transport select swd' -c 'source [find target/stm32l4x.cfg]' -c 'init'
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
swd
adapter speed: 500 kHz
adapter_nsrst_delay: 100
none separate
cortex_m reset_config sysresetreq
Info : No device selected, using first device.
Info : J-Link EDU Mini V1 compiled Jul 17 2020 16:25:21
Info : Hardware version: 1.00
Info : VTarget = 3.244 V
Info : clock speed 500 kHz
Info : SWD DPIDR 0x2ba01477
Info : stm32l4x.cpu: hardware has 6 breakpoints, 4 watchpoints

Then open up an interactive session with telnet, reset the controller just to be sure, halt it and then dump the flash (memory location is given by this datasheet on page 101, figure 14 as 0x08000000 to 0x08100000)

> telnet localhost 4444
Trying ::1...
Connection failed: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> reset
adapter speed: 500 kHz
> halt
target halted due to debug-request, current mode: Thread
xPSR: 0x81000000 pc: 0x0805a766 msp: 0x20017818
> dump_image /tmp/image.bin 0x08000000 0x00100000
dumped 1048576 bytes in 35.742870s (28.649 KiB/s)
>

We can verify we got the right thing with a quick check:

> strings /tmp/image.bin | tail -n 3
    elif ("app_library" in apps) and ("main.py" in os.listdir("apps/app_library")):
        m = "apps/app_library/main.py"
pyb.main(m)

Looks like some Tilda micropython!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment