
TinyGo -gc=conservative vs -gc=leaking vs -gc=none for Firmware
Compare the TinyGo -gc=conservative, -gc=leaking and -gc=none garbage collector settings, what each costs, and which one fits a given firmware.
Tag
6 posts

Compare the TinyGo -gc=conservative, -gc=leaking and -gc=none garbage collector settings, what each costs, and which one fits a given firmware.

Attach a handler to a pin edge with machine.Pin.SetInterrupt in TinyGo 0.37, keep the handler short with atomics, and debounce a button in the main loop.

Configure machine.I2C0 in TinyGo, scan the bus, read a chip ID register by hand, then read a BME280 with the tinygo.org/x/drivers package.

Install TinyGo 0.37, write a Go blinky for the Raspberry Pi Pico, put the board in BOOTSEL mode and flash it with tinygo flash -target=pico.

Build Go programs for 32-bit and 64-bit Arm boards with GOOS, GOARCH and GOARM, pick the right GOARM value, and verify the result with file and go version -m.

Use Go 1.24 native fuzzing with testing.F to fuzz a binary decoder, find a slice bounds panic, read the saved testdata file and add a round-trip property.