I have explored, does Go support on Micro Controller Unit. Got some info that is TinyGo. Have doubt is TinyGo equivalent to Golang which support in Linux.
-
1Do you mean an MCU as a concept of some specific make? I wonder why you capitalized the words of that term. If you wanted to ask whether Go supports development for "embedded" platforms then the answer is "it depends". 1) AFAIK, the two "stock" implementations of Go does not support running on bare metal of whatever H/W architecture; each requires an OS; 2) The stock implementations of Go support Linux as an OS and a bunch of H/W arches it runs on; the full list is [here](https://golang.org/doc/install/source#environment). – kostix Mar 01 '21 at 08:59
-
1…Now there's the question of resource consumption. Go is primarily used to implement networked servers which handle requests at rates of several kRPS per core; this hints at that the various knobs related to performance may be tuned to cater to these workloads rather than those typically found on low-profile embedded solutions. In particular, Go implements garbage collection which means a running program typically has a hefty amount of memory dedicated to "floating trash" (produced but not yet collected). The size of the complied executable images produced by stock Go toolchains are also big. – kostix Mar 01 '21 at 09:04
-
1…I guess that's the reason projects like TinyGo exists: they try to bring the relative simplicity of programming in Go and its toolchain of stellar quality to lower-profile environments that those Go typically used in. In other words, "your mileage may vary", as they say. If you want to use Go, say, on a system running Linux on an ARM device, just try and see. If you want to use it in a more constrained environment, a custom solution like TinyGo may fit the bill way better. – kostix Mar 01 '21 at 09:06
1 Answers
The short answer: Yes, when using TinyGo.
The long answer: As of the time writing TineGo directly supports more than 70 different microcontroller boards. And about 65 different peripheral devices.
TinyGo is a new Compiler, which is written in Go that consumes normal Go code. It also makes use of the LLVM compiler toolchain to be able to emit the binaries needed for microcontrollers. Using TinyGo you can shrink a simple HelloWorld program from ~1MB binary size to about 480 bytes on an Arduino UNO.
TinyGo has reimplemented large parts of the Go standard libary, but not everything. Check out this site for more details on the support of std libraries.
IDE Integration: In order to achieve a nice developer experience, the TinyGo Team does also provide a VSCode Extension, which provides functionality to switch the context to your currently used board. That way the go language server and intellisense etc. are enabled to help you out while coding.
Also Jetbrains is working on a Goland Extension, which provides atleast the same functionality as the VSCode extension, if not even a little bit more.
Summary: TinyGo is not yet an in place replacement for Go, but you can already build really great things using TinyGo. If you want to start with microcontroller projects and want to use Go then chose TinyGo.

- 3,088
- 2
- 25
- 45