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

1073 коммитов

Автор SHA1 Сообщение Дата
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
Ron Evans
1dbfc976e8 docker: use Go 1.12 base Docker image for compatibility
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-09 09:37:43 +02:00
Ron Evans
e26f0b35e3 machine/atsamd21: correct order of params for USB CDC descriptor
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-06 14:24:32 +02:00
Ron Evans
4ee26fd54b machine/atsamd21: correct issue with invalid first reading coming from ADC
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-06 14:22:24 +02:00
Jaden Weiss
a718b10502 fix sleep queue corruption bug 2019-09-06 14:19:05 +02:00
BCG
8a5fa51f60 Updated SPI pins so that they are configurable, enabling multiple SPI sercoms for ATSAMD21 2019-08-28 11:19:52 +02:00
Elliott Sales de Andrade
7c5f943564 Fix a Python SyntaxWarning.
Using 'is' for literals is incorrect, and only should be done for
singletons.
2019-08-27 14:17:17 +02:00
Ayke van Laethem
7938740bf3 tools: make tools python2 compatible
This allows the tools to be used for Python 2 and Python 3.
2019-08-26 16:39:28 +02:00
Ayke van Laethem
319d21e662 runtime: don't mark the object right before a non-existing object
False positives (pointers that point to nowhere but happen to point into
the heap) would result in the block just before that pointer to be
marked. This is clearly not intended, so ignore such a pointer.
2019-08-25 13:12:27 +02:00
Ayke van Laethem
3bf2487dc5 runtime: add some more asserts to the GC 2019-08-25 13:12:27 +02:00
Ayke van Laethem
6917faabf5 runtime: fix GC to take goroutines into account
This fix is needed because with the new task-based scheduler, the
current stack pointer may not be on the system stack.
2019-08-25 13:12:27 +02:00
Ayke van Laethem
db4de46d88 runtime: add dummy getCurrentStackPointer functions
This is useful for the next commit, to get it to compile on all systems.
2019-08-25 13:12:27 +02:00
Ayke van Laethem
9b1dd8e03d arm7tdmi: clean up architecture definition 2019-08-25 13:12:27 +02:00
Ayke van Laethem
e356bad4d1 reflect: implement t.Comparable()
This is necessary to support the context package, which is a dependency
of a lot of packages.
2019-08-20 10:20:09 +02:00
Ayke van Laethem
c19c738f52 reflect: implement support for array types 2019-08-19 11:08:26 +02:00
Ayke van Laethem
bbc3046687 compiler: add support for 'go' on func values
This commit allows starting a new goroutine directly from a func value,
not just when the static callee is known.

This is necessary to support the whole time package, not just the
commonly used subset that was compiled with the SimpleDCE pass enabled.
2019-08-17 11:51:43 +02:00
Ayke van Laethem
e4fc3bb66a compiler,runtime: fix new task-based scheduler
A bug was introduced in the previous commit that led to miscompilations
in the time.Sleep function when the scheduler was disabled, because
time.Sleep (implemented in the runtime) tried to switch to the scheduler
stack.

This commit restores the binary size of most examples to what it was
before, but still reduces static RAM consumption (.bss) slightly. This
gives me some confidence that it does indeed fix the introduced bug.
2019-08-17 08:42:23 +02:00
Ayke van Laethem
542135c357 compiler,runtime: implement stack-based scheduler
This scheduler is intended to live along the (stackless) coroutine based
scheduler which is needed for WebAssembly and unsupported platforms. The
stack based scheduler is somewhat simpler in implementation as it does
not require full program transform passes and supports things like
function pointers and interface methods out of the box with no changes.

Code size is reduced in most cases, even in the case where no scheduler
scheduler is used at all. I'm not exactly sure why but these changes
likely allowed some further optimizations somewhere. Even RAM is
slightly reduced, perhaps some global was elminated in the process as
well.
2019-08-15 17:31:54 +02:00