Ayke van Laethem
8a704e43fc
os: gofmt
2019-07-15 17:53:01 +02:00
Justin Clift
847681457f
runtime: add several os package stubs
2019-07-15 01:18:37 +02:00
Ayke van Laethem
b0cad7ed63
runtime: add support for math intrinsics where supported
...
In particular, add support for a few math intrinsics for WebAssembly,
but add a few intrinsics to other systems as well at the same time. Some
may be missing still but will be easy to add if needed.
This increases the performance of one example by 50% to 100% depending
on the browser: the bottleneck was the inefficient sqrt implementation.
2019-07-08 00:32:42 +02:00
Ayke van Laethem
d627208c48
all: make WebAssembly initial linear memory size configurable
...
When the target supports it, allow the (initial) heap size to be
configured. Currently only supported in WebAssembly.
This also changes the default heap size of WebAssembly from 64kB to 1MB.
2019-07-08 00:09:59 +02:00
Ayke van Laethem
7ed6b45149
compiler: add the //go:noinline pragma
...
This is directly useful to avoid some unsafety around runtime.alloc and
should be useful in general.
This pragma has the same form as in the main Go compiler:
https://github.com/golang/go/issues/12312
2019-07-08 00:02:28 +02:00
Ron Evans
fc9188a298
machine/samd21/arduino-nano33: adds support for Arduino Nano33 IoT along with mapping to NINA-W102 WiFi chip.
...
Also adds DTR and RTS functions along with timeouts to USBCDC functions to prevent lockups.
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-07-07 18:09:05 +02:00
Ayke van Laethem
ffa38b183b
all: add HiFive1 rev B board with RISC-V architecture
...
This page has been a big help in adding support for this new chip:
https://wiki.osdev.org/HiFive-1_Bare_Bones
2019-07-07 14:03:24 +02:00
Ayke van Laethem
385d1d0a5d
compiler,runtime: implement a portable conservative GC
2019-07-01 16:30:33 +02:00
Ayke van Laethem
00e91ec569
all: rename garbage collectors
...
dumb -> leaking:
make it more clear what this "GC" does: leak everything.
marksweep -> conservative:
"marksweep" is too generic, use "conservative" to differentiate
between future garbage collectors: precise marksweep / mark-compact /
refcounting.
2019-07-01 13:03:07 +02:00
Daniel Esteban
1fd0c8d48c
adds PowerSupplyActive to enable supply voltages to nRF52840 and ( #430 )
...
* machine/reelboard: adds PowerSupplyActive to enable supply voltages to nRF52840 and
peripherals.
2019-06-30 12:23:44 +02:00
Daniel Esteban
d34bb7e708
add reelboard pins for the epaper display and the reset pin ( #429 )
...
* machine/reelboard: added descriptive pin names for the epaper display and the reset pin
2019-06-30 09:57:07 +02:00
Ayke van Laethem
4ecd478d82
machine: add generic board support on non-baremetal hardware
...
Instead of trying to modify periperhals directly, external functions are
called. For example, __tinygo_gpio_set sets a GPIO pin to a specified
value (high or low). It is expected that binaries made this way will be
linked with some extra libraries that implement support for these
functions.
One particularly interesting case is this experimental board simulator:
https://github.com/aykevl/tinygo-play
Compiling code to WebAssembly with the correct build tag for a board
will enable this board to be simulated in the browser.
Atmel/Microchip based SAMD boards are not currently supported, because
their I2C/SPI support is somewhat uncommon and harder to support in the
machine API. They may require a modification to the machine API for
proper support.
2019-06-28 10:00:14 +02:00
Ayke van Laethem
ed7c242a09
runtime: fix a heap corruption where some blocks were not marked as reachable
...
This is a rather critical error and I wonder why it hasn't been
discovered earlier.
2019-06-20 13:32:45 +02:00
scriptonist
e9f6e51fc8
compiler,runtime: implement string to []rune conversion
...
Commit message by aykevl
2019-06-19 01:17:21 +02:00
Carolyn Van Slyck
208e1719ad
Add test command to tinygo ( #243 )
...
* Add test command to tinygo
2019-06-18 12:23:59 +02:00
Tomer Elmalem
3e1c0d90c5
Add implementation for os.Exit and syscall.Exit
2019-06-12 19:04:34 +02:00
Ayke van Laethem
b7197bcaae
compiler,runtime: implement non-blocking selects
...
Blocking selects are much more complicated, so let's do non-blocking
ones first.
2019-06-12 18:26:52 +02:00
Ayke van Laethem
8890a0f3c8
compiler,runtime: store channel size in the channel itself
...
This may have a small effect on code size sometimes, but will simplify
the implementation of the select statement.
2019-06-12 18:26:52 +02:00
Ayke van Laethem
e67506ee68
arm: update to avoid //go:volatile
...
This change results in changes to all smoketests for Cortex-M based
chips: they get a bit smaller (32-48 bytes). I'm not sure why but
probably because the inliner made a different inlining decision. There
was a similar effect when files generated from SVD files switched to the
new volatile types so it's probably harmless.
2019-06-06 19:46:49 +02:00
Ayke van Laethem
f2c205a008
machine: update ringbuffer to use runtime/volatile.Register8
...
This avoids the //go:volatile pragma, which will be removed soon.
There were no changes to the output of the smoke tests.
2019-06-06 19:46:49 +02:00
Ayke van Laethem
c84c625585
runtime: update to avoid //go:volatile
...
There was exactly one change in the output of the smoke tests:
examples/test. However, it still runs just fine on a PCA10040.
2019-06-06 19:46:49 +02:00
Ayke van Laethem
9673ad3774
all: move Register{8,16,32} values into runtime/volatile
...
This avoids duplication of code. None of the smoke tests have changed
their output.
2019-06-06 19:46:49 +02:00
Tomer Elmalem
1047c9bd05
reflect: stub out reflect.New and reflect.Zero
2019-06-03 19:26:47 +02:00
Justin Clift
4442b1304e
Trivial typo fix
2019-05-28 09:55:35 +02:00
Ron Evans
2504754325
machine/samd21: use HasBits() method to simplify bit comparisons
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-05-27 18:43:11 +02:00
Ron Evans
be491abc46
machine/stm32: use HasBits() method to simplify bit comparisons
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-05-27 18:43:11 +02:00
Ron Evans
31189deb3b
machine/avr: use HasBits() method to simplify bit comparisons
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-05-27 18:43:11 +02:00
Ayke van Laethem
eb1d834dd4
wasm: add support for js.FuncOf
2019-05-27 13:35:59 +02:00
Ayke van Laethem
3313decb68
compiler,runtime: make panic functions camelCase
...
Rename panic functions to be runtime.nilPanic, runtime.lookupPanic, and
runtime.slicePanic.
2019-05-27 13:35:59 +02:00
Ayke van Laethem
0f2dcba7b3
syscall: implement Exit call on unix
2019-05-27 07:50:13 +02:00
Ayke van Laethem
94b8214529
machine: refactor pins to be of Pin type
2019-05-26 20:48:50 +02:00
Ayke van Laethem
421ef04efb
wasm: fix Makefile to avoid debuginfo
2019-05-25 18:40:56 +02:00
Ron Evans
9f8340a970
machine/nrf: refactor to use volatile package/API
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-05-24 15:44:33 +02:00
k-brk
0f6873cf02
machine/stm32f103xx: fix i2c 2 byte read
2019-05-24 15:26:06 +02:00
Ayke van Laethem
f2cd4d12e8
compiler,runtime: fix multiple definitions of a single function
...
strings.IndexByte was implemented in the runtime up to Go 1.11. It is
implemented using a direct call to internal/bytealg.IndexByte since Go
1.12.
Make sure we remain compatible with both.
2019-05-24 14:51:40 +02:00
Ayke van Laethem
3568254593
machine/atsamd21: fix analog pin mode
2019-05-23 20:37:10 +02:00
Ron Evans
e4d53daa02
machine/stm32: refactor to use new volatile package for all register access
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-05-21 15:08:43 +02:00
Ayke van Laethem
ba85c82fbb
arm: print an error when a HardFault occurs
...
This is very useful for debugging. It differentiates between a stack
overflow and other errors (because it's easy to see when a stack
overflow occurs) and prints the old stack pointer and program counter if
available.
2019-05-20 11:39:17 +02:00
Ron Evans
de032cddd2
machine/sam: Refactor all machine/runtime code to use new volatile package/API
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-05-19 19:53:11 +02:00
Ron Evans
51c6b972bf
machine/feather-m0: correct board build tag and add placeholders for I2S interface
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-05-19 19:52:14 +02:00
Anthony Elder
4cd151faf5
Add Feather M0 Board ( #356 )
...
* Add Feather M0 Board
2019-05-19 17:10:17 +02:00
Martin Treml
fc2ed2bdd0
[Board] Adafruit Trinket ( #333 )
...
* Add support for Adafruit Trinket-M0 board
2019-05-14 19:30:39 +02:00
Ayke van Laethem
e0cf74e638
avr: use register wrappers that use runtime/volatile.*Uint8 calls
...
This avoids the //go:volatile pragma on types in Go source code, at
least for AVR targets.
2019-05-14 12:24:01 +02:00
Ayke van Laethem
397b90753c
compiler: implement volatile operations as compiler builtins
...
The long term goal is to remove the //go:volatile hack.
2019-05-14 12:24:01 +02:00
Ayke van Laethem
763b9d7d10
runtime: implement growing hashmaps
...
Add support for growing hashmaps beyond their initial size.
2019-05-14 09:59:00 +02:00
Ayke van Laethem
55fc7b904a
compiler,runtime: use the size hint when creating a new map
...
It defaults to hint/8 number of buckets. This number may be tuned in the
future.
2019-05-14 09:59:00 +02:00
Anthony Elder
8d3f19bc84
Fix I2C signalStop in readLastByte for Microbit ( #344 )
...
* Fix I2C signalStop in readLastByte for Microbit
2019-05-13 14:30:25 +02:00
Ron Evans
d90f1947d9
machine/samd21: Initial implementation of I2S hardware interface using Circuit Playground Express
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-05-12 21:51:07 +02:00
Ayke van Laethem
4ae4ef5e12
compiler: implement complex division
...
This is hard to do correctly, so copy the relevant files from the Go
compiler itself.
For related discussions:
* https://github.com/golang/go/issues/14644
* https://github.com/golang/go/issues/29846
2019-05-11 15:33:37 +02:00
Justin Clift
4c8c048c49
example: just using 'Cache-Control': 'no-cache' should be good enough
2019-05-09 09:23:36 +02:00