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
Ayke van Laethem
9a54ee4241
compiler: allow larger-than-int values to be sent across a channel
...
Instead of storing the value to send/receive in the coroutine promise,
store only a pointer in the promise. This simplifies the code a lot and
allows larger value sizes to be sent across a channel.
Unfortunately, this new system has a code size impact. For example,
compiling testdata/channel.go for the BBC micro:bit, there is an
increase in code size from 4776 bytes to 4856 bytes. However, the
improved flexibility and simplicity of the code should be worth it. If
this becomes an issue, we can always refactor the code at a later time.
2019-05-05 16:46:50 +02:00
Ayke van Laethem
46d5ea8cf6
compiler: support returning values from async functions
...
This is implemented as follows:
* The parent coroutine allocates space for the return value in its
frame and stores a pointer to this frame in the parent coroutine
handle.
* The child coroutine obtains the alloca from its parent using the
parent coroutine handle. It then stores the result value there.
* The parent value reads the data from the alloca on resumption.
2019-05-05 16:46:50 +02:00
Daniel Esteban
fb952a722a
Remove microbit matrix ( #319 )
...
* Remove matrix code from bbc:microbit, and move it to a driver
2019-05-05 16:25:50 +02:00
Justin Clift
d594342642
examples: tell browsers to not cache wasm files from the example server
2019-05-02 14:13:50 +01:00
Justin Clift
4bd1b9e53d
wasm: use println instead of fmt
...
The generated wasm is 575 bytes when compiled with -no-debug (and
works), which is a much better first experience for new users than
the 20KB+ added (atm) just from including fmt.
2019-05-01 10:35:18 +02:00
Ayke van Laethem
024eceb476
runtime: print error when panicking with error interface type
2019-04-25 14:06:34 +02:00
Ron Evans
b2e96fc35a
machine/atsamd21: select internal ground for ADC and scale result correctly to 16-bit
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-04-22 07:59:35 +02:00
Johan Brandhorst
586023b45d
src/examples/wasm: Show both methods supported
...
Adds another example showing the simple case
of executing main, adds a README explaining how
everything fits together and how to execute the compiled
code in the browser. Include a minimal webserver for
local testing.
2019-04-19 17:46:46 +02:00
Ron Evans
a00a51e70e
examples: add microbit blink example
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-04-19 15:30:12 +02:00
Ron Evans
745b5dfb81
examples: remove colorlamp example that is better suited for the TinyGo Zoo (and already in it)
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-04-18 19:03:13 +02:00
Ayke van Laethem
2a0a7722f9
compiler: lower func values to switch + direct call
...
This has several advantages, among them:
- Many passes (heap-to-stack, dead arg elimination, inlining) do not
work with function pointer calls. Making them normal function calls
improves their effectiveness.
- Goroutine lowering to LLVM coroutines does not currently support
function pointers. By eliminating function pointers, coroutine
lowering gets support for them for free.
This is especially useful for WebAssembly.
Because of the second point, this work is currently only enabled for the
WebAssembly target.
2019-04-17 23:12:59 +02:00
Ron Evans
8d3b5a58d1
machine/atsamd21: correct pad/pin handling when using both UART and USBCDC interfaces at same time
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-04-17 22:50:08 +02:00
Ayke van Laethem
7de3d4be2b
all: support interface asserts in interp
...
This adds support for the math/rand package.
2019-04-13 20:55:56 +02:00
Ayke van Laethem
02ecab833f
all: check formatting on CI
2019-04-13 19:58:58 +02:00
Yusuke Mitsuki
1322f404a6
stm32: add support for the STM32F4Discovery
...
Signed-off-by: Yusuke Mitsuki <mickey.happygolucky@gmail.com>
2019-04-13 13:32:05 +02:00
Ayke van Laethem
6a2a587dff
compiler: fix MakeSlice bounds check and casting
2019-04-10 20:21:33 +02:00
Ayke van Laethem
3a76a49ddf
compiler: fix int casting to use the source signedness
...
Previously, when casting an integer to a bigger integer, the destination
signedness was used. This is problematic when casting a negative int16
to uint32, for example, because it would cause zero-extension.
2019-04-10 20:21:33 +02:00
Ron Evans
85f2ef40f8
machine/itsybitsy-m0: set pins and pin mode mapping for i2c0 bus
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-04-05 15:25:11 +02:00
Ron Evans
ae4ead8690
machine/circuitplay: correct pin and pin mode mapping for both i2c0 (external) and i2c1 (internal) buses
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-04-05 14:31:26 +02:00