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

1277 коммитов

Автор SHA1 Сообщение Дата
Ayke van Laethem
ed9b2dbc03 runtime/hifive1: use CLINT peripheral for timekeeping
The CLINT is implemented both on the fe310-g002 chip and in the sifive_e
QEMU machine type. Therefore, use that peripheral for consistency.

The only difference is the clock speed, which runs at 10MHz in QEMU for
some reason instead of 32.768kHz as on the physical HiFive1 boards.
2020-01-10 08:04:13 +01:00
Ayke van Laethem
3e521f710a compiler: add support for debugging globals
This makes most globals visible from GDB, using `info variables`.
2020-01-07 20:20:19 +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
Jaden Weiss
7363bdc298 Add Jaden Weiss to CONTRIBUTORS 2020-01-06 09:24:20 +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
Ayke van Laethem
25cff20117 interp: error location for "unknown GEP" error
This commit removes a panic and replaces it with a proper source
location. The message still isn't very helpful, but at least it points
to a location in the source code.

I'm not very happy with all the `err.Error()` calls, but that's the way
to fit this in a `scanner.Error`. Eventually we should make a
replacement for `scanner.Error` that does proper wrapping of the
original error message.
2020-01-05 13:45:23 +01:00
Ayke van Laethem
ec467da83c ci: produce zip as artifact in Azure Pipelines
Zip files are far more often used on Windows systems, so we provide zip
files in releases. Unfortunately, previously the provided artifact in CI
was really just a compressed .tar.gz file, which defeats the purpose.

This commit zips the release tarball itself so it can be downloaded as
an artifact.
2020-01-05 12:43:21 +01:00
BCG
5f77447e1a Adding code use 12-bit resolution for ADC and to clear previous ADC INPUTCTRL before subsequent read 2020-01-05 12:34:47 +01:00
Ayke van Laethem
27fafb7ab5 runtime: fix atsamd51 volatile usage
It was still using the (long removed) //go:volatile pragma for volatile
variables, thus it was only accidentally working.
2020-01-05 12:08:33 +01:00
Ayke van Laethem
d1cc3c109d compiler: add globaldce pass to start of optimization pipeline
This reduces code size in a few cases when tested against the drivers
smoketests (although there was one minor increase) without significantly
increasing compile time. In fact, in my testing compile time appears to
be going down a little bit (around 1%, within the noise).
2020-01-05 11:37:26 +01:00
Ayke van Laethem
0933577e60 compiler: improve "function redeclared" error
This error can normally only happen with //go:linkname and such, but
it's nice to get an informative error message in that case.
2020-01-04 10:24:14 +01:00
Ayke van Laethem
69c1d802e1 loader: improve error messages for failed imports
Add location information (whenever possible) to failed imports. This
helps in debugging where an incorrect import came from.

For example, show the following error message:

    /home/ayke/src/github.com/tinygo-org/tinygo/src/machine/machine.go:5:8: cannot find package "foobar" in any of:
        /usr/local/go/src/foobar (from $GOROOT)
        /home/ayke/src/foobar (from $GOPATH)

Instead of the following:

    error: cannot find package "foobar" in any of:
        /usr/local/go/src/foobar (from $GOROOT)
        /home/ayke/src/foobar (from $GOPATH)
2020-01-04 00:01:07 +01:00
Ayke van Laethem
b424056721 cgo: fix a bug in number tokenization 2020-01-03 23:44:58 +01:00
Ayke van Laethem
d735df6e16 cgo: add support for symbols 2020-01-03 23:44:58 +01:00
Ayke van Laethem
d37bbadb54 machine/arduino-nano33: fix UART1 and UART2
UART2 was configured with the wrong SERCOM for the used pins (PB22 and
PB23). However, after changing the SERCOM from 3 to 5 that led to a
conflict with UART1 (used for the on-board WiFi). But the used pins are
also usable from SERCOM 3, so in the end I switched SERCOM5 and SERCOM3
around.

With this change, I was able to get examples/echo working.
2020-01-03 23:25:37 +01:00
Ayke van Laethem
ab7dc45288 wasm: implement memcpy and memset
This was reported in issue #805.
2019-12-30 20:51:46 +01:00
Jaden Weiss
eee1b995f6 revise defer to use heap allocations when running a variable number of times 2019-12-30 18:12:40 +01:00
Ayke van Laethem
a4fa41b49d compiler: don't crash when encountering types.Invalid
This commit fixes a crash when trying to compile the following (invalid)
code:

    package main

    import "unsafe"

    func main() {
    }

    type Foo struct {
       x DoesNotExist
    }

    const foo = unsafe.Sizeof(Foo{})

This commit fixes this situation. The result is a regular error message,
indicating that DoesNotExist is not defined.
2019-12-30 13:40:37 +01:00
Ayke van Laethem
a5a90a57b9 main: remove getting a serial port in gdb subcommand
Remove this code for two reasons:

 1. It is not needed.
 2. It breaks `tinygo gdb` for debugging QEMU targets (such as
    cortex-m-qemu).
2019-12-29 19:41:24 +01:00
Dmitri Goutnik
71a380ce8c Add initial FreeBSD support 2019-12-29 10:48:28 +01:00
Ayke van Laethem
3b2a4b64c5 main: kill tests if they run too long
Sometimes, tests suddenly hang somewhere (in particular in emulators
where crashes often lead to hangs). Setting a limit has two advantages:

  1. Quickly killing test processes that are frozen (as opposed to
     waiting for the default 10min go test timeout).
  2. The output becomes visible, hopefully giving a clue what went
     wrong.
