Go compiler for small places. Microcontrollers, WebAssembly, and command-line tools. Based on LLVM.

Overview

TinyGo - Go compiler for small places

CircleCI Build Status

TinyGo is a Go compiler intended for use in small places such as microcontrollers, WebAssembly (Wasm), and command-line tools.

It reuses libraries used by the Go language tools alongside LLVM to provide an alternative way to compile programs written in the Go programming language.

Here is an example program that blinks the built-in LED when run directly on any supported board with onboard LED:

package main

import (
    "machine"
    "time"
)

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

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

The above program can be compiled and run without modification on an Arduino Uno, an Adafruit ItsyBitsy M0, or any of the supported boards that have a built-in LED, just by setting the correct TinyGo compiler target. For example, this compiles and flashes an Arduino Uno:

tinygo flash -target arduino examples/blinky1

Installation

See the getting started instructions for information on how to install TinyGo, as well as how to run the TinyGo compiler using our Docker container.

Supported boards/targets

You can compile TinyGo programs for microcontrollers, WebAssembly and Linux.

The following 44 microcontroller boards are currently supported:

For more information, see this list of boards. Pull requests for additional support are welcome!

Currently supported features:

For a description of currently supported Go language features, please see https://tinygo.org/lang-support/.

Documentation

Documentation is located on our web site at https://tinygo.org/.

You can find the web site code at https://github.com/tinygo-org/tinygo-site.

Getting help

If you're looking for a more interactive way to discuss TinyGo usage or development, we have a #TinyGo channel on the Gophers Slack.

If you need an invitation for the Gophers Slack, you can generate one here which should arrive fairly quickly (under 1 min): https://invite.slack.golangbridge.org

Contributing

Your contributions are welcome!

Please take a look at our CONTRIBUTING.md document for details.

Project Scope

Goals:

  • Have very small binary sizes. Don't pay for what you don't use.
  • Support for most common microcontroller boards.
  • Be usable on the web using WebAssembly.
  • Good CGo support, with no more overhead than a regular function call.
  • Support most standard library packages and compile most Go code without modification.

Non-goals:

  • Using more than one core.
  • Be efficient while using zillions of goroutines. However, good goroutine support is certainly a goal.
  • Be as fast as gc. However, LLVM will probably be better at optimizing certain things so TinyGo might actually turn out to be faster for number crunching.
  • Be able to compile every Go program out there.

Why this project exists

We never expected Go to be an embedded language and so its got serious problems...

-- Rob Pike, GopherCon 2014 Opening Keynote

TinyGo is a project to bring Go to microcontrollers and small systems with a single processor core. It is similar to emgo but a major difference is that we want to keep the Go memory model (which implies garbage collection of some sort). Another difference is that TinyGo uses LLVM internally instead of emitting C, which hopefully leads to smaller and more efficient code and certainly leads to more flexibility.

The original reasoning was: if Python can run on microcontrollers, then certainly Go should be able to run on even lower level micros.

License

This project is licensed under the BSD 3-clause license, just like the Go project itself.

Some code has been copied from the LLVM project and is therefore licensed under a variant of the Apache 2.0 license. This has been clearly indicated in the header of these files.

Some code has been copied and/or ported from Paul Stoffregen's Teensy libraries and is therefore licensed under PJRC's license. This has been clearly indicated in the header of these files.

