Граф коммитов

2496 коммитов

Автор SHA1 Сообщение Дата
Elias Naur
bd7ab8ddd5 targets,runtime,machine: add support for the stm32f469-disco board
The LEDs and button work; I haven't tested the SPI and I2C
configuration.
2021-12-31 10:30:48 +00:00
Elias Naur
302e72e84f machine: add PG* and PK* pins
They're used for LEDs on the STM32F469-Discovery board.
2021-12-31 10:30:48 +00:00
Elias Naur
55ca5287fe runtime: separate runtime initialization for STM32F4 boards
The STM32F469 can use the same initialization as the existing STM32F407
with a few frequency tweaks. This change splits the generic
initialization code into a separate runtime_stm32f4.go file, leaving
only the 407 board specific constants in the existing
runtime_stm32f407.go file.

Note that runtime_stm32f405.go initialization seems semantically similar
to the 407, but I don't have enough confidence in merging 405 with 407
in this change.
2021-12-31 10:30:48 +00:00
Elias Naur
11ee0969b6 machine: merge stm32f405/407
They're no longer functionally different.
2021-12-31 10:30:48 +00:00
Elias Naur
81dbbc89d3 machine: make machine_stm32f407.go equivalent to machine_stm32f405.go
The only differences are a more general SPI.getBaudRate and a different
frequency limit in I2C.getFreqRange.

This is a first step towards adding stm32f469 support: a follow-up
merges machine_stm32f407.go and machine_stm32f405.go, another adds
frequency tweaks for stm32f469.
2021-12-31 10:30:48 +00:00
Nia Waldvogel
a4f9e5e552 targets (wasi/wasm): raise default stack size to 16 KiB
In some cases, 8 KiB is not enough for both the C stack and the asyncify stack.
This gets the compress/zlib tests to fail without crashing.
2021-12-30 12:20:04 -05:00
Nia Waldvogel
f9f2349850 tinygo test: simplify output buffering 2021-12-30 12:03:12 -05:00
Nia Waldvogel
f1b15db258 main (tinygo test): reduce memory use when compiling a large number of packages
This change adds an additional semaphore to tinygo test that limits the number of tests being processed simultaneously (in addition to the existing limit on build jobs and runs).
When running a large number of tests, this limits the number of copies of per-test data stored in memory (avoiding an OOM in CI).
2021-12-30 12:03:12 -05:00
Nia Waldvogel
12e314ccc9 main (tinygo test): build and run tests in concurrently 2021-12-30 12:03:12 -05:00
Nia Waldvogel
e594dbc133 builder: refactor job runner and use a shared semaphore across build jobs
Switching to a shared semaphore allows multi-build operations (compiler tests, package tests, etc.) to use the expected degree of parallelism efficiently.

While refactoring the job runner, the time complexity was also reduced from O(n^2) to O(n+m) (where n is the number of jobs, and m is the number of dependencies).
2021-12-30 12:03:12 -05:00
Nia Waldvogel
bb08a25edc main (test): remove global build lock 2021-12-30 12:03:12 -05:00
sago35
b7b7713526 docker: update Dockerfile for xtensa-esp32-elf-ld 2021-12-30 15:50:43 +01:00
Dmitriy
92150bd1c5 Interrupt based time. Adjust tick cost when timer-0 is reconfigured (the time precision affected when timer-0 reconfigured). Keep all time in nanoseconds.
Interrupt based time. Adjust tick cost every 1 minute and when timer-0 is reconfigured (the time precision affected when timer-0 reconfigured). Keep all time in nanoseconds.
2021-12-30 11:39:28 +01:00
Kenneth Bell
d0633f6228 all: go-llvm that defaults to llvm-12 2021-12-29 16:53:25 +01:00
Arsen Musayelyan
d46933abf2 Use os.Stat instead of os.ReadDir as that was added in 1.16 2021-12-29 12:05:51 +01:00
Arsen Musayelyan
26625f5a22 Check for /run/media on Linux for non-debian-based distros 2021-12-29 12:05:51 +01:00
Ayke van Laethem
3e109fca5f builder: use build ID as cache key
Instead of storing an increasing version number in relevant packages
(compiler.Version, interp.Version, cgo.Version, ...), read the build ID
from the currently running executable. This has several benefits:

  * All changes relevant to the compiled packages are caught.
  * No need to bump the version for each change to these packages.
    This avoids merge conflicts.
  * During development, `go install` is enough. No need to run
    `tinygo clean` all the time.

