-
Notifications
You must be signed in to change notification settings - Fork 181
Build Debug hints
Hrvoje Čavrak edited this page Apr 15, 2024
·
2 revisions
(kindly provided by Jan Almeroth)
To build DeskHop for debugging, put the follow new lines into your CMakeLists.txt
:
set(CMAKE_BUILD_TYPE "Debug")
# set(LOG 2) # standard level is 1
make sure to put these before include(pico_sdk_import.cmake)
.
To get a CBC serial device add this line:
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDH_DEBUG=1")
after set(CMAKE_C_FLAGS "-Ofast -Wall -mcpu=cortex-m0plus -mtune=cortex-m0plus -funroll-loops")
.
So the final result will look something like this:
[…]
set(CMAKE_BUILD_TYPE "Debug")
set(LOG 2)
include(pico_sdk_import.cmake)
set(CMAKE_C_FLAGS "-Ofast -Wall -mcpu=cortex-m0plus -mtune=cortex-m0plus -funroll-loops")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDH_DEBUG=1")
[…]
DeskHop can be debugged and flashed via SWD, you can use a third Raspberry Pi Pico and the picoprobe firmware therefore. For more information check out the Getting started with Raspberry Pi Pico guide.
Flashing device A:
# workdir: /path/to/deskhop
openocd -f pico-sdk/lib/tinyusb/hw/bsp/rp2040/rp2040-openocd.cfg -s /path/to/openocd/ -c "program build/board_A.elf verify reset exit
Reboot device:
# workdir: /path/to/deskhop
openocd -f pico-sdk/lib/tinyusb/hw/bsp/rp2040/rp2040-openocd.cfg -s /path/to/openocd/ -c "init; reset; exit"
Enable remote debugging:
# workdir: /path/to/deskhop
openocd -f pico-sdk/lib/tinyusb/hw/bsp/rp2040/rp2040-openocd.cfg -s /path/to/openocd/