1 https://www.youtube.com/watch?v=hWYzgw0WhYU
5 sudo apt-get install git autoconf libtool make pkg-config libusb-1.0-0 libusb-1.0-0-dev
6 sudo apt install libgpiod-dev
7 git clone http://openocd.zylin.com/openocd
10 ./configure --enable-sysfsgpio --enable-bcm2835gpio
15 pi@pihdmi:~/openocd $ ./src/openocd -f tcl/interface/raspberrypi2-native.cfg
16 Open On-Chip Debugger 0.10.0+dev-01489-g06c7a53f1-dirty (2020-11-14-15:21)
17 Licensed under GNU GPL v2
19 http://openocd.org/doc/doxygen/bugs.html
20 BCM2835 GPIO nums: swclk = 11, swdio = 25
22 Info : Listening on port 6666 for tcl connections
23 Info : Listening on port 4444 for telnet connections
24 Info : BCM2835 GPIO JTAG/SWD bitbang driver
25 Error: An adapter speed is not selected in the init script. Insert a call to "adapter speed" or "jtag_rclk" to proceed.
29 IO1 gpio17 level=1 fsel=0 func=INPUT "ds18b20_temp@2" out hi
30 IO2 gpio18 level=0 fsel=0 func=INPUT io
31 IO3 gpio27 level=0 fsel=0 func=INPUT clk
34 pi@pihdmi:~/openocd-stm32 $ openocd -f pihdmi-rpi2.cfg
35 Open On-Chip Debugger 0.10.0+dev-01489-g06c7a53f1-dirty (2020-11-14-15:21)
36 Licensed under GNU GPL v2
38 http://openocd.org/doc/doxygen/bugs.html
40 Info : Listening on port 6666 for tcl connections
41 Info : Listening on port 4444 for telnet connections
42 Info : BCM2835 GPIO JTAG/SWD bitbang driver
43 Info : clock speed 100 kHz
44 Warn : gdb services need one or more targets defined
47 https://github.com/antongus/stm32tpl/blob/master/stm32.h
50 0xe0042000: 20036410 00000000 00000000 00000000
54 Failed to read memory at 0x1fff7a14
57 0x1ffff7e8: 0670ff48 56558967 67064740 ffff00ff
61 openocd -f pihdmi-rpi2.cfg -f target/stm32f1x.cfg
64 #0 : stm32f1x.flash (stm32f1x) at 0x08000000, size 0x00000000, buswidth 0, chipwidth 0
66 > flash read_bank 0 bank0.bin
67 device id = 0x20036410
68 flash size = 128kbytes
69 wrote 131072 bytes to file bank0.bin from flash bank 0 at offset 0x00000000 in 1.273383s (100.520 KiB/s)
76 # if it failed, re-try command again
77 flash write_bank 0 image.bin
84 (gdb) set architecture arm
85 The target architecture is assumed to be arm
87 (gdb) target remote localhost:3333
88 Remote debugging using localhost:3333
89 warning: No executable has been specified and target does not support
90 determining executable automatically. Try using the "file" command.
98 => 0x8000194: subs r0, r0, #1
100 0x8000198: bne.n 0x8000194
102 0x800019c: push {r3, lr}
103 0x800019e: movs r1, #1
104 0x80001a0: movs r0, #16
105 0x80001a2: bl 0x80002ec
106 0x80001a6: mov.w r0, #8192 ; 0x2000
107 0x80001aa: strh.w r0, [sp]
110 Breakpoint 1 at 0x800019a
114 Note: automatically using hardware breakpoints for read-only addresses.
116 Breakpoint 1, 0x0800019a in ?? ()