Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildsystem: add target debug-client #19725

Merged
merged 2 commits into from
Jun 13, 2023

Conversation

fabian18
Copy link
Contributor

@fabian18 fabian18 commented Jun 9, 2023

Contribution description

We have a test setup with some boards connected to a Raspberry Pi. We want to debug remotely, not from the Pi.
The Pi can start the debug server and the host can use the newly added debug-client target.
Integration is only added for OpenOCD.

Testing procedure

RROGRAMMER=openocd BOARD=same54-xpro make debug-server

### Starting GDB Server ###
Open On-Chip Debugger 0.12.0-rc3-00999-gfcb40f49b (2023-05-12-10:54)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
swd
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: FW Version = 03.25.01B6
Info : CMSIS-DAP: Serial# = ATML2748101800010083
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 2000 kHz
Info : SWD DPIDR 0x2ba01477
Info : [atsame5.cpu] Cortex-M4 r0p1 processor detected
Info : [atsame5.cpu] target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for atsame5.cpu on 3333
Info : Listening on port 3333 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* atsame5.cpu        cortex_m   little atsame5.cpu        halted

Info : Listening on port 6333 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : accepting 'gdb' connection on tcp/3333
Info : SAM MCU: SAME54P20A (1024KB Flash, 256KB RAM)
undefined debug reason 8 - target needs reset
Info : Auto-detected RTOS: RIOT

BOARD=same54-xpro make debug-client

### Attaching to GDB Server ###
Reading symbols from /home/[email protected]/RIOT/examples/gnrc_networking/bin/same54-xpro/gnrc_networking.elf...
Remote debugging using :3333
__set_PRIMASK (priMask=1)
    at /home/[email protected]/RIOT/build/pkg/cmsis/CMSIS/Core/Include/cmsis_gcc.h:1236
1236      __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory");
(gdb)

Issues/PRs references

@github-actions github-actions bot added Area: build system Area: Build system Area: tools Area: Supplementary tools labels Jun 9, 2023
@benpicco benpicco requested a review from maribu June 12, 2023 09:14
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jun 12, 2023
@@ -50,6 +50,11 @@
# TELNET_PORT: port opened for telnet connections
# DBG: debugger client command, default: 'gdb -q'
# TUI: if TUI!=null, the -tui option will be used
# debug-client: debug-client <elffile>
# connects to a running debug-server
# GDB_PORT: port opened for GDB connections
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can the server be specified to which this connects?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OPENOCD_SERVER_ADDRESS becomes part of DBG_FLAGS in openocd.sh.

: ${DBG_DEFAULT_FLAGS:=-q -ex \"tar ext ${OPENOCD_SERVER_ADDRESS}:$(( GDB_PORT + GDB_PORT_CORE_OFFSET ))\"}
: ${DBG_FLAGS:=${DBG_DEFAULT_FLAGS} ${DBG_EXTRA_FLAGS}}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want a GDB_ADDRESS which is set to OPENOCD_SERVER_ADDRESS?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah no, I see that OPENOCD_SERVER_ADDRESS is now documented further up in this file.

@riot-ci
Copy link

riot-ci commented Jun 12, 2023

Murdock results

✔️ PASSED

c76a192 openocd: support target debug-client

Success Failures Total Runtime
6933 0 6933 12m:14s

Artifacts

@benpicco
Copy link
Contributor

bors merge

@bors
Copy link
Contributor

bors bot commented Jun 13, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit 5e7c6c2 into RIOT-OS:master Jun 13, 2023
@benpicco benpicco added this to the Release 2023.07 milestone Aug 2, 2023
@fabian18 fabian18 deleted the pr/buildsystem_target_debug-client branch January 11, 2025 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: build system Area: Build system Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants