machine: optimize RTT initialization

This converts the heap allocation to a statically allocated string.
This is useful for me, since it reduces binary size and makes it
possible to use `-gc=none` (which would previously result in a linker
error).
This commit is contained in:
Ayke van Laethem
2026-06-21 17:54:05 +02:00
committed by Ron Evans
parent 6f686d12af
commit cb311ed25e
+4 -2
View File
@@ -71,16 +71,18 @@ type rttSerial struct {
rttControlBlock
}
var terminalByteString = []byte("Terminal\x00")
func (s *rttSerial) Configure(config UARTConfig) error {
s.maxNumUpBuffers = rttMaxNumUpBuffers
s.maxNumDownBuffers = rttMaxNumDownBuffers
s.buffersUp[0].name = &[]byte("Terminal\x00")[0]
s.buffersUp[0].name = &terminalByteString[0]
s.buffersUp[0].buffer = &rttBufferUpData[0]
s.buffersUp[0].bufferSize = rttBufferSizeUp
s.buffersUp[0].flags = rttModeNoBlockSkip
s.buffersDown[0].name = &[]byte("Terminal\x00")[0]
s.buffersDown[0].name = &terminalByteString[0]
s.buffersDown[0].buffer = &rttBufferDownData[0]
s.buffersDown[0].bufferSize = rttBufferSizeDown
s.buffersDown[0].flags = rttModeNoBlockSkip