Randy Reddig
4f8672c9ab
internal/cm: change error type from struct{string}
...
This is a temporary fix until cm@v0.2.2 is released, and package internal/cm and internal/wasi can be regenerated.
See #4810 for more information.
2025-03-18 15:40:46 +01:00
Randy Reddig
a7416e7300
internal/wasi: remove x bit from generated files
2025-03-18 15:40:46 +01:00
Randy Reddig
d63d8e0899
internal/wasm-tools, internal/cm: udpate to go.bytecodealliance.org@v0.6.1 and cm@v0.2.1
2025-03-18 15:40:46 +01:00
Randy Reddig
8e009de8a8
internal/cm: remove go.mod file
2025-03-18 15:40:46 +01:00
Randy Reddig
d6527ece02
internal/cm: exclude certain files when copying package
2025-03-18 15:40:46 +01:00
Randy Reddig
211425c3e9
internal/wasi: regenerate WASI 0.2 bindings
...
Use go.bytecodealliance.org/cmd/wit-bindgen-go@v0.6.0
2025-03-18 15:40:46 +01:00
Randy Reddig
429aea8e74
internal/cm: update to go.bytecodealliance.org/cm@v0.2.0
2025-03-18 15:40:46 +01:00
Ayke van Laethem
3a7c25f987
all: add the Boehm-Demers-Weiser GC on Linux
...
This adds support for the well-known Boehm GC. It's significantly faster
than our own naive GC and could be used as an alternative on bigger
systems.
In the future, this GC might also be supported on WebAssembly with some
extra work. Right now it's Linux only (though Windows/MacOS shouldn't be
too difficult to add).
2025-03-18 10:31:38 +01:00
Ayke van Laethem
a4cbe3326e
runtime: only allocate heap memory when needed
...
For example, with -gc=none and -gc=leaking, no heap needs to be
allocated when initializing the runtime. And some GCs (like -gc=custom)
are responsible for allocating the heap themselves.
2025-03-18 10:31:38 +01:00
Ayke van Laethem
5282b4efac
runtime: remove unused file func.go
...
This was used in the past, but we don't use it anymore.
2025-03-17 22:13:17 +01:00
Randy Reddig
6a25fd494e
reflect, internal/reflectlite: add Value.SetIter{Key,Value} and MapIter.Reset
...
Fixes #4790 . Depends on #4787 (merge that first).
2025-03-17 20:44:20 +01:00
Randy Reddig
d95c1b5982
reflect: remove unused go:linkname functions
2025-03-17 18:23:28 +01:00
Randy Reddig
24eed9e376
reflect: remove strconv.go
2025-03-17 18:23:28 +01:00
Randy Reddig
c2af1d183e
reflect: panic on Type.CanSeq[2] instead of returning false
...
PR feedback.
2025-03-17 18:23:28 +01:00
Randy Reddig
64651115c2
reflect: Value.Seq iteration value types should match
...
Implementation of https://github.com/golang/go/issues/71905
194696f1d1f6e5609f96d0fb0192595e7e0f5b90
2025-03-17 18:23:28 +01:00
Randy Reddig
b6c3d142db
reflect: copy reflect iter tests from upstream Go
2025-03-17 18:23:28 +01:00
Randy Reddig
fafe80704f
loader, iter, reflect: use build tags for package iter and iter methods on reflect.Value
2025-03-17 18:23:28 +01:00
Randy Reddig
a2be2f3330
loader, iter: add shim for go1.22 and earlier
2025-03-17 18:23:28 +01:00
Randy Reddig
05fc49a0cf
internal/reflectlite: remove old reflect.go
2025-03-17 18:23:28 +01:00
Randy Reddig
417aa4312e
internal/reflectlite, reflect: move StringHeader and SliceHeader back to package reflect
2025-03-17 18:23:28 +01:00
Randy Reddig
c8d0b87a67
internal/reflectlite, reflect: handle different StructField
2025-03-17 18:23:28 +01:00
Randy Reddig
99a618385b
runtime: use package reflectlite
2025-03-17 18:23:28 +01:00
Randy Reddig
9e143efd73
reflect: add Go 1.24 iter.Seq[2] methods
2025-03-17 18:23:28 +01:00
Randy Reddig
d5c70a1cd3
reflect, internal/reflectlite: embed reflectlite types into reflect types
2025-03-17 18:23:28 +01:00
Michael Smith
4768c7d431
machine/rp2350: add flash support for rp2350 ( #4803 )
...
* machine/rp2350: add flash support for rp2350
* combine duplicate files
* clean things up and group by source file
* add stubbed out xip cache clean func if needed in the future
* update flash_enable_xip_via_boot2
* remove unused macros and fix inconsistent formatting
* make flash size configurable like rp2040
* add missing flash size configs
* retain big Go CGo compatibility per #4103
* clarify CS0_SIZE source and remove single-use typedef
2025-03-16 09:45:53 +01:00
あーるどん
4f7c64cb24
fix(rp2040): replace loop counter with hw timer for USB SetAddressReq… ( #4796 )
...
* fix(rp2040/rp2350): replace loop counter with hw timer for USB SetAddressRequest timeout.
* fix code format.
---------
Co-authored-by: rdon <you@example.com >
2025-03-13 16:39:43 +01:00
soypat
04c7057ea6
add goroutine benchmark to examples
2025-03-11 13:10:41 -07:00
Ron Evans
f76e8d2812
fix: ensure use of pointers for SPI interface on atsam21/atsam51 and other machines/boards that were missing implementation. ( #4798 )
...
Signed-off-by: deadprogram <ron@hybridgroup.com >
2025-03-11 12:50:31 -03:00
deadprogram
2bee29959b
refactor: use *SPI everywhere to make consistant for implementations.
...
Fixes #4663 "in reverse" by making SPI a pointer everywhere, as discussed
in the comments.
Signed-off-by: deadprogram <ron@hybridgroup.com >
2025-03-11 06:06:31 -07:00
Ayke van Laethem
cab3834bc9
riscv-qemu: add VirtIO RNG device
...
This implements machine.GetRNG() using VirtIO. This gets the tests to
pass for crypto/md5 and crypto/sha1 that use crypto/rand in their tests.
2025-03-11 04:22:16 -07:00
Elias Naur
7f970a45c2
machine: don't block the rp2xxx UART interrupt handler
...
Don't block forever if there's nothing to receive. On the other hand,
process the entire FIFO, not just a single byte.
This fixes an issue where the rp2350 would hang after programming through
openocd, where the UART0 interrupt would be spuriously pending.
2025-03-11 02:01:18 -07:00
Elias Naur
226744a538
machine: correct register address for Pin.SetInterrupt for rp2350 ( #4782 )
...
Fixes #4689
2025-03-09 10:26:38 -03:00
Ayke van Laethem
5a09084c73
os: add stub Symlink for wasm
...
This doesn't do anything, but it makes tests work.
2025-03-07 09:09:13 -08:00
Ayke van Laethem
e49663809b
machine: fix RP2040 Pico board on the playground
...
Right now it doesn't compile, with errors like the following:
# machine
/app/tinygo/src/machine/board_pico.go:7:13: undefined: GPIO0
/app/tinygo/src/machine/board_pico.go:8:13: undefined: GPIO1
/app/tinygo/src/machine/board_pico.go:9:13: undefined: GPIO2
/app/tinygo/src/machine/board_pico.go:10:13: undefined: GPIO3
[...etc...]
This patch should fix that.
2025-03-07 07:20:40 -08:00
Elias Naur
7d6d93f7aa
machine: bump rp2040 to 200MHz ( #4768 )
...
* machine: add support for core voltage adjustments to rp2040
In preparation for bumping the core frequency of the rp2040, this
change implements the required core voltage adjustment logic.
* machine: bump rp2040 to 200MHz
2025-03-04 08:57:59 -03:00
Randy Reddig
9a1cde40a8
src/reflect: implement Value.Equal
...
Implementation copied from Go.
2025-03-03 12:14:30 -08:00
Elias Naur
20fc814635
machine: replace hard-coded cpu frequencies on rp2xxx ( #4767 )
...
Missed from the earlier change that bumped the rp2350 frequency.
2025-03-02 08:38:29 -03:00
Elias Naur
b95effbdd7
machine: bump rp2350 CPUFrequency to 150 MHz ( #4766 )
...
Leave rp2040 speed bump to 200 MHz for a future change, because it
requires bumping the core voltage as well[0].
[0] https://github.com/raspberrypi/pico-sdk/releases/tag/2.1.1
2025-03-01 10:09:53 -03:00
Elias Naur
92c130c7be
machine: compute rp2 clock dividers from crystal and target frequency ( #4747 )
...
Follow-up to #4728 which implemented the algorithm for finding the
dividers.
The calculation is computed at compile time by interp, as verified by
building example/blinky1 for -target pico.
2025-02-28 19:05:27 -03:00
Ayke van Laethem
1545659817
internal/syscall/unix: use our own version of this package
...
The upstream one assumes it's running on a Unix system (which makes
sense), but this package is also used on baremetal. So replace it on
systems that need a replaced syscall package.
2025-02-27 15:45:23 +01:00
Ayke van Laethem
38e3d55e64
all: add Go 1.24 support
2025-02-25 14:41:42 +01:00
Ayke van Laethem
66da29e89f
wasip2: add stubs to get internal/syscall/unix to work
...
This fixes lots of broken tests in stdlib packages in Go 1.24.
2025-02-25 14:41:42 +01:00
Ayke van Laethem
c180d6fe2f
testing: add Chdir
...
This method was added in Go 1.24.
2025-02-25 14:41:42 +01:00
Ayke van Laethem
cdea833b5c
os: add File.Chdir support
...
We should really be using syscall.Fchdir here, but this is a fix to get
Go 1.24 working.
2025-02-25 14:41:42 +01:00
Ayke van Laethem
c2eaa495df
os: implement stub Chdir for non-OS systems
2025-02-25 14:41:42 +01:00
Ayke van Laethem
3476100dd0
syscall: add wasip1 RandomGet
...
This function is needed starting with Go 1.24.
2025-02-25 14:41:42 +01:00
Ayke van Laethem
07c7eff3c3
runtime: add FIPS helper functions
...
Not entirely sure what they're for, but the Go runtime also stores this
information per goroutine so let's go with that.
2025-02-25 14:41:42 +01:00
Ayke van Laethem
a1be8cd9fe
machine/usb/descriptor: avoid bytes package
...
We can't use the bytes package in Go 1.24 since it would result in an
import cycle. Therefore, use bytealg.Index instead.
(I'm not sure this code is correct - just searching for a range of bytes
seems brittle. But at least this commit shouldn't change the code).
2025-02-25 14:41:42 +01:00
Ayke van Laethem
52b9fcd57f
machine: remove bytes package dependency in flash code
...
This also moves flash padding code to a single place, since it was
copied 5 times.
This change is necessary in Go 1.24 to avoid an import cycle.
2025-02-25 14:41:42 +01:00
Ayke van Laethem
a6cd072fa1
Revert "fix: implement testing {Skip,Fail}Now"
...
This reverts commit c5879c682c .
It doesn't look like this is working (see
https://github.com/tinygo-org/tinygo/pull/4736#issuecomment-2679670226 ),
and it doesn't have any tests anyway to prove that it does work. So I
think it's best to revert it for now and add a working implementation
with tests in the future.
2025-02-25 12:38:52 +01:00