mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-17 11:13:27 +00:00
fix: expand RTT debugger compatibility
This commit is contained in:
+3
-3
@@ -35,8 +35,8 @@ func Monitor(executable, port string, config *compileopts.Config) error {
|
|||||||
// Use the RTT interface, which is documented (in part) here:
|
// Use the RTT interface, which is documented (in part) here:
|
||||||
// https://wiki.segger.com/RTT
|
// https://wiki.segger.com/RTT
|
||||||
|
|
||||||
// Try to find the "machine.rttSerialInstance" symbol, which is the RTT
|
// Try to find the "_SEGGER_RTT" symbol (machine.rttSerialInstance)
|
||||||
// control block.
|
// symbol, which is the RTT control block.
|
||||||
file, err := elf.Open(executable)
|
file, err := elf.Open(executable)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not open ELF file to determine RTT control block: %w", err)
|
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
|
var address uint64
|
||||||
for _, symbol := range symbols {
|
for _, symbol := range symbols {
|
||||||
if symbol.Name == "machine.rttSerialInstance" {
|
if symbol.Name == "_SEGGER_RTT" {
|
||||||
address = symbol.Value
|
address = symbol.Value
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// This symbol name is known by the compiler, see monitor.go.
|
// This symbol name is known by the compiler, see monitor.go.
|
||||||
|
//
|
||||||
|
//go:linkname rttSerialInstance _SEGGER_RTT
|
||||||
var rttSerialInstance rttSerial
|
var rttSerialInstance rttSerial
|
||||||
|
|
||||||
var Serial = &rttSerialInstance
|
var Serial = &rttSerialInstance
|
||||||
|
|||||||
Reference in New Issue
Block a user