The Linux, macOS and Windows workflows build every file that a release
needs when the release branch is pushed. The new Release workflow finds
those runs for the tagged commit, waits for them, and collects their nine
files into a draft release. It builds nothing, so what ships is what was
tested.
The release notes come from the CHANGELOG.md entry for that version.
Signed-off-by: Ron Evans <ron@hybridgroup.com>
The Actions cache of the repository was at 10.24 GB against a quota of
10 GB, so GitHub removed entries by least recent use. The LLVM entries
were among the first to go, and CI then built LLVM again although the
LLVM version did not change.
The Docker buildx layer blobs held 6.0 GB of the quota. All LLVM caches
together held 1.97 GB. Move the Docker layer cache to a registry cache in
GHCR, which does not use the Actions quota. Both jobs have the necessary
permission and login already.
Pin the LLVM commit in llvm-version.txt and fetch that commit, in place
of a clone of the branch tip tinygo_22.x. Add a hash of that file to each
LLVM cache key, so a change of the LLVM version invalidates the caches
and no other change does.
Also rename the LLVM image tags from llvm-20 to llvm-22.
* pinout yamls removed
* machine: implement default UART pin configuration for Embedfire boards
* flash command moved to chip level so VS Code plugin can select bare chip
* machine: add support for alternate pin mode configuration
* add build targets for embedfire on py32
* add support for embedfire target in GNUmakefile for py32
* lib/py32-svd: remove duplicate DBGMCU.IDCODE CODE field
Update submodule to fix duplicate SetIDCODE/GetIDCODE method
declarations in the generated py32f002bxx.go device file.
* update subproject commit reference in py32-svd
* refactor: update CPU frequency handling in machine and runtime packages
* refactor: replace ConfigureUARTPin function with direct pin configuration in UART setup
* SetAltFunc documentation for GPIO pin alternate functions
* refactor: improve UART write and flush error handling with timeout
* machine/py32: generalize UART driver to any USART
Add a per-instance setup func to the UART type so the driver is no longer
hardwired to USART1. DefaultUART stays USART1; add UART2 (USART2) in a
separately build-tagged file since py32f002x parts lack USART2. RX IRQ
handlers reference runtime-assigned vars to break the init cycle, and setup
is assigned in the var initializer so it runs before InitSerial.
Add the py32f003_32k_4k target (32K flash / 4K RAM).
* Add canonical PY32F002, F003, and F030 density targets
Use CMSIS/pyocd device names for target files and build tags. Add all F003 and F030 densities plus F002A/B, correct F002B to 24K flash and its own startup file, fix the F030x8 pyocd target, and update Embedfire inheritance.
* Add targets for all PY32 CMSIS devices
* Support all PY32 register layout variants
* machine/py32: use generated register definitions
* machine/py32: fix alternate-function documentation
* machine/py32: report the configured CPU frequency
* machine/py32: use unsafe.Add for GPIO ports
* machine/py32: bound and yield UART polling
* machine/py32: configure UART pins from UARTConfig
* build: use the current PY32 SVD repository URL
* test: cover PY32 UART register layouts
* machine/py32: restore dynamic CPU frequency tracking
* machine/py32: share the USART TX-ready bit
* targets/py32: scale system stacks with RAM
* machine/py32: keep clock state internal
* targets/py32: normalize generated metadata
* machine/py32: normalize GPIO configuration
* machine/py32: fix T020 UART setup
* machine/py32: reduce clock variant files
* machine/py32: clean up UART variants
* machine/py32: decouple UART clock capability
* lib/py32-svd: use organization repository
* runtime/py32: name 24MHz HSI encodings
* machine/py32: derive startup clock from capability
* machine/py32: use generated USART clock mask
* machine/py32: name T020 8-bit UART mode
* ci: include PY32 in sharded smoke tests
* runtime: remove PY32 HSI frequency workaround
* add support for UEFI time and UEFI events; fix STOP \n -> \r\n conversion
* make it so both scheduler=none and scheduler=tasks works
* address pr comments
- Renamed/shared the amd64 Win64 ABI task stack Go file for both Windows and UEFI.
- Deleted the duplicate UEFI task stack Go file and old Windows-suffixed Go file.
- Added task_stack_amd64_windows.S unconditionally to targets/uefi-amd64.json.
- Removed the UEFI ExtraFiles() special case from compileopts/config.go.
- Added a scheduler.none tinygo_task_exit stub.
- Removed the custom UEFI sleep override so normal scheduler sleep queue is used.
* revert back to simpler return value for ExtraFiles()
* create uefi specific tasks_none file
* remove unused sleepSchedulerCustom stuff
* add back the uefi tag
* lib: restore macos-minimal-sdk pointer
* GNUmakefile: split into topic files in make/
The GNUmakefile had 1295 lines and mixed build configuration, LLVM
bootstrapping, device generation, four test suites, the smoke tests,
release packaging, and lint tools. The smoke tests alone were 500 lines.
Move each part into its own file in make/ and include them from
GNUmakefile. config.mk must be included first because the other files
use its variables in immediate assignments and conditionals.
There is no change in behavior. The parsed make database is identical
for the default build and for ASSERT=1, STATIC=1, XTENSA=0, STM32=0,
WASM=0, and CROSS=aarch64-linux-gnu, except for MAKEFILE_LIST and the
.PHONY list, which now also includes targets that were phony but not
declared.
The Dockerfile copies GNUmakefile alone before it builds LLVM, to keep
that layer independent of the source tree. It must copy make/ too.
* make/smoketest.mk: split into groups and add smoketest-quick
The smoke test was one recipe of about 500 lines with 236 builds that
always ran in sequence. Split it at the group boundaries that were
already there, so that:
- `make -j smoketest` builds the groups in parallel. A full run goes
from 325 to 91 seconds on a 32 core machine.
- CI can shard the groups across runners.
Each group writes to its own name in build/smoke/, because all builds
wrote to test.hex before and would overwrite each other in a parallel
build. The output extension selects the format, so it stays per line.
Add smoketest-quick, which builds one board for each processor
architecture. The full smoke test answers "can TinyGo build for every
board", which does not depend on the host OS, so it only needs to run
on one OS. The other jobs use smoketest-quick.
The comment above the esp32c3 group had 4 spaces of indentation instead
of a tab. That was harmless in the middle of a recipe, but it is now the
first line of a group, where it would stop the recipe from starting.
The set of build commands is unchanged for the default flags and for
XTENSA=0, STM32=0, and WASM=0. All 226 checksums are the same as before,
for a sequential build and for `make -j16`.
* ci: run the full smoke test once, on Linux only
The smoke test ran six times for each push: twice on Linux, twice on
macOS, once on Windows, and once in the compatibility test. Together
that was about 97 minutes of the CI time.
The smoke test checks that TinyGo can build a binary for each board.
That does not depend on the host OS. The only part that does is one
build behind a Windows check.
Add a smoketest-linux job that runs the full set, split across four
runners that use the tarball from the build-linux job. The groups are
balanced with the measured build time of each group. Remove the full
smoke test from test-linux-build, which the new job replaces, and use
smoketest-quick for the other four jobs.
Expected result: about 55 to 39 minutes for the slowest workflow, and
about 97 to 35 minutes of total smoke test time.
* make/smoketest.mk: build nintendoswitch in smoketest-quick
It is the only target that uses the aarch64 LLVM triple. With it,
smoketest-quick covers all 13 triples that the full smoke test uses.
* runtime: run syscall/js finalizers on wasm without a manual GC
* runtime: address review feedback on finalizer idle GC
* runtime: clear a finished task's args pointer so its arguments are collectable
* runtime: skip the finalizer scan with a per-block registration bit
* runtime: guard the finalizer registration bitmap with gcLock
* testdata: cover finalizer invariants on every scheduler
* main_test: limit the finalizer scheduler variants to linux and darwin
* testdata: wait for the finalizer queue to drain before asserting
* testdata: make the finalizer counters atomic and wait for a known drain count
* runtime: add finalizer bookkeeping asserts under runtime_asserts
* runtime: address finalizer GC review feedback
* testdata: strengthen blocked stack finalizer test
* runtime: fix finalizer cleanup edge cases
* runtime: decouple wasm export scheduling from finalizers
* runtime: avoid redundant wakeups for re-entrant wasm exports
* runtime: simplify finalizer comments
* machine/esp32: add ADC driver
Implements ADC1 on the Xtensa ESP32: InitADC, Configure and Get for
GPIO36, GPIO37, GPIO38, GPIO39, GPIO32, GPIO33, GPIO34 and GPIO35
(channels 0-7). The ADC pins are not contiguous on this chip, so the
pin to channel mapping is a lookup rather than arithmetic as on the
ESP32-S3.
Conversions are driven by the RTC controller under software control,
and Get returns the 12-bit sample scaled to 0..65520 to match the
other ESP ADC drivers.
The analog pads are spread over three unrelated RTC_IO registers
(SENSOR_PADS, XTAL_32K_PAD and ADC_PAD), so pad setup is kept local to
this file rather than adding a PinAnalog mode to machine_esp32.go.
That keeps the change to a single file.
Values are raw and uncalibrated. Unlike the ESP32-C3, S3 and C6
drivers there is no eFuse or self-calibration step; accurate voltage
mapping should be done with a two-point calibration in user code.
ADC2 is not implemented. On the ESP32 it is shared with the Wi-Fi
radio and cannot be used reliably while the radio is active.
Tested on an ESP32 Coreboard V2 with a photoresistor divider on
GPIO36. Readings swept 5056..59824 over the light range, all eight
channels returned independent values, and an invalid pin returned an
error from Configure and 0 from Get.
Signed-off-by: zombieleet <osikwemhev@gmail.com>
* fix: use package level err definiition and return (uint32, bool) from adcRTCGPIO
---------
Signed-off-by: zombieleet <osikwemhev@gmail.com>
Remove the C3 bluetooth hook addresses from esp32s3.ld (on the S3 they
point into the ROM md5/crc thunk table, and being bare assignments they
also shadowed the blob's own definitions), keep the interrupt frame clear
of the 16-byte windowed-ABI save area below SP, and make tinygo_swapTask
hold INTLEVEL across the stack switch while keeping the running frame's
WINDOWSTART bit set.
Signed-off-by: deadprogram <ron@hybridgroup.com>
The guard was on runtime.GOOS == "wasip1", so under wasip2 the three cases that
rely on recover ran anyway. recover does not work on wasm yet, so the panic
escaped and trapped the test binary — which is the tinygo-test-wasip2-fast
failure on this PR.
Checked on runtime.GOARCH instead, since the limitation is wasm's rather than
any one platform's. wasip1, wasip2 and js/wasm all set the tinygo.wasm build
tag, and arch_tinygowasm.go defines GOARCH as wasm for it, so one condition
covers all three of the wasm test targets.
Worth noting for anyone reading targets/wasip2.json: the goarch there is arm,
but that is what is handed to the Go toolchain for package selection —
runtime.GOARCH is the one above.
TinyGo had MakeMap/MakeSlice but not MakeChan. Implement it via the runtime
chanMake primitive (mirroring MakeMap), so packages that call reflect.MakeChan
(e.g. github.com/ugorji/go/codec used by gin) compile and work.
* machine: add USBDevice.Attach and USBDevice.Detach
The USB device is attached to the bus automatically during startup,
before user code has a chance to finish its USB configuration (device
identifiers, extra HID interfaces, ...). Composite devices such as
keyboards may therefore be enumerated by the host with an incomplete
configuration.
Attach and Detach expose the soft-connect control (DP pull-up) so that
an application or library can detach in an init function, complete its
configuration, and attach again to let the host enumerate the finished
device. They can also be used to force re-enumeration without
replugging the cable.
Implemented for atsamd21, atsamd51, nrf52840, rp2040 and rp2350.
* machine: make USB Detach sticky on nrf52840
The USB IRQ handler re-enables the DP pull-up on every power-ready
event, silently undoing an earlier Detach. Guard the pull-up write with
a detached flag so the device stays off the bus until Attach is called.
* machine: add USB Attach and Detach to stm32 and esp32 targets
- stm32f4, stm32f7, stm32h7: implement Attach and Detach using the
DCTL soft-disconnect bit that Configure already toggles.
- esp32c3, esp32c6, esp32s3: add no-op stubs to keep user code
portable; the fixed-function USB Serial/JTAG controller has no
software-controlled soft-connect.
* machine: use Attach and Detach in USB Configure
Replace the direct soft-connect register writes in Configure with the
equivalent Attach and Detach calls on atsamd21, atsamd51, rp2040,
rp2350, stm32f4, stm32f7 and stm32h7.
Skip TestUnmarshalNestingLimitSlice/Struct, which fails due to the nesting limit
added in golang/go@6a6d115f9a.
Since Go 1.27 the crypto hash tests go through cryptotest.TestHash, which
calls cryptotest.BoundarySlices. Targets reporting GOOS=linux build
boundary.go (//go:build linux || darwin) instead of boundary_compat.go, and
that needs a working syscall.Mmap/syscall.Mprotect:
* baremetal fails to compile: undefined: syscall.Mprotect
* wasip2 gets ENOSYS from syscall.Mmap, and since t.Fatalf cannot Goexit on
wasm the test falls through and panics with "slice out of range"
Exclude crypto/md5, crypto/sha1, crypto/sha256 and crypto/sha512 from both.
wasip1 reports GOOS=wasip1, gets the boundary_compat.go fallback, and keeps
testing all four.
Signed-off-by: deadprogram <ron@hybridgroup.com>
file_unix.go (darwin/linux/wasip) was missing the exported (*File).Chown method
that file_other.go (baremetal/wasm) already has, so callers requiring the full
os.File surface — e.g. github.com/pkg/sftp — failed to compile for the
linux/amd64 TinyGo target. Delegates to the package-level Chown, mirroring
(*File).Truncate.
Reading runtime.MemStats.NumGC is common enough in dependency code that its
absence is a compile error for programs that never look at the value. Rather
than add the field as a constant zero, track it:
- gc_blocks: count completed cycles in runGC, so collections triggered by an
allocation are counted as well as explicit runtime.GC() calls. The counter is
read and written under gcLock, like the other counters beside it.
- gc_boehm: report bdwgc's own gc_no from the prof_stats struct.
- gc_leaking: always 0, since that collector never completes a cycle.
In gcMarkReachable, busy-wait for other cores to enter the interrupt handler and pause before scanning the GC core's stack or globals. Prevents data race where a running core relocates heap references to globals during mark phase.
Using blocksPerStateByte instead of bytesPerBlock caused the old size to be underestimated for multi-block allocations, leading to data truncation on growing reallocations.
Previously, running 'tinygo build -o dist/ file.go' where dist/ already
exists as a directory failed with 'open dist/: is a directory', because
Build() only auto-derived a binary name when outpath was empty, not when
it pointed to an existing directory. This adds that check, matching the
behavior of 'go build -o dir/' with a package.
Note: only handles the case where the directory already exists; if the
directory doesn't exist yet, behavior is unchanged.
This add the `espradio` build tag to all ESP32C3,
ESP32S3, and ESP32 boards, since they all have support
for wireless communication using espradio. This
just makes it to people do not have to remember to use
the build tag, the same as we have done with both
`ninafw` and `cyw43439` build tags.
Signed-off-by: deadprogram <ron@hybridgroup.com>
Place espradio's RX ring buffer and WiFi-only BSS (ISR tables,
timer slots, ISR ring) in SRAM1 pool 7/6 ahead of the arena.
Frees ~14 KB of SRAM2 for the Go GC heap. The arena assertion
still guarantees ≥32 KB remains for WiFi DMA buffers.
Signed-off-by: deadprogram <ron@hybridgroup.com>
Match the Go runtime by terminating for deadlocks, stack overflows,
runtime and GC invariants, invalid lock operations, and platform
initialization failures instead of routing them through panic/recover.
Keep language-level runtime errors and unsupported user operations
recoverable. Add crash coverage that verifies fatal errors bypass deferred
recover calls.
Match the Go runtime by terminating instead of unwinding when an
allocator exhausts the heap. Recovering an OOM can leave allocator locks
held and cannot safely continue when the panic path itself needs memory.