From 373ca88f14f8032ea998a387b3c5c08438da0732 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 12 Sep 2025 09:55:40 -0400 Subject: [PATCH] fix: expand RTT debugger compatibility --- monitor.go | 6 +++--- src/machine/serial-rtt.go | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/monitor.go b/monitor.go index 46f3de927..35a256fca 100644 --- a/monitor.go +++ b/monitor.go @@ -35,8 +35,8 @@ func Monitor(executable, port string, config *compileopts.Config) error { // Use the RTT interface, which is documented (in part) here: // https://wiki.segger.com/RTT - // Try to find the "machine.rttSerialInstance" symbol, which is the RTT - // control block. + // Try to find the "_SEGGER_RTT" symbol (machine.rttSerialInstance) + // symbol, which is the RTT control block. file, err := elf.Open(executable) if err != nil { return fmt.Errorf("could not open ELF file to determine RTT control block: %w", err) @@ -48,7 +48,7 @@ func Monitor(executable, port string, config *compileopts.Config) error { } var address uint64 for _, symbol := range symbols { - if symbol.Name == "machine.rttSerialInstance" { + if symbol.Name == "_SEGGER_RTT" { address = symbol.Value break } diff --git a/src/machine/serial-rtt.go b/src/machine/serial-rtt.go index 15f6463de..c258ccd25 100644 --- a/src/machine/serial-rtt.go +++ b/src/machine/serial-rtt.go @@ -16,6 +16,8 @@ import ( ) // This symbol name is known by the compiler, see monitor.go. +// +//go:linkname rttSerialInstance _SEGGER_RTT var rttSerialInstance rttSerial var Serial = &rttSerialInstance