Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
ff58c50
machine: add attiny85 pwm support (#5171)
jespino Jan 12, 2026
8bd2233
machine/rp: use the blockReset() and unresetBlockWait() helper functi…
deadprogram Jan 13, 2026
1fe934e
machine/rp: add Close function to UART to allow for removing all syst…
deadprogram Jan 13, 2026
1876b65
compiler: simplify createObjectLayout
niaow Dec 28, 2025
707d37a
chore: update version to 0.41.0-dev
deadprogram Jan 14, 2026
a0069b6
testdata: more corpus entries (#5182)
dgryski Jan 17, 2026
5d8e071
machine/attiny85: add USI-based SPI support (#5181)
jespino Jan 17, 2026
f0256ca
Fix syntax for building with TinyGo
robogg133 Jan 21, 2026
e79cdc1
targets: Add Shrike Lite board (#5170)
YajTPG Jan 24, 2026
bef0dc5
Add per-byte timeout budget for rp2 I2C (#5189)
sparques Feb 2, 2026
66d7099
build: update CI builds to use latest Go 1.25.7 release
deadprogram Feb 4, 2026
f23e18a
flake.*: bump to nixpkgs 25.11
eliasnaur Feb 6, 2026
f5b2a08
builder: order embedded files deterministically
eliasnaur Feb 6, 2026
3237853
sponsorship: add explicit callout/link in README to help out TinyGo
deadprogram Feb 11, 2026
4b0e858
Esp32s3 implement spi (#5169)
dimajolkin Feb 15, 2026
934d5f4
fix: init heap before random number seed on wasm platforms
deadprogram Feb 15, 2026
b6b723a
targets: correct name/tag use for esp32s3-wroom1 board
deadprogram Feb 16, 2026
24f9654
make: remove machine without board from smoketest
deadprogram Feb 16, 2026
9bbad67
esp32s3-usbserial: added usbserial printing
dimajolkin Feb 15, 2026
c1cddff
esp32s3-usbserial: split usb
dimajolkin Feb 16, 2026
44ca224
esp32s3-usbserial: common usbserial for both esp32c3 & esp32s3
dimajolkin Feb 17, 2026
610dd19
esp32s3-usbserial: move InitSerial to init method
dimajolkin Feb 17, 2026
5c37d1b
runtime: implement fminimum/fmaximum
niaow Feb 9, 2026
fd1d10c
export UART0 and pins
cowellmi Feb 17, 2026
e0425ed
Esp32s3 i2c interface (#5210)
dimajolkin Feb 21, 2026
9a1be25
transform: modify output format from the -print-allocs flag to be the…
deadprogram Feb 24, 2026
4afce2b
esp3s3 & esp32c3 PWM implements (#5215)
dimajolkin Feb 25, 2026
72e7040
update tools/gen-device-svd w.r.t. recent changes to the structure of…
knieriem Feb 25, 2026
8c2fcac
lib/stm32-svd: update submodule
knieriem Feb 25, 2026
6607df5
targets/nucleo-f722ze.json: add build-tag stm32f722, change stm32f7x2…
knieriem Nov 28, 2025
4140cb0
targets/swan: rename group build tag stm32l4x5 => stm32l4y5 to avoid …
knieriem Feb 23, 2026
3bd5d72
machine: sync stm32g0 with updated stm32 device files
knieriem Feb 23, 2026
e4c4b67
machine: stm32l0x1,l0x2: TIM: adapt to 32-bit register access
knieriem Feb 23, 2026
bbca047
targets: add support for Seeedstudio Xiao-RP2350 board.
deadprogram Feb 26, 2026
5343bcf
feature: add esp32flash flash method for esp32s3/esp32c3/esp32/esp8266
deadprogram Feb 27, 2026
1385c97
targets: modify esp32, esp32s3, esp32c3, & esp8266 targets to use bui…
deadprogram Feb 27, 2026
4f9857a
modules: update espflash to 0.2.0 for esp8266 fixes
deadprogram Feb 28, 2026
a17ffae
machine: implement RNG for esp32s3 based on the onboard hardware rand…
deadprogram Feb 27, 2026
0952eb4
esp32s3 + c3 ADC (#5231)
dimajolkin Mar 1, 2026
f195d09
usb/cdc: Better ring buffer implementation (#5209)
soypat Mar 1, 2026
f50eccf
esp32c3/esp32s3: refactor ADC implementation to reduce code duplication.
deadprogram Mar 1, 2026
0abc514
targets: switch rp2040/rp2350 to default to tasks scheduler
deadprogram Mar 2, 2026
1f4e303
esp32c3/esp32s3: refactoring and corrections for SPI implementation
deadprogram Mar 2, 2026
dfb2578
modules: update to latest serial and espflash packages
deadprogram Mar 4, 2026
ba88db0
flashing: introduce flash method 'esp32jtag' for esp32c3/esp32s3 targets
deadprogram Mar 4, 2026
9966dc3
fix: ESP32-C3 needs to clear MCAUSE after handling interrupt
deadprogram Mar 5, 2026
6424b09
chore: update espflash to espflasher
deadprogram Mar 8, 2026
e955418
Add support for esp32-c6
gandarez Mar 13, 2026
0bfb03e
feat: Add esp32c6 to smoke test
gandarez Mar 13, 2026
6f18e1e
fix: correct ESP32-C6 SWD key and clock dividers to prevent reset and…
gandarez Mar 13, 2026
603d5ca
fix: format
gandarez Mar 13, 2026
87b11f8
fix: move sarEnable to separate file to fix m5stamp_c3 build tag mism…
gandarez Mar 13, 2026
61183a5
fix: enable atomic extension features for ESP32-C6 target
gandarez Mar 13, 2026
a3fa14a
fix: fix llvm features ordering
gandarez Mar 13, 2026
ae68d6d
fix: Add missing ROM functions
gandarez Mar 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: '1.25.5'
go-version: '1.25.7'
cache: true
- name: Restore LLVM source cache
uses: actions/cache/restore@v4
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: '1.25.5'
go-version: '1.25.7'
cache: true
- name: Build TinyGo (LLVM ${{ matrix.version }})
run: go install -tags=llvm${{ matrix.version }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: '1.25.5'
go-version: '1.25.7'
cache: true
- name: Install wasmtime
uses: bytecodealliance/actions/wasmtime/setup@v1
Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: '1.25.5'
go-version: '1.25.7'
cache: true
- name: Install Node.js
uses: actions/setup-node@v4
Expand Down Expand Up @@ -298,7 +298,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: '1.25.5'
go-version: '1.25.7'
cache: true
- name: Restore LLVM source cache
uses: actions/cache/restore@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
key: ${{ steps.cache-llvm-source.outputs.cache-primary-key }}
path: |
llvm-project/compiler-rt
- uses: cachix/install-nix-action@v22
- uses: cachix/install-nix-action@v31
- name: Test
run: |
nix develop --ignore-environment --keep HOME --command bash -c "go install && ~/go/bin/tinygo version && ~/go/bin/tinygo build -o test ./testdata/cgo"
8 changes: 4 additions & 4 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: '1.25.5'
go-version: '1.25.7'
cache: true
- name: Restore cached LLVM source
uses: actions/cache/restore@v4
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: '1.25.5'
go-version: '1.25.7'
cache: true
- name: Download TinyGo build
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -177,7 +177,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: '1.25.5'
go-version: '1.25.7'
cache: true
- name: Download TinyGo build
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -213,7 +213,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: '1.25.5'
go-version: '1.25.7'
cache: true
- name: Download TinyGo build
uses: actions/download-artifact@v4
Expand Down
44 changes: 44 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,10 @@ endif
@$(MD5SUM) test.hex
$(TINYGO) build -size short -o test.hex -target=waveshare-rp2040-tiny examples/echo
@$(MD5SUM) test.hex
$(TINYGO) build -size short -o test.hex -target=vicharak_shrike-lite examples/echo
@$(MD5SUM) test.hex
$(TINYGO) build -size short -o test.hex -target=xiao-rp2350 examples/blinky1
@$(MD5SUM) test.hex
# test pwm
$(TINYGO) build -size short -o test.hex -target=itsybitsy-m0 examples/pwm
@$(MD5SUM) test.hex
Expand Down Expand Up @@ -896,13 +900,19 @@ endif
@$(MD5SUM) test.hex
$(TINYGO) build -size short -o test.hex -target=digispark examples/blinky1
@$(MD5SUM) test.hex
$(TINYGO) build -size short -o test.hex -target=digispark examples/pwm
@$(MD5SUM) test.hex
$(TINYGO) build -size short -o test.hex -target=digispark examples/mcp3008
@$(MD5SUM) test.hex
$(TINYGO) build -size short -o test.hex -target=digispark -gc=leaking examples/blinky1
@$(MD5SUM) test.hex
ifneq ($(XTENSA), 0)
$(TINYGO) build -size short -o test.bin -target=esp32-mini32 examples/blinky1
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target=esp32c3-supermini examples/blinky1
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target=esp32c3-supermini examples/blinkm
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target=nodemcu examples/blinky1
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target m5stack-core2 examples/machinetest
Expand All @@ -915,9 +925,40 @@ ifneq ($(XTENSA), 0)
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target mch2022 examples/machinetest
@$(MD5SUM) test.bin
# xiao-esp32s3
$(TINYGO) build -size short -o test.bin -target=xiao-esp32s3 examples/blinky1
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target=xiao-esp32s3 examples/blinkm
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target=xiao-esp32s3 examples/mcp3008
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target=xiao-esp32s3 examples/pwm
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target=xiao-esp32s3 examples/adc
@$(MD5SUM) test.bin

# esp32s3-wroom1
$(TINYGO) build -size short -o test.bin -target=esp32s3-wroom1 examples/blinkm
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target=esp32s3-wroom1 examples/mcp3008
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target=esp32s3-wroom1 examples/pwm
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target=xiao-esp32s3 examples/adc
@$(MD5SUM) test.bin
endif
# esp32c3-supermini
$(TINYGO) build -size short -o test.bin -target=esp32c3-supermini examples/blinky1
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target=esp32c3-supermini examples/blinkm
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target=esp32c3-supermini examples/mcp3008
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target=esp32c3-supermini examples/pwm
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target=esp32c3-supermini examples/adc
@$(MD5SUM) test.bin

$(TINYGO) build -size short -o test.bin -target=esp-c3-32s-kit examples/blinky1
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target=qtpy-esp32c3 examples/machinetest
Expand All @@ -930,6 +971,9 @@ endif
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target=esp32c3-12f examples/blinky1
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target=esp32c6 examples/machinetest
@$(MD5SUM) test.bin

$(TINYGO) build -size short -o test.bin -target=makerfabs-esp32c3spi35 examples/machinetest
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.hex -target=hifive1b examples/blinky1
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ TinyGo is a Go compiler intended for use in small places such as microcontroller

It reuses libraries used by the [Go language tools](https://golang.org/pkg/go/) alongside [LLVM](http://llvm.org) to provide an alternative way to compile programs written in the Go programming language.

> [!IMPORTANT]
> You can help TinyGo with a financial contribution using OpenCollective. Please see https://opencollective.com/tinygo for more information. Thank you!

## Embedded

Here is an example program that blinks the built-in LED when run directly on any supported board with onboard LED:
Expand Down Expand Up @@ -63,7 +66,7 @@ tinygo build -buildmode=c-shared -o add.wasm -target=wasip1 add.go
You can also use the same syntax as Go 1.24+:

```shell
GOARCH=wasip1 GOOS=wasm tinygo build -buildmode=c-shared -o add.wasm add.go
GOOS=wasip1 GOARCH=wasm tinygo build -buildmode=c-shared -o add.wasm add.go
```

## Installation
Expand Down
15 changes: 10 additions & 5 deletions builder/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"os/exec"
"path/filepath"
"runtime"
"slices"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -281,9 +282,13 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
allFiles[file.Name] = append(allFiles[file.Name], file)
}
}
for name, files := range allFiles {
name := name
files := files
// Sort embedded files by name to maintain output determinism.
embedNames := make([]string, 0, len(allFiles))
for _, files := range allFiles {
embedNames = append(embedNames, files[0].Name)
}
slices.Sort(embedNames)
for _, name := range embedNames {
job := &compileJob{
description: "make object file for " + name,
run: func(job *compileJob) error {
Expand All @@ -298,7 +303,7 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
sum := sha256.Sum256(data)
hexSum := hex.EncodeToString(sum[:16])

for _, file := range files {
for _, file := range allFiles[name] {
file.Size = uint64(len(data))
file.Hash = hexSum
if file.NeedsData {
Expand Down Expand Up @@ -1042,7 +1047,7 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
if err != nil {
return result, err
}
case "esp32", "esp32-img", "esp32c3", "esp32s3", "esp8266":
case "esp32", "esp32-img", "esp32c3", "esp32c6", "esp32s3", "esp8266":
// Special format for the ESP family of chips (parsed by the ROM
// bootloader).
result.Binary = filepath.Join(tmpdir, "main"+outext)
Expand Down
1 change: 1 addition & 0 deletions builder/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func TestClangAttributes(t *testing.T) {
"cortex-m4",
"cortex-m7",
"esp32c3",
"esp32c6",
"esp32s3",
"fe310",
"gameboy-advance",
Expand Down
29 changes: 19 additions & 10 deletions builder/esp.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ package builder

import (
"bytes"
"crypto/sha256"
"debug/elf"
"encoding/binary"
"fmt"
Expand Down Expand Up @@ -100,12 +99,24 @@ func makeESPFirmwareImage(infile, outfile, format string) error {
chip_id := map[string]uint16{
"esp32": 0x0000,
"esp32c3": 0x0005,
"esp32c6": 0x000D,
"esp32s3": 0x0009,
}[chip]

// SPI flash speed/size byte (byte 3 of header):
// Upper nibble = flash size, lower nibble = flash frequency.
// The espflasher auto-detects and patches the flash size (upper nibble),
// but the frequency (lower nibble) must be correct per chip.
spiSpeedSize := map[string]uint8{
"esp32": 0x1f, // 80MHz=0x0F, 2MB=0x10
"esp32c3": 0x1f, // 80MHz=0x0F, 2MB=0x10
"esp32c6": 0x10, // 80MHz=0x00, 2MB=0x10 (C6 uses different freq encoding)
"esp32s3": 0x1f, // 80MHz=0x0F, 2MB=0x10
}[chip]

// Image header.
switch chip {
case "esp32", "esp32c3", "esp32s3":
case "esp32", "esp32c3", "esp32c6", "esp32s3":
// Header format:
// https://github.com/espressif/esp-idf/blob/v4.3/components/bootloader_support/include/esp_app_format.h#L71
// Note: not adding a SHA256 hash as the binary is modified by
Expand All @@ -126,12 +137,12 @@ func makeESPFirmwareImage(infile, outfile, format string) error {
}{
magic: 0xE9,
segment_count: byte(len(segments)),
spi_mode: 2, // ESP_IMAGE_SPI_MODE_DIO
spi_speed_size: 0x1f, // ESP_IMAGE_SPI_SPEED_80M, ESP_IMAGE_FLASH_SIZE_2MB
spi_mode: 2, // ESP_IMAGE_SPI_MODE_DIO
spi_speed_size: spiSpeedSize,
entry_addr: uint32(inf.Entry),
wp_pin: 0xEE, // disable WP pin
chip_id: chip_id,
hash_appended: true, // add a SHA256 hash
hash_appended: false, // disabled: espflasher patches header, invalidating the hash
})
case "esp8266":
// Header format:
Expand Down Expand Up @@ -173,11 +184,9 @@ func makeESPFirmwareImage(infile, outfile, format string) error {
outf.Write(make([]byte, 15-outf.Len()%16))
outf.WriteByte(checksum)

if chip != "esp8266" {
// SHA256 hash (to protect against image corruption, not for security).
hash := sha256.Sum256(outf.Bytes())
outf.Write(hash[:])
}
// Note: SHA256 hash intentionally omitted. espflasher patches the header
// (SPI mode/speed/size), which invalidates the hash. The ROM would report
// "SHA-256 comparison failed" and boot anyway, so it's just noise.

// QEMU (or more precisely, qemu-system-xtensa from Espressif) expects the
// image to be a certain size.
Expand Down
2 changes: 1 addition & 1 deletion builder/sizes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestBinarySize(t *testing.T) {
// microcontrollers
{"hifive1b", "examples/echo", 3668, 280, 0, 2244},
{"microbit", "examples/serial", 2694, 342, 8, 2248},
{"wioterminal", "examples/pininterrupt", 6837, 1491, 120, 6888},
{"wioterminal", "examples/pininterrupt", 7074, 1510, 120, 7248},

// TODO: also check wasm. Right now this is difficult, because
// wasm binaries are run through wasm-opt and therefore the
Expand Down
3 changes: 3 additions & 0 deletions compiler/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ func typeHasPointers(t llvm.Type) bool {
}
return false
case llvm.ArrayTypeKind:
if t.ArrayLength() == 0 {
return false
}
if typeHasPointers(t.ElementType()) {
return true
}
Expand Down
Loading
Loading