Ayke van Laethem
0a06c6014d
compiler: special slice bounds check for 64-bit numbers
...
It is allowed to index with an int64 even on a 32-bit platform, so we
have to handle that case. But make sure the normal case isn't penalized
by using 32-bit numbers when possible.
2018-10-20 18:28:00 +02:00
Ayke van Laethem
239504d9f4
compiler: implement recover()
...
Doesn't do anything useful yet as running deferred calls are not
executed during panic. Only implemented to get code to compile.
2018-10-20 18:00:12 +02:00
Ayke van Laethem
7c2a6169b0
compiler: support comma-ok in map lookup
2018-10-20 17:54:16 +02:00
Ayke van Laethem
c0c1ccb381
compiler, runtime: implement delete builtin
2018-10-20 16:18:55 +02:00
Ayke van Laethem
7f60dd79ee
sync: implement dummy sync.Pool for fmt
2018-10-20 15:52:41 +02:00
Ayke van Laethem
963ba16d7b
compiler: add support for the append builtin
2018-10-19 14:40:19 +02:00
Ayke van Laethem
fd45410c24
runtime: add proper arm arch
2018-10-18 15:23:52 +02:00
Ayke van Laethem
daf92226d8
nrf: add nrf52840-mdk board
...
With the help of Chillance on GitHub.
2018-10-18 15:07:06 +02:00
Ayke van Laethem
a613d0484e
runtime: add support for time.Now()
...
TODO: On unix systems, this does not return an accurate value.
2018-10-15 20:20:37 +02:00
Ayke van Laethem
ccee42ec7a
machine: add helpers for bit-banged driver support
...
The returned pointer and value can be used to set or clear a specific
pin.
2018-10-15 19:56:27 +02:00
Ayke van Laethem
392bba8394
compiler: add support for parameters to inline assembly
2018-10-15 19:37:09 +02:00
Ayke van Laethem
0ce5347409
runtime: fix hashmap lookup of entries at position > 8
...
Bigger hashmaps (size > 8) use multiple buckets in a chain. The lookup
code looked at multiple buckets for a lookup, but kept checking the
first bucket for key equality.
2018-10-10 14:09:17 +02:00
Ron Evans
ca13bfd992
microbit: add SetEntireLEDMatrixOn() function
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2018-10-08 20:38:21 +02:00
Ayke van Laethem
a63af97e86
all: add emulation support for Cortex-M3 with QEMU
2018-10-08 17:07:19 +02:00
Ayke van Laethem
8982b8df83
runtime: refactor initialization code
...
Let each target handle its own initialization/finalization sequence
instead of providing one in the runtime with hooks for memory
initialization etc. This is much more flexible although it causes a
little bit of code duplication.
2018-10-08 14:49:33 +02:00
Ayke van Laethem
1bbdab41d2
all: improve compiler-rt compilation
...
A few changes to make sure compiler-rt is correctly compiled (and
doesn't include host headers, for example).
This improves support for AVR, but it still doesn't work. Compiler-rt
itself doesn't really work for AVR either.
2018-10-07 21:29:45 +02:00
Ron Evans
c516a11004
microbit: add functions for LED matrix and correct button pin mapping
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2018-10-07 19:40:16 +02:00
Ayke van Laethem
bc9210b674
nrf: add micro:bit board
2018-10-06 13:04:14 +02:00
Ron Evans
e4fa1a8288
nrf: I2C interface
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2018-10-05 12:50:43 +02:00
Ron Evans
8f7b7e6ee3
nrf52: implement ADC and PWM interfaces
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2018-10-04 13:56:44 +02:00
Ayke van Laethem
3e98fbcdc8
avr: use machine.UART0 as stdout
2018-10-04 13:38:12 +02:00
Ayke van Laethem
f37d409855
nrf: use machine.UART0 as stdout
2018-10-04 13:36:15 +02:00
Ron Evans
ef2ac09561
nrf: implement UART interface
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2018-10-02 17:08:31 +02:00
Ron Evans
4c8a725d78
avr: implement UART interface
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2018-10-01 12:02:59 +02:00
Ron Evans
ee5d562050
examples: add color mood lamp that shows using GPIO, PWM, ADC, and I2C all at the same time on an Arduino
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2018-09-29 23:18:31 +02:00
Ayke van Laethem
5bf058a0a6
nrf: fix off-by-one in modulo of runtime.ticks
...
This code:
foo & 0xffffff
Is equivalent to this code:
foo % 0x1000000
However, to drop the high 8 bits, this calculation was used:
foo % 0xffffff
This is far more expensive (and incorrect), as it needs an actual modulo
operation which increases code size and probably reduces speed on a
Cortex-M4 and needs library functions for a Cortex-M0 increasing code
size by a much bigger amount.
2018-09-29 16:21:17 +02:00
Ayke van Laethem
8d170d3bd2
all: change special type __volatile to pragma //go:volatile
...
This is one step towards removing unnecessary special casts in most
cases. It is also part of removing as much magic as possible from the
compiler (the pragma is explicit, the special name is not).
2018-09-28 13:17:03 +02:00
Ayke van Laethem
69f2cec045
avr: fix build for Arduino
...
I'm afraid I broke this while merging the I2S changes...
2018-09-25 14:32:02 +02:00
Ron Evans
12fb4f3f91
avr: i2c implementation with BlinkM example
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2018-09-25 14:00:01 +02:00
Ayke van Laethem
c9ae72a105
all: allow -O0 optimization level
2018-09-24 16:17:42 +02:00
Ayke van Laethem
473e71b573
compiler: implement range over a string
2018-09-22 19:19:53 +02:00
Ayke van Laethem
4d5b5241ec
all: avoid _Msk fields when not necessary
2018-09-22 17:42:44 +02:00
Ayke van Laethem
3bba26ce5b
machine/bluepill: create definitions for all pins
2018-09-22 15:47:16 +02:00
Ayke van Laethem
8f5bd81bf5
machine: split board definitions in separate files
2018-09-22 15:47:08 +02:00
Ron Evans
9df7d6e8e8
examples: add nrf example for all 4 built-in buttons and LEDs
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2018-09-22 15:17:47 +02:00
Ayke van Laethem
dd5b5a381c
stm32: initial support
2018-09-22 01:51:44 +02:00
Ayke van Laethem
12298d23a7
all: move generic ARM bits into separate files
2018-09-22 01:44:47 +02:00
Ayke van Laethem
7517ac86e4
runtime: merge common sleep() functions
2018-09-22 01:40:04 +02:00
Ayke van Laethem
9fa08bf51d
all: use groupName in peripherals
...
This is needed for support for multiple instances of a peripheral type.
2018-09-21 22:24:41 +02:00
Ayke van Laethem
505b1f750d
all: generate interrupt vector from .svd file
2018-09-21 15:38:28 +02:00
Ayke van Laethem
3c22f5731c
all: replace _extern_* workaround with //go:extern pragma
2018-09-21 14:37:11 +02:00
Ayke van Laethem
3e6750ae23
examples/test: make unicode example more interesting
2018-09-21 14:37:11 +02:00
Ayke van Laethem
486ea1b8ea
examples: re-add hello world serial communication
...
I accidentally removed the serial example from 45348bfc3e
while merging
commit 40f834d58f
(PR: https://github.com/aykevl/tinygo/pull/12 ).
Force-pushing seemed like a bad idea so here it is.
2018-09-21 14:33:39 +02:00
Ayke van Laethem
de694b5857
avr: set ADLAR bit in ADC to get a value scaled to 16-bit
2018-09-20 21:39:45 +02:00
Ron Evans
40f834d58f
avr: ADC with 0-1023 range
2018-09-20 21:39:45 +02:00
Ayke van Laethem
dbb5ae5a23
avr: use i16 for lengths
2018-09-20 20:52:59 +02:00
Ron Evans
45348bfc3e
examples: add hello world serial communication
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2018-09-19 22:38:29 +02:00
Ayke van Laethem
c0d1963d63
runtime/nrf: remove some leftover header files
2018-09-18 20:45:02 +02:00
Ron Evans
fc0ff3a987
avr: initial implementation for PWM
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
Edited slightly by Ayke van Laethem
2018-09-17 14:03:05 +02:00
Ayke van Laethem
39e3fe28db
avr: convert initialization from asm to Go
...
This increases code size by 1 instruction (2 bytes) because LLVM isn't
yet smart enough to recognize that it doesn't need to clear a register
to use 0: it can just use r1 which is always 0 according to the
convention. It makes initialization a lot easier to read, however.
2018-09-16 15:03:48 +02:00