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

140 коммитов

Автор SHA1 Сообщение Дата
Ayke van Laethem
67ac4fdd8e nrf: add microbit-s110v8 target
This makes it possible to use Bluetooth on the BBC micro:bit.

Note that you need to use -programmer=cmsis-dap otherwise the SoftDevice
will be erased while flashing something that uses Bluetooth.
2020-05-26 18:50:33 +02:00
Brad Peabody
95f509b109
wasm test suite (#1116)
* wasm: add test suite using headlless chrome
2020-05-23 14:12:01 +02:00
Ayke van Laethem
b5f028e1f7 ci: build .deb files along with .tar.gz files for Debian 2020-05-13 08:39:12 +02:00
Ayke van Laethem
6b8940421e avr: use standard pin numbering
This commit changes pin numbering for atmega328 based boards (Uno, Nano)
to use the standard format, where pin number is determined by the
pin/port. Previously, pin numbers were based on what the Uno uses, which
does not seem to have a clear pattern.

One difference is that counting starts at port B, as there is no port A.
So PB0 is 0, PB1 is 1… PC0 is 8.

This commit also moves PWM code to the atmega328 file, as it may not be
generic to all ATmega chips.
2020-05-12 08:16:34 +02:00
Ayke van Laethem
5ef8c89937 reelboard: add SoftDevice target reelboard-s140v7
Unfortunately, `tinygo flash` doesn't work here. You have to merge the
SoftDevice and the application hex with a mergehex tool and flash that
to the board.
2020-04-11 10:56:58 +02:00
Ayke van Laethem
0afd42c439 main: switch to LLVM 10
This commit also adds a bit of version independence, in particular for
external commands. It also adds the LLVM version to the `tinygo version`
command, which might help while debugging.
2020-04-09 20:23:51 +02:00
Ayke van Laethem
8333c171f4 hifive1-qemu: fix compile error and add smoke test
This probably got broken with this PR:
https://github.com/tinygo-org/tinygo/pull/976
2020-04-07 16:17:10 +02:00
Ayke van Laethem
f316ebc23b all: include picolibc for bare metal targets
This is necessary for better CGo support on bare metal. Existing
libraries expect to be able to include parts of libc and expect to be
able to link to those symbols.

Because with this all targets have a working libc, it is now possible to
add tests to check that a libc in fact works basically.

Not all parts of picolibc are included, such as the math or stdio parts.
These should be added later, when needed.

This commit also avoids the need for the custom memcpy/memset/memcmp
symbols that are sometimes emitted by LLVM. The C library will take care
of that.
2020-03-22 17:14:59 +01:00
Ayke van Laethem
add014f21b avr: add support for tasks scheduler
This adds support for the `-scheduler=tasks` flag for AVR. On most AVR
chips you wouldn't want to run a real scheduler but it may be useful in
some cases, especially on devices with more RAM. It is disabled by
default.
2020-03-20 15:12:05 +01:00
Ayke van Laethem
fbb8efd24c Makefile: allow overriding the llvm-project directory
This allows setting a different directory for experimental changes. For
example, I also have a llvm-project.master directory that tracks the
master branch. It is very useful to be able to temporarily use that
directory:

    make llvm-build.master LLVM_BUILDDIR=llvm-build.master LLVM_PROJECT=llvm-project.master
2020-03-17 21:33:39 +01:00
Ayke van Laethem
5089d1a5a7 avr: add atmega1284 chip support
Not tested on actual hardware, only on simavr. The main motivation for
adding this chip is to be able to run simulated tests using a much
larger memory space (16kB RAM, 128kB flash) without jumping to the XMega
devices that may not be as well supported by LLVM.
2020-03-17 14:46:56 +01:00
Ayke van Laethem
978a0cd9b0 Makefile: fix LLVM tools detection for wasi-libc
This makes the `make wasi-libc` command much more reliable and makes the
CI configuration simpler. Also, it avoids warnings when they are not
relevant.
2020-02-28 14:23:31 +01:00
Wojtek Siudzinski
765440b8ec Add smoke tests 2020-02-18 23:34:56 +01:00
Jaden Weiss
94ec082f6c
Makefile: autodetect llvm-ar and llvm-nm commands 2020-02-18 19:17:28 +01:00
BCG
c721cae48b
machine: add Adafruit CLUE Alpha 2020-02-07 23:49:59 +01:00
Ayke van Laethem
415c60551e runtime/fe310: add support for PLIC interrupts
This commit adds support for software vectoring in the PLIC interrupt.
The interrupt table is created by the compiler, which leads to very
compact code while retaining the flexibility that the interrupt API
provides.
2020-01-27 19:58:39 +01:00
Ayke van Laethem
15c7d93ea9 avr: use a garbage collector
This might sound crazy, but I think it's better to enable the GC by
default to avoid surprises. It costs 1130 bytes of flash and 16 bytes of
RAM (plus heap overhead) so it's not exactly free, but if needed it can
easily be disabled with `-gc=leaking`. On the Uno (32kB flash, 2kB RAM)
that's not massive, on the DigiSpark (8kB flash, 0.5kB RAM) that may be
too much depending on the application.
2020-01-27 19:01:55 +01:00
Ayke van Laethem
aeb2e6f70a all: add Arduino Nano support 2020-01-26 23:24:45 +01:00
Ayke van Laethem
e2aa3789c3 wasm: include wasi-libc
This allows CGo code to call some libc functions. Additionally, by
putting memset/memmove/memcpy in an archive they're not included anymore
when not necessary, reducing code size for small programs.
2020-01-23 16:40:09 +01:00
BCG
ecff6f8e0c Adafruit PyPortal Support (#800)
* machine/PyPortal: implementation, also includes refinements for other members of samd51x familty.
2020-01-06 11:53:43 +01:00
Michael Matloob
1cb9b948bc targets: add target circuitplay-bluefruit
Add a target for the Adafruit Circuit Playground Bluefruit, which is
based on the nRF52840. Adds the necessary code for the machine
package and the json and linker script files in the targets directory.
The machine package code is based on board_circuitplay_express.go,
with modifications made by consulting the wiring diagram on the
adafruit website here:
https://learn.adafruit.com/adafruit-circuit-playground-bluefruit/downloads

Also adds support to the uf2 conversion packacge to set the familyID
field. The Circuit Playground Bluefruit firmware rejects uf2 files
without the family id set to 0xADA52840 (and without the flag specifying
that the family id is present).
2020-01-06 09:23:39 +01:00
Dmitri Goutnik
71a380ce8c Add initial FreeBSD support 2019-12-29 10:48:28 +01:00
Daniel Esteban
c2481b10f4 Added Adafruit's pybadge target (#795)
* machine/pybadge: add support for Adafruit PyBadge board
2019-12-22 19:37:16 +01:00
Ayke van Laethem
cf32607306 tools: rewrite gen-device-svd in Go
This should make it more maintainable. Another big advantage that
generation time (including gofmt) is now 3 times faster. No real attempt
at refactoring has been made, that will need to be done at a later time.
2019-12-14 22:27:45 +01:00
Ayke van Laethem
8d32a7c3a3 builder: use builtin Clang when building statically
This will be a huge help for people installing TinyGo that don't have
LLVM/Clang 9 already installed and in the $PATH variable.
2019-12-11 20:17:35 +01:00
Ayke van Laethem
39d21e21f1 targets: simulate Circuit Playground Express in play.tinygo.org
This requires a number of changes to atsamd21 code. It's not a very
clean separation, but I couldn't come up with a better one.
2019-12-08 13:11:39 +01:00
Ayke van Laethem
d441f0152f riscv: use LLVM tools instead of GNU toolchain
Now that we use LLVM 9, RISC-V support in LLVM has far fewer bugs and we
can avoid the GNU toolchain.

  * replace GNU linker with lld
  * replace GCC with clang

Additionally, RISC-V was promoted to stable so it can be enabled by
default in CI.
2019-12-07 16:27:10 +01:00
Ayke van Laethem
24259cbb5f tools: rewrite gen-device-avr in Go
This brings a big speedup. Not counting gofmt time,
`make gen-device-avr` became about 3x faster. In the future, it might be
an idea to generate the AST in-memory and write it out already
formatted.
2019-12-07 16:04:47 +01:00
Ayke van Laethem
86f48da594 ci: build with Go 1.13 on Windows
The default Go version is 1.12. Because Go 1.13 introduced language
changes (improved numeric constants), TinyGo compiled with Go 1.12
cannot handle Go 1.13 code such as the Go 1.13 standard library.

Use Go 1.13 to build TinyGo on Azure Pipelines to fix this.
2019-11-25 17:47:47 +01:00
Ayke van Laethem
4be80e0372 Revert "all: use compiler-rt from the llvm-project directory"
This reverts commit acdaaa17d8.
See https://github.com/tinygo-org/tinygo/issues/734 for details.
2019-11-25 14:37:52 +01:00
Nikolas Sepos
c09724bfc5 nrf: support for SoftDevice s140 PCA10056 board 2019-11-20 16:43:55 +01:00
Ayke van Laethem
118af9df69 all: switch to LLVM 9 2019-11-16 18:44:27 +01:00
BCG
009b27350e Adding Support for Adafruit Metro M4 Express Airlift (#694)
* machine/metro-m4: add support for Adafruit Metro M4 Express Airlift board
2019-11-15 09:52:54 +01:00
Ayke van Laethem
acdaaa17d8 all: use compiler-rt from the llvm-project directory
We don't need the separate submodule: compiler-rt is already included in
the llvm-project repository.

This should hopefully make CI slightly faster too.
2019-11-13 16:00:22 +01:00
Ayke van Laethem
8e6cb89ceb main: refactor compile/link part to a builder package
This is a large commit that moves all code directly related to
compiling/linking into a new builder package. This has a number of
advantages:

  * It cleanly separates the API between the command line and the full
    compilation (with a very small API surface).
  * When the compiler finally compiles one package at a time (instead of
    everything at once as it does now), something will have to invoke it
    once per package. This builder package will be the natural place to
    do that, and also be the place where the whole process can be
    parallelized.
  * It allows the TinyGo compiler to be used as a package. A client can
    simply import the builder package and compile code using it.

As part of this refactor, the following additional things changed:

  * Exported symbols have been made unexported when they weren't needed.
  * The compilation target has been moved into the compileopts.Options
    struct. This is done because the target really is just another
    compiler option, and the API is simplified by moving it in there.
  * The moveFile function has been duplicated. It does not really belong
    in the builder API but is used both by the builder and the command
    line. Moving it into a separate package didn't seem useful either
    for what is essentially an utility function.
  * Some doc strings have been improved.

Some future changes/refactors I'd like to make after this commit:

  * Clean up the API between the builder and the compiler package.
  * Perhaps move the test files (in testdata/) into the builder package.
  * Perhaps move the loader package into the builder package.
2019-11-11 20:53:50 +01:00
Ayke van Laethem
16fbf53ae2 nrf: add support for SoftDevices to PCA10040 board 2019-11-08 13:08:59 +01:00
BCG
0db403dc0c Adding Board: Feather M4 Express (#688)
* machine/feather-m4: Adding Feather M4
2019-11-05 15:34:46 +01:00
Ayke van Laethem
e7cf75030c main: move target specification into a separate package 2019-11-04 11:45:35 +01:00
Ayke van Laethem
26bdfa9c84 cgo: add bare-bones test 2019-11-03 19:15:38 +01:00
Ayke van Laethem
2a5ab2500d machine: add support for the X9 Pro smartwatch
This is a Chinese smart watch sold on AliExpress etc. It is based on a
nrf52832. More information:
https://github.com/curtpw/nRF5x-device-reverse-engineering/tree/master/X9-nrf52832-activity-tracker
2019-11-03 17:28:32 +01:00
Ron Evans
3ec94a06ed gen-device: correct source for SiFive SVD files
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-10-31 13:07:51 +01:00
Ayke van Laethem
a4642ddf59 Makefile: add simulated boards to smoke tests
One board (pca10040) was already tested. To make sure stuff doesn't
break in the future, test all the other boards too.
2019-10-29 13:10:50 +01:00
Ayke van Laethem
ceece08959 nrf: add support for the PineTime64 devkit
This smartwatch doesn't have an on-board debugger, so I picked the one I
was using while getting this smartwatch to run Go programs (the J-Link
EDU Mini).
2019-10-28 07:17:39 +01:00
Ayke van Laethem
8dc0deaf46 Makefile: add systick example to smoke tests
This makes sure future changes will at least keep the example code
compiling.
2019-10-25 15:58:18 +02:00
Ayke van Laethem
7369a0e7f2 all: add support for Windows 2019-10-17 00:14:59 +02:00
Jaden Weiss
81c0f9af4e try adding assertions to CI 2019-09-27 10:57:35 +02:00
Elliott Sales de Andrade
9aace79298 Allow overridding Python used for generators. 2019-09-25 12:04:38 +02:00
Ayke van Laethem
4ea1559d46 interp: add basic test to interp package
More tests should be added in the future, but this is a start.
2019-09-24 18:16:43 +02:00
Jaden Weiss
17ef7a5c32
all: add support for go 1.13 2019-09-24 16:13:26 +02:00
Ayke van Laethem
076699add8 Makefile: add md5sum to smoketest
This makes it much easier to check whether a binary changed at all, to
avoid having to test it on real hardware.
2019-09-24 10:23:58 +02:00