install tinygo using brew
brew tap tinygo-org/tools
arch -arm64 brew install tinygo
add arduino dependencies
arch -arm64 brew install avrdude
Getting GOROOT and build tags by controller
tinygo info arduino
Vscode settings.json example for arduino controller
{
"go.toolsEnvVars": {
"GOROOT": "~/Library/Caches/tinygo/goroot-fec2d8579c293d2bd4e0e76a523c22d1acfbd2d095f15ac22320ece59243a0fb",
"GOFLAGS": "-tags=avr baremetal linux arm atmega328p atmega avr5 arduino tinygo math_big_pure_go gc.conservative scheduler.none serial.uart"
}
}
Flashing blinky to arduino-mega2560 controller
tinygo flash -target=arduino-mega2560 main.go