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

1240 коммитов

Автор SHA1 Сообщение Дата
Jaden Weiss
b5ecd9cab0 fix LLVM assertions from improved blocking 2019-09-25 23:04:53 +02:00
Elliott Sales de Andrade
9aace79298 Allow overridding Python used for generators. 2019-09-25 12:04:38 +02:00
Ron Evans
c16e07469b machine/samd21,samd51: remove use of binary package to avoid reflection and reduce binary size
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-24 19:41:34 +02:00
Ayke van Laethem
582457b81e interp: implement runtime.sliceCopy
This implements the copy() built-in function. It may not work in all
cases, but should work in most cases.

This commit gets the following 3 packages to compile, according to
tinygo-site/imports/main.go:

  * encoding/base32
  * encoding/base64
  * encoding/pem (was blocked by encoding/base64)
2019-09-24 18:16:43 +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
Ayke van Laethem
da7f7eef00 interp: avoid an extra TargetData argument
This can be easily calculated from the module datalayout string.
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
Jaden Weiss
6c9e55bd06
reflect: delete incorrect optimization 2019-09-24 16:13:19 +02:00
Ron Evans
368abeeb9a machine/stm32f103xx: prevent time.Sleep() issues by preventing sleeping for less than 200us, which is the current effictive minimum due to prescaler settings.
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-24 12:16:38 +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
Jaden Weiss
d843ebfe40 Improved blocking (#513)
core: major improvements to blocking, including support for buffered channels.
2019-09-22 17:58:00 +02:00
Jaden Weiss
d17f500c8b replace reflect.interfaceHeader with strongly typed runtime functions 2019-09-22 16:36:11 +02:00
Ayke van Laethem
65beddafe8 compiler: move OptimizeStringToBytes to transform package
Unfortunately, while doing this I found that it doesn't actually apply
in any real-world programs (tested with `make smoketest`), apparently
because nil pointer checking messes with the functionattrs pass. I hope
to fix that after moving to LLVM 9, which has an optimization that makes
nil pointer checking easier to implement.
2019-09-22 08:25:50 +02:00
Ayke van Laethem
cea0d9f864 Makefile: include the transform package in the gofmt list
To make sure it stays properly formatted.
2019-09-22 08:25:50 +02:00
Jaden Weiss
1913e3e1cd allow selecting a different go version and use ccache for LLVM whenever possible 2019-09-21 18:18:51 +02:00
Ayke van Laethem
9d47897368 gitignore: ignore llvm-project directory
It was ignored before when the directory was still just called llvm, but
now it isn't anymore. Fix that.
2019-09-21 16:59:14 +02:00
Ron Evans
a7d00f1b6d machine/gameboy-advance: allow TinyGo to directly output GBA files that are ready for flashing by performing objcopy
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-21 15:03:18 +02:00
Jaden Weiss
7732c6f449 fix bug in IR regarding type aliases 2019-09-20 10:35:49 +02:00
Ayke van Laethem
cf2a7b5089 compiler: add //go:align pragma
This is sometimes needed for globals. For example, the atsamd21 chip
requires the DMA buffers to be aligned on a 16 byte boundary.
2019-09-18 20:15:17 +02:00
Ayke van Laethem
d40fb5bc46 main: switch to version 0.9.0-dev 2019-09-18 20:03:48 +02:00
Ayke van Laethem
cc313798f3 main: version 0.8.0 2019-09-18 16:51:27 +02:00
Ayke van Laethem
86acfc7ef4 ci: add caching to macOS build
This should speed up testing.
2019-09-18 16:34:01 +02:00
Ron Evans
a5fb785334 compiler: ensure that any passed in target, if it does not point to a .json file, is a full LLVM triple
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-18 16:11:09 +02:00
Ron Evans
86b888fdcb docs: update README with current list of supported boards
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-18 15:50:52 +02:00
Ron Evans
ef1bfe359c runtime/samd51: set minimum sleep to 260us due to minimum delay in register synchronization
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-18 15:27:34 +02:00
Ron Evans
0a5601c3fc runtime/samd21: set minimum sleep to 214us due to minimum delay in register synchronization
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-18 15:26:16 +02:00
Ron Evans
f5fd49bb74 machine/samd21: use PinMode for SPI SERCOM peripheral to allow for more configuration options on boards like Arduino Nano33-IoT that have many predefined pin mappings
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-17 21:28:05 +02:00
Ayke van Laethem
d2856bd6bd nrf: improve SPI write-only speed, by making use of double buffering
The SPI peripheral in the nrf chips support double buffering, which
makes it possible to keep sending continuously. This change introduces
double buffering on the nrf chips, which should improve SPI performance.

Tested on the pca10040 (nrf52832).
2019-09-17 17:51:13 +02:00
Elliott Sales de Andrade
869d2c4524 Add a way to bake-in final TINYGOROOT.
This is similar to setting FINAL_GOROOT when building standard Go.
2019-09-17 17:28:17 +02:00
cn
9d35c1197f machine/stm32f103xx/nucleo-f103rb: add support for NUCLEO-F103RB STM32F1-based board
Compared to the already supported stm32f103xx "bluepill" board this:

- features 128 KiB flash memory size ("RB" suffix) instead of 64 KiB, see `targets/stm32f103rb.ld`
- has onboard ST-LINK/V2-1 programmer and debugger requiring different OpenOCD configuration file
- uses USART2 connected to ST-LINK/V2-1 debugger as virtual COM port over USB for `putchar()`
- has a user-accessible button besides the reset button
2019-09-17 13:26:26 +02:00
cn
688dd81400 machine/stm32f103xx: allow board specific UART usage
Motivation: The bluepill uses USART1 as UART0 but other boards like the
STM32 Nucleo boards (and disco as well) use USART2 for USB COM port.

To avoid duplication of code the same pattern as in `machine_atsamd21.go`
is applied where only UART-specific code is moved to `board_*.go`.
2019-09-17 10:28:03 +02:00
Jaden Weiss
abca3132a9 fix bugs found by LLVM assertions 2019-09-16 18:31:33 +02:00
Ayke van Laethem
e0ebc75df2 runtime: implement memcpy
A call to memcpy is sometimes created by the compiler, for example when
compiling with -opt=s or opt=2.
2019-09-16 15:34:16 +02:00
Ayke van Laethem
b4859240e1 main: stop running the LLVM verifier for trivial changes
The above changes might indeed introduce inconsistencies in the IR, but
the code is small and doesn't change often so it's unnecessary to always
check for errors. It will be tested again later anyway.

The compile time impact was somewhere around 6%, so that's a nice
improvement.
2019-09-16 15:11:59 +02:00
Konstantin Itskov
4eb34b36f8 Add syscall/js.valueInvoke support 2019-09-16 13:36:37 +02:00
Konstantin Itskov
61750be9aa Add syscall/js.valueSetIndex support 2019-09-16 13:32:31 +02:00
cn
efd9cf72ba machine/stm32f103xx: add machine.Pin.Get method for reading GPIO values
Writing pin values was already possible but reading was missing.
2019-09-16 13:24:21 +02:00
cn
500ee8067d machine/stm32f103xx: fix SPI frequency selection
The SPI frequency is broken since b8c326d710
added I2C interface and changed the unrelated `PCLK2 = HCLK/4` initialization
to `PCLK2 = HCLK/1` (but I2C uses PCLK1 anyways).

This commit changes all baud rate prescalers to be /4 compared to before.

Note: it is not possible to find an equivalent for 125 KHz SPI speed,
it will be too fast (`f = 72 MHz / 256`)
2019-09-16 11:08:59 +02:00
Ayke van Laethem
8cd2c7502e all: move OptimizeMaps to transforms and add tests 2019-09-15 21:26:27 +02:00
Ayke van Laethem
d905476231 all: refactor heap-to-stack transform into the transform package
Also add unit tests.

This is the first of several transformation (optimization/lowering)
passes that I'd like to move to the new transform package. This
separates the compiler from the optimizer.

Also, it finally adds unit tests for the compiler, not just end-to-end
compilation tests. This should improve robustness and should make it
easier to change these transformation passes in the future.
While the heap-to-stack transform is relatively simple, other passes are
much more complex. Adding unit tests not only helps robustness over
time, but also doubles as documentation as to what these transformation
passes do exactly.
2019-09-15 21:26:27 +02:00
Ayke van Laethem
10ed3decb0 compiler: rename getZeroValue to llvm.ConstNull
It does the same thing but should be more complete, and it probably is
faster as well (just one CGo call instead of several).
2019-09-15 19:09:10 +02:00
Ayke van Laethem
8d959b7c63 all: replace dep with Go modules
We've moved to go modules, and keeping both working is burdensome.
In fact, I think dep already wasn't working.
2019-09-15 18:04:38 +02:00
Ron Evans
02c4020228 machine/atsamd51: add support for ATSAMD51 processor using Adafruit ItsyBitsy-M4 board
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-14 17:56:14 +02:00
Ron Evans
bc41cc688f main: check the major/minor installed version of Go before tinygo compile, to ensure that it is a supported version.
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-14 17:50:16 +02:00
Ron Evans
7d481c179f machine/atsamd21: uses different required magic values for BOSSA and UF2 bootloaders
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-14 16:18:30 +02:00
Ron Evans
69aaea44a0 machine/atsamd21: Add support for bootloader reset/programming and correct error in receiving endpoint 0 data for CDC Set Line Coding changes, implementing system reset on switch to 1200 baud connection speed with DTR false.
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-14 16:18:30 +02:00
Ron Evans
6c1abfe047 device/arm: add support for System Control Block (SCB) registers and SystemReset() function
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-14 16:18:30 +02:00
Ron Evans
656fb4e372 tools/generator: correctly handle padding when it is 3 bytes long
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-13 00:40:25 +02:00
Ron Evans
f4485f414f uf2: extract target address from ELF to accomodate the differences with M0 vs M4 processors
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-13 00:37:54 +02:00
Phil Kedy
55144ad608 WASM: Support for setting an imported function's module name (#455)
* wasm: add support for setting a function's Wasm import module name by using the //go:wasm-module comment.
2019-09-12 08:35:43 +02:00