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

3689 коммитов

Автор SHA1 Сообщение Дата
Ayke van Laethem
13cb7d6503
avr: add interrupt support
Interrupts are supported using a special //go:interrupt pragma.
For example:

//go:interrupt INT0_vect
func handleINT0() {
    // do something here
}
2018-09-25 13:47:20 +02:00
Ayke van Laethem
dc88948f55
Makefile: go fmt testdata/*.go 2018-09-25 13:45:50 +02:00
Ayke van Laethem
174b6333f8
compiler: fix expanding zero-length structs 2018-09-25 13:45:04 +02:00
Ayke van Laethem
d8f0ddf3fa
main: add tests
Add testing infrastructure and one initial test (for
src/runtime/print.go). More tests to be added later.
2018-09-24 17:24:58 +02:00
Ayke van Laethem
ed227b8fd3
all: fix errors reported by go vet 2018-09-24 17:22:59 +02:00
Ayke van Laethem
a2eaaa42a0
main: optimize 'tinygo run'
Apparently -Oz without inliner is the fastest, probably because it
removes code that would otherwise need to be emitted.

TODO: does this mean that the ExecutionEngine compiles the module before
running it? Can we control this?
2018-09-24 16:22:09 +02:00
Ayke van Laethem
c9ae72a105
all: allow -O0 optimization level 2018-09-24 16:17:42 +02:00
Ayke van Laethem
6191d4e1ac
compiler: rename .Parse() to .Compiler()
The fact it was called Parse() is more of a historical accident, as the
compiler started out using the Go AST directly instead of Go SSA.
2018-09-24 15:55:38 +02:00
Ayke van Laethem
1b229a8f8b
compiler: support compiling individual .go files
For example:

    tinygo run ./src/examples/test/test.go
2018-09-24 15:46:30 +02:00
Ayke van Laethem
a561e9a9ac
ir: move adding packages from the compiler 2018-09-24 15:46:30 +02:00
Ayke van Laethem
9df04a2170
compiler: fix panic on import errors
I think this is a problem in the loader package - it doesn't seem to
return errors for missing packages.
2018-09-24 15:46:30 +02:00
Ayke van Laethem
8a468786df
compiler: use config struct for options 2018-09-24 15:46:05 +02:00
Ayke van Laethem
ddd4a39cb8
avr: fix default handler in interrupt vector
Apparently the target of a weak symbol must be defined in the same file
as where it is used as a weak symbol.

https://www.avrfreaks.net/forum/using-weak-custom-vector-table#comment-745922
2018-09-24 13:03:21 +02:00
Ayke van Laethem
fd6dda5e4f
main: run the compiler from any path 2018-09-24 12:25:33 +02:00
Ayke van Laethem
453450f40d
ir: sort function pragmas 2018-09-23 23:30:13 +02:00
Ayke van Laethem
3076ad470e
tools/gen-device-svd: fix script filename in output 2018-09-23 20:50:44 +02:00
Ayke van Laethem
b09f7a5e6c
avr: make linker script generic 2018-09-23 20:50:12 +02:00
Ayke van Laethem
b9638315d2
avr: automatically generate interrupt vectors 2018-09-23 20:37:22 +02:00
Ayke van Laethem
3850530c88
docs/installation: fix LLVM hyperlink 2018-09-23 17:21:49 +02:00
Ayke van Laethem
3e1a60351d
docs/internals: fix hyperlink 2018-09-23 17:20:24 +02:00
Ayke van Laethem
7c597c910f
README: move installation instructions to docs 2018-09-23 17:15:52 +02:00
Ayke van Laethem
4868823dad
README: add docs badge 2018-09-23 17:13:26 +02:00
Ayke van Laethem
c9a2b3f417
docs: remove "Indices and tables" 2018-09-23 17:05:32 +02:00
Ayke van Laethem
f7f33a1163
docs: add initial documentation 2018-09-23 16:46:57 +02:00
Ayke van Laethem
2938437efc
compiler: make string data unnamed addresses
This ensures LLVM can merge identical strings, and thus reduces code
size in some cases.
2018-09-23 03:03:40 +02:00
Ayke van Laethem
7cea40bcb5
compiler: small cleanup in call handling code 2018-09-23 03:01:10 +02:00
Ayke van Laethem
fdfa810060
compiler: expand small structs
Use fields of small structs (3 or less fields when flattened
recursively) directly as parameter values.

Advantages:
  * Code size is slightly reduced, both on unix and nrf.
  * AVR can finally deal with struct parameters - at least the small
    ones. examples/test now compiles. A real fix for struct parameters
    should go into upstream LLVM, but this is a nice win.

fixes #20
2018-09-23 02:39:05 +02:00
Ayke van Laethem
a86739d235
Makefile: add new packages to tgo dependencies 2018-09-23 01:17:46 +02:00
Ayke van Laethem
b2cbfa78ca
compiler: refactor compiler into separate package 2018-09-22 20:32:28 +02:00
Ayke van Laethem
b75a02e66d
compiler: refactor IR parts into separate package 2018-09-22 20:32:07 +02:00
Ayke van Laethem
473e71b573
compiler: implement range over a string 2018-09-22 19:19:53 +02:00
Ayke van Laethem
18b5ab290c
compiler: recognize untyped strings as strings 2018-09-22 19:18:09 +02:00
Ayke van Laethem
c8587c7d1e
Makefile: go fmt more packages 2018-09-22 17:44:42 +02:00
Ayke van Laethem
4d5b5241ec
all: avoid _Msk fields when not necessary 2018-09-22 17:42:44 +02:00
Ayke van Laethem
eadec6f766
tools/gen-device-svd: avoid _Msk for single-bit fields 2018-09-22 17:42:05 +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
Ayke van Laethem
2c21925f4c
targets: put board name in build tags 2018-09-22 15:37:46 +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
a577bc2a1b
tools/gen-device-svd: show better error messages
Show an error message when input .svd files cannot be found.
2018-09-22 14:34:40 +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
895d109fc4
compiler: run flash command in a shell 2018-09-22 01:40:46 +02:00
Ayke van Laethem
7517ac86e4
runtime: merge common sleep() functions 2018-09-22 01:40:04 +02:00
Ayke van Laethem
7c16f6c904
tools/gen-device-svd: make source URL configurable 2018-09-22 01:20:34 +02:00
Ayke van Laethem
b705b332a7
tools/gen-device-svd: indentation in .s file 2018-09-22 01:09:08 +02:00
Ayke van Laethem
e0d13f489f
tools/gen-device/svd: auto-generate output directory 2018-09-22 01:08:42 +02:00
Ayke van Laethem
d841daa32b
tools/gen-device-svd: emit correct Go code for stm32
Groups were not recognized because the parser only looked at the
derivedFrom attribute and not at <groupName> tags for matching
peripherals.
2018-09-22 01:05:22 +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
110230a50d
tools/gen-device-svd: make svd files deal with stm32
First concrete preparation for stm32 support at some point.
2018-09-21 21:52:16 +02:00