-
11[OpenOCD] Modify the "ft232h-module-swd.cfg"
The green version is using PID 0x6010, so you need to change this one as well. Or, make a backup copy of it and rename it something else:
ftdi_vid_pid 0x0403 0x6010
and add that one:
adapter speed 100
-
12[OpenOCD] Run OpenOCD with the config files in Cygwin.
Get back to Cygwin. Run it. Like this:
openocd -f interface/raspberrypi-swd.cfg -f target/rp2040.cfg
The output should look like this:
$ openocd -f tcl/interface/ftdi/ft232h-module-swd.cfg -f tcl/target/rp2040.cfg Open On-Chip Debugger 0.10.0+dev-g7c96119-dirty (2021-01-25-21:56) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info : FTDI SWD mode enabled adapter speed: 400 kHz Info : Hardware thread awareness created Info : Hardware thread awareness created Info : RP2040 Flash Bank Command Info : Listening on port 6666 for tcl connections Info : Listening on port 4444 for telnet connections Info : clock speed 400 kHz Info : SWD DPIDR 0x0bc12477 Info : SWD DLPIDR 0x00000001 Info : SWD DPIDR 0x0bc12477 Info : SWD DLPIDR 0x10000001 Info : rp2040.core0: hardware has 4 breakpoints, 2 watchpoints Info : rp2040.core1: hardware has 4 breakpoints, 2 watchpoints Info : starting gdb server for rp2040.core0 on 3333 Info : Listening on port 3333 for gdb connections
It is now waiting for GDB connection. You will have to switch back to the Linux Subsystem to start the GDB-multiarch.
-
13[OpenOCD] Go back to Linux Subsystem -> load program!
Go to your project build folder (example MyProject/build) and run GDB-multiarch:
gdb-multiarch myProject.elf
Then when you can log into it, enter this:
target extended-remote localhost:3333
You will see this:
GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... warning: No executable has been specified and target does not support determining executable automatically. Try using the "file" command. 0x10000e98 in ?? () Reading symbols from hello.elf...done. __wfe () at E:\pico-sdk\src\rp2_common\hardware_sync\include/hardware/sync.h:95 95 E:\pico-sdk\src\rp2_common\hardware_sync\include/hardware/sync.h: No such file or directory. (gdb)
Load a program, just send "load" and it'll do the magic for you!
(gdb) load Loading section .boot2, size 0x100 lma 0x10000000 Loading section .text, size 0x7018 lma 0x10000100 Loading section .rodata, size 0x12ac lma 0x10007118 Loading section .binary_info, size 0x20 lma 0x100083c4 Loading section .data, size 0xb04 lma 0x100083e4 Start address 0x10000104, load size 36584 Transfer rate: 13 KB/sec, 6097 bytes/write. (gdb)
Send "c" to let it run! You can see the LED blinking! :D
-
14[OpenOCD] One fast tip - automatic connect to localhost:3333
If you are bored with "target remote localhost:3333" everytime you start the GDB, you can create the .gdbinit file inside the build folder:
target extended-remote localhost:3333
On the Linux Subsystem, just run GDB with these parameters:
gdb-multiarch -iex "set auto-load safe-path /" myProject.elf
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
FYI, the connection in “[OpenOCD] Connect the board to Pico!” is correct. I have tested it. However, the side note is wrong. According to the "ft232h-module-swd.cfg" in OpenOCD config file, D1 is TDO, ad D2 is TDI on Adafruit FT232H Breakout Board.
Are you sure? yes | no