Skip to content

Commit 373ca88

Browse files
mikesmittydeadprogram
authored andcommitted
fix: expand RTT debugger compatibility
1 parent be33de1 commit 373ca88

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

monitor.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ func Monitor(executable, port string, config *compileopts.Config) error {
3535
// Use the RTT interface, which is documented (in part) here:
3636
// https://wiki.segger.com/RTT
3737

38-
// Try to find the "machine.rttSerialInstance" symbol, which is the RTT
39-
// control block.
38+
// Try to find the "_SEGGER_RTT" symbol (machine.rttSerialInstance)
39+
// symbol, which is the RTT control block.
4040
file, err := elf.Open(executable)
4141
if err != nil {
4242
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 {
4848
}
4949
var address uint64
5050
for _, symbol := range symbols {
51-
if symbol.Name == "machine.rttSerialInstance" {
51+
if symbol.Name == "_SEGGER_RTT" {
5252
address = symbol.Value
5353
break
5454
}

src/machine/serial-rtt.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import (
1616
)
1717

1818
// This symbol name is known by the compiler, see monitor.go.
19+
//
20+
//go:linkname rttSerialInstance _SEGGER_RTT
1921
var rttSerialInstance rttSerial
2022

2123
var Serial = &rttSerialInstance

0 commit comments

Comments
 (0)