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

452 коммитов

Автор SHA1 Сообщение Дата
John Clark
45c8817ddd Support for the Espressif ESP32-C3-DevKit-RUST-1 development board
Signed-off-by: John Clark <inindev@gmail.com>
2023-01-29 22:50:12 +01:00
John Clark
1adfdf8fa5 Support for Makerfabs ESP32C3SPI35 TFT Touchscreen board
Signed-off-by: John Clark <inindev@gmail.com>
2023-01-26 20:16:11 +01:00
Olivier Fauchon
7fa13ed0a6 Target MCU was not properly defined for LGT92 target
Change openocd interface from stlink-v2 to stlink (interface/stlink-v2.cfg is deprecated)
2023-01-25 14:11:28 +01:00
Adrian Cole
334a12818d Allows the emulator to expand {tmpDir}
This allows you to expand {tmpDir} in the json "emulator" field, and
uses it in wasmtime instead of custom TMPDIR mapping logic.

Before, we had custom logic for wasmtime to create a separate tmpDir
when running go tests. This overwrite the TMPDIR variable when running,
after making a mount point. A simpler way to accomplish the end goal of
writing temp files is to use wasmtime's map-dir instead. When code is
compiled to wasm with the wasi target, tempDir is always /tmp, so we
don't need to add variables (since we know what it is). Further, the
test code is the same between normal go and run through wasmtime. So, we
don't need to make a separate temp dir first, and avoiding that reduces
logic, as well makes it easier to swap out the emulator (for wazero
which has no depedencies). To map the correct directory, this introduces
a {tmpDir} token whose value is the host-specific value taken from
`os.TempDir()`.

The motivation I have for this isn't so much to clean up the wasmtime
code, but allow wazero to execute the same tests. After this change, the
only thing needed to pass tests is to change the emulator, due to
differences in how wazero deals with relative lookups (they aren't
restricted by default, so there's not a huge amount of custom logic
needed).

In other words, installing wazero from main, `make tinygo-test-wasi`
works with no other changes except this PR and patching
`targets/wasi.json`.
```json
	"emulator":      "wazero run -mount=.:/ -mount={tmpDir}:/tmp {}",
```

