在ArduinoYún上执行Go程序

时间:2017-11-29 15:16:22

标签: go arduino cross-compiling mips32 arduino-yun

我想在ArduinoYún平台上运行Go程序。它具有在32位MIPS处理器(Atheros AR9331)上运行的嵌入式Linux。

test.go的内容:

package main

import "fmt"

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

我在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)编译二进制:

GOOS=linux GOARCH=mips go build test.go

我将二进制文件复制到设备(通过SSH)并在那里执行。它没有崩溃。它不会打印“你好!”。它似乎等待stdin。我该如何调试/解决此问题?

设备上/ proc / cpuinfo的内容:

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

在设备上输出strace ./test:

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

在设备上输出uname -r:

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

1 个答案:

答案 0 :(得分:0)

你可能想再试一次Go 1.10,它增加了32位MIPS软件浮点仿真。

您可以使用priority启用此功能,请参阅 https://golang.org/doc/go1.10#ports