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

603 коммитов

Автор SHA1 Сообщение Дата
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
Ayke van Laethem
e1e3dbdce6
compiler: correctly generate global hashmaps of size > 8
Static map generation used the last bucket instead of the first bucket
in the chain, which caused lots of missing entries in hashmaps with
multiple buckets (size > 8).
2018-10-10 14:06:59 +02:00
Ayke van Laethem
0e65b0da1c
docs: add page "Go on microcontrollers" 2018-10-09 15:32:40 +02:00
Ayke van Laethem
823ecd5167
docs: reorder internals sections 2018-10-09 15:32:40 +02:00
Ayke van Laethem
ec73bd6a26
compiler: optimize runtime.stringToBytes calls
This optimization makes sure the following pattern doesn't do a heap
allocation (assuming Write doesn't modify the slice):

    var w *machine.UART = ...
    w.Write([]byte("foo"))

As long as Write doesn't modify the slice and LLVM can detect this, a
call to runtime.stringToBytes with the necessary allocation + copy is
avoided.
2018-10-09 14:18:12 +02:00
Ayke van Laethem
4219652535
compiler: add basic heap-to-stack optimization 2018-10-09 14:14:52 +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
aee9eb413e
main, travis: add qemu to run tests in
This makes sure we'll catch bugs that occur only on ARM hardware.
2018-10-08 20:36:25 +02:00
Ayke van Laethem
3289dd7134
compiler: use a fresh context for every compilation 2018-10-08 20:18:12 +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
96f07243a4
main: add aeabi builtins to arm targets
Some builtins require these __aeabi_* functions.
2018-10-07 23:20:46 +02:00
Ayke van Laethem
e50c6f1af1
main: generate binary files when compiling to .bin 2018-10-07 22:48:33 +02:00
Ayke van Laethem
f0f6a12d19
docs: add avr-libc as a dependency 2018-10-07 22:14:44 +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
Ayke van Laethem
73709922b2
main: extra interface test for simple named types 2018-10-07 19:40:21 +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
Ron Evans
269bef5494
microbit: add Makefile entries for target=microbit
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2018-10-07 19:06:00 +02:00
Ayke van Laethem
22da104530
all: use compiler-rt for builtins 2018-10-07 19:04:29 +02:00
Ayke van Laethem
e8f211935e
compiler: fix expanded structs in invoke calls 2018-10-07 13:19:38 +02:00
Ayke van Laethem
4957db89f4
compiler: fix interface calls for big underlying values
When the underlying value of an interface does not fit in a pointer, a
pointer to the value was correctly inserted in the heap. However, the
receiving method still assumed it got the underlying value instead of a
pointer to it leading to a crash.

This commit inserts wrapper functions for method calls on interfaces.

The bug wasn't obvious as on a 64-bit system, the underlying value was
almost always put directly in the interface. However, it led to a crash
on the AVR platform where pointer are (usually) just 16 bits making it
far more likely that underlying values cannot be directly stored in an
interface.
2018-10-07 02:06:48 +02:00
Ayke van Laethem
482c5633dd
compiler: put debug information on package initializer functions
Make sure package initializers show up in backtraces, as they should. In
practice, it doesn't actually break backtraces as these functions are
usually inlined anyway, but it may help to debug an error in
initialization code.
2018-10-06 23:50:35 +02:00
Ayke van Laethem
5db43e8d04
compiler: move Optimize() function to a separate file
In the future, there will be more optimizations. Let's keep them in a
separate file for separation of concerns.
2018-10-06 19:57:41 +02:00
Ayke van Laethem
c9c9935b9c
travis: add micro:bit 2018-10-06 13:51:40 +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
Ayke van Laethem
b36b9c24a2
tools/gen-device-svd: fix interrupts for derived peripherals 2018-10-03 20:06:13 +02:00
Ayke van Laethem
9d408b7cbc
main: hide OCD output by default in gdb subcommand
In most cases, it's useless. But in some cases it may be critical if the
OCD server (like openocd) has a problem.

It would be nice if openocd would differentiate between stdout and
stderr, and only write errors to stderr. But sadly it doesn't.
2018-10-03 19:33:36 +02:00
Ayke van Laethem
5d2ffa79e5
compiler: improve debug info to cover initialization 2018-10-03 19:24:29 +02:00
Ayke van Laethem
f2768bee17
nrf: better formatting of pca10040.json 2018-10-03 19:03:27 +02:00
Ayke van Laethem
b08c8a0cf0
all: implement gdb sub-command for easy debugging 2018-10-03 19:03:22 +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
Ayke van Laethem
3540fd9638
travis: try to build blinky2 for the host 2018-10-02 16:00:52 +02:00
Ayke van Laethem
afecd28859
travis: test running a few builds for MCUs
Just a sanity check nothing gets horribly broken in the "runtime" or
"machine" packages.
2018-10-02 15:42:13 +02:00
Ayke van Laethem
2ca4540f2a
tools/gen-device-svd: support old Python version
Travis-CI runs Ubuntu Trusty with Python 3.4, so we have to support
that.
2018-10-02 14:22:28 +02:00
Ayke van Laethem
bdcac9ae42
Makefile: add gen-device-stm32 to gen-device target 2018-10-02 13:30:49 +02:00
Ayke van Laethem
ffa6d562a9
tools/gen-device-svd: fix bug in previous commit
There was a bug in the generated Go code: padding member numbers would
not increase their count leading to multiple struct members with the
same name.
2018-10-01 21:21:09 +02:00
Ayke van Laethem
a72d0b7959
tools/gen-device-svd: make sure all clusters are included
This is important for nrf52840, which has UART pin selection in a
cluster that wasn't exposed.
2018-10-01 17:14:33 +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
Ayke van Laethem
bcf441ccba
docs: add another way in which a llvm-7-dev installation can fail 2018-09-30 18:02:15 +02:00
Ayke van Laethem
eac81e5232
Makefile: run verbose 'make test' 2018-09-30 18:01:14 +02:00
Ayke van Laethem
02936042b8
travis: add Travis CI build script 2018-09-30 17:32:40 +02:00
Ayke van Laethem
a2e57b40f9
docs: update installation instructions
* Update to system-installed LLVM.
  * Avoid the use of make.
2018-09-30 15:40:58 +02:00
Ayke van Laethem
f107a24b72
all: use LLVM library provided by the system 2018-09-30 15:10:04 +02:00
Ayke van Laethem
5c79a93c85
tools/gen-device-svd: generate code for cluster arrays
This should make it possible to add support for PWM on nrf devices.
2018-09-30 14:57:06 +02:00
Ayke van Laethem
9b4a6dcc14
tools/gen-device-svd: move peripheral list to beginning
It's much easier to scan the source when the peripheral list is at the
front. Go doesn't care about the order of declaration anyway.
2018-09-30 14:56:19 +02:00
Ayke van Laethem
e77a5af5d2
tools/gen-device-svd: rewrite with ElementTree
xml.etree.ElementTree is much easier to work with. This also fixes a few
small bugs in the parser. And as an added bonus, device generation got a
lot faster: apprently etree is a lot faster than minidom.
2018-09-30 14:55:38 +02:00