Embedded Go supports the i.MX RT106x family. You may know it as Teensy 4 which is a family of the popular development boards based on the i.MX RT1062.
-
Go complier.
You can download it from go.dev/dl.
-
Git command.
To instll git on Linux use the package manager provided by your Linux distribution (apt, pacman, rpm, ...).
Windows users may check the git for Windows website.
The Mac users may use the git command provided by the Xcode commandline tools. Another way is to use the Homebrew package manager.
-
Install the Embedded Go toolchain.
Make sure the
$GOPATH/bin
directory is in yourPATH
, as tools installed with thego install
command will be placed here. If you didn't set theGOPATH
environment variable manually you can find its default value using thego env GOPATH
command.Then install the Embedded Go toolchain using the following two commands:
go install github.com/embeddedgo/dl/go1.24.5-embedded@latest go1.24.5-embedded download
-
Install egtool.
go install github.com/embeddedgo/tools/egtool@latest
-
Create a project directory containing the
main.go
file with your first Go program for Teensy 4.x.package main import ( "time" "github.com/embeddedgo/imxrt/devboard/teensy4/board/leds" ) func main() { for { leds.User.Toggle() time.Sleep(time.Second/2) } }
-
Initialize your project
go mod init firstprog go mod tidy
-
Copy the
go.env
file suitable for your board (here is one for Teensy and another one for a board with 4 MB flash). -
Compile your first program
export GOENV=go.env go build
or
GOENV=go.env go build
or
egtool build
The last one is like
GOENV=go.env go build
but looks for thego.env
file up the current module directory tree. -
Connect your Teensy to your computer and press the onboard button.
-
Load and run.
egtool load
-
See the Embedded Go website for more information.
See more example code for supported develompent boards.