Comments
  • Teensy 3.6

    Teensy 3.6

    I want to use TinyGo for the Teensy 3.6, which is powered by the MK66FX1M0VMD18, a NXP Kinetis K66 processor. TinyGo does not currently support any NXP device.

    • [x] Add SVD
      • posborne/cmsis-svd#93
    • [x] src/device/nxp/mk66f18.go
      • I updated gen-device-svd to work with NXP SVDs
    • [x] src/runtime/runtime_nxpmk66f18.go (and maybe runtime_nxp.go)
    • [x] src/machine/machine_nxpmk66f18.go (and maybe machine_nxp.go)
    • [x] src/machine/board_teensy36.go
      • I think I can just pull this from #548
    • [x] targets/nxpmk66f18.ld, targets/nxpmk66f18.json
    • [x] targets/teensy36.json
    opened by firelizzard18 66
  • Support compiling basic Vecty/Vugu examples to WASM

    Support compiling basic Vecty/Vugu examples to WASM

    This is just a tracking issue for any outstanding work required for us to compile a vecty-style web app into WASM with tinygo. I think this would be a fantastic milestone for this repo and the Go WASM community at large, so lets see what remains outstanding.

    • Channels
    • syscall/js callback support
    • a subset of reflect including
      • reflect.ValueOf, reflect.TypeOf, reflect.New and the following functions of the reflect.Value type:
        • Kind, Elem, String, Interface, Type, NumField, Field, Set

    Would love to have @slimsag take a quick look at this if possible, but otherwise I think @bketelsen will know the best what is outstanding.

    enhancement wasm 
    opened by johanbrandhorst 60
  • Add support for the `recover()` builtin function

    Add support for the `recover()` builtin function

    Not all architectures are supported yet. In particular, the current design doesn't support WebAssembly. Other architectures (avr, xtensa, riscv64) can be supported but are left as a TODO.

    This PR does result in an increase in code size if either defer or panic is used. There is no way to turn this feature off with this PR, but I don't think we should do that for the following reasons:

    • The code size increase only happens when defer or panic is used (especially defer). If you really care about code size, you may want to avoid those.
    • Having another knob to configure the compiler is a maintenance burden. We already have quite a few (-gc, -scheduler).

    To give an idea of the code size change, here is the difference in binary size before and after the last commit of this PR:

    before  after   diff
     10796  10796      0  0.00%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/adxl345/main.go
     13708  13708      0  0.00%  tinygo build -size short -o ./build/test.hex -target=pybadge ./examples/amg88xx
      9088   9088      0  0.00%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/apa102/main.go
     10108  10108      0  0.00%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/apa102/itsybitsy-m0/main.go
      6524   6524      0  0.00%  tinygo build -size short -o ./build/test.hex -target=microbit ./examples/at24cx/main.go
     10516  10516      0  0.00%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/bh1750/main.go
      9672   9672      0  0.00%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/blinkm/main.go
     13772  13772      0  0.00%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/bmp180/main.go
     12380  12380      0  0.00%  tinygo build -size short -o ./build/test.hex -target=trinket-m0 ./examples/bmp388/main.go
      6724   6724      0  0.00%  tinygo build -size short -o ./build/test.hex -target=bluepill ./examples/ds1307/sram/main.go
      4396   4396      0  0.00%  tinygo build -size short -o ./build/test.hex -target=microbit ./examples/easystepper/main.go
     11096  11096      0  0.00%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/hcsr04/main.go
      5596   5596      0  0.00%  tinygo build -size short -o ./build/test.hex -target=microbit ./examples/hd44780/customchar/main.go
      5580   5580      0  0.00%  tinygo build -size short -o ./build/test.hex -target=microbit ./examples/hd44780/text/main.go
     11360  11360      0  0.00%  tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/hd44780i2c/main.go
     15640  15640      0  0.00%  tinygo build -size short -o ./build/test.hex -target=microbit ./examples/hub75/main.go
     10780  10780      0  0.00%  tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/ili9341/basic
     11804  11804      0  0.00%  tinygo build -size short -o ./build/test.hex -target=xiao ./examples/ili9341/basic
     29628  29628      0  0.00%  tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/ili9341/pyportal_boing
     10832  10832      0  0.00%  tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/ili9341/scroll
     11884  11884      0  0.00%  tinygo build -size short -o ./build/test.hex -target=xiao ./examples/ili9341/scroll
     12752  12752      0  0.00%  tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/lis3dh/main.go
     15304  15304      0  0.00%  tinygo build -size short -o ./build/test.hex -target=microbit ./examples/lsm303agr/main.go
     12780  12780      0  0.00%  tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/lsm6ds3/main.go
     13036  13036      0  0.00%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mag3110/main.go
     10500  10500      0  0.00%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mcp3008/main.go
     10540  10540      0  0.00%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mma8653/main.go
     10388  10388      0  0.00%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mpu6050/main.go
      4444   4444      0  0.00%  tinygo build -size short -o ./build/test.hex -target=microbit ./examples/pcd8544/setbuffer/main.go
      4452   4452      0  0.00%  tinygo build -size short -o ./build/test.hex -target=microbit ./examples/pcd8544/setpixel/main.go
      2468   2468      0  0.00%  tinygo build -size short -o ./build/test.hex -target=arduino ./examples/servo
      8732   8732      0  0.00%  tinygo build -size short -o ./build/test.hex -target=pybadge ./examples/shifter/main.go
      5072   5072      0  0.00%  tinygo build -size short -o ./build/test.hex -target=microbit ./examples/ssd1306/i2c_128x32/main.go
      5332   5332      0  0.00%  tinygo build -size short -o ./build/test.hex -target=microbit ./examples/ssd1306/spi_128x64/main.go
      5116   5116      0  0.00%  tinygo build -size short -o ./build/test.hex -target=microbit ./examples/ssd1331/main.go
      5696   5696      0  0.00%  tinygo build -size short -o ./build/test.hex -target=microbit ./examples/st7735/main.go
      5448   5448      0  0.00%  tinygo build -size short -o ./build/test.hex -target=microbit ./examples/st7789/main.go
     14160  14160      0  0.00%  tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/thermistor/main.go
      8088   8088      0  0.00%  tinygo build -size short -o ./build/test.hex -target=circuitplay-bluefruit ./examples/tone
     10592  10592      0  0.00%  tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/tm1637/main.go
     17064  17064      0  0.00%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/vl53l1x/main.go
      5828   5828      0  0.00%  tinygo build -size short -o ./build/test.hex -target=microbit ./examples/waveshare-epd/epd2in13/main.go
      5364   5364      0  0.00%  tinygo build -size short -o ./build/test.hex -target=microbit ./examples/waveshare-epd/epd2in13x/main.go
      5684   5684      0  0.00%  tinygo build -size short -o ./build/test.hex -target=microbit ./examples/waveshare-epd/epd4in2/main.go
      8692   8692      0  0.00%  tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/ws2812
      1420   1420      0  0.00%  tinygo build -size short -o ./build/test.hex -target=arduino   ./examples/ws2812
       720    720      0  0.00%  tinygo build -size short -o ./build/test.hex -target=digispark ./examples/ws2812
     24788  24788      0  0.00%  tinygo build -size short -o ./build/test.hex -target=trinket-m0 ./examples/bme280/main.go
     13528  13528      0  0.00%  tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/microphone/main.go
     13124  13124      0  0.00%  tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/buzzer/main.go
     15136  15136      0  0.00%  tinygo build -size short -o ./build/test.hex -target=trinket-m0 ./examples/veml6070/main.go
      8664   8664      0  0.00%  tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/l293x/simple/main.go
     10072  10072      0  0.00%  tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/l293x/speed/main.go
      8632   8632      0  0.00%  tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/l9110x/simple/main.go
     10104  10104      0  0.00%  tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/l9110x/speed/main.go
     15264  15264      0  0.00%  tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/lis2mdl/main.go
     10512  10512      0  0.00%  tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/max72xx/main.go
      6094   6094      0  0.00%  tinygo build -size short -o ./build/test.hex -target=arduino ./examples/keypad4x4/main.go
      8952   8952      0  0.00%  tinygo build -size short -o ./build/test.hex -target=xiao ./examples/pcf8563/clkout/
      9976   9976      0  0.00%  tinygo build -size short -o ./build/test.hex -target=feather-m0 ./examples/ina260/main.go
      8656   8656      0  0.00%  tinygo build -size short -o ./build/test.hex -target=nucleo-l432kc ./examples/aht20/main.go
      7492   7496      4  0.05%  tinygo build -size short -o ./build/test.hex -target=hifive1b ./examples/ssd1351/main.go
     21300  21332     32  0.15%  tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/espat/espconsole/main.go
     22460  22492     32  0.14%  tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/espat/esphub/main.go
     22492  22524     32  0.14%  tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/espat/espstation/main.go
     10912  10952     40  0.37%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mcp23017/main.go
     11356  11396     40  0.35%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mcp23017-multiple/main.go
      6312   6352     40  0.63%  tinygo build -size short -o ./build/test.hex -target=nucleo-f103rb ./examples/shiftregister/main.go
     10016  10072     56  0.56%  tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/touch/resistive/fourwire/main.go
     12824  12880     56  0.44%  tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/touch/resistive/pyportal_touchpaint/main.go
      6124   6184     60  0.98%  tinygo build -size short -o ./build/test.hex -target=microbit ./examples/microbitmatrix/main.go
     15844  15992    148  0.93%  tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/wifinina/webclient/main.go
     53660  54460    800  1.49%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/bmi160/main.go
     58404  59316    912  1.56%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/flash/console/spi
     56408  57336    928  1.65%  tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/flash/console/qspi
     61000  61976    976  1.60%  tinygo build -size short -o ./build/test.hex -target=feather-m4 ./examples/sdcard/console/
    247992 249480   1488  0.60%  tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/ili9341/slideshow
     20004  21596   1592  7.96%  tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/wifinina/udpstation/main.go
     61028  62724   1696  2.78%  tinygo build -size short -o ./build/test.hex -target=p1am-100 ./examples/p1am/main.go
     52840  54748   1908  3.61%  tinygo build -size short -o ./build/test.hex -target=feather-m0 ./examples/gps/i2c/main.go
     52560  54468   1908  3.63%  tinygo build -size short -o ./build/test.hex -target=feather-m0 ./examples/gps/uart/main.go
     15196  17328   2132 14.03%  tinygo build -size short -o ./build/test.hex -target=bluepill ./examples/ds1307/time/main.go
     29552  31752   2200  7.44%  tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/wifinina/ntpclient/main.go
     54996  57332   2336  4.25%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mcp2515/main.go
     51460  53876   2416  4.69%  tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/wifinina/tcpclient/main.go
     61624  64300   2676  4.34%  tinygo build -size short -o ./build/test.hex -target=xiao ./examples/pcf8563/alarm/
     60232  62924   2692  4.47%  tinygo build -size short -o ./build/test.hex -target=xiao ./examples/pcf8563/time/
     61528  64220   2692  4.38%  tinygo build -size short -o ./build/test.hex -target=xiao ./examples/pcf8563/timer/
     49948  52684   2736  5.48%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/adt7410/main.go
     52092  54828   2736  5.25%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/bmp280/main.go
     44932  47668   2736  6.09%  tinygo build -size short -o ./build/test.hex -target=microbit ./examples/sht3x/main.go
     63672  67104   3432  5.39%  tinygo build -size short -o ./build/test.hex -target=feather-m0 ./examples/dht/main.go
    139744 144244   4500  3.22%  tinygo build -size short -o ./build/test.hex -target=feather-m4 ./examples/sdcard/tinyfs/
     57976  62588   4612  7.96%  tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/ds3231/main.go
     93948  99040   5092  5.42%  tinygo build -size short -o ./build/test.hex -target=wioterminal ./examples/rtl8720dn/mqttsub/
    122832 128836   6004  4.89%  tinygo build -size short -o ./build/test.hex -target=wioterminal ./examples/rtl8720dn/webserver/
    124396 130624   6228  5.01%  tinygo build -size short -o ./build/test.hex -target=wioterminal ./examples/rtl8720dn/webclient/
    sum: 67968 (2.72%)
    

    What you can see here:

    • The overall code size increase is 2.72%.
    • Many examples (about two thirds) don't change in binary size at all. Probably because they don't use defer or panic.
    • Examples that increased in binary size are usually large examples, >25kB or so. It looks like they import the fmt package, which seems to use defer and /recover.
    opened by aykevl 46
  • nrf52840-mdk support

    nrf52840-mdk support

    I really like this tinygo project and am trying to figure out how to add support for this neat little thing: https://wiki.makerdiary.com/nrf52840-mdk/

    I've managed to add this as target:

    {
    	"llvm-target": "armv7em-none-eabi",
    	"build-tags": ["nrf52840_mdk", "nrf52840", "nrf", "arm", "js", "wasm"],
    	"linker": "arm-none-eabi-gcc",
    	"pre-link-args": ["-nostdlib", "-nostartfiles", "-mcpu=cortex-m4", "-mthumb", "-T", "targets/nrf52.ld", "-Wl,--gc-sections", "-fno-exceptions", "-fno-unwind-tables", "-ffunction-sections", "-fdata-sections", "-Os", "-DNRF52840_XXAA", "-Ilib/CMSIS/CMSIS/Include", "lib/nrfx/mdk/system_nrf52.c", "src/device/nrf/nrf52.s"],
    	"objcopy": "arm-none-eabi-objcopy",
    	"flash": "nrfjprog -f nrf52 --sectorerase --program {hex} --reset"
    }
    

    And added machine/board_nrf52840-mdk.go (which is just a copy of board_pca10040.go for now)

    // +build nrf,nrf52840_mdk
    
    package machine
    
    // LEDs on the nrf52840-mdk (nRF52840 dev board)
    const (
    	LED  = LED1
    	LED1 = 17
    	LED2 = 18
    	LED3 = 19
    	LED4 = 20
    )
    
    // Buttons on the nrf52840-mdk (nRF52840 dev board)
    const (
    	BUTTON  = BUTTON1
    	BUTTON1 = 13
    	BUTTON2 = 14
    	BUTTON3 = 15
    	BUTTON4 = 16
    )
    

    When I now run: tinygo flash -target=nrf52840-mdk examples/button

    I get:

    github.com/aykevl/tinygo/src/runtime/runtime_nrf.go:33:12: invalid operation: nrf.UART0 (variable of type *device/nrf.UART_Type) has no field or method PSELTXD

    So, obviously, I'm missing something. But, I can't add "nrf52" to the build-tags, because then I get a bunch of re-declaration errors:

    GPIO_PIN_CNF_DRIVE_D0S1 redeclared in this block
    ...
    

    So, anyone here wanna help me adding support for this dev board? I'm new to this code, and figured it would be quicker to ask about this here since I couldn't find anything on the wiki about how to add a new board. Wasn't as straight forward as I thought, unless I'm missing something.

    Thanks!

    opened by Chillance 43
  • runtime (gc): add lightweight `list` GC

    runtime (gc): add lightweight `list` GC

    This saves about a kilobyte of flash, and attempts to address the AVR size increase issue in #1181. Similar to #1181 and the avr-libc allocator, this is a best-fit allocator.

    opened by niaow 37
  • Support Arduino MEGA 2560

    Support Arduino MEGA 2560

    Please add support for the Ardunio MEGA 2560 boards, as this board provides a larger number of GPIO's than most of the other boards (54 off).

    https://www.arduino.cc/en/Main/arduinoBoard_Mega2560?setlang=en

    enhancement 
    opened by kgolding 36
  • proposal: interrupt API

    proposal: interrupt API

    We need to define an API to interact with interrupts in TinyGo in an idiomatic way. At the moment, there is some support but they rely on magic comments and are hard to use correctly. For example:

    //go:export RTC1_IRQHandler
    func handleRTC1() {
        // ...
    }
    

    Here are a few requirements I could come up with, for such an API:

    • It should be portable across processor architectures. For example: Cortex-M, AVR, traditional ARM, RISC-V (both the older PLIC design and the upcoming standard, which will likely be CLIC-based), perhaps others? I've seen roughly these designs:
      • Full interrupt vector table with hardware stacking/unstacking, as implemented in Cortex-M.
      • Interrupt vector, but apart from saving/restoring the PC the interrupt controller expects the software to handle everything. This is the case for AVR and the new CLIC-based interrupt scheme in RISC-V.
      • Single entry point with software vectoring. This is the case for the old RISC-V design, can optionally be used with the new CLIC-based RISC-V interrupt design, and is used on the older ARM core in the GameBoy Advance.
    • It should be efficient to implement. That is, it should not use extra RAM for the vector table on Cortex-M or always require jumping through a handler of some sort if that is not absolutely necessary.
    • It should fit well in the Go language. That means it should not conflict too much with normal Go-style programs: lots of goroutines that perform blocking operations and a scheduler that switches between all these goroutines.
    • It should be easy to use.

    This is the design I came up with uses two different kinds of interrupt handlers, as I recognize there are certain interrupts that are easier to use in one style or in the other:

    • Low-level interrupts, much like you would use in your classical C or assembly based embedded application. This should map as closely as possible to the hardware and be as efficient as possible. Such interrupts have limitations, such as being unable to use heap allocation or not being able to perform blocking operations (but non-blocking channel operations should still be allowed). The idea is that you register a function as an interrupt and possibly need to manually enable/configure it. These interrupts are usually run in response to certain events when some action needs to be performed, such as pressing a button.
    • High level blocking operations. This is closer to how I/O is usually done in Go. The typical example would be waiting for an SPI transmission to be completed before continuing.

    Here is my proposed API in pseudo-Go:

    // Low level interrupt style
    type runtime.Interrupt struct { ... }
    func runtime.NewInterrupt(interruptNumber uintptr, handler func()) runtime.Interrupt {}
    func (i runtime.Interrupt) Enable() {}
    func (i runtime.Interrupt) Disable() {}
    func (i runtime.Interrupt) IsEnabled() {}
    func (i runtime.Interrupt) SetPriority(priority uint8) {} // TODO: how should priority numbers be specified?
    
    // High level interrupt style
    func runtime.BlockOnInterrupt(interruptNumber uintptr) {}
    

    This system will have some limitations:

    • The interrupt number must always be a compile-time constant. If it is not, the compiler would not be able to determine where to place the interrupt in the interrupt vector and could thus not keep the interrupt vector table in ROM.
    • An interrupt cannot be registered twice. While it is possible for the compiler to update it and pick the last registration (or the first), this will probably be unexpected and better to show an error instead.
    • The runtime.NewInterrupt call must always be called in global scope, to initialize a global variable (this could be _). This makes sure the compiler can resolve the call at compile time.
    • The handler must be statically known to the compiler. This limitation may be lifted later by letting the compiler write a wrapper function - but I don't think this will often be necessary.

    The high level implementation could be implemented by a compiler transformation that inserts a new interrupt handler and suspends/resumes the goroutine at the right time. Multiple suspend points should be allowed (unlike runtime.NewInterrupt).

    An example of the low-level API:

    var rtc1Interrupt = runtime.NewInterrupt(nrf.IRQ_RTC1, func() {
        // handler code
    })
    func init() {
        rtc1Interrupt.SetPriority(prio) // TODO: how should priorities be numbered?
        rtc1Interrupt.Enable()
    }
    

    An example of the high-level API:

    func (spi SPI) Transfer(w byte) (byte, error) {
        // send byte
        for /* has byte been sent? */ {
            runtime.BlockOnInterrupt(nrf.IRQ_SPI0)
        }
        // read response byte
    }
    

    The compiler may eventually learn to rewrite high-level blocking operations to low-level interrupt handlers, if it can determine this would result in equivalent behavior. An example would be a single-function goroutine that is started once at startup and only ever blocks on a single interrupt, with no external calls.

    Problems I see now with this proposal:

    • Interrupts should be usable by the machine package, and they currently aren't because the runtime package imports the machine package. Perhaps they should be moved to a separate package?
    • How to specify the priority of interrupts when blocking on them? Is this relevant at all?
    • There might be race conditions in the BlockOnInterrupt call (TOCTOU).
    enhancement 
    opened by aykevl 32
  • main: add support for LLVM 11

    main: add support for LLVM 11

    This can be useful to test improvements in LLVM master and to make it possible to support LLVM 11 for the most part already before the next release. That also allows catching LLVM bugs early to fix them upstream.

    Note that tests do not yet pass for this LLVM version, but the TinyGo compiler can be built with the binaries from apt.llvm.org (at the time of making this commit).


    One concrete example of what I want to do with this change is to test/improve AVR support: upstream master has a number of improvements that aren't included yet in LLVM 10.

    Note that #1055 should be merged first.

    opened by aykevl 31
  • Support Go 1.14.

    Support Go 1.14.

    I believe this works without issues, but I've also got to figure out LLVM 10 at the same time. I also have only checked 0.11.0, not 0.12.0 yet. So let's see how CI feels about this.

    opened by QuLogic 30
  • Some arduino issues

    Some arduino issues

    When trying to run gourotines: Code:
    package main
    
    import (
    	"time"
    )
    
    var currentTime int
    
    func trackTime() {
    	for {
    		currentTime++
    		time.Sleep(1 * time.Microsecond)
    	}
    }
    
    func main() {
    	go trackTime()
    
    	for {
    		println(currentTime)
    	}
    }
    

    When trying to flash:

    tinygo flash -target=arduino-mega2560 -port "/dev/ttyACM0" -ocd-output main.go
    > main.go:17:2: attempted to start a goroutine without a scheduler
    
    When trying to get the current time Now i'd like to point out that I know arduino doesnt have a good time system, but they do have a `millis()` function that returns how long the arduino has been running in milliseconds. import ( "time" )

    var currentTime int

    func main() {

    for {
    	now := time.Now()
    
    	println(now.String())
    }
    

    }

    
    	When building:
    	```tinygo flash -target=arduino-mega2560 -port "/dev/ttyACM0" -ocd-output main.go
    /tmp/tinygo295588631/main.o: In function `LBB10_3':
    main.go:(.text.(reflect.Value).Complex+0x9a): undefined reference to `__extendsfdf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '0', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.(reflect.Value).Complex+0xba): undefined reference to `__extendsfdf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found address size '9', this reader can not handle sizes greater than '8'.
    /tmp/tinygo295588631/main.o: In function `LBB12_3':
    main.go:(.text.(reflect.Value).Float+0x3c): undefined reference to `__extendsfdf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '12', this reader only handles version 2, 3 and 4 information.
    /tmp/tinygo295588631/main.o: In function `LBB20_48':
    main.go:(.text.runtime._panic+0x2c4): undefined reference to `__extendsfdf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '0', this reader only handles version 2, 3 and 4 information.
    /tmp/tinygo295588631/main.o: In function `LBB20_71':
    main.go:(.text.runtime._panic+0x3fa): undefined reference to `__extendsfdf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '0', this reader only handles version 2, 3 and 4 information.
    /tmp/tinygo295588631/main.o:main.go:(.text.runtime._panic+0x406): more undefined references to `__extendsfdf2' follow
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '4354', this reader only handles version 2, 3 and 4 information.
    /tmp/tinygo295588631/main.o: In function `runtime.printfloat64':
    main.go:(.text.runtime.printfloat64+0x46): undefined reference to `__unorddf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '13312', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x64): undefined reference to `__ledf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '256', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x7a): undefined reference to `__adddf3'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '65535', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0xb0): undefined reference to `__eqdf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '17', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0xd6): undefined reference to `__unorddf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '15619', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x104): undefined reference to `__gedf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '0', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x126): undefined reference to `__eqdf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '0', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x14c): undefined reference to `__unorddf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '0', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x1d2): undefined reference to `__eqdf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '1537', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x1f4): undefined reference to `__unorddf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '0', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x282): undefined reference to `__gedf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '0', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x2a0): undefined reference to `__subdf3'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '1792', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x2ce): undefined reference to `__ltdf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '0', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x2ea): undefined reference to `__divdf3'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '18946', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x322): undefined reference to `__muldf3'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '13312', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x35c): undefined reference to `__gedf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '256', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x384): undefined reference to `__adddf3'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '65535', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x39e): undefined reference to `__ltdf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '74', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x3be): undefined reference to `__divdf3'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '23042', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x3f4): undefined reference to `__divdf3'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '13312', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x404): undefined reference to `__gedf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '256', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x458): undefined reference to `__fixdfsi'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '65535', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x470): undefined reference to `__floatsidf'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '90', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x484): undefined reference to `__subdf3'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '26882', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.printfloat64+0x49e): undefined reference to `__muldf3'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '13312', this reader only handles version 2, 3 and 4 information.
    /tmp/tinygo295588631/main.o: In function `LBB40_15':
    main.go:(.text.runtime.reflectValueEqual+0x16c): undefined reference to `__eqdf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '256', this reader only handles version 2, 3 and 4 information.
    main.go:(.text.runtime.reflectValueEqual+0x192): undefined reference to `__eqdf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '65535', this reader only handles version 2, 3 and 4 information.
    /tmp/tinygo295588631/main.o: In function `LBB40_29':
    main.go:(.text.runtime.reflectValueEqual+0x31e): undefined reference to `__eqdf2'
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: Dwarf Error: found dwarf version '105', this reader only handles version 2, 3 and 4 information.
    /tmp/tinygo295588631/main.o: In function `LBB40_31':
    main.go:(.text.runtime.reflectValueEqual+0x334): undefined reference to `__unorddf2'
    collect2: error: ld returned 1 exit status
    error: failed to link /tmp/tinygo295588631/main: exit status 1
    
    There's also a lot of builtin arduino functions we cant use. Could you make a way for us to include Arduino.h via cgo? bug enhancement question avr 
    opened by AllAwesome497 29
  • WASM Target Not Supported on OSX

    WASM Target Not Supported on OSX

    Adding a tracking case for monitoring progress of WASM target when building from OSX.

    OSX developers cannot use tinygo to build WASM targets because WASM is an experimental feature in LLVM

    $ tinygo build -o test.wasm test.go
    error: No available targets are compatible with this triple.
    

    The Facts:

    • Tinygo can build on OSX when LLVM 7 is installed via brew. However, WASM targets are experimental in LLVM 7 and not supported by the homebrew recipe.
    • WASM will be supported in LLVM 8 (Expected release March 2019)

    RELATED:

    Possible Workarounds:

    • Wait for LLVM 8 in March of 2019
    • Build LLVM 7 from source with full WASM support (Does this work?)
    • ???
    enhancement 
    opened by drush 29
  • [proposal] Support for machine/board Bundles

    [proposal] Support for machine/board Bundles

    Within a time we will have a significant number of supported machines/boards. This will bloat the base tinygo srcs.

    Proposal

    This proposal is about to split the machines-related code in "bundles". The existing code allows to merge regular Go sources and TinyGo (btw, src/os/exec/exec.go never being used with current implementation because os/exec is overriden by Go sources). The approach is to traverse bundles src directories and merge the contents with the TinyGo sources in the cached root. Same should be done for lib and bin if present. The per bundle targets should be merged separately.

    Dependencies In order to support cross-bundle dependencies, it's possible to wrap the go install command to be called within bundle directory (set the GOPATH variable). The existing PoC should be re-worked to follow pkg-structure of Go packages.

    Caching At the first implementation the targets being traversed each invocation and only missing symlinks are re-created. The bundle modifications (install, update, remove) should invalidate the existing cache.

    The PoC that splits up the nrfx package: https://github.com/tinygo-org/tinygo/pull/3361

    opened by ya-mouse 1
  • Support for Adafruit Feather M0 Express board

    Support for Adafruit Feather M0 Express board

    I'm still really confused regarding the UART though, not sure whether this is correct. So far I struggle to test it with a CMSIS-DAP debugger & USB-to-TTY-Serial on the other side.

    Pinout used:

    opened by trichner 0
  • Add PDM support for circuitplay-bluefruit

    Add PDM support for circuitplay-bluefruit

    This PR attempts to add some basic support for PDM and implements it for the Nordic 52840 based SoCs and the CircuitPlayground-Bluefruit board.

    I could imagine maybe the configuration and API can be filled out a bit more to do things like configure and fetch sample rate. I'm completely new to tinygo and have only played with microcontrollers here and there as a hobby, so hopefully I haven't done anything too boneheaded.

    With the change in this PR, I was able to complete a tinygo version of the Adafruit VU meter with my son on the Bluefruit. I couldn't easily figure out how to write to the "CPLAYBTBOOT" onboard flash filesystem to try storing a WAV file, but I did go so far as to echo out a 1 second integer buffer (per the PR's example code) and save that as a WAV on my laptop and play it back. So I think in general it works.

    As a side note, I noticed that there is a "microphone" PDM driver that can run I2S in PDM mode. I think maybe this is a quirk of a specific board, to be able to run I2S in PDM mode? I wonder if it would make sense later to refactor this as a PDM device and just make the controller-specific implementation leverage its I2S. It was a bit confusing to me to see this microphone driver documented as a PDM but then need an I2S in order to use it.

    Thanks!

    opened by mlsorensen 1
  • map delete not finding keys when value is largeish, key hash seems to be incorrect

    map delete not finding keys when value is largeish, key hash seems to be incorrect

    I am currently debugging this code that tries to delete the keys in a map (to empty it while retaining bucket storage)

    https://github.com/corazawaf/coraza/blob/v3/dev/internal/corazawaf/rulegroup.go#L105

    (for the below, note that I tried copying the keys into a slice before deleting to see if it was iterator+delete behavior problem but it was all the same so simplified back to normal map iteration).

    I noticed a memory leak and after adding if len(transformationCache) > 0 { panic } after the deletion could verify that the map wasn't getting cleared with tinygo wasm. It works fine with Go.

    I have added this instrumentation to hashmap.go

    https://github.com/anuraaga/tinygo/compare/custom-gc...anuraaga:tinygo:hashmapdelete-debug?expand=1

    And shrunk down the test to similar one as last time

    https://github.com/corazawaf/coraza-proxy-wasm/compare/main...anuraaga:coraza-1225?expand=1#diff-173fbfd8d8844658344b121461b4290d0a85230caae9825240705df8130e8b75R33 ~/go/bin/tinygo build -scheduler=none -target=wasi -opt=2 -o mapbench.wasm

    The debug output looks something like this

    hashmapBinaryGet 0x0001019c 0x0000ffd0 16 1666840535
    could find key
    hashmapBinaryDelete 0x0001019c 0x0000ffb8 16 1666840535
    delete could find key 0x0001019c 0x0000ffb8 1666840535
    hashmapBinaryGet 0x0001019c 0x0000ffd0 16 1666840535
    couldn't find key
    

    The key address for get is 0x0000ffd0 and delete is 0x0000ffb8. That being said the hash is the same in this example so it's being able to clear the map but with the same instrumentation when looking at the output for the original coraza code, the hash values were also different. I'm not sure why I wasn't able to reproduce this hash value difference, but either way, the key is in a local variable k, which there is only one of, so intuitively I suppose those addresses must be the same and the difference is unexpected.

    One weird thing I found while making the repro is it seems the value struct needs to be more than 2 strings worth of size to exhibit the behavior - with three fields, get and delete have different addresses, while with two fields they are the same.

    Looked through the code in hashmap.go and map.go (compiler) and couldn't see anything suspicious, the code paths for get/lookup vs delete look basically the same for both, but the difference does cause our real-world code to fail with the map not being cleared. With the code looking the same, the issue may be in IR reduction?

    Note the above simpleish test case approach is also applied to the real world code here (which is where I was observing the address+key value difference)

    https://github.com/corazawaf/coraza/compare/v3/dev...anuraaga:scratch?expand=1

    The output looks like this (we can see the different hash values)

    [2022-12-28 04:04:56.210312][25][info][wasm] [source/extensions/common/wasm/context.cc:1170] wasm log coraza-filter my_vm_id: hashmapBinaryGet 0x09887b70 0x0000fb98 16 2748313615
    [2022-12-28 04:04:56.210312][25][info][wasm] [source/extensions/common/wasm/context.cc:1170] wasm log coraza-filter my_vm_id: could find key
    [2022-12-28 04:04:56.210312][25][info][wasm] [source/extensions/common/wasm/context.cc:1170] wasm log coraza-filter my_vm_id: hashmapBinaryDelete 0x09887b70 0x0000fbf8 16 3003228291
    [2022-12-28 04:04:56.210313][25][info][wasm] [source/extensions/common/wasm/context.cc:1170] wasm log coraza-filter my_vm_id: delete couldn't find key 0x09887b70
    [2022-12-28 04:04:56.210313][25][info][wasm] [source/extensions/common/wasm/context.cc:1170] wasm log coraza-filter my_vm_id: hashmapBinaryGet 0x09887b70 0x0000fb98 16 2748313615
    [2022-12-28 04:04:56.210314][25][info][wasm] [source/extensions/common/wasm/context.cc:1170] wasm log coraza-filter my_vm_id: could find key
    
    opened by anuraaga 3
  • Filter target build-tags if user specified an overriding option

    Filter target build-tags if user specified an overriding option

    I noticed that when building for wasi, the runtime_memhash_ option cannot be overridden because the leveldb option always gets added, but only one file is allowed to be compiled

    ❯ ~/go/bin/tinygo build -scheduler=none -target=wasi -opt=2 -o mapbench.wasm -tags="runtime_memhash_tsip" .
    # runtime
    /Users/anuraag/git/tinygo/src/runtime/memhash_tsip.go:18:6: ptrToSlice redeclared in this block
    /Users/anuraag/git/tinygo/src/runtime/memhash_leveldb.go:16:6: 	other declaration of ptrToSlice
    /Users/anuraag/git/tinygo/src/runtime/memhash_tsip.go:47:6: hash64 redeclared in this block
    /Users/anuraag/git/tinygo/src/runtime/memhash_leveldb.go:82:6: 	other declaration of hash64
    /Users/anuraag/git/tinygo/src/runtime/memhash_tsip.go:119:6: hash32 redeclared in this block
    /Users/anuraag/git/tinygo/src/runtime/memhash_leveldb.go:34:6: 	other declaration of hash32
    
    opened by anuraaga 0
Releases(v0.26.0)
  • v0.26.0(Oct 4, 2022)

    This is another TinyGo release with many small changes, including over 110 commits.

    This release introduces two possible breaking changes:

    1. The machine package has had some changes in the public API, to remove some unintentionally exported constants. It is likely that very little real-world code is affected by this change.

    2. WebAssembly files could previously import functions by leaving a Go function unimplemented, like so:

      func add(a, b int) int
      

      This worked by accident. With this release, this is no longer possible. Instead, functions will need to be imported explicitly to avoid a compiler error:

      //export add
      func add(a, b int) int
      

      (The //export may be confusing, we intend to add a less-confusing //go:wasm-import directive in the future).

    Here is a detailed changelog for this release:

    • general
      • remove support for LLVM 13
      • remove calls to deprecated ioutil package
      • move from os.IsFoo to errors.Is(err, ErrFoo)
      • fix for builds using an Android host
      • make interp timeout configurable from command line
      • ignore ports with VID/PID if there is no candidates
      • drop support for Go 1.16 and Go 1.17
      • update serial package to v1.3.5 for latest bugfixes
      • remove GOARM from tinygo info
      • add flag for setting the goroutine stack size
      • add serial port monitoring functionality
    • compiler
      • cgo: implement support for static functions
      • cgo: fix panic when FuncType.Results is nil
      • compiler: add aliases for edwards25519/field.feMul and field.feSquare
      • compiler: fix incorrect DWARF type in some generic parameters
      • compiler: use LLVM math builtins everywhere
      • compiler: replace some math operation bodies with LLVM intrinsics
      • compiler: replace math aliases with intrinsics
      • compiler: fix unsafe.Sizeof for chan and map values
      • compileopts: use tags parser from buildutil
      • compileopts: use backticks for regexp to avoid extra escapes
      • compileopts: fail fast on duplicate values in target field slices
      • compileopts: fix windows/arm target triple
      • compileopts: improve error handling when loading target/*.json
      • compileopts: add support for stlink-dap programmer
      • compileopts: do not complain about -no-debug on MacOS
      • goenv: support GOOS=android
      • interp: fix reading from external global
      • loader: fix link error for crypto/internal/boring/sig.StandardCrypto
    • standard library
      • rename assembly files to .S extension
      • machine: add PWM peripheral comments to pins
      • machine: improve UARTParity slightly
      • machine: do not export DFU_MAGIC_* constants on nrf52840
      • machine: rename PinInputPullUp/PinInputPullDown
      • machine: add KHz, MHz, GHz constants, deprecate TWI_FREQ_* constants
      • machine: remove level triggered pin interrupts
      • machine: do not expose RESET_MAGIC_VALUE
      • machine: use NoPin constant where appropriate (instead of 0 for example)
      • net: sync net.go with Go 1.18 stdlib
      • os: add SyscallError.Timeout
      • os: add ErrProcessDone error
      • reflect: implement CanInterface and fix string Index
      • runtime: make MemStats available to leaking collector
      • runtime: add MemStats.TotalAlloc
      • runtime: add MemStats.Mallocs and Frees
      • runtime: add support for time.NewTimer and time.NewTicker
      • runtime: implement resetTimer
      • runtime: ensure some headroom for the GC to run
      • runtime: make gc and scheduler asserts settable with build tags
      • runtime/pprof: add WriteHeapProfile
      • runtime/pprof: runtime/trace: stub some additional functions
      • sync: implement Map.LoadAndDelete
      • syscall: group WASI consts by purpose
      • syscall: add WASI {D,R}SYNC, NONBLOCK FD flags
      • syscall: add ENOTCONN on darwin
      • testing: add support for -benchmem
    • targets
      • remove USB vid/pid pair of bootloader
      • esp32c3: remove unused UARTStopBits constants
      • nrf: implement GetRNG function
      • nrf: rp2040: add machine.ReadTemperature
      • nrf52: cleanup s140v6 and s140v7 uf2 targets
      • rp2040: implement semi-random RNG based on ROSC based on pico-sdk
      • wasm: add summary of wasm examples and fix callback bug
      • wasm: do not allow undefined symbols (--allow-undefined)
      • wasm: make sure buffers returned by malloc are kept until free is called
      • windows: save and restore xmm registers when switching goroutines
    • boards
      • add Pimoroni's Tufty2040
      • add XIAO ESP32C3
      • add Adafruit QT2040
      • add Adafruit QT Py RP2040
      • esp32c3-12f: matrixportal-m4: p1am-100: remove duplicate build tags
      • hifive1-qemu: remove this emulated board
      • wioterminal: add UART3 for RTL8720DN
      • xiao-ble: fix usbpid
    Source code(tar.gz)
    Source code(zip)
    tinygo0.26.0.darwin-amd64.tar.gz(94.54 MB)
    tinygo0.26.0.linux-amd64.tar.gz(112.29 MB)
    tinygo0.26.0.linux-arm.tar.gz(104.36 MB)
    tinygo0.26.0.linux-arm64.tar.gz(105.08 MB)
    tinygo0.26.0.windows-amd64.zip(101.34 MB)
    tinygo_0.26.0_amd64.deb(112.47 MB)
    tinygo_0.26.0_arm64.deb(105.25 MB)
    tinygo_0.26.0_armhf.deb(104.53 MB)
  • v0.25.0(Aug 3, 2022)

    This release improves USB support with new support for the RP2040 and MIDI, improves support for generics, fixes some bugs on darwin/arm64, and adds 3 new boards: the Challenger RP2040 LoRa, the MCH2022 badge, and the XIAO RP2040

    • command line
      • change to ignore PortReset failures
    • compiler
      • compiler: darwin/arm64 is aarch64, not arm
      • compiler: don't clobber X18 and FP registers on darwin/arm64
      • compiler: fix issue with methods on generic structs
      • compiler: do not try to build generic functions
      • compiler: fix type names for generic named structs
      • compiler: fix multiple defined function issue for generic functions
      • compiler: implement unsafe.Alignof and unsafe.Sizeof for generic code
    • standard library
      • machine: add DTR and RTS to Serialer interface
      • machine: reorder pin definitions to improve pin list on tinygo.org
      • machine/usb: add support for MIDI
      • machine/usb: adjust buffer alignment (samd21, samd51, nrf52840)
      • machine/usb/midi: add NoteOn, NoteOff, and SendCC methods
      • machine/usb/midi: add definition of MIDI note number
      • runtime: add benchmarks for memhash
      • runtime: add support for printing slices via print/println
    • targets
      • avr: fix some apparent mistake in atmega1280/atmega2560 pin constants
      • esp32: provide hardware pin constants
      • esp32: fix WDT reset on the MCH2022 badge
      • esp32: optimize SPI transmit
      • esp32c3: provide hardware pin constants
      • esp8266: provide hardware pin constants like GPIO2
      • nrf51: define and use P0_xx constants
      • nrf52840, samd21, samd51: unify bootloader entry process
      • nrf52840, samd21, samd51: change usbSetup and sendZlp to public
      • nrf52840, samd21, samd51: refactor handleStandardSetup and initEndpoint
      • nrf52840, samd21, samd51: improve usb-device initialization
      • nrf52840, samd21, samd51: move usbcdc to machine/usb/cdc
      • rp2040: add usb serial vendor/product ID
      • rp2040: add support for usb
      • rp2040: change default for serial to usb
      • rp2040: add support for machine.EnterBootloader
      • rp2040: turn off pullup/down when input type is not specified
      • rp2040: make picoprobe default openocd interface
      • samd51: add support for DAC1
      • samd51: improve TRNG
      • wasm: stub runtime.buffered, runtime.getchar
      • wasi: make leveldb runtime hash the default
    • boards
      • add Challenger RP2040 LoRa
      • add MCH2022 badge
      • add XIAO RP2040
      • clue: remove pins D21..D28
      • feather-rp2040, macropad-rp2040: fix qspi-flash settings
      • xiao-ble: add support for flash-1200-bps-reset
      • gopherbot, gopherbot2: add these aliases to simplify for newer users
    Source code(tar.gz)
    Source code(zip)
    tinygo0.25.0.darwin-amd64.tar.gz(93.43 MB)
    tinygo0.25.0.linux-amd64.tar.gz(111.16 MB)
    tinygo0.25.0.linux-arm.tar.gz(103.27 MB)
    tinygo0.25.0.linux-arm64.tar.gz(103.97 MB)
    tinygo0.25.0.windows-amd64.zip(100.03 MB)
    tinygo_0.25.0_amd64.deb(111.33 MB)
    tinygo_0.25.0_arm64.deb(104.13 MB)
    tinygo_0.25.0_armhf.deb(103.43 MB)
  • v0.25.0-beta1(Jul 29, 2022)

  • v0.24.0(Jul 1, 2022)

    This release adds a few pretty major features to TinyGo: the embed package, recover() (for most non-wasm architectures), and generics. It also adds initial (incomplete) support for Go 1.19, which is still in beta. Apart from that, we have the usual assortment of new features and bug fixes and we add the Badger 2040 board.

    One possible breaking change is that we will now use a few newer WebAssembly features. If this is a problem, let us know and we can add a new target without these newer features. We use them because it lowers the binary size of the .wasm files.

    Here is the complete changelog:

    • command line
      • remove support for go 1.15
      • remove support for LLVM 11 and LLVM 12
      • add initial Go 1.19 beta support
      • test: fix package/... syntax
    • compiler
      • add support for the embed package
      • builder: improve error message for "command not found"
      • builder: add support for ThinLTO on MacOS and Windows
      • builder: free LLVM objects after use, to reduce memory leaking
      • builder: improve -no-debug error messages
      • cgo: be more strict: CGo now requires every Go file to import the headers it needs
      • compiler: alignof(func) is 1 pointer, not 2
      • compiler: add support for type parameters (aka generics)
      • compiler: implement recover() built-in function
      • compiler: support atomic, volatile, and LLVM memcpy-like functions in defer
      • compiler: drop support for macos syscalls via inline assembly
      • interp: do not try to interpret past task.Pause()
      • interp: fix some buggy localValue handling
      • interp: do not unroll loops
      • transform: fix MakeGCStackSlots that caused a possible GC bug on WebAssembly
    • standard library
      • os: enable os.Stdin for baremetal target
      • reflect: add Value.UnsafePointer method
      • runtime: scan GC globals conservatively on Windows, MacOS, Linux and Nintendo Switch
      • runtime: add per-map hash seeds
      • runtime: handle nil map write panics
      • runtime: add stronger hash functions
      • syscall: implement Getpagesize
    • targets
      • atmega2560: support UART1-3 + example for uart
      • avr: use compiler-rt for improved float64 support
      • avr: simplify timer-based time
      • avr: fix race condition in stack write
      • darwin: add support for GOARCH=arm64 (aka Apple Silicon)
      • darwin: support -size=short and -size=full flag
      • rp2040: replace sleep 'busy loop' with timer alarm
      • rp2040: align api for PortMaskSet, PortMaskClear
      • rp2040: fix GPIO interrupts
      • samd21, samd51, nrf52840: add support for USBHID (keyboard / mouse)
      • wasm: update wasi-libc version
      • wasm: use newer WebAssembly features
    • boards
      • add Badger 2040
      • matrixportal-m4: attach USB DP to the correct pin
      • teensy40: add I2C support
      • wioterminal: fix I2C definition
    Source code(tar.gz)
    Source code(zip)
    tinygo0.24.0.darwin-amd64.tar.gz(93.42 MB)
    tinygo0.24.0.linux-amd64.tar.gz(106.99 MB)
    tinygo0.24.0.linux-arm.tar.gz(103.29 MB)
    tinygo0.24.0.linux-arm64.tar.gz(103.99 MB)
    tinygo0.24.0.windows-amd64.zip(100.01 MB)
    tinygo_0.24.0_amd64.deb(107.14 MB)
    tinygo_0.24.0_arm.deb(103.43 MB)
    tinygo_0.24.0_arm64.deb(104.14 MB)
  • v0.23.0(Apr 29, 2022)

    This release adds support for the recently released Go 1.18, although not for all language features yet. We have also added support for LLVM 14 which is the latest release of the compiler framework. Lots of improvements to the runtime and standard library support, especially when running in WASM/WASI environments. Also a whole bunch of bugfixes and improvements to our hardware support, in particular for the RP2040 processor.

    The following new boards have been added this release:

    Here is the complete list of changes:

    • command line
      • add -work flag
      • add Go 1.18 support
      • add LLVM 14 support
      • run: add support for command-line parameters
      • build: calculate default output path if -o is not specified
      • build: add JSON output
      • test: support multiple test binaries with -c
      • test: support flags like -v on all targets (including emulated firmware)
    • compiler
      • add support for ThinLTO
      • use compiler-rt from LLVM
      • builder: prefer GNU build ID over Go build ID for caching
      • builder: add support for cross compiling to Darwin
      • builder: support machine outlining pass in stacksize calculation
      • builder: disable asynchronous unwind tables
      • compileopts: fix emulator configuration on non-amd64 Linux architectures
      • compiler: move allocations > 256 bytes to the heap
      • compiler: fix incorrect unsafe.Alignof on some 32-bit architectures
      • compiler: accept alias for slice cap builtin
      • compiler: allow slices of empty structs
      • compiler: fix difference in aliases in interface methods
      • compiler: make RawSyscall an alias for Syscall
      • compiler: remove support for memory references in AsmFull
      • loader: only add Clang header path for CGo
      • transform: fix poison value in heap-to-stack transform
    • standard library
      • internal/fuzz: add this package as a shim
      • os: implement readdir for darwin and linux
      • os: add DirFS, which is used by many programs to access readdir.
      • os: isWine: be compatible with older versions of wine, too
      • os: implement RemoveAll
      • os: Use a uintptr for NewFile
      • os: add stubs for exec.ExitError and ProcessState.ExitCode
      • os: export correct values for DevNull for each OS
      • os: improve support for Signal by fixing various bugs
      • os: implement File.Fd method
      • os: implement UserHomeDir
      • os: add exec.ProcessState stub
      • os: implement Pipe for darwin
      • os: define stub ErrDeadlineExceeded
      • reflect: add stubs for more missing methods
      • reflect: rename reflect.Ptr to reflect.Pointer
      • reflect: add Value.FieldByIndexErr stub
      • runtime: fix various small GC bugs
      • runtime: use memzero for leaking collector instead of manually zeroing objects
      • runtime: implement memhash
      • runtime: implement fastrand
      • runtime: add stub for debug.ReadBuildInfo
      • runtime: add stub for NumCPU
      • runtime: don't inline runtime.alloc with -gc=leaking
      • runtime: add Version
      • runtime: add stubs for NumCgoCall and NumGoroutine
      • runtime: stub {Lock,Unlock}OSThread on Windows
      • runtime: be able to deal with a very small heap
      • syscall: make Environ return a copy of the environment
      • syscall: implement getpagesize and munmap
      • syscall: wasi: define MAP_SHARED and PROT_READ
      • syscall: stub mmap(), munmap(), MAP_SHARED, PROT_READ, SIGBUS, etc. on nonhosted targets
      • syscall: darwin: more complete list of signals
      • syscall: wasi: more complete list of signals
      • syscall: stub WaitStatus
      • syscall/js: allow copyBytesTo(Go|JS) to use Uint8ClampedArray
      • testing: implement TempDir
      • testing: nudge type TB closer to upstream; should be a no-op change.
      • testing: on baremetal platforms, use simpler test matcher
    • targets
      • atsamd: fix usbcdc initialization when -serial=uart
      • atsamd51: allow higher frequency when using SPI
      • esp: support CGo
      • esp32c3: add support for input pin
      • esp32c3: add support for GPIO interrupts
      • esp32c3: add support to receive UART data
      • rp2040: fix PWM bug at high frequency
      • rp2040: fix some minor I2C bugs
      • rp2040: fix incorrect inline assembly
      • rp2040: fix spurious i2c STOP during write+read transaction
      • rp2040: improve ADC support
      • wasi: remove --export-dynamic linker flag
      • wasm: remove heap allocator from wasi-libc
    • boards
      • circuitplay-bluefruit: move pin mappings so board can be compiled for WASM use in Playground
      • esp32-c3-12f: add the ESP32-C3-12f Kit
      • m5stamp-c3: add pin setting of UART
      • macropad-rp2040: add the Adafruit MacroPad RP2040 board
      • nano-33-ble: typo in LPS22HB peripheral definition and documentation (#2579)
      • teensy41: add the Teensy 4.1 board
      • teensy40: add ADC support
      • teensy40: add SPI support
      • thingplus-rp2040: add the SparkFun Thing Plus RP2040 board
      • wioterminal: add DefaultUART
      • wioterminal: verify written data when flashing through OpenOCD
      • xiao-ble: add XIAO BLE nRF52840 support
    Source code(tar.gz)
    Source code(zip)
    tinygo0.23.0.darwin-amd64.tar.gz(94.05 MB)
    tinygo0.23.0.linux-amd64.tar.gz(107.60 MB)
    tinygo0.23.0.linux-arm.tar.gz(103.91 MB)
    tinygo0.23.0.windows-amd64.zip(101.22 MB)
    tinygo_0.23.0_amd64.deb(107.76 MB)
    tinygo_0.23.0_armhf.deb(104.05 MB)
  • v0.22.0(Jan 26, 2022)

    This release contains significantly improved standard library support with many more packages passing all tests. Especially the os package was improved a lot with many functions added to match the standard Go os package. In addition, we upgraded LLVM to LLVM 13, improved the build cache (no tinygo clean anymore), and of course we've made various other improvements and bug fixes.

    We've added the following boards this release:

    Here are the changes in detail:

    • command line
      • add asyncify to scheduler flag help
      • support -run for tests
      • remove FreeBSD target support
      • add LLVM 12 and LLVM 13 support, use LLVM 13 by default
      • add support for ARM64 MacOS
      • improve help
      • check /run/media as well as /media on Linux for non-debian-based distros
      • test: set cmd.Dir even when running emulators
      • info: add JSON output using the -json flag
    • compiler
      • builder: fix off-by-one in size calculation
      • builder: handle concurrent library header rename
      • builder: use flock to avoid double-compiles
      • builder: use build ID as cache key
      • builder: add -fno-stack-protector to musl build
      • builder: update clang header search path to look in /usr/lib
      • builder: explicitly disable unwind tables for ARM
      • cgo: add support for C.CString and related functions
      • compiler: fix ranging over maps with particular map types
      • compiler: add correct debug location to init instructions
      • compiler: fix emission of large object layouts
      • compiler: work around AVR atomics bugs
      • compiler: predeclare runtime.trackPointer
      • interp: work around AVR function pointers in globals
      • interp: run goroutine starts and checks at runtime
      • interp: always run atomic and volatile loads/stores at runtime
      • interp: bump timeout to 180 seconds
      • interp: handle type assertions on nil interfaces
      • loader: elminate goroot cache inconsistency
      • loader: respect $GOROOT when running go list
      • transform: allocate the correct amount of bytes in an alloca
      • transform: remove switched func lowering
    • standard library
      • crypto/rand: show error if platform has no rng
      • device/*: add *_Msk field for each bit field and avoid duplicates
      • device/*: provide Set/Get for each register field described in the SVD files
      • internal/task: swap stack chain when switching goroutines
      • internal/task: remove -scheduler=coroutines
      • machine: add Device string constant
      • net: add bare Interface implementation
      • net: add net.Buffers
      • os: stub out support for some features
      • os: obey TMPDIR on unix, TMP on Windows, etc
      • os: implement ReadAt, Mkdir, Remove, Stat, Lstat, CreateTemp, MkdirAll, Chdir, Chmod, Clearenv, Unsetenv, Setenv, MkdirTemp, Rename, Seek, ExpandEnv, Symlink, Readlink
      • os: implement File.Stat
      • os: fix IsNotExist on nonexistent path
      • os: fix opening files on WASI in read-only mode
      • os: work around lack of syscall.seek on 386 and arm
      • reflect: make sure indirect pointers are handled correctly
      • runtime: allow comparing interfaces
      • runtime: use LLVM intrinsic to read the stack pointer
      • runtime: strengthen hashmap hash function for structs and arrays
      • runtime: fix float/complex hashing
      • runtime: fix nil map dereference
      • runtime: add realloc implementation to GCs
      • runtime: handle negative sleep times
      • runtime: correct GC scan bounds
      • runtime: remove extalloc GC
      • rumtime: implement __sync libcalls as critical sections for most microcontrollers
      • runtime: add stubs for Func.FileLine and Frame.PC
      • sync: fix concurrent read-lock on write-locked RWMutex
      • sync: add a package doc
      • sync: add tests
      • syscall: add support for Mmap and Mprotect
      • syscall: fix array size for mmap slice creation
      • syscall: enable Getwd in wasi
      • testing: add a stub for CoverMode
      • testing: support -bench option to run benchmarks matching the given pattern.
      • testing: support b.SetBytes(); implement sub-benchmarks.
      • testing: replace spaces with underscores in test/benchmark names, as upstream does
      • testing: implement testing.Cleanup
      • testing: allow filtering subbenchmarks with the -bench flag
      • testing: implement -benchtime flag
      • testing: print duration
      • testing: allow filtering of subtests using -run
    • targets
      • all: change LLVM features to match vanilla Clang
      • avr: use interrupt-based timer which is much more accurate
      • nrf: fix races in I2C
      • samd51: implement TRNG for randomness
      • stm32: pull-up on I2C lines
      • stm32: fix timeout for i2c comms
      • stm32f4, stm32f103: initial implementation for ADC
      • stm32f4, stm32f7, stm32l0x2, stm32l4, stm32l5, stm32wl: TRNG implementation in crypto/rand
      • stm32wl: add I2C support
      • windows: add support for the -size= flag
      • wasm: add support for tinygo test
      • wasi, wasm: raise default stack size to 16 KiB
    • boards
      • add M5Stack
      • add lorae5 (stm32wle) support
      • add Generic Node Sensor Edition
      • add STM32F469 Discovery
      • add M5Stamp C3
      • add Blues Wireless Swan
      • bluepill: add definitions for ADC pins
      • stm32f4disco: add definitions for ADC pins
      • stm32l552ze: use supported stlink interface
      • microbit-v2: add some pin definitions
    Source code(tar.gz)
    Source code(zip)
    tinygo0.22.0.darwin-amd64.tar.gz(92.38 MB)
    tinygo0.22.0.linux-amd64.tar.gz(105.45 MB)
    tinygo0.22.0.windows-amd64.zip(98.89 MB)
    tinygo_0.22.0_amd64.deb(105.58 MB)
  • v0.21.0(Nov 18, 2021)

    This release brings many small changes to the TinyGo compiler toolchain. Some of the highlights are: support for building Windows binaries in TinyGo, improved goroutine support on WebAssembly using Asyncify, and many small fixes that together get 12 more standard library packages to pass the package tests. Of course, there is also a number of improvements for microcontrollers such as ESP32-C3 and the RP2040. And lastly, we've added support for the M5Stack Core2 board.

    • command line
      • drop support for LLVM 10
      • build: drop support for LLVM targets in the -target flag
      • build: fix paths in error messages on Windows
      • build: add -p flag to set parallelism
      • lldb: implement tinygo lldb subcommand
      • test: use emulator exit code instead of parsing test output
      • test: pass testing arguments to wasmtime
    • compiler
      • use -opt flag for optimization level in CFlags (-Os, etc)
      • builder: improve accuracy of the -size=full flag
      • builder: hardcode some more frame sizes for _aeabi* functions
      • builder: add support for -size= flag for WebAssembly
      • cgo: fix line/column reporting in syntax error messages
      • cgo: support function definitions in CGo headers
      • cgo: implement rudimentary C array decaying
      • cgo: add support for stdio in picolibc and wasi-libc
      • cgo: run CGo parser per file, not per CGo fragment
      • compiler: fix unintentionally exported math functions
      • compiler: properly implement div and rem operations
      • compiler: add support for recursive function types
      • compiler: add support for the go keyword on interface methods
      • compiler: add minsize attribute for -Oz
      • compiler: add "target-cpu" and "target-features" attributes
      • compiler: fix indices into strings and arrays
      • compiler: fix string compare functions
      • interp: simplify some code to avoid some errors
      • interp: support recursive globals (like linked lists) in globals
      • interp: support constant globals
      • interp: fix reverting of extractvalue/insertvalue with multiple indices
      • transform: work around renamed return type after merging LLVM modules
    • standard library
      • internal/bytealg: fix indexing error in Compare()
      • machine: support Pin.Get() function when the pin is configured as output
      • net, syscall: Reduce code duplication by switching to internal/itoa.
      • os: don't try to read executable path on baremetal
      • os: implement Getwd
      • os: add File.WriteString and File.WriteAt
      • reflect: fix type.Size() to account for struct padding
      • reflect: don't construct an interface-in-interface value
      • reflect: implement Value.Elem() for interface values
      • reflect: fix Value.Index() in a specific case
      • reflect: add support for DeepEqual
      • runtime: add another set of invalid unicode runes to encodeUTF8()
      • runtime: only initialize os.runtime_args when needed
      • runtime: only use CRLF on baremetal systems for println
      • runtime/debug: stub debug.SetMaxStack
      • runtime/debug: stub debug.Stack
      • testing: add a stub for t.Parallel()
      • testing: add support for -test.short flag
      • testing: stub B.ReportAllocs()
      • testing: add testing.Verbose
      • testing: stub testing.AllocsPerRun
    • targets
      • fix gen-device-svd to handle 64-bit values
      • add CPU and Features property to all targets
      • match LLVM triple to the one Clang uses
      • atsam: simplify definition of SERCOM UART, I2C and SPI peripherals
      • atsam: move I2S0 to machine file
      • esp32: fix SPI configuration
      • esp32c3: add support for GDB debugging
      • esp32c3: add support for CPU interrupts
      • esp32c3: use tasks scheduler by default
      • fe310: increase CPU frequency from 16MHz to 320MHz
      • fe310: add support for bit banging drivers
      • linux: build static binaries using musl
      • linux: reduce binary size by calling write instead of putchar
      • linux: add support for GOARM
      • riscv: implement 32-bit atomic operations
      • riscv: align the heap to 16 bytes
      • riscv: switch to tasks-based scheduler
      • rp2040: add CPUFrequency()
      • rp2040: improve I2C baud rate configuration
      • rp2040: add pin interrupt API
      • rp2040: refactor PWM code and fix Period calculation
      • stm32f103: fix SPI
      • stm32f103: make SPI frequency selection more flexible
      • qemu: signal correct exit code to QEMU
      • wasi: run C/C++ constructors at startup
      • wasm: ensure heapptr is aligned
      • wasm: update wasi-libc dependency
      • wasm: wasi: use asyncify
      • wasm: support -scheduler=none
      • windows: add support for Windows (amd64 only for now)
    • boards
      • feather-stm32f405, feather-rp2040: add I2C pin names
      • m5stack-core2: add M5Stack Core2
      • nano-33-ble: SoftDevice s140v7 support
      • nano-33-ble: add constants for more on-board pins
    Source code(tar.gz)
    Source code(zip)
    tinygo0.21.0.darwin-amd64.tar.gz(70.18 MB)
    tinygo0.21.0.linux-amd64.tar.gz(75.16 MB)
    tinygo0.21.0.linux-arm.tar.gz(69.56 MB)
    tinygo0.21.0.windows-amd64.zip(72.85 MB)
    tinygo_0.21.0_amd64.deb(75.27 MB)
    tinygo_0.21.0_arm.deb(69.70 MB)
  • v0.20.0(Sep 21, 2021)

    This release adds support for Go 1.17, fixes a bunch of compiler bugs (especially for WebAssembly), and adds support for a few new boards including boards based on the ESP32-C3 chip.

    • command line
      • add support for Go 1.17
      • improve Go version detection
      • add support for the Black Magic Probe (BMP)
      • add a flag for creating cpu profiles
    • compiler
      • builder: list libraries at the end of the linker command
      • builder: strip debug information at link time instead of at compile time
      • builder: add missing error check for ioutil.TempFile()
      • builder: simplify running of jobs
      • compiler: move LLVM math builtin support into the compiler
      • compiler: move math aliases from the runtime to the compiler
      • compiler: add aliases for many hashing packages
      • compiler: add *ssa.MakeSlice bounds tests
      • compiler: fix max possible slice
      • compiler: add support for new language features of Go 1.17
      • compiler: fix equally named structs in different scopes
      • compiler: avoid zero-sized alloca in channel operations
      • interp: don't ignore array indices for untyped objects
      • interp: keep reverted package initializers in order
      • interp: fix bug in compiler-time/run-time package initializers
      • loader: fix panic in CGo files with syntax errors
      • transform: improve GC stack slot pass to work around a bug
    • standard library
      • crypto/rand: switch to arc4random_buf
      • math: fix math.Max and math.Min
      • math/big: fix undefined symbols error
      • net: add MAC address implementation
      • os: implement os.Executable
      • os: add SEEK_SET, SEEK_CUR, and SEEK_END
      • reflect: add StructField.IsExported method
      • runtime: reset heapptr to heapStart after preinit()
      • runtime: add subsections_via_symbols to assembly files on darwin
      • testing: add subset implementation of Benchmark
      • testing: test testing package using tinygo test
      • testing: add support for the -test.v flag
    • targets
      • 386: bump minimum requirement to the Pentium 4
      • arm: switch to Thumb instruction set on ARM
      • atsamd: fix copy-paste error for atsamd21/51 calibTrim block
      • baremetal,wasm: support command line params and environment variables
      • cortexm: fix stack overflow because of unaligned stacks
      • esp32c3: add support for the ESP32-C3 from Espressif
      • nrf52840: fix ram size
      • nxpmk66f18: fix a suspicious bitwise operation
      • rp2040: add SPI support
      • rp2040: add I2C support
      • rp2040: add PWM implementation
      • rp2040: add openocd configuration
      • stm32: add support for PortMask* functions for WS2812 support
      • unix: fix time base for time.Now()
      • unix: check for mmap error and act accordingly
      • wasm: override dlmalloc heap implementation from wasi-libc
      • wasm: align heap to 16 bytes
      • wasm: add support for the crypto/rand package
    • boards
      • add DefaultUART to adafruit boards
      • arduino-mkrwifi1010: add board definition for Arduino MKR WiFi 1010
      • arduino-mkrwifi1010: fix pin definition of NINA_RESETN
      • feather-nrf52: fix pin definition of uart
      • feather-rp2040: add pin name definition
      • gameboy-advance: fix ROM header
      • mdbt50qrx-uf2: add Raytac MDBT50Q-RX Dongle with TinyUF2
      • nano-rp2040: define NINA_SPI and fix wifinina pins
      • teensy40: enable hardware UART reconfiguration, fix receive watermark interrupt
    Source code(tar.gz)
    Source code(zip)
    tinygo0.20.0.darwin-amd64.tar.gz(63.64 MB)
    tinygo0.20.0.linux-amd64.tar.gz(69.70 MB)
    tinygo0.20.0.linux-arm.tar.gz(65.25 MB)
    tinygo0.20.0.windows-amd64.zip(68.87 MB)
    tinygo_0.20.0_amd64.deb(69.74 MB)
    tinygo_0.20.0_arm.deb(65.35 MB)
  • v0.19.0(Jul 1, 2021)

    This release contains a bunch of small changes such as improvements to serial output, various compiler improvements, and the addition of TinyGo versions of the net and crypto/rand packages. The net package isn't complete, it is a work in progress and will eventually allow for plugging in different network stacks.

    When it comes to board support, this release has one significant addition: the RP2040 chip developed by the Raspberry Pi foundation used on boards from some vendors. It also adds support for two new nRF52840-based boards.

    • command line
      • don't consider compile-only tests as failing
      • add -test flag for tinygo list
      • escape commands while printing them with the -x flag
      • make flash-command portable and safer to use
      • use extended-remote instead of remote in GDB
      • detect specific serial port IDs based on USB vid/pid
      • add a flag to the command line to select the serial implementation
    • compiler
      • cgo: improve constant parser
      • compiler: support chained interrupt handlers
      • compiler: add support for running a builtin in a goroutine
      • compiler: do not emit nil checks for loading closure variables
      • compiler: skip context parameter when starting regular goroutine
      • compiler: refactor method names
      • compiler: add function and global section pragmas
      • compiler: implement syscall.rawSyscallNoError in inline assembly
      • interp: ignore inline assembly in markExternal
      • interp: fix a bug in pointer cast workaround
      • loader: fix testing a main package
    • standard library
      • crypto/rand: replace this package with a TinyGo version
      • machine: make USBCDC global a pointer
      • machine: make UART objects pointer receivers
      • machine: define Serial as the default output
      • net: add initial support for net.IP
      • net: add more net compatibility
      • os: add stub for os.ReadDir
      • os: add FileMode constants from Go 1.16
      • os: add stubs required for net/http
      • os: implement process related functions
      • reflect: implement AppendSlice
      • reflect: add stubs required for net/http
      • runtime: make task.Data a 64-bit integer to avoid overflow
      • runtime: expose memory stats
      • sync: implement NewCond
      • syscall: fix int type in libc version
    • targets
      • cortexm: do not disable interrupts on abort
      • cortexm: bump default stack size to 2048 bytes
      • nrf: avoid heap allocation in waitForEvent
      • nrf: don't trigger a heap allocation in SPI.Transfer
      • nrf52840: add support for flashing with the BOSSA tool
      • rp2040: add support for GPIO input
      • rp2040: add basic support for ADC
      • rp2040: gpio and adc pin definitions
      • rp2040: implement UART
      • rp2040: patch elf to checksum 2nd stage boot
      • stm32: add PWM for most chips
      • stm32: add support for pin interrupts
      • stm32f103: add support for PinInputPullup / PinInputPulldown
      • wasi: remove wasm build tag
    • boards
      • feather-rp2040: add support for this board
      • feather-nrf52840-sense: add board definition for this board
      • pca10059: support flashing from Windows
      • nano-rp2040: add this board
      • nano-33-ble: add support for this board
      • pico: add the Raspberry Pi Pico board with the new RP2040 chip
      • qtpy: add pin for neopixels
      • all: add definition for ws2812 for supported boards
    Source code(tar.gz)
    Source code(zip)
    tinygo0.19.0.darwin-amd64.tar.gz(63.24 MB)
    tinygo0.19.0.linux-amd64.tar.gz(70.40 MB)
    tinygo0.19.0.linux-arm.tar.gz(65.07 MB)
    tinygo0.19.0.windows-amd64.zip(68.46 MB)
    tinygo_0.19.0_amd64.deb(70.43 MB)
    tinygo_0.19.0_arm.deb(65.16 MB)
  • v0.18.0(May 12, 2021)

    This release is the combination of more than two months of work, including improvements to reflection, a big change to the PWM API to make it more powerful (including support for servos!), support for command line parameters and environment variables, many improvements to SAM and STM32 chip support. It also saw the addition of various new boards.

    Note that this release drops support for Go 1.11 and Go 1.12, so if you're using one of those versions please upgrade to Go 1.13 or later.

    • command line
      • drop support for Go 1.11 and 1.12
      • throw an error when no target is specified on Windows
      • improve error messages in getDefaultPort(), support for multiple ports
      • remove -cflags and -ldflags flags
      • implement -ldflags="-X ..."
      • add -print-allocs flag that lets you print all heap allocations
      • openocd commands in tinygo command line
      • add -llvm-features parameter
      • match go test output
      • discover USB ports only, this will ignore f.ex. bluetooth
      • use physicmal path instead of cached GOROOT in function getGoroot
      • add goroot for snap installs
    • compiler
      • builder: add support for -opt=0
      • builder, compiler: compile and cache packages in parallel
      • builder: run interp per package
      • builder: cache C and assembly file outputs
      • builder: add support for -x flag to print commands
      • builder: add optsize attribute while building the package
      • builder: run function passes per package
      • builder: hard code Clang compiler
      • compiler: do not use llvm.GlobalContext()
      • compiler: remove SimpleDCE pass
      • compiler: do not emit nil checks for *ssa.Alloc instructions
      • compiler: merge runtime.typecodeID and runtime.typeInInterface
      • compiler: do not check for impossible type asserts
      • compiler: fix use of global context: llvm.Int32Type()
      • compiler: add interface IR test
      • compiler: fix lack of method name in interface matching
      • compiler: fix "fragment covers entire variable" bug
      • compiler: optimize string literals and globals
      • compiler: decouple func lowering from interface type codes
      • compiler: add function attributes to some runtime calls
      • compiler: improve position information in error messages
      • cgo: add support for CFLAGS in .c files
      • interp: support GEP on fixed (MMIO) addresses
      • interp: handle (reflect.Type).Elem()
      • interp: add support for runtime.interfaceMethod
      • interp: make toLLVMValue return an error instead of panicking
      • interp: add support for switch statement
      • interp: fix phi instruction
      • interp: remove map support
      • interp: support extractvalue/insertvalue with multiple operands
      • transform: optimize string comparisons against ""
      • transform: optimize reflect.Type Implements() method
      • transform: fix bug in interface lowering when signatures are renamed
      • transform: don't rely on struct name of runtime.typecodeID
      • transform: use IPSCCP pass instead of the constant propagation pass
      • transform: fix func lowering assertion failure
      • transform: do not lower zero-sized alloc to alloca
      • transform: split interface and reflect lowering
    • standard library
      • runtime: add dummy debug package
      • machine: fix data shift/mask in newUSBSetup
      • machine: make machine.I2C0 and similar objects pointers
      • machine: unify usbcdc code
      • machine: refactor PWM support
      • machine: avoid heap allocations in USB code
      • reflect: let reflect.Type be of interface type
      • reflect: implement a number of stub functions
      • reflect: check for access in the Interface method call
      • reflect: fix AssignableTo and Implements methods
      • reflect: implement Value.CanAddr
      • reflect: implement Sizeof and Alignof for func values
      • reflect: implement New function
      • runtime: implement command line arguments in hosted environments
      • runtime: implement environment variables for Linux
      • runtime: improve timers on nrf, and samd chips
    • targets
      • all: use -Qunused-arguments only for assembly files
      • atmega1280: add PWM support
      • attiny: remove dummy UART
      • atsamd21: improve SPI
      • atsamd51: fix PWM support in atsamd51p20
      • atsamd5x: improve SPI
      • atsamd51, atsame5x: unify samd51 and same5x
      • atsamd51, atsamd21: fix ADC.Get() value at 8bit and 10bit
      • atsame5x: add support for CAN
      • avr: remove I2C stubs from attiny support
      • cortexm: check for arm-none-eabi-gdb and gdb-multiarch commands
      • cortexm: add __isr_vector symbol
      • cortexm: disable FPU on Cortex-M4
      • cortexm: clean up Cortex-M target files
      • fe310: fix SPI read
      • gameboy-advance: Fix RGBA color interpretation
      • nrf52833: add PWM support
      • stm32l0: use unified UART logic
      • stm32: move f103 (bluepill) to common i2c code
      • stm32: separate altfunc selection for UART Tx/Rx
      • stm32: i2c implementation for F7, L5 and L4 MCUs
      • stm32: make SPI CLK fast to fix data issue
      • stm32: support SPI on L4 series
      • unix: avoid possible heap allocation with -opt=0
      • unix: use conservative GC by default
      • unix: use the tasks scheduler instead of coroutines
      • wasi: upgrade WASI version to wasi_snapshot_preview1
      • wasi: darwin: support basic file io based on libc
      • wasm: only export explicitly exported functions
      • wasm: use WASI ABI for exit function
      • wasm: scan globals conservatively
    • boards
      • arduino-mega1280: add support for the Arduino Mega 1280
      • arduino-nano-new: Add Arduino Nano w/ New Bootloader target
      • atsame54-xpro: add initial support this board
      • feather-m4-can: add initial support for this board
      • grandcentral-m4: add board support for Adafruit Grand Central M4 (SAMD51)
      • lgt92: update to new UART structure
      • microbit: remove LED constant
      • microbit-v2: add support for S113 SoftDevice
      • nucleol432: add support for this board
      • nucleo-l031k6: add this board
      • pca10059: initial support for this board
      • qtpy: fix msd-volume-name
      • qtpy: fix i2c setting
      • teensy40: move txBuffer allocation to UART declaration
      • teensy40: add UART0 as alias for UART1
    Source code(tar.gz)
    Source code(zip)
    tinygo0.18.0.darwin-amd64.tar.gz(65.68 MB)
    tinygo0.18.0.linux-amd64.tar.gz(74.22 MB)
    tinygo0.18.0.linux-arm.tar.gz(67.35 MB)
    tinygo0.18.0.windows-amd64.zip(71.85 MB)
    tinygo_0.18.0_amd64.deb(74.23 MB)
    tinygo_0.18.0_arm.deb(67.46 MB)
  • v0.17.0(Mar 6, 2021)

    This is a large release of almost 3 months of work, with several improvements to the compiler, tinygo gdb, many improvements to the machine package and finally the addition of several new boards. We've also updated TinyGo with support for LLVM 11 and Go 1.16.

    • command line
      • switch to LLVM 11 for static builds
      • support gdb debugging with AVR
      • add support for additional openocd commands
      • add -x flag to print commands
      • use LLVM 11 by default when linking LLVM dynamically
      • update go-llvm to use LLVM 11 on macOS
      • bump go.bug.st/serial to version 1.1.2
      • do not build LLVM with libxml to work around a bugo on macOS
      • add support for Go 1.16
      • support gdb daemonization on Windows
      • remove support for LLVM 9, to fix CI
      • kill OpenOCD if it does not exit with a regular quit signal
      • support -ocd-output on Windows
    • compiler
      • builder: parallelize most of the build
      • builder: remove unused cacheKey parameter
      • builder: add -mcpu flag while building libraries
      • builder: wait for running jobs to finish
      • cgo: add support for variadic functions
      • compiler: fix undefined behavior in wordpack
      • compiler: fix incorrect "exported function" panic
      • compiler: fix non-int integer constants (fixing a crash)
      • compiler: refactor and add tests
      • compiler: emit a nil check when slicing an array pointer
      • compiler: saturate float-to-int conversions
      • compiler: test float to int conversions and fix upper-bound calculation
      • compiler: support all kinds of deferred builtins
      • compiler: remove ir package
      • compiler: remove unnecessary main.main call workaround
      • compiler: move the setting of attributes to getFunction
      • compiler: create runtime types lazily when needed
      • compiler: move settings to a separate Config struct
      • compiler: work around an ARM backend bug in LLVM
      • interp: rewrite entire package
      • interp: fix alignment of untyped globals
      • loader: use name "main" for the main package
      • loader: support imports from vendor directories
      • stacksize: add support for DW_CFA_offset_extended
      • transform: show better error message in coroutines lowering
    • standard library
      • machine: accept configuration struct for ADC parameters
      • machine: make I2C.Configure signature consistent
      • reflect: implement PtrTo
      • runtime: refactor to simplify stack switching
      • runtime: put metadata at the top end of the heap
    • targets
      • atsam: add a length check to findPinPadMapping
      • atsam: improve USBCDC
      • atsam: avoid infinite loop when USBCDC is disconnected
      • avr: add SPI support for Atmega based chips
      • avr: use Clang for compiling C and assembly files
      • esp32: implement task based scheduler
      • esp32: enable the FPU
      • esp8266: implement task based scheduler
      • esp: add compiler-rt library
      • esp: add picolibc
      • nrf: refactor code a bit to reduce duplication
      • nrf: use SPIM peripheral instead of the legacy SPI peripheral
      • nrf: update nrfx submodule to latest commit
      • nrf52840: ensure that USB CDC interface is only initialized once
      • nrf52840: improve USBCDC
      • stm32: use stm32-rs SVDs which are of much higher quality
      • stm32: harmonization of UART logic
      • stm32: replace I2C addressable interface with simpler type
      • stm32: fix i2c and add stm32f407 i2c
      • stm32: revert change that adds support for channels in interrupts
      • wasm: implement a growable heap
      • wasm: fix typo in wasm_exec.js, syscall/js.valueLoadString()
      • wasm: Namespaced Wasm Imports so they don't conflict across modules, or reserved LLVM IR
      • wasi: support env variables based on libc
      • wasi: specify wasi-libc in a different way, to improve error message
    • boards
      • matrixportal-m4: add support for board Adafruit Matrix Portal M4
      • mkr1000: add this board
      • nucleo-f722ze: add this board
      • clue: correct volume name and add alias for release version of Adafruit Clue board
      • p1am-100: add support for the P1AM-100 (similar to Arduino MKR)
      • microbit-v2: add initial support based on work done by @alankrantas thank you!
      • lgt92: support for STM32L0 MCUs and Dragino LGT92 device
      • nicenano: nice!nano board support
      • circuitplay-bluefruit: correct internal I2C pin mapping
      • clue: correct for lack of low frequency crystal
      • digispark: split off attiny85 target
      • nucleo-l552ze: implementation with CLOCK, LED, and UART
      • nrf52840-mdk-usb-dongle: add this board
    Source code(tar.gz)
    Source code(zip)
    tinygo0.17.0.darwin-amd64.tar.gz(63.19 MB)
    tinygo0.17.0.linux-amd64.tar.gz(71.69 MB)
    tinygo0.17.0.linux-arm.tar.gz(64.76 MB)
    tinygo0.17.0.windows-amd64.zip(69.30 MB)
    tinygo_0.17.0_amd64.deb(71.71 MB)
    tinygo_0.17.0_arm.deb(64.87 MB)
  • v0.16.0(Nov 18, 2020)

    This is the next release of TinyGo, this time featuring the addition of the Teensy 4.0 and the addition of initial WASI support, apart from numerous fixes and improvements (such as improved tinygo test support). See the full changelog below.

    • command-line
      • add initial support for LLVM 11
      • make lib64 clang include path check more robust
      • build: improve support for GOARCH=386 and add tests
      • gdb: add support for qemu-user targets
      • test: support non-host tests
      • test: add support for -c and -o flags
      • test: implement some benchmark stubs
    • compiler
      • builder: improve detection of clang on Fedora
      • compiler: fix floating point comparison bugs
      • compiler: implement negate for complex numbers
      • loader: fix linkname in test binaries
      • transform: add missing return pointer restore for regular coroutine tail calls
    • standard library
      • machine: switch default frequency to 4MHz
      • machine: clarify caller's responsibility in SetInterrupt
      • os: add LookupEnv() stub
      • reflect: implement Swapper
      • runtime: fix UTF-8 decoding
      • runtime: gc: use raw stack access whenever possible
      • runtime: use dedicated printfloat32
      • runtime: allow ranging over a nil map
      • runtime: avoid device/nxp dependency in HardFault handler
      • testing: implement dummy Helper method
      • testing: add Run method
    • targets
      • arm64: add support for SVCall intrinsic
      • atsamd51: avoid panic when configuring SPI with SDI=NoPin
      • avr: properly support the .rodata section
      • esp8266: implement Pin.Get function
      • nintendoswitch: fix crash when printing long lines (> 120)
      • nintendoswitch: add env parser and removed unused stuff
      • nrf: add I2C error checking
      • nrf: give more flexibility in picking SPI speeds
      • nrf: fix nrf52832 flash size
      • stm32f103: support wakeups from interrupts
      • stm32f405: add SPI support
      • stm32f405: add I2C support
      • wasi: add support for this target
      • wasi: use 'generic' ABI by default
      • wasi: remove --no-threads flag from wasm-ld
      • wasm: add instanceof support for WebAssembly
      • wasm: use fixed length buffer for putchar
    • boards
      • d1mini: add this ESP8266 based board
      • esp32: use board definitions instead of chip names
      • qtpy: add board definition for Adafruit QTPy
      • teensy40: add this board
    Source code(tar.gz)
    Source code(zip)
    tinygo0.16.0.darwin-amd64.tar.gz(64.87 MB)
    tinygo0.16.0.linux-amd64.tar.gz(75.71 MB)
    tinygo0.16.0.linux-arm.tar.gz(65.13 MB)
    tinygo0.16.0.windows-amd64.zip(69.73 MB)
    tinygo_0.16.0_amd64.deb(75.80 MB)
    tinygo_0.16.0_arm.deb(65.23 MB)
  • v0.15.0(Sep 17, 2020)

    This is a very major release that adds some long-awaited capabilities to TinyGo, like support for Bluetooth Low Energy via the Nordic Semiconductor nRF51/nRF52. and also support for the Espressif ESP32/ESP8266.

    • command-line
      • add cached GOROOT to info subcommand
      • embed git-hash in tinygo-dev executable
      • implement tinygo targets to list usable targets
      • use simpler file copy instead of file renaming to avoid issues on nrf52840 UF2 bootloaders
      • use ToSlash() to specify program path
      • support flashing esp32/esp8266 directly from tinygo
      • when flashing call PortReset only on other than openocd
    • compiler
      • compileopts: add support for custom binary formats
      • compiler: improve display of goroutine wrappers
      • interp: don't panic in the Store method
      • interp: replace some panics with error messages
      • interp: show error line in first line of the traceback
      • loader: be more robust when creating the cached GOROOT
      • loader: rewrite/refactor much of the code to use go list directly
      • loader: use ioutil.TempDir to create a temporary directory
      • stacksize: deal with DW_CFA_advance_loc1
    • standard library
      • runtime: use waitForEvents when appropriate
    • wasm
      • wasm: Remove --no-threads from wasm-ld calls.
      • wasm: update wasi-libc dependency
    • targets
      • arduino-mega2560: fix flashing on Windows
      • arm: automatically determine stack sizes
      • arm64: make dynamic loader structs and constants private
      • avr: configure emulator in board files
      • cortexm: fix stack size calculation with interrupts
      • flash: add openocd settings to atsamd21 / atsamd51
      • flash: add openocd settings to nrf5
      • microbit: reelboard: flash using OpenOCD when needed
      • nintendoswitch: Add dynamic loader for runtime loading PIE sections
      • nintendoswitch: fix import cycle on dynamic_arm64.go
      • nintendoswitch: Fix invalid memory read / write in print calls
      • nintendoswitch: simplified assembly code
      • nintendoswitch: support outputting .nro files directly
    • boards
      • arduino-zero: Adding support for the Arduino Zero (#1365)
      • atsamd2x: fix BAUD value
      • atsamd5x: fix BAUD value
      • bluepill: Enable stm32's USART2 for the board and map it to UART1 tinygo's device
      • device/atsamd51x: add all remaining bitfield values for PCHCTRLm Mapping
      • esp32: add libgcc ROM functions to linker script
      • esp32: add SPI support
      • esp32: add support for basic GPIO
      • esp32: add support for the Espressif ESP32 chip
      • esp32: configure the I/O matrix for GPIO pins
      • esp32: export machine.PortMask* for bitbanging implementations
      • esp8266: add support for this chip
      • machine/atsamd51x,runtime/atsamd51x: fixes needed for full support for all PWM pins. Also adds some useful constants to clarify peripheral clock usage
      • machine/itsybitsy-nrf52840: add support for Adafruit Itsybitsy nrf52840 (#1243)
      • machine/stm32f4: refactor common code and add new build tag stm32f4 (#1332)
      • nrf: add SoftDevice support for the Circuit Playground Bluefruit
      • nrf: call sd_app_evt_wait when the SoftDevice is enabled
      • nrf52840: add build tags for SoftDevice support
      • nrf52840: use higher priority for USB-CDC code
      • runtime/atsamd51x: use PCHCTRL_GCLK_SERCOMX_SLOW for setting clocks on all SERCOM ports
      • stm32f405: add basic UART handler
      • stm32f405: add STM32F405 machine/runtime, and new board/target feather-stm32f405
    • build
      • all: run test binaries in the correct directory
      • build: Fix arch release job
      • ci: run tinygo test for known-working packages
      • ci: set git-fetch-depth to 1
      • docker: fix the problem with the wasm build (#1357)
      • Makefile: check whether submodules have been downloaded in some common cases
    • docs
      • add ESP32, ESP8266, and Adafruit Feather STM32F405 to list of supported boards
    Source code(tar.gz)
    Source code(zip)
    tinygo0.15.0.darwin-amd64.tar.gz(64.81 MB)
    tinygo0.15.0.linux-amd64.tar.gz(75.65 MB)
    tinygo0.15.0.linux-arm.tar.gz(65.08 MB)
    tinygo0.15.0.windows-amd64.zip(69.66 MB)
    tinygo_0.15.0_amd64.deb(75.73 MB)
    tinygo_0.15.0_arm.deb(65.16 MB)
  • v0.14.1(Aug 19, 2020)

  • v0.14.0(Aug 4, 2020)

    This is a big release with lots of small improvements. Some of the highlights include Go module support and the support for channel operations in interrupts for a few chips. This release also includes support for a number of new boards: the Adafruit Feather nRF52840 Express, the Adafruit PyGamer, the Sipeed MAix BiT with a 64-bit RISC-V MCU, the Teensy 3.6, the Seed WioTerminal, and the Seeed Xiao. Perhaps more interesting, it includes initial support for the Nintendo Switch.

    • command-line
      • fix getDefaultPort() on non-English Windows locales
      • compileopts: improve error reporting of unsupported flags
      • fix test subcommand
      • use auto-retry to locate MSD for UF2 and HEX flashing
      • fix touchSerialPortAt1200bps on Windows
      • support package names with backslashes on Windows
    • compiler
      • fix a few crashes due to named types
      • add support for atomic operations
      • move the channel blocked list onto the stack
      • fix -gc=none
      • fix named string to []byte slice conversion
      • implement func value and builtin defers
      • add proper parameter names to runtime.initAll, to fix a panic
      • builder: fix picolibc include path
      • builder: use newer version of gohex
      • builder: try to determine stack size information at compile time
      • builder: remove -opt=0
      • interp: fix sync/atomic.Value load/store methods
      • loader: add Go module support
      • transform: fix debug information in func lowering pass
      • transform: do not special-case zero or one implementations of a method call
      • transform: introduce check for method calls on nil interfaces
      • transform: gc: track 0-index GEPs to fix miscompilation
    • cgo
      • Add LDFlags support
    • standard library
      • extend stdlib to allow import of more packages
      • replace master/slave terminology with appropriate alternatives (MOSI->SDO etc)
      • internal/bytealg: reimplement bytealg in pure Go
      • internal/task: fix nil panic in (*internal/task.Stack).Pop
      • os: add Args and stub it with mock data
      • os: implement virtual filesystem support
      • reflect: add Cap and Len support for map and chan
      • runtime: fix return address in scheduler on RISC-V
      • runtime: avoid recursion in printuint64 function
      • runtime: replace ReadRegister with AsmFull inline assembly
      • runtime: fix compilation errors when using gc.extalloc
      • runtime: add cap and len support for chans
      • runtime: refactor time handling (improving accuracy)
      • runtime: make channels work in interrupts
      • runtime/interrupt: add cross-chip disable/restore interrupt support
      • sync: implement sync.Cond
      • sync: add WaitGroup
    • targets
      • arm: allow nesting in DisableInterrupts and EnableInterrupts
      • arm: make FPU configuraton consistent
      • arm: do not mask fault handlers in critical sections
      • atmega2560: fix pin mapping for pins D2, D5 and the L port
      • atsamd: return an error when an incorrect PWM pin is used
      • atsamd: add support for pin change interrupts
      • atsamd: add DAC support
      • atsamd21: add more ADC pins
      • atsamd51: fix ROM / RAM size on atsamd51j20
      • atsamd51: add more pins
      • atsamd51: add more ADC pins
      • atsamd51: add pin change interrupt settings
      • atsamd51: extend pinPadMapping
      • arduino-nano33: use (U)SB flag to ensure that device can be found when not on default port
      • arduino-nano33: remove (d)ebug flag to reduce console noise when flashing
      • avr: use standard pin numbering
      • avr: unify GPIO pin/port code
      • avr: add support for PinInputPullup
      • avr: work around codegen bug in LLVM 10
      • avr: fix target triple
      • fe310: remove extra println left in by mistake
      • feather-nrf52840: add support for the Feather nRF52840
      • maixbit: add board definition and dummy runtime
      • nintendoswitch: Add experimental Nintendo Switch support without CRT
      • nrf: expose the RAM base address
      • nrf: add support for pin change interrupts
      • nrf: add microbit-s110v8 target
      • nrf: fix bug in SPI.Tx
      • nrf: support debugging the PCA10056
      • pygamer: add Adafruit PyGamer suport
      • riscv: fix interrupt configuration bug
      • riscv: disable linker relaxations during gp init
      • stm32f4disco: add new target with ST-Link v2.1 debugger
      • teensy36: add Teensy 3.6 support
      • wasm: fix event handling
      • wasm: add --no-demangle linker option
      • wioterminal: add support for the Seeed Wio Terminal
      • xiao: add support for the Seeed XIAO
    Source code(tar.gz)
    Source code(zip)
    tinygo0.14.0.darwin-amd64.tar.gz(62.19 MB)
    tinygo0.14.0.linux-amd64.tar.gz(72.93 MB)
    tinygo0.14.0.linux-arm.tar.gz(84.92 MB)
    tinygo0.14.0.windows-amd64.zip(67.95 MB)
    tinygo_0.14.0_amd64.deb(73.03 MB)
    tinygo_0.14.0_arm.deb(144.59 MB)
  • v0.13.1(Apr 26, 2020)

    This is a patch release that fixes a few bugs in the previous 0.13.0 release related to the GC and in support for the GameBoy Advance.

    • standard library
      • runtime: do not put scheduler and GC code in the same section
      • runtime: copy stack scan assembly for GBA
    • boards
      • gameboy-advance: always use ARM mode instead of Thumb mode
    Source code(tar.gz)
    Source code(zip)
    tinygo0.13.1.darwin-amd64.tar.gz(58.92 MB)
    tinygo0.13.1.linux-amd64.tar.gz(69.69 MB)
    tinygo0.13.1.linux-arm.tar.gz(59.16 MB)
    tinygo0.13.1.windows-amd64.zip(64.67 MB)
    tinygo_0.13.1_amd64.deb(69.60 MB)
    tinygo_0.13.1_armhf.deb(59.07 MB)
  • v0.13.0(Apr 14, 2020)

    This new release adds support for Go 1.14 and LLVM 10. It fixes a number of compiler and runtime bugs and also has had some significant refactoring in goroutine support. Perhaps most visible is that USB-CDC now works on all major OSes (Windows, macOS, and Linux) so that you can flash Adafruit boards without manually entering the bootloader.

    This release adds support for five new boards: the Adafruit CLUE, Arduino Mega 2560, and the Particle Argon, Boron and Xenon.

    Note that this release requires Go 1.14 to support WebAssembly.

    Here is a detailed list of changes with this release:

    • command line
      • use gdb-multiarch for debugging Cortex-M chips
      • support tinygo run with simavr
      • support LLVM 10
      • support Go 1.14
      • retry 3 times when attempting to do a 1200-baud reset
    • compiler
      • mark the abort function as noreturn
      • fix deferred calls to exported functions
      • add debug info for local variables
      • check for channel size limit
      • refactor coroutine lowering
      • add dereferenceable_or_null attribute to pointer parameters
      • do not perform nil checking when indexing slices and on unsafe.Pointer
      • remove runtime.isnil hack
      • use LLVM builtins for runtime memcpy/memmove/memzero functions
      • implement spec-compliant shifts on negative/overflow
      • support anonymous type asserts
      • track pointer result of string concatenation for GC
      • track PHI nodes for GC
      • add debug info to goroutine start wrappers
      • optimize comparing interface values against nil
      • fix miscompilation when deferring an interface call
      • builder: include picolibc for most baremetal targets
      • builder: run tools (clang, lld) as separate processes
      • builder: use -fshort-enums consistently
      • interp: add support for constant type asserts
      • interp: better support for interface operations
      • interp: include backtrace with error
      • transform: do not track const globals for GC
      • transform: replace panics with source locations
      • transform: fix error in interface lowering pass
      • transform: make coroutine lowering deterministic
      • transform: fix miscompilation in func lowering
    • cgo
      • make -I and -L paths absolute
    • standard library
      • machine: set the USB VID and PID to the manufacturer values
      • machine: correct USB CDC composite descriptors
      • machine: move errors.New calls to globals
      • runtime: support operations on nil maps
      • runtime: fix copy builtin return value on AVR
      • runtime: refactor goroutines
      • runtime: support -scheduler=none on most platforms
      • runtime: run package initialization in the main goroutine
      • runtime: export malloc / free for use from C
      • runtime: add garbage collector that uses an external allocator
      • runtime: scan callee-saved registers while marking the stack
      • runtime: remove recursion from conservative GC
      • runtime: fix blocking select on nil channel
      • runtime/volatile: include ReplaceBits method
      • sync: implement trivial sync.Map
    • targets
      • arm: use -fomit-frame-pointer
      • atmega1284: support this chip for testing purposes
      • atsamd51: make QSPI available on all boards
      • atsamd51: add support for ADC1
      • atsamd51: use new interrupt registration in UART code
      • attiny: clean up pin definitions
      • avr: use the correct RAM start address
      • avr: pass the correct -mmcu flag to the linker
      • avr: add support for tasks scheduler (disabled by default)
      • avr: fix linker problem with overlapping program/data areas
      • nrf: fix typo in pin configuration options
      • nrf: add lib/nrfx/mdk to include dirs
      • nrf52840: implement USB-CDC
      • riscv: implement VirtIO target and add RISC-V integration test
      • riscv: add I2C support for the HiFive1 rev B board
      • stm32: refactor GPIO pin handling
      • stm32: refactor UART code
      • stm32f4: add SPI
      • wasm: support Go 1.14 (breaking previous versions)
      • wasm: support syscall/js.CopyBytesToJS
      • wasm: sync polyfills from Go 1.14.
    • boards
      • arduino-mega2560: add the Arduino Mega 2560
      • clue-alpha: add the Adafruit CLUE Alpha
      • gameboy-advance: enable debugging with GDB
      • particle-argon: add the Particle Argon board
      • particle-boron: add the Particle Boron board
      • particle-xenon: add the Particle Xenon board
      • reelboard: add reelboard-s140v7 SoftDevice target
    Source code(tar.gz)
    Source code(zip)
    tinygo0.13.0.darwin-amd64.tar.gz(58.92 MB)
    tinygo0.13.0.linux-amd64.tar.gz(69.69 MB)
    tinygo0.13.0.windows-amd64.zip(64.67 MB)
    tinygo_0.13.0_amd64.deb(69.60 MB)
  • v0.12.0(Jan 31, 2020)

    This release incorporates a ton of smaller changes over more than a month. Notable changes are the addition of 3 new boards (Adafruit PyPortal, Adafruit Circuit Playground Bluefruit, Arduino Nano), improved support for interrupts, improved CGo support, and a number of improvements for the atsamd51 chip (for "M4" branded boards). Take a look below for a more detailed list of changes.

    • command line
      • add initial FreeBSD support
      • remove getting a serial port in gdb subcommand
      • add support for debugging through JLinkGDBServer
      • fix CGo when cross compiling
      • remove default port check for Digispark as micronucleus communicates directly using HID
      • differentiate between various serial/USB error messages
    • builder
      • improve detection of Clang headers
    • compiler
      • fix assertion on empty interface
      • don't crash when encountering types.Invalid
      • revise defer to use heap allocations when running a variable number of times
      • improve error messages for failed imports
      • improve "function redeclared" error
      • add globaldce pass to start of optimization pipeline
      • add support for debugging globals
      • implement RISC-V CSR operations as intrinsics
      • add support for CGO_ENABLED environment variable
      • do not emit debug info for extern globals (bugfix)
      • add support for interrupts
      • implement maps for arbitrary keys
      • interp: error location for "unknown GEP" error
      • wasm-abi: create temporary allocas in the entry block
    • cgo
      • add support for symbols in #define
      • fix a bug in number tokenization
    • standard library
      • machine: avoid bytes package in USB logic
      • runtime: fix external address declarations
      • runtime: provide implementation for internal/bytealg.IndexByte
    • targets
      • atsamd51: fix volatile usage
      • atsamd51: fix ADC, updating to 12-bits precision
      • atsamd51: refactor SPI pin configuration to only look at pin numbers
      • atsamd51: switch UART to use new pin configuration
      • atsamd51: fix obvious bug in I2C code
      • atsamd51: use only the necessary UART interrupts
      • atsamd51: refactor I2C pin handling to auto-detect pin mode
      • avr: use a garbage collector
      • fe310: use CLINT peripheral for timekeeping
      • fe310: add support for PLIC interrupts
      • fe310: implement UART receive interrupts
      • riscv: support sleeping in QEMU
      • riscv: add bare-bones interrupt support
      • riscv: print exception PC and code
      • wasm: implement memcpy and memset
      • wasm: include wasi-libc
      • wasm: use wasi ABI for basic startup/stdout
    • boards
      • arduino: make avrdude command line compatible with Windows
      • arduino-nano: add this board
      • arduino-nano33: fix UART1 and UART2
      • circuitplay-bluefruit: add this board
      • digispark: add clock speed and pin mappings
      • gameboy-advance: include compiler-rt in build
      • gameboy-advance: implement interrupt handler
      • hifive1b: add support for gdb subcommand
      • pyportal: add this board
      • pyportal: remove manual SPI pin mapping as now handled by default
    Source code(tar.gz)
    Source code(zip)
    tinygo0.12.0.darwin-amd64.tar.gz(54.54 MB)
    tinygo0.12.0.linux-amd64.tar.gz(64.28 MB)
    tinygo0.12.0.linux-arm.tar.gz(54.74 MB)
    tinygo0.12.0.windows-amd64.zip(59.96 MB)
    tinygo_0.12.0_amd64.deb(64.18 MB)
    tinygo_0.12.0_armhf.deb(54.66 MB)
  • v0.11.0(Dec 23, 2019)

    This release includes a few significant usability improvements: it bundles Clang in the release tarball, auto-detects the serial port on macOS, and adds support for tinygo flash on Windows. There are also other changes, such as the addition of the Adafruit PyBadge and a critical fix to RISC-V support.

    • command line
      • add support for QEMU in gdb subcommand
      • use builtin Clang when building statically, dropping the clang-9 dependency
      • search for default serial port on both macOS and Linux
      • windows: support tinygo flash directly by using win32 wmi
    • compiler
      • add location information to the IR checker
      • make reflection sidetables constant globals
      • improve error locations in goroutine lowering
      • interp: improve support for maps with string keys
      • interp: add runtime fallback for mapassign operations
    • standard library
      • machine: add support for SPI.Tx() on play.tinygo.org
      • machine: rename CPU_FREQUENCY to CPUFrequency()
    • targets
      • adafruit-pybadge: add Adafruit Pybadge
      • arduino-nano33: allow simulation on play.tinygo.org
      • arduino-nano33: fix default SPI pin numbers to be D13/D11/D12
      • circuitplay-express: allow simulation on play.tinygo.org
      • hifive1-qemu: add target for testing RISC-V bare metal in QEMU
      • riscv: fix heap corruption due to changes in LLVM 9
      • riscv: add support for compiler-rt
      • qemu: rename to cortex-m-qemu
    Source code(tar.gz)
    Source code(zip)
    tinygo0.11.0.darwin-amd64.tar.gz(53.88 MB)
    tinygo0.11.0.linux-amd64.tar.gz(63.58 MB)
    tinygo0.11.0.linux-arm.tar.gz(54.05 MB)
    tinygo0.11.0.windows-amd64.zip(59.43 MB)
    tinygo_0.11.0_amd64.deb(63.50 MB)
    tinygo_0.11.0_armhf.deb(53.98 MB)
  • v0.10.0(Nov 26, 2019)

    This release adds support for blocking select, switches to LLVM 9, improves CGo support, improves support for the ATSAMD51 ("M4") chip, and generally has a lot of improvements and bug fixes throughout. It also adds support for a number of new boards: the Adafruit Feather M4, the Adafruit Metro M4 Express AirLift, the PineTime dev kit, and the "X9 Pro" smartwatch.

    • command line
      • halt GDB after flashing with gdb subcommand
      • fix a crash when using -ocd-output
      • add info subcommand
      • add -programmer flag
    • builder
      • macos: use llvm@8 instead of just llvm in paths
      • add linkerscript key to target JSON files
      • write a symbol table when writing out the compiler-rt lib
      • make Clang header detection more robust
      • switch to LLVM 9
    • compiler
      • fix interface miscompilation with reflect
      • fix miscompile of static goroutine calls to closures
      • fix todo: store panic
      • fix incorrect starting value for optimized allocations in a loop
      • optimize coroutines on non-Cortex-M targets
      • fix crash for programs which have heap allocations but never hit the GC
      • add support for async interface calls
      • fix inserting non-const values in a const global
      • interp: improve error reporting
      • interp: implement comparing ptrtoint to 0
    • cgo
      • improve diagnostics
      • implement the constant parser (for #define) as a real parser
      • rename reserved field names such as type
      • avoid "unsafe" imported but not used error
      • include all enums in the CGo Go AST
      • add support for nested structs and unions
      • implement #cgo CFLAGS
    • standard library
      • reflect: add implementation of array alignment
      • runtime: improve scheduler performance when no goroutines are queued
      • runtime: add blocking select
      • runtime: implement interface equality in non-trivial cases
      • runtime: add AdjustTimeOffset to update current time
      • runtime: only implement CountString for required platforms
      • runtime: use MSP/PSP registers for scheduling on Cortex-M
    • targets
      • arm: add system timer registers
      • atmega: add port C GPIO support
      • atsamd21: correct handling of pins >= 32
      • atsamd21: i2s initialization fixes
      • atsamd51: fix clock init code
      • atsamd51: correct initialization for RTC
      • atsamd51: fix pin function selection
      • atsamd51: pin method cleanup
      • atsamd51: allow setting pin mode for each of the SPI pins
      • atsamd51: correct channel init and pin map for ADC based on ItsyBitsy-M4
      • feather-m4: add Adafruit Feather M4 board
      • hifive1b: add support for SPI1
      • hifive1b: fix compiling in simulation
      • linux: fix time on arm32
      • metro-m4: add support for Adafruit Metro M4 Express Airlift board
      • metro-m4: fixes for UART2
      • pinetime-devkit0: add support for the PineTime dev kit
      • x9pro: add support for this smartwatch
      • pca10040-s132v6: add support for SoftDevice
      • pca10056-s140v7: add support for SoftDevice
      • arduino-nano33: added SPI1 connected to NINA-W102 chip on Arduino Nano 33 IO
    Source code(tar.gz)
    Source code(zip)
    tinygo0.10.0.darwin-amd64.tar.gz(49.69 MB)
    tinygo0.10.0.linux-amd64.tar.gz(57.78 MB)
    tinygo0.10.0.linux-arm.tar.gz(50.43 MB)
    tinygo0.10.0.windows-amd64.zip(53.97 MB)
    tinygo_0.10.0_amd64.deb(57.70 MB)
    tinygo_0.10.0_armhf.deb(50.35 MB)
  • v0.9.0(Oct 17, 2019)

    This release adds experimental support for Windows, updates to support Go 1.13, improves flashing experience of many boards (no more button pressing), and adds support for buffered channels. There are also lots of other smaller changes, see the list below.

    0.9.0

    • command line
      • implement 1200-baud UART bootloader reset when flashing boards that support it
      • flash using mass-storage device for boards that support it
      • implement tinygo env
      • add support for Windows (but not yet producing Windows binaries)
      • add Go version to tinygo env
      • update SVD files for up-to-date peripheral interfaces
    • compiler
      • add //go:align pragma
      • fix bug related to type aliases
      • add support for buffered channels
      • remove incorrect reflect optimization
      • implement copying slices in init interpretation
      • add support for constant indices with a named type
      • add support for recursive types like linked lists
      • fix miscompile of function nil panics
      • fix bug related to goroutines
    • standard library
      • machine: do not check for nil slices in SPI.Tx
      • reflectlite: add support for Go 1.13
      • runtime: implement internal/bytealg.CountString
      • sync: properly handle nil New func in sync.Pool
    • targets
      • arduino: fix .bss section initialization
      • fe310: implement Pin.Get
      • gameboy-advance: support directly outputting .gba files
      • samd: reduce code size by avoiding reflection
      • samd21: do not hardcode pin numbers for peripherals
      • stm32f103: avoid issue with time.Sleep less than 200µs
    Source code(tar.gz)
    Source code(zip)
    tinygo0.9.0.darwin-amd64.tar.gz(48.44 MB)
    tinygo0.9.0.linux-amd64.tar.gz(56.06 MB)
    tinygo0.9.0.linux-arm.tar.gz(49.41 MB)
    tinygo0.9.0.windows-amd64.zip(52.37 MB)
    tinygo_0.9.0_amd64.deb(55.97 MB)
    tinygo_0.9.0_armhf.deb(49.45 MB)
  • v0.8.0(Sep 18, 2019)

    This release improves reflect support, extends and improves the scheduler, and has a whole list of improvements to microcontroller boards. In particular, it adds supports for the ItsyBitsy M4, the NUCLEO-F103RB, and even adds some preliminary support for the GameBoy Advance.

    • command line
      • fix parsing of beta Go versions
      • check the major/minor installed version of Go before compiling
      • validate -target flag better to not panic on an invalid target
    • compiler
      • implement full slice expression: s[:2:4]
      • fix a crash when storing a linked list in an interface
      • fix comparing struct types by making type IDs more unique
      • fix some bugs in IR generation
      • add support for linked lists in reflect data
      • implement []rune to string conversion
      • implement support for go on func values
    • standard library
      • reflect: add support for named types
      • reflect: add support for t.Bits()
      • reflect: add basic support for t.AssignableTo()
      • reflect: implement t.Align()
      • reflect: add support for struct types
      • reflect: fix bug in v.IsNil and v.Pointer for addressable values
      • reflect: implement support for array types
      • reflect: implement t.Comparable()
      • runtime: implement stack-based scheduler
      • runtime: fix bug in the sleep queue of the scheduler
      • runtime: implement memcpy for Cortex-M
      • testing: implement stub testing.B struct
      • testing: add common test logging methods such as Errorf/Fatalf/Printf
    • targets
      • 386: add support for linux/386 syscalls
      • atsamd21: make SPI pins configurable so that multiple SPI ports can be used
      • atsamd21: correct issue with invalid first reading coming from ADC
      • atsamd21: add support for reset-to-bootloader using 1200baud over USB-CDC
      • atsamd21: make pin selection more flexible for peripherals
      • atsamd21: fix minimum delay in time.Sleep
      • atsamd51: fix minimum delay in time.Sleep
      • nrf: improve SPI write-only speed, by making use of double buffering
      • stm32f103: fix SPI frequency selection
      • stm32f103: add machine.Pin.Get method for reading GPIO values
      • stm32f103: allow board specific UART usage
      • nucleo-f103rb: add support for NUCLEO-F103RB board
      • itsybitsy-m4: add support for this board with a SAMD51 family chip
      • cortex-m: add support for arm.SystemReset()
      • gameboy-advance: add initial support for the GameBoy Advance
      • wasm: add //go:wasm-module magic comment to set the wasm module name
      • wasm: add syscall/js.valueSetIndex support
      • wasm: add syscall/js.valueInvoke support
    Source code(tar.gz)
    Source code(zip)
    tinygo0.8.0.darwin-amd64.tar.gz(45.20 MB)
    tinygo0.8.0.linux-amd64.tar.gz(46.84 MB)
    tinygo0.8.0.linux-arm.tar.gz(45.97 MB)
    tinygo_0.8.0_amd64.deb(46.74 MB)
    tinygo_0.8.0_armhf.deb(45.99 MB)
  • v0.7.1(Jul 27, 2019)

  • v0.7.0(Jul 17, 2019)

    Version 0.7.0 has many smaller improvements that you can see below. Some of the highlights include initial support for tinygo test, support for garbage collection in most targets including WebAssembly, and the addition of the HiFive1 rev B board, which is based on the new RISC-V architecture.

    0.7.0

    • command line
      • try more locations to find Clang built-in headers
      • add support for tinygo test
      • build current directory if no package is specified
      • support custom .json target spec with -target flag
      • use zversion.go to detect version of GOROOT version
      • make initial heap size configurable for some targets (currently WebAssembly only)
    • cgo
      • add support for bitfields using generated getters and setters
      • add support for anonymous structs
    • compiler
      • show an error instead of panicking on duplicate function definitions
      • allow packages like github.com/tinygo-org/tinygo/src/* by aliasing it
      • remove //go:volatile support
        It has been replaced with the runtime/volatile package.
      • allow poiners in map keys
      • support non-constant syscall numbers
      • implement non-blocking selects
      • add support for the -tags flag
      • add support for string to []rune conversion
      • implement a portable conservative garbage collector (with support for wasm)
      • add the //go:noinline pragma
    • standard library
      • os: add os.Exit and syscall.Exit
      • os: add several stubs
      • runtime: fix heap corruption in conservative GC
      • runtime: add support for math intrinsics where supported, massively speeding up some benchmarks
      • testing: add basic support for testing
    • targets
      • add support for a generic target that calls __tinygo_* functions for peripheral access
      • arduino-nano33: add support for this board
      • hifive1: add support for this RISC-V board
      • reelboard: add e-paper pins
      • reelboard: add PowerSupplyActive to enable voltage for on-board devices
      • wasm: put the stack at the start of linear memory, to detect stack overflows
    Source code(tar.gz)
    Source code(zip)
    tinygo0.7.0.darwin-amd64.tar.gz(45.13 MB)
    tinygo0.7.0.linux-amd64.tar.gz(46.76 MB)
    tinygo0.7.0.linux-arm.tar.gz(45.91 MB)
    tinygo_0.7.0_amd64.deb(46.68 MB)
    tinygo_0.7.0_armhf.deb(45.93 MB)
  • v0.6.0(May 29, 2019)

    Version 0.6.0 again has many improvements. Big changes are much better CGo support, support for js.FuncOf (Go 1.12+), and support for two new boards: the Adafruit Feather M0 and the Adafruit Trinket M0. Other than that, there were lots of smaller improvements and bug fixes.

    0.6.0

    • command line
      • some portability improvements
      • make $GOROOT more robust and configurable
      • check for Clang at the Homebrew install location as fallback
    • compiler driver
      • support multiple variations of LLVM commands, for non-Debian distributions
    • compiler
      • improve code quality in multiple ways
      • make panic configurable, adding trap on panic
      • refactor many internal parts of the compiler
      • print all errors encountered during compilation
      • implement calling function values of a named type
      • implement returning values from blocking functions
      • allow larger-than-int values to be sent across a channel
      • implement complex arithmetic
      • improve hashmap support
      • add debuginfo for function arguments
      • insert nil checks on stores (increasing code size)
      • implement volatile operations as compiler builtins
      • add //go:inline pragma
      • add build tags for the Go stdlib version
    • cgo
      • implement char, enum and void* types
      • support #include for builtin headers
      • improve typedef/struct/enum support
      • only include symbols that are necessary, for broader support
      • mark external function args as nocapture
      • implement support for some #define constants
      • implement support for multiple CGo files in a single package
    • standard library
      • machine: remove microbit matrix (moved to drivers repository)
      • machine: refactor pins to use Pin type instead of GPIO
      • runtime: print more interface types on panic, including error
    • targets
      • arm: print an error on HardFault (including stack overflows)
      • atsamd21: fix a bug in the ADC peripheral
      • atsamd21: add support for I2S
      • feather-m0: add support for this board
      • nrf51: fix a bug in I2C
      • stm32f103xx: fix a bug in I2C
      • syscall: implement Exit on unix
      • trinket-m0: add support for this board
      • wasm: make main example smaller
      • wasm: don't cache wasm file in the server, for ease of debugging
      • wasm: work around bug #41508 that caused a deadlock while linking
      • wasm: add support for js.FuncOf
    Source code(tar.gz)
    Source code(zip)
    tinygo0.6.0.darwin-amd64.tar.gz(41.60 MB)
    tinygo0.6.0.linux-amd64.tar.gz(43.24 MB)
    tinygo0.6.0.linux-arm.tar.gz(42.37 MB)
    tinygo_0.6.0_amd64.deb(43.10 MB)
    tinygo_0.6.0_armhf.deb(42.38 MB)
  • v0.5.0(Apr 20, 2019)

    Version 0.5.0 has many big and small improvements. The headline changes include support for the Go standard library 1.12 in addition to the existing Go 1.11 support and a switch to LLVM 8 which improves WebAssembly support. Other notable changes are support for the stm32f4discovery and dropping the dependency on the GNU toolchain for ARM microcontrollers.

    • compiler driver
      • use wasm-ld instead of wasm-ld-8 on macOS
      • drop dependency on llvm-ar
      • fix linker script includes when running outside TINYGOROOT
    • compiler
      • switch to LLVM 8
      • add support for the Go 1.12 standard library (Go 1.11 is still supported)
      • work around lack of escape analysis due to nil checks
      • implement casting named structs and pointers to them
      • fix int casting to use the source signedness
      • fix some bugs around make([]T, …) with uncommon index types
      • some other optimizations
      • support interface asserts in interp for "math/rand" support
      • resolve all func value targets at compile time (wasm-only at the moment)
    • cgo
      • improve diagnostics
      • implement C struct, union, and arrays
      • fix CGo-related crash in libclang
      • implement C.struct_ types
    • targets
      • all baremetal: pretend to be linux/arm instead of js/wasm
      • avr: improve uintptr support
      • cortexm: implement memmove intrinsic generated by LLVM
      • cortexm: use the lld linker instead of arm-none-eabi-ld
      • darwin: use custom syscall package that links to libSystem.dylib
      • microbit: add blink example
      • samd21: support I2C1
      • samd21: machine/atsamd21: correct pad/pin handling when using both UART and USBCDC interfaces at same time
      • stm32f4discovery: add support for this board
      • wasm: support async func values
      • wasm: improve documentation and add extra example
    Source code(tar.gz)
    Source code(zip)
    tinygo0.5.0.darwin-amd64.tar.gz(40.63 MB)
    tinygo0.5.0.linux-amd64.tar.gz(42.69 MB)
    tinygo0.5.0.linux-arm.tar.gz(41.84 MB)
    tinygo_0.5.0_amd64.deb(42.58 MB)
    tinygo_0.5.0_armhf.deb(41.84 MB)
  • v0.4.1(Mar 15, 2019)

  • v0.4.0(Mar 9, 2019)

    Version 0.4.0 has improved support for samd21-based boards and has various compiler improvements.

    It currently still requires Go 1.11, support for Go 1.12 will be added in a future release.

    • compiler
      • switch to the hardfloat ABI on ARM, which is more widely used
      • avoid a dependency on objcopy (arm-none-eabi-objcopy etc.)
      • fix a bug in make([]T, n) where n is 64-bits on a 32-bit platform
      • adapt to a change in the AVR backend in LLVM 8
      • directly support the .uf2 firmware format as used on Adafruit boards
      • fix a bug when calling panic() at init time outside of the main package
      • implement nil checks, which results in a ~5% increase in code size
      • inline slice bounds checking, which results in a ~1% decrease in code size
    • targets
      • samd21: fix a bug in port B pins
      • samd21: implement SPI peripheral
      • samd21: implement ADC peripheral
      • stm32: fix a bug in timekeeping
      • wasm: fix a bug in wasm_exec.js that caused corruption in linear memory when running on Node.js.
    Source code(tar.gz)
    Source code(zip)
    tinygo0.4.0.linux-amd64.tar.gz(40.30 MB)
    tinygo0.4.0.linux-arm.tar.gz(39.97 MB)
  • v0.3.0(Feb 27, 2019)

    Version 0.3.0 has added support for macOS and has greatly improved support for samd21-based boards. It currently still depends on Go 1.11, support for Go 1.12 will be added in a future release.

    • compiler
      • remove old -initinterp flag
      • add support for macOS
    • cgo
      • add support for bool/float/complex types
    • standard library
      • device/arm: add support to disable/enable hardware interrupts
      • machine: add CPU frequency for nrf-based boards
      • syscall: add support for darwin/amd64
    • targets
      • circuitplay_express: add support for this board
      • microbit: add regular pin constants
      • samd21: fix time function for goroutine support
      • samd21: add support for USB-CDC (serial over USB)
      • samd21: add support for pins in port B
      • samd21: add support for pullup and pulldown pins
      • wasm: add support for Safari in example
    Source code(tar.gz)
    Source code(zip)
    tinygo0.3.0.linux-amd64.tar.gz(40.24 MB)
    tinygo0.3.0.linux-arm.tar.gz(39.92 MB)
  • v0.2.0(Feb 8, 2019)

    Release 0.2.0 has greatly improved standards library support.

    • command line
      • add version subcommand
    • compiler
      • fix a bug in floating point comparisons with NaN values
      • fix a bug when calling panic in package initialization code
      • add support for comparing complex64 and complex128
    • cgo
      • add support for external globals
      • add support for pointers and function pointers
    • standard library
      • fmt: initial support, fmt.Println works
      • math: support for most/all functions
      • os: initial support (only stdin/stdout/stderr)
      • reflect: initial support
      • syscall: add support for amd64, arm, and arm64
    Source code(tar.gz)
    Source code(zip)
    tinygo0.2.0.linux-amd64.tar.gz(40.36 MB)
    tinygo0.2.0.linux-arm.tar.gz(39.95 MB)
Owner
TinyGo
Go compiler for small places. Microcontrollers, WebAssembly, and command-line tools. Based on LLVM.
TinyGo
Running a Command line tool written in Go on browser with WebAssembly

Running a command line tool written in Go on browser with WebAssembly This repo contains code/assets from the article Files: . ├── article.md

wcchoi 82 Dec 30, 2022
Golang-WASM provides a simple idiomatic, and comprehensive API and bindings for working with WebAssembly for Go and JavaScript developers

A bridge and bindings for JS DOM API with Go WebAssembly. Written by Team Ortix - Hamza Ali and Chan Wen Xu. GOOS=js GOARCH=wasm go get -u github.com/

TeamOrtix 93 Dec 22, 2022
WebAssembly interop between Go and JS values.

vert Package vert provides WebAssembly interop between Go and JS values. Install GOOS=js GOARCH=wasm go get github.com/norunners/vert Examples Hello W

null 83 Dec 28, 2022
A package to build progressive web apps with Go programming language and WebAssembly.

Go-app is a package for building progressive web apps (PWA) with the Go programming language (Golang) and WebAssembly (Wasm). Shaping a UI is done by

Maxence Charriere 6.7k Dec 30, 2022
A package to build progressive web apps with Go programming language and WebAssembly.

Go-app is a package for building progressive web apps (PWA) with the Go programming language (Golang) and WebAssembly (Wasm). Shaping a UI is done by

Maxence Charriere 6.7k Jan 2, 2023
WebAssembly for Proxies (Golang host implementation)

WebAssembly for Proxies (GoLang host implementation) The GoLang implementation for proxy-wasm, enabling developer to run proxy-wasm extensions in Go.

MOSN 38 Dec 29, 2022
🐹🕸️ WebAssembly runtime for Go

Wasmer Go Website • Docs • Slack Channel A complete and mature WebAssembly runtime for Go based on Wasmer. Features Easy to use: The wasmer API mimics

Wasmer 2.3k Jan 2, 2023
🐹🕸️ WebAssembly runtime for Go

Wasmer Go Website • Docs • Slack Channel A complete and mature WebAssembly runtime for Go based on Wasmer. Features Easy to use: The wasmer API mimics

Wasmer 2.3k Dec 29, 2022
Vugu: A modern UI library for Go+WebAssembly (experimental)

Vugu: A modern UI library for Go+WebAssembly (experimental)

Vugu 4.5k Jan 3, 2023
WebAssembly runtime for wasmer-go

gowasmer When compiling Go to WebAssembly, the Go compiler assumes the WebAssembly is going to run in a JavaScript environment. Hence a wasm_exec.js f

mattn 99 Dec 28, 2022
A template project to demonstrate how to run WebAssembly functions as sidecar microservices in dapr

Live Demo 1. Introduction DAPR is a portable, event-driven runtime that makes it easy for any developer to build resilient, stateless and stateful app

Second State 185 Jan 3, 2023
Tiny, blazing fast WebAssembly compute

Sat, the tiny WebAssembly compute module Sat (as in satellite) is an experiment, and isn't ready for production use. Please try it out and give feedba

Suborbital 320 Jan 5, 2023
WebAssembly Lightweight Javascript Framework in Go (AngularJS Inspired)

Tango Lightweight WASM HTML / Javascript Framework Intro WebAssembly is nice, Go on the web is nice, so I ported Tangu to Go and WebAssembly. Tangu is

enimatek 8 Dec 20, 2022
This library provides WebAssembly capability for goja Javascript engine

This module provides WebAssembly functions into goja javascript engine.

YC-L 1 Jan 10, 2022
Dom - A Go API for different Web APIs for WebAssembly target

Go DOM binding (and more) for WebAssembly This library provides a Go API for dif

Denys Smirnov 472 Jan 7, 2023
wazero: the zero dependency WebAssembly runtime for Go developers

wazero: the zero dependency WebAssembly runtime for Go developers WebAssembly is a way to safely run code compiled in other languages. Runtimes execut

Tetrate Labs 2.3k Jan 2, 2023
Go compiler running entirely in your browser

wasm-go-playground This is the Go compiler ("gc") compiled for WASM, running in your browser! It can be used to run a simple playground, à la play.gol

Chris 237 Nov 10, 2022
Aes for go and java; build go fo wasm and use wasm parse java response.

aes_go_wasm_java aes for go and java; build go fo wasm and use wasm parse java response. vscode setting config settings.json { "go.toolsEnvVars":

忆年 0 Dec 14, 2021
DOM library for Go and WASM

Go DOM binding (and more) for WebAssembly This library provides a Go API for different Web APIs for WebAssembly target. It's in an active development,

Denys Smirnov 469 Dec 23, 2022