2019-12-28 21:10:13 +01:00
Ayke van Laethem
184827e4d8 riscv: support sleeping in QEMU
QEMU doesn't support the RTC peripheral yet so work around it for now.

This makes the following command work:

    tinygo run -target=hifive1-qemu ./testdata/coroutines.go
2019-12-26 09:57:58 +01:00
Ayke van Laethem
14474e7099 compiler: fix assertion on empty interface
This fixes issue #453.
2019-12-26 09:20:22 +01:00
Ron Evans
3656ac2fc9 main: increment version to 0.12-dev
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-12-24 19:48:38 +01:00
Ayke van Laethem
08f01ba3ff riscv: improve startup assembly
Now that we've switched to LLVM 9, we don't need a workaround anymore
for the 'la' pseudo-instruction.
2019-12-24 19:00:22 +01:00
Ayke van Laethem
699312f477 ci: remove symlink creation
These symlinks are now unnecessary because Clang (and previously lld)
have been integrated into TinyGo.
2019-12-24 08:59:33 +01:00
Ayke van Laethem
9644edcd5a builder: update Clang header location
We have long since moved towards a different location for these headers
in the git checkout, so update where getClangHeaderPath looks for these
headers.

Also add an extra check to make sure a path has been detected.
2019-12-24 08:59:33 +01:00
Ayke van Laethem
46325910c5 ci: increase Azure Pipelines timeout to 4 hours
3 hours is too close to the edge. Extend to 4 hours to make sure a build
including LLVM build will finish before the deadline.
2019-12-24 08:49:04 +01:00
Ayke van Laethem
923c2e7ada main: version 0.11.0 2019-12-23 16:37:59 +01:00
Ron Evans
18e446561d flash: use more precise searches for correct volume/port with default Windows matching
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-12-23 16:09:58 +01:00
Ron Evans
447537aebe flash: use win32 wmi to try to find UF2 and COM ports
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-12-23 16:09:58 +01:00
Ayke van Laethem
74e32acf33 compiler: improve error locations in goroutine lowering 2019-12-23 08:33:04 +01:00
Ayke van Laethem
072f8c354e interp: add runtime fallback for mapassign operations
Some mapassign operations cannot (yet) be done by the interp package.
Implement a fallback mechanism so that these operations can still be
performed at runtime.
2019-12-23 08:15:09 +01:00
Daniel Esteban
0587934a44 added missing pinetime devkit to list of suppoerted boards/targets 2019-12-22 21:23:07 +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
d41f01f003 main: avoid leaving files open
Eventually, open files should be closed when the GC runs and the
finalizer is called. However we shouldn't rely on that.

Using `ioutil.ReadFile` as it's a simpler pattern anyway.
2019-12-21 23:12:13 +01:00
Ayke van Laethem
5a70c88483 transform: make reflection sidetables constant globals
These globals are (and must be!) never modified by the reflect package.
By marking them as constant, they will be put in read-only memory. This
reduces RAM consumption on microcontrollers.
2019-12-21 22:59:23 +01:00
Ayke van Laethem
5510dec846 compiler: add location information to the IR checker 2019-12-21 20:49:51 +01:00
Ayke van Laethem
dffb9fbfa7 tools: use byte padding to skip unused register ranges
This simplifies the code. The fields are blank anyway so there is no way
to access them anyway (volatile or not).
Also do some other related simplifications of the code that result from
this change.
2019-12-21 19:59:41 +01:00
Jaden Weiss
525ded3d90 run tests partially in parallel 2019-12-21 12:22:59 +01:00
Ayke van Laethem
ec2658ca79 interp: remove accidental debug print
Accidentally left in the source in
https://github.com/tinygo-org/tinygo/pull/787.
2019-12-20 14:47:20 +01:00
Ayke van Laethem
2004555fe2 interp: check whether the map update key/value are constant
This is a limitation in the PutString/PutBinary calls, make sure that
they won't get non-constant values as a safety measure.
2019-12-20 01:43:12 +01:00
Ayke van Laethem
9aeb8d9e06 interp: support llvm.lifetime.* calls
This fixes a bug found when updating a map with string keys.
Originally reported here:
https://github.com/hybridgroup/gdg-2019/issues/6
2019-12-20 01:43:12 +01:00
Ron Evans
34ee3883d6 flash: search for default serial port on both macOS and Linux
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-12-17 02:15:06 +01:00
Ayke van Laethem
768c652468 machine: rename CPU_FREQUENCY -> CPUFrequency()
These all-caps constants aren't in the Go style, so rename it to
CPUFrequency (which is more aligned with Go style). Additionally, make
it a function so that it is possible to add support for changing the
frequency in the future.

Tested by running `make smoketest`. None of the outputs did change.
2019-12-16 20:34:39 +01:00
Daniel Esteban
2778377ac9 Nano33 IoT: default SPI should be D13/D11/D12 instead of A2/A3/A6 (#781)
* Nano33 IoT: default SPI should be D13/D11/D12 instead of A2/A3/A6
2019-12-15 15:21:33 +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
ad022ef23d riscv: add support for compiler-rt
This gets all the tests to compile and many of them to pass. There are
some issues left, but those are probably unrelated to compiler-rt.
2019-12-14 12:48:21 +01:00
Ayke van Laethem
c97b7221bd machine: support arduino-nano33 on play.tinygo.org 2019-12-11 21:49:19 +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