On that note, if there's a way to override the emulator via arg or env,
this would be even better, but in any case patching json is fine.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-01-19 20:06:18 +01:00
Thomas Richner
05ec4e6bd0 Support for Adafruit Feather M0 Express board 2023-01-11 10:07:11 +01:00
BCG
481aba6536 board: Adafruit KB2040 (https://www.adafruit.com/product/5302) 2022-12-22 11:49:31 +01:00
Jesús Espino
e71e289e8b
Add basic atmega32u support (#3337)
machine/atmega32u: add support for arduino leonardo
2022-12-20 16:57:55 +01:00
Jesús Espino
d304e6706b
Adding support for waveshare rp2040-zero (#3321)
machine: adding support for waveshare rp2040-zero
2022-12-19 12:15:03 +01:00
Ron Evans
69a284bd36 Revert "Bump CMSIS to 5.9.0"
This reverts commit 92be61534e.
2022-12-16 21:26:49 +01:00
Anton D. Kachalov
92be61534e Bump CMSIS to 5.9.0 2022-12-16 15:42:35 +01:00
Ayke van Laethem
4d14d3cd54 avr: support ThinLTO
ThinLTO results in a small code size reduction, which is nice
(especially on these very small chips). It also brings us one step
closer to using ThinLTO everywhere.
2022-11-18 18:40:38 +01:00
Ayke van Laethem
bb5050a50d avr: fix .data initialization for binaries over 64kB
I found that .data is not correctly initialized with firmware images
that use over 64kB of flash. The problem is that the data in .data
(which is stored in flash, and copied to RAM at reset) is beyond the
64kB limit and must therefore be loaded using the elpm instruction
instead of the lpm instruction.

I encountered this issue while getting testdata/math.go to work for AVR.
The following command mostly works with this patch, while it prints
garbage withtout it:

    tinygo run -target=simavr -size=short -scheduler=none ./testdata/math.go

(This also requires a patch to picolibc to work, see
https://github.com/picolibc/picolibc/pull/371)

It still doesn't work entirely with this patch: some of the math
operations have an incorrect result. But at least it's an improvement as
it won't print garbage anymore.
2022-11-14 22:22:26 +01:00
Ayke van Laethem
df888acd5e avr: drop GNU toolchain dependency
- Use compiler-rt and picolibc instead of avr-libc.
  - Use ld.lld instead of avr-ld (or avr-gcc).

This makes it much easier to get started with TinyGo on AVR because
installing these extra tools (gcc-avr, avr-libc) can be a hassle.
It also opens the door for future improvements such as ThinLTO.

There is a code size increase but I think it's worth it in the long run.
The code size increase can hopefully be reduced with improvements to the
LLVM AVR backend and to compiler-rt.
2022-11-06 09:05:05 +01:00
Ayke van Laethem
9e34ca9e5f esp: use LLVM Xtensa linker instead of Espressif toolchain
The Espressif fork of LLVM now has Xtensa support in the linker LLD.
(This support was written mosly by me). This means we don't have to use
the Espressif GNU toolchain anymore and makes installing TinyGo simpler.

In the future, this also paves the way for ThinLTO support. Right now it
is mostly just a way to simplify TinyGo installation and speed up CI
slightly.
2022-11-04 09:11:21 +01:00
Ayke van Laethem
2b7f562202 ci: add support for LLVM 15
This commit switches to LLVM 15 everywhere by default, while still
keeping LLVM 14 support.
2022-10-19 22:23:19 +02:00
Ayke van Laethem
0ddcf4af96 riscv: add "target-abi" metadata flag
This flag is necessary in LLVM 15 because it appears that LLVM 15 has
changed the default target ABI from lp64 to lp64d. This results in a
linker failure. Setting the "target-abi" forces the RISC-V backend to
use the intended target ABI.
2022-10-19 22:23:19 +02:00
Ayke van Laethem
65d65c1313 wasm: fix GC scanning of allocas
Scanning of allocas was entirely broken on WebAssembly. The code
intended to do this was never run. There were also no tests.

Looking into this further, I found that it is actually not really
necessary to do that: the C stack can be scanned conservatively and in
fact this was already done for goroutine stacks (because they live on
the heap and are always referenced). It wasn't done for the system stack
however.

With these fixes, I believe code should be both faster *and* more
correct.

I found this in my work to get opaque pointers supported in LLVM 15,
because the code that was never reached now finally got run and was
actually quite buggy.
2022-10-19 18:36:53 +02:00
Ayke van Laethem
c153239682 targets: remove "acm:"` prefix for USB vid/pid pair
This prefix isn't actually used and only adds noise, so remove it.

It may have been useful on Linux that makes a distinction between
/dev/ttyACM* and /dev/ttyUSB* but it isn't now. Also, it's unlikely that
the same vid/pid pair will be shared between an acm and usb driver
anyway.
2022-10-16 10:02:48 +02:00
Ayke van Laethem
a62044d89b targets: do not set stack size per board
The needed stack size is hard to determine by the compiler. It will try,
but will fail in many common cases. Therefore, the runtime will pick a
fixed stack size.

There is a tradeoff between avoiding stack overflows and wasting RAM.
This tradeoff depends on the application: some don't need large stack
sizes but do need a lot of memory, while others need deep stacks but
aren't so memory constrained. That's why I've added a flag to do this on
the command line: https://github.com/tinygo-org/tinygo/pull/3159

It may be reasonable to use a different stack size per chip, for example
chips with lots of RAM could default to a larger stack size. But I don't
think it's a good idea to do this per board.
2022-10-14 13:36:42 +02:00
sago35
aca1ad187d targets: remove usbpid of bootloader
For more information, see
https://github.com/tinygo-org/tinygo/pull/3168
2022-09-17 11:00:31 +02:00
sago35
4af530f238 wioterminal: remove serial-port setting of bootloader 2022-09-16 20:12:47 +02:00
Isaac Rodman
7366d5e185 Set default-stack-size to 4096, and remove NEOPIXELS pluralization for qtpy-rp2040 2022-09-09 11:05:12 +02:00
Ayke van Laethem
8bbfb1ee68 wasm: do not allow undefined symbols
--allow-undefined can be a problem: it allows compiling code that will
fail when loaded. This change makes sure that if some symbols are
undefined, they are reported as an error by the linker.

Previously, people could get away with importing a function that was not
defined, like this:

    func add(int a, int b) int

    func test() {
        println(add(3, 5))
    }

This was always unintended but mostly worked. With this change, it isn't
possible anymore. Now every function needs to be marked with //export
explicitly:

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

    func test() {
        println(add(3, 5))
    }

As before, functions will be placed in the `env` module with the name
set from the `//export` tag. This can be overridden with
`//go:import-module`:

    //go:import-module math
    //export add
    func add(int a, int b) int

    func test() {
        println(add(3, 5))
    }

For the syscall/js package, I needed to give a list of symbols that are
undefined. This list is based on the JavaScript functions defined in
targets/wasm_exec.js.
2022-09-08 08:25:27 +02:00
Yurii Soldak
d7814ff50b targets: fix build tag duplicates
and add missing targets to smoke test
2022-09-03 08:31:27 +02:00
Ayke van Laethem
472aecf07a targets: remove hifive1-qemu target
This target was added purely for running tests, and it is currently
unused. When I try to use it, it causes runtime exceptions.
The replacement riscv-qemu is much better behaved.

This doesn't drop support for any actual hardware, the HiFive 1 B will
remain supported.
2022-09-02 16:35:05 +02:00
Isaac Rodman
09350e5719 Add qtpy-rp2040 to TinyGo v0.25.0 2022-09-02 15:06:37 +02:00
Yurii Soldak
f094e895c5 p1am-100: remove duplicate build tags 2022-08-29 09:44:03 +02:00
Matt Schultz
ef912a132d machine: Add support for Adafruit QT2040 board. 2022-08-28 10:16:52 +02:00
Yurii Soldak
fb603a471c boards: Add XIAO ESP32C3 board 2022-08-26 12:44:04 +02:00
Daniel Esteban
aa13b5d83b Add Pimoroni's Tufty2040 board 2022-08-24 13:50:02 +02:00
Yurii Soldak
2365c7cfec nrf52: cleanup s140v7 uf2 targets 2022-08-07 12:58:36 +02:00
Yurii Soldak
a5d28bdcca nrf52: cleanup s140v6 uf2 targets 2022-08-07 11:27:49 +02:00
Ayke van Laethem
c4392d9472 all: rename assembly files to .S extension
The Go tools only consider lowercase .s files to be assembly files. By
renaming these to uppercase .S files they won't be discovered by the Go
toolchain and listed as the SFiles to be assembled.

There is a difference between .s and .S: only uppercase .S will be
passed through the preprocessor. Doing that is normally safe, and
definitely safe in the case of these files.
2022-08-04 15:43:42 +02:00
Kenneth Bell
5026047cde rp2040: make picoprobe default openocd interface 2022-07-28 06:48:46 +02:00
deadprogram
1f43f32aae target: add gopherbot and gopherbot2 aliases to simplify for newer users
Signed-off-by: deadprogram <ron@hybridgroup.com>
2022-07-26 08:06:24 +02:00
sago35
5271bd8cfa xiao-ble: add support for flash-1200-bps-reset 2022-07-21 08:31:28 +02:00
Ayke van Laethem
610e7fd16a boards: Add MCH2022 badge
I haven't fully tested this badge because I don't have the physical
hardware but I have followed the pinout from the website.
2022-07-16 08:31:22 +02:00
sago35
f370cd18fc rp2040: add support for EnterBootloader() 2022-07-15 09:41:32 +02:00
sago35
58f2533f15 rp2040: change default for serial to usb 2022-07-14 09:18:21 +02:00
Kenneth Bell
1d99b1ed84 boards: add Challenger RP2040 LoRa 2022-07-08 13:01:14 +02:00
Daniel Esteban
b112477e95 Initial support for XIAO RP2040 2022-07-06 22:23:47 +02:00
sago35
7eaad62568 feather-rp2040,macropad-rp2040: fix qspi-flash settings 2022-07-05 16:37:45 +02:00
sago35
1766746c60 rp2040: add usb settings 2022-07-04 13:17:54 +02:00
Damian Gryski
07049b87b6 targets: make leveldb runtime hash default for wasi 2022-07-03 19:27:54 +02:00
Ayke van Laethem
b5c5d95b68 wasm: use newer WebAssembly features
This commit will start to use a few more WebAssembly features, such as
bulk memory operations. This results in a significant code size saving.
How much it saves varies a lot but it's typically around 1300 bytes.

This change is possible by bumping our minimum Node.js version to 14.
The previous LTS version (12) has been marked end of life, so we can
start to depend on features in the current oldest LTS version, which is
version 14. Browsers have been supporting these features for a long time
now, it's just Node.js that prevented us doing this before.
2022-06-21 08:55:42 +02:00
Ayke van Laethem
8d6b210c09 compiler: implement recover() built-in function 2022-06-16 07:59:21 +02:00
deadprogram
f308d7d28c machine/badger2040: support for Badger 2040
Signed-off-by: deadprogram <ron@hybridgroup.com>
2022-05-24 15:02:23 +02:00
Ayke van Laethem
109b5298c4 avr: use compiler-rt
This change adds support for compiler-rt, which supports float64 (unlike
libgcc for AVR). This gets a number of tests to pass that require
float64 support.

We're still using libgcc with this change, but libgcc will probably be
removed eventually once AVR support in compiler-rt is a bit more mature.

I've also pushed a fix for a small regression in our
xtensa_release_14.0.0-patched LLVM branch that has also been merged
upstream. Without it, a floating point comparison against zero always
returns true which is certainly a bug. It is necessary to correctly
print floating point values.
2022-05-18 15:20:09 +02:00
Ayke van Laethem
a94e03eff2 avr: get go test -target=simavr to work
This patch changes two things:

 1. It changes the default stack size. Without this change, the
    goroutine.go test doesn't pass (apparently there's some memory
    corruption).
 2. It moves the excluded tests so that they are skipped with a regular
    `-target=simavr`, not just when running all tests (without
    `-target`).
2022-05-18 15:20:09 +02:00
Ayke van Laethem
5c23f6fb6c all: remove support for LLVM 11 and LLVM 12
This removes a lot of backwards compatibility cruft and makes it
possible to start using features that need LLVM 13 or newer.
For example:

  * https://github.com/tinygo-org/tinygo/pull/2637
  * https://github.com/tinygo-org/tinygo/pull/2830
2022-05-07 17:15:35 +02:00