Of course, the drawback is that it might be updated a bit more often
than necessary but I think the overall benefit is big.

Regular release users shouldn't see any difference. Because the tinygo
binary stays the same, the cache works well.
2021-12-28 18:29:05 -05:00
Nia Waldvogel
763a86cd8e loader: elminate goroot cache inconsistency
This change breaks the merged goroot creation process into 2 steps:
1. List all overrides
2. Construct a goroot with the specified overrides

Now step 2 is cached using a hash of the results from step 1.
This eliminates cache inconsistency, but means that step 1 needs to be run on every build.
This is relatively acceptable, as step 1 only takes about 3 ms (assuming the directory tree is in the OS filesystem cache).
2021-12-28 18:01:15 -05:00
Nia Waldvogel
13a3c4b155 Makefile: update tool search for LLVM 12 2021-12-28 17:33:22 -05:00
Nia Waldvogel
9fa667ce63 rumtime: implement __sync libcalls as critical sections
This change implements __sync atomic polyfill libcalls by disabling interrupts.
This was previously done in a limited capacity on some targets, but this change uses a go:generate to emit all of the calls on all microcontroller targets.
2021-12-28 22:12:03 +01:00
kenbell
8bd39d2fc2
Merge pull request #2427 from eliasnaur/remove-arrtype
Remove unused arrtype from package runtime
2021-12-28 19:18:35 +00:00
Nia Waldvogel
c685e0696a os: add Perm stub on Go 1.15
This adds a stub for Perm on Go 1.15, which allows the OS package to compile again.
2021-12-26 16:04:19 -05:00
Nia Waldvogel
9db8826b3b interp: run goroutine starts and checks at runtime
This change prevents interp from trying to execute goroutine starts or checks.
This fixes a bug where a goroutine started by an init function would run before the init function.
2021-12-24 09:10:21 +01:00
Dan Kegel
0aed62efe4 Makefile: add tinygo-test-wasi; like tinygo-test but with -target wasi 2021-12-24 01:20:59 +01:00
Olivier Fauchon
2b1a72d112 stm32wlx: I2C implementation for gnse,lora-e5,nucleo-wl55jc boards 2021-12-23 23:45:28 +01:00
Elias Naur
a6837f05a4 runtime: remove unused arrtype type aliases
The arrtype aliases are used in the machine package.
2021-12-23 22:07:49 +01:00
Dmitriy
c35ce761aa Merge duplicate registers into a single record and merge they bitfields. 2021-12-23 15:14:06 +01:00
Dmitriy
d2963b153e Add *_Msk for each bit field and avoid duplicate fields in the output file 2021-12-23 15:14:06 +01:00
Nia Waldvogel
f9293645af builder: use flock to avoid double-compiles
This change uses flock (when available) to acquire locks for build operations.
This allows multiple tinygo processes to run concurrently without building the same thing twice.
2021-12-23 08:28:08 +01:00
Nia Waldvogel
38305399a3 sync: add tests 2021-12-22 11:02:45 +01:00
deadprogram
8f2082df69 docker: remove only subdirectories (which are updated as submodules) from lib to keep picolibc file in its correct place
Signed-off-by: deadprogram <ron@hybridgroup.com>
2021-12-22 08:06:28 +01:00
deadprogram
da8eb521e1 build: update XCode version for CircleCI builds to 11.4.1 due to deprecations
Signed-off-by: deadprogram <ron@hybridgroup.com>
2021-12-21 19:01:19 +01:00
deadprogram
dc53a59c49 docker: have to copy build results to GOPATH at the very end of docker build
Signed-off-by: deadprogram <ron@hybridgroup.com>
2021-12-20 13:36:08 -05:00
Nia Waldvogel
f21fdd1f76 sync: add a package doc 2021-12-20 13:35:57 -05:00
Nia Waldvogel
5e719b0d3d sync: fix concurrent read-lock on write-locked RWMutex
This bug can be triggered by the following series of events:
A acquires a write lock
B starts waiting for a read lock
C starts waiting for a read lock
A releases the write lock

After this, both B and C are supposed to be resumed as a read-lock is available.
However, with the previous implementation, only C would be resumed immediately.
Other goroutines could immediately acquire the read lock, but B would not be resumed until C released the read lock.
2021-12-20 13:35:57 -05:00
Damian Gryski
9eb13884de compileopts,targets: replace '{root}' in target files 2021-12-20 13:13:32 -05:00
Damian Gryski
85031d6df7 tinygo: set cmd.Dir even when running emulators
This allows compress/bzip2 to pass with -target=wasi

Fixes #2367
2021-12-20 13:13:32 -05:00
Alan Wang
58b44f9f17 Update board_microbit-v2.go 2021-12-18 14:03:19 +01:00
Damian Gryski
c0ea21ece7 src/reflect: add test for indirect array indexing 2021-12-18 10:02:36 +01:00
Damian Gryski
81edf577a3 src/reflect: add test for indirect pointer fix 2021-12-18 10:02:36 +01:00
Damian Gryski
484bb8f13d src/reflect: fix stripPrefix comment 2021-12-18 10:02:36 +01:00
Damian Gryski
ae1e7731a4 src/reflect: comment out a now-failing test
Keys() is unimplemented, which is required to compare
these two maps.
2021-12-18 10:02:36 +01:00
Damian Gryski
518745ea79 src/reflect: make sure indirect pointers are handled correctly
Fixes #2370
Fixes #2323
2021-12-18 10:02:36 +01:00
Damian Gryski
38b14706e2 internal/task: fix two missed instances of extalloc 2021-12-17 17:36:49 -05:00
Nia Waldvogel
747336f0a9 runtime: remove extalloc
The extalloc collector has been broken for a while, and it doesn't seem reasonable to fix right now.
In addition, after a recent change it no longer compiles.
In the future similar functionality can hopefully be reintroduced, but for now this seems to be the most reasonable option.
2021-12-17 18:15:18 +01:00
Nia Waldvogel
e4de7b4957 internal/task: swap stack chain when switching goroutines
This change swaps the stack chain when switching goroutines, ensuring that the chain is maintained consistently.
This is only really currently necessary with asyncify on wasm.
2021-12-17 10:01:11 +01:00
Nia Waldvogel
d5c0083085 builder: handle concurrent library header rename
When a library is built concurrently by multiple TinyGo processes, they may sometimes both build the headers.
In that case a directory rename may fail due to conflict.
This change detects and handles the conflict similar to how GOROOT construction does.
2021-12-17 09:33:28 +01:00
Nia Waldvogel
e6fbad13c6 runtime (gc): correct scan bounds
This fixes 2 bugs in the GC scan bounds:
1. On AVR, the GC could sometimes read one byte past the end of a block due to the difference between pointer size and alignment.
2. On WASM, the linker does not properly align the marker for the end of the globals section. A manual alignment operation has been added to markGlobals to work around this.
2021-12-17 09:26:44 +01:00
Dan Kegel
62bda8e129 os: os_chmod_test.go: fix copyright 2021-12-16 16:36:53 -05:00
Dan Kegel
51d6ffb3be os: Chmod: don't test on wasi yet, wasi-libc does not yet support it
Lets "tinygo test -target wasi os" compile, if not pass.

For https://github.com/tinygo-org/tinygo/issues/2369
2021-12-16 16:36:53 -05:00