tinyGo working on an Itsy Bitsy M0 (long) but with IMHO key

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
larryp
 
Posts: 9
Joined: Sat Jul 21, 2012 2:38 pm

tinyGo working on an Itsy Bitsy M0 (long) but with IMHO key

Post by larryp »

Greetings all,

I'm pleased to report success installing and testing tinyGo (https://tinygo.org/) on an Itsy Bitsy M0. Just blinking the red LED, but I find golang on bare silicon pretty promising!

A few key details:

The #tinygo channel of gophers.slack.com is *invaluable*. I got help from the compiler developer and another helpful expert; can't beat that!

FYI, the key help was the (unintuitive-to-me-at-least) need to unset both GOROOT and GOPATH to get tinygo to work:

====

Gory details follow:

larry@larryLaptopDell:~/GoProjects/tinygo/blinky1/blinky1$ pwd
/home/larry/GoProjects/tinygo/blinky1/blinky1
larry@larryLaptopDell:~/GoProjects/tinygo/blinky1/blinky1$ unset GOROOT
larry@larryLaptopDell:~/GoProjects/tinygo/blinky1/blinky1$ unset GOPATH
larry@larryLaptopDell:~/GoProjects/tinygo/blinky1/blinky1$ which tinygo
/usr/local/tinygo/bin/tinygo
larry@larryLaptopDell:~/GoProjects/tinygo/blinky1/blinky1$ tinygo build -o blinky.hex -target itsybitsy-m0 examples/blinky1


larry@larryLaptopDell:~/GoProjects/tinygo/blinky1/blinky1$ ls -l
total 48
-rw-r--r-- 1 larry larry 328 Jun 5 15:16 blinky1.go
-rw-r--r-- 1 larry larry 43704 Jun 5 15:54 blinky.hex

larry@larryLaptopDell:~/GoProjects/tinygo/blinky1/blinky1$ ls -l *.hex
-rw-r--r-- 1 larry larry 43704 Jun 5 15:54 blinky.hex

#The command below builds an executable compatible with the itsyBitsyM0 bootloader, namely in .uf2 format:

larry@larryLaptopDell:~/GoProjects/tinygo/blinky1/blinky1$ tinygo build -o blinky.uf2 -target itsybitsy-m0 examples/blinky1
larry@larryLaptopDell:~/GoProjects/tinygo/blinky1/blinky1$ ls -l
total 80
-rw-r--r-- 1 larry larry 328 Jun 5 15:16 blinky1.go
-rw-r--r-- 1 larry larry 43704 Jun 5 15:54 blinky.hex
-rw-r--r-- 1 larry larry 32256 Jun 5 16:13 blinky.uf2

#I plugged in a new itsyBitsyM0; dragged blinky.uf2 into the dir with the other .uf2 files and voila!

# The go code is short, sweet and generic; I like it!


larry@larryLaptopDell:~/GoProjects/tinygo/blinky1/blinky1$ more blinky1.go
package main

// This is the most minimal blinky example and should run almost everywhere.

import (
"machine"
"time"
)

func main() {
led := machine.LED
led.Configure(machine.PinConfig{Mode: machine.PinOutput})
for {
led.Low()
time.Sleep(time.Millisecond * 500)

led.High()
time.Sleep(time.Millisecond * 500)
}
}

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: tinyGo working on an Itsy Bitsy M0 (long) but with IMHO

Post by adafruit_support_mike »

Nice info.. thanks for letting us know!

User avatar
larryp
 
Posts: 9
Joined: Sat Jul 21, 2012 2:38 pm

Re: tinyGo working on an Itsy Bitsy M0 (long) but with IMHO

Post by larryp »

FYI, the size of my executable (in uf2 fmt) was much larger than when one of the two gurus (guri?) did this demo. Link here for his fosdem 2019 talk on tinygo: https://www.youtube.com/watch?v=KY8u9yZ97Tc
I don't yet know why; this is my first spin w/tinygo; YMMV. That said, I think this is worth a look. Only at ver 0.6.0 as of this writing, but making rapid progress. Porting to more boards, adding more sensors. Good stuff!

Locked
Please be positive and constructive with your questions and comments.

Return to “Itsy Bitsy Boards”