fix: expand RTT debugger compatibility

This commit is contained in:
Michael Smith
2025-09-12 09:55:40 -04:00
committed by Ron Evans
parent be33de1086
commit 373ca88f14
2 changed files with 5 additions and 3 deletions
+3 -3
View File
@@ -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
}
+2
View File
@@ -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