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

1530 коммитов

Автор SHA1 Сообщение Дата
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
Ayke van Laethem
35fe24981f
runtime/unix: panic: call abort() instead of exit(2)
abort() will cause gdb to show a backtrace when running inside the
debugger, and abort() seems more appropriate anyway for critical errors.
2018-09-16 13:01:15 +02:00
Ayke van Laethem
1484bb5c2c
all: basic support for the os package
The resulting binary is pretty big due to lacking optimizations
(probably because of interfaces), so that should be fixed.
2018-09-16 13:01:03 +02:00
Ayke van Laethem
c237633d34
all: use a custom sync package
The sync package is strongly tied to the runtime, so it's easier to
implement a new one. Besides, it's pretty big so it's better to replace
it.
2018-09-15 18:51:51 +02:00
Ayke van Laethem
2a20c0c7f0
all: rewrite sleep function
time.Sleep now compiles on all systems, so lets use that.
Additionally, do a few improvements in time unit handling for the
scheduler. This should lead to somewhat longer sleep durations without
wrapping (on some platforms).

Some examples got smaller, some got bigger. In particular, code using
the scheduler got bigger and the blinky1 example got smaller (especially
on Arduino: 380 -> 314 bytes).
2018-09-15 01:58:54 +02:00
Ayke van Laethem
152e12e4b0
all: implement iterating over hashmaps
Still no support for hashmaps > 8 entries, but this kind of works.
2018-09-15 00:29:34 +02:00
Ayke van Laethem
327076da39
examples/test: add slice-a-slice test 2018-09-14 21:02:29 +02:00
Ayke van Laethem
1387a1024d
examples/test: small cleanup
I forgot to remove some commented out code...
2018-09-14 21:00:52 +02:00
Ayke van Laethem
6450daa3c8
runtime/cgo: go fmt 2018-09-14 20:58:00 +02:00
Ayke van Laethem
f41a8032e7
machine/dummy: add fake button pins 2018-09-14 17:01:16 +02:00
Ayke van Laethem
752332ff13
machine/nrf: implement reading GPIO pins 2018-09-14 16:59:28 +02:00
Ron Evans
ab6757fe11
avr: implement Get() function on AVR, and leave stubs for NRF and dummy machines
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2018-09-13 20:54:01 +02:00
Ron Evans
d948abdf82 avr: correct register for Set() operation on pins 0-7
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2018-09-13 12:03:04 +02:00
Ayke van Laethem
8ce139284a
all: remove last traces of the C runtime
This increases code size on the nrf, but it is a fixed increase and can
hopefully be reduced in the future.
The Makefile gets a lot smaller with this which is a huge advantage
(less build time complexity).
2018-09-12 23:26:30 +02:00
Ayke van Laethem
f7f7d4cbbc
runtime/nrf: translate nrf sleep function from C to Go
This is the last critical part of the C runtime.

Code size is reduced by 4 bytes for examples/blinky2 (probably due to
inlining) and is unchanged for examples/test.
2018-09-12 22:24:17 +02:00
Ayke van Laethem
2788ab0172
all: rename __reg to __volatile
It is less magical now: it only marks loads and stores as volatile. So
the name '__reg' is a bit wrong now.
2018-09-12 22:05:41 +02:00
Ayke van Laethem
8675025fc8
compiler: implement type assert without comma-ok 2018-09-11 19:51:31 +02:00
Ayke van Laethem
31e0662856
runtime: use a specialized runtime panic function
This specifically fixes unix alloc(): previously when allocation fails
it would (recursively) call alloc() again to create an interface due to
lacking escape analysis.
Also, all other cases shouldn't try to allocate just because something
bad happens at runtime.

TODO: implement escape analysis.
2018-09-11 19:50:49 +02:00
Ayke van Laethem
4ad6df3227
all: complete the implementation of interface asserts
Because a few things were left unimplemented it only happened to kind-of
work before in my test cases.
This commit should complete interface-to-interface type asserts.
2018-09-11 19:39:25 +02:00
Ayke van Laethem
43b8c24226
compiler: implement interface assertions
This is a lot harder than 'regular' type assertions as the actual
methods need to be checked.
2018-09-06 20:18:18 +02:00
Ayke van Laethem
31f494e611
all: swap string from {len, ptr} to {ptr, len} for slice compatibility
Having slices and strings be similar makes other code simpler.
2018-09-06 10:50:13 +02:00
Ayke van Laethem
5aa8b71ae1
compiler: implement builtin copy(dst, src []T)
Not implemented: copying a string into a []byte slice.
2018-09-06 10:37:44 +02:00
Ayke van Laethem
01635b5efd
runtime: move panic functions to a separate file 2018-09-06 09:59:32 +02:00
Ayke van Laethem
094c5561b6
compiler: implement make([]T, ...) 2018-09-06 09:46:58 +02:00
Ayke van Laethem
f44d2f718f
compiler: rewrite defer support to better support them
This costs a bit in code size, but should be more flexible for the
future to implement recover() and running deferred functions while
panicking.
2018-09-05 20:34:17 +02:00
Ayke van Laethem
9101ea11bf
examples: clean up examples and add blinky1 for Arduino
Arduino has trouble supporting anything that's not extremely simple, so
add a simple blinky example for it. Also, it may be useful anyway.
2018-09-05 16:40:46 +02:00
Ayke van Laethem
17b5b6ec5b
all: use less magic in memory-mapped IO
Don't store addresses in the values of registers, this leads to problems
with char arrays (among others). Instead, do it like it's done in C with
raw addresses cast to struct pointers.

This commit also splits gen-device.py, as AVR and ARM have very
different ideas of what a register is. It's easier to just keep them
separate.
2018-09-05 12:18:21 +02:00
Ayke van Laethem
93248c93ed
avr: remove device files, use them from a subrepository
These files don't really belong in this repository. It's better to
generate them automatically from a source, like the one provided by the
avr-rust project. So a new command `make gen-device-avr` has been
provided for this purpose.
2018-09-05 12:13:33 +02:00
Ayke van Laethem
ce71d18450
runtime/nrf: remove AEABI functions
Apparently these functions were not actually used.
2018-09-05 07:09:24 +02:00