Questions tagged [tinygo]

TinyGo is a Go compiler that mainly targets embedded systems, by natively including libraries for a wide range of microcontrollers; and WASM. Always use the [go] tag along with this one, plus any applicable architecture tag.

TinyGo is a Go compiler that mainly targets embedded systems. It can output significantly smaller binaries compared with gc, the official Go compiler.

TinyGo is also a good compiler choice for targeting WASM. It provides comment directives like //export that help simplify development.

Useful links:

27 questions
1
vote
0 answers

Failed to link whem trying to flash code to esp32 with tinygo

I'm trying to make a simple Hello World with tinygo and esp32, but I get an error when I upload it. In that context, a hello world would be a led blink. ` package main import ( "machine" "time" ) func main() { println("START") var…
1
vote
0 answers

How to write in tinygo bluetooth with response?

I'm trying to use Tinygo Bluetooth to connect to a Timeflip v2 (https://github.com/DI-GROUP/TimeFlip.Docs/blob/master/Hardware/TimeFlip%20BLE%20protocol%20ver4_02.06.2020.md). The API documentation says, that I need to login (which is a write to…
El Gohr
  • 177
  • 1
  • 12
1
vote
1 answer

How to map two value ranges in tinygo

I'm using Golang to program a arduino uno with tinygo. I am trying to map two value ranges. One is an encoder with a range between 0-1000 and the other is tinygo's ADC range between 0-65535. I am reading the ADC range and need to covert it to the…
Jadefox10200
  • 466
  • 1
  • 3
  • 12
1
vote
0 answers

Use tinygo to compile arm binary from x64 Linux : undefined reference problems

I am trying to compile a program with tinygo from Linux, when I enter the following command : GOARCH=arm tinygo build -o ./main.go I got : /usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld:…
Kuriyama_Shien
  • 123
  • 1
  • 6
0
votes
2 answers

Can Golang (Win11) send messages to a TinyGo USB HID device (Badger2040)

Note: The following may be impossible - I can't find whether or not in the USB spec. I am currently using a Badger2040 as a keyboard - using USB HID from TinyGo - which works fine. I can also (which I didn't expect) print to the console from the…
AndyS
  • 725
  • 7
  • 17
0
votes
1 answer

How to get buttons working on Badger2040 in Tinygo

I've been trying to access the Badger2040 buttons through Tinygo and not having any luck (I have succeeded in CircuitPython before). When I try to change the led state based on Button A, the led is switched on and never switches off: package…
AndyS
  • 725
  • 7
  • 17
0
votes
2 answers

WebAssembly / Go (tinygo) function execution time extremely slow

I compiled a go code with tinygo to WebAssembly and I don't understand why the function took 17 minutes to execute while the same function in JavaScript only took 4000 ms. what I'm doing wrong? also it is possible to modify the function in Go so I…
insurg3nt3
  • 63
  • 4
0
votes
1 answer

How to get current timestamp in proxy-wasm-go-sdk

When using a WasmPlugin with Istio 1.12 and proxy-wasm-go-sdk, it seems that stdlib-functions like time.Now() are not available, and I have not found an alternative. However, there is GetProperty() function, which allows to access some request…
user140547
  • 7,750
  • 3
  • 28
  • 80
0
votes
0 answers

Run external command without os/exec

I'm using TinyGo to build for an ARM-based Linux system that has limited resources. I'm trying to invoke a few other processes from my program, e.g. killall: exec.Command("killall", "someproc").Start() However, this results in a bunch of errors…
fstanis
  • 5,234
  • 1
  • 23
  • 42
0
votes
2 answers

Minimize integer round-off error in PLL frequency calculation

On a particular STM32 microcontroller, the system clock is driven by a PLL whose frequency F is given by the following formula: F := (S/M * (N + K/8192)) / P S is the PLL input source frequency (1 - 64000000, or 64 MHz). The other factors M, N, K,…
ardnew
  • 2,028
  • 20
  • 29
0
votes
1 answer

LinkError: WebAssembly.instantiate(): Import #... module="env" function="memcpy" error: function import requires a callable

I'm building a Go wasm module (compiled with TinyGo) and it compiles fine. But when I try to run it in the browser I get the above error.
Dellowar
  • 3,160
  • 1
  • 18
  • 37
0
votes
1 answer

Cannot use lib.Const (constant 16777216 of type lib.Version) as lib.Version

I've come across an odd error. I have this larger project that compiles fine with the typical go build. However when I switch to TinyGo (v0.8.0). I get the above error from this code: func main() { _ = lib.NewObject{ Version:…
Dellowar
  • 3,160
  • 1
  • 18
  • 37
1
2