mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 12:03:41 +00:00
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:
committed by
Ron Evans
parent
6f686d12af
commit
cb311ed25e
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user