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

20 коммитов

Автор SHA1 Сообщение Дата
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
4d5b5241ec
all: avoid _Msk fields when not necessary 2018-09-22 17:42: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
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
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
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
83ad0b6137
all: move bootstrapping IR to Go runtime
This has the benefit of not requiring a 'runtime' IR file, so that
complete relocatable files can be built without requiring input IR.
This makes the compiler a lot easier to use without the Makefile.

Code size is not affected.
2018-09-04 21:18:26 +02:00
Ayke van Laethem
d4f5700625
Remove use of CGo in the runtime
CGo depends on syscall, which (in the standard library) depends on sync,
which depends on the runtime. There are also other import cycles. To be
able to use the syscall package from upstream, stop using CGo.
2018-08-29 20:01:33 +02:00
Ayke van Laethem
62c4c5e90b
go fmt 2018-08-17 23:23:20 +02:00
Ayke van Laethem
802302a1aa
Add support for inline assembly
This depends on support in LLVM, which hasn't been merged yet.
See: https://reviews.llvm.org/D46437
2018-06-07 18:29:49 +02:00
Ayke van Laethem
0168bf7797
Add goroutines and function pointers 2018-06-07 14:48:24 +02:00
Ayke van Laethem
b4e60deacd
runtime/nrf: Fix allocator by adding align() function 2018-06-03 17:56:56 +02:00
Ayke van Laethem
a39951c3d7 runtime: Convert device initialization to Go 2018-05-05 20:10:39 +02:00
Ayke van Laethem
d4170faa0a runtime/nrf: Add Sleep() 2018-04-26 23:47:59 +02:00
Ayke van Laethem
c940617849 compiler: Implement init() 2018-04-26 18:54:46 +02:00
Ayke van Laethem
04fef19753 Add runtime support for the nRF52 2018-04-25 20:06:08 +02:00