Execute Go program on Arduino Yún

441 Views Asked by At

I would like to run a Go program on the Arduino Yún platform. It features an embedded Linux running on a 32 bit MIPS processor (Atheros AR9331).

Contents of test.go:

package main

import "fmt"

func main() {
    fmt.Println("Hello!")
}

I use the following command on Linux (4.13.12-1-ARCH #1 SMP PREEMPT Wed Nov 8 11:54:06 CET 2017 x86_64 GNU/Linux), Go (go1.9.2 linux/amd64) to compile the binary:

GOOS=linux GOARCH=mips go build test.go

I copy the binary to the device (via SSH) and execute it there. It doesn't crash. It doesn't print "Hello!". It just seems to wait for stdin. How can I debug/fix this?

Contents of /proc/cpuinfo on the device:

system type     : Atheros AR9330 rev 1
machine         : Arduino Yun
processor       : 0
cpu model       : MIPS 24Kc V7.4
BogoMIPS        : 265.42
wait instruction    : yes
microsecond timers  : yes
tlb_entries     : 16
extra interrupt vector  : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0000, 0x0920, 0x04b8, 0x0180]
ASEs implemented    : mips16
shadow register sets    : 1
kscratch registers  : 0
core            : 0
VCED exceptions     : not available
VCEI exceptions     : not available

Output of strace ./test on the device:

execve("./test", ["./test"], [/* 11 vars */]) = 0

Output of uname -r on the device:

Linux B4218AF03376 3.3.8 #1 Sun Oct 4 02:29:26 CEST 2015 mips GNU/Linux
1

There are 1 best solutions below

0
On

You might want to try again with Go 1.10, which added 32-bit MIPS software floating point emulation.

You can enable this with GOMIPS=softfloat, see https://golang.org/doc/go1.10#ports