Commit Graph

364 Commits

Author SHA1 Message Date
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
Ayke van Laethem 5b0aaf0d39 targets: clean up and unify linker scripts
Especially arm.ld needed some cleaning up. Other than that, I've made
sure the two linker scripts look similar where possible.
2018-09-21 15:38:55 +02:00
Ayke van Laethem 2122780309 compiler: implement *ssa.ChangeType 2018-09-21 15:38:55 +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 2ca2220e44 compiler: move SSA construction to ir.go 2018-09-21 14:37:11 +02:00
Ayke van Laethem 2496ae9967 compiler: emit non-PIE executables
This fixes a problem on baremetal targets, where PIE doesn't make any
sense. Specifically, on ARM, the compiler sometimes inserted GOT
pointers for linker-defined globals.
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
Ayke van Laethem 7c9a3d70bc nrf: use correct ISA type for pca10040
No change to code size.
2018-09-18 20:16:55 +02:00
Ayke van Laethem c554c7c009 nrf: use assembly for nrf52, not nrf51
Slightly increase code size, but this is the more correct thing to do.
2018-09-18 20:15:18 +02:00
Ayke van Laethem 87963d3d5b compiler: add -size flag to replace size utility
The size flag has two modes:
  -size=short: prints data basically equivalent to the `size` program.
  -size=full:  tries to determine sizes per package (not entirely
               accurate).
2018-09-18 00:04:21 +02:00
Ayke van Laethem 8b94fe9205 avr: fix assembly comment regarding data/stack 2018-09-17 20:51:41 +02:00
Ayke van Laethem db8c3479d6 compiler: give names to nameless globals
This should make it easier in the future to show a breakdown of which
packages consume text/data/bss.
2018-09-17 20:41:48 +02:00
Ayke van Laethem 1f2af7d848 compiler: do not remove dead globals
These were not removed when they contain data, and will be removed by
LLVM anyway.
2018-09-17 15:15:03 +02:00
Ayke van Laethem b0aeaed635 compiler: allow a global to be defined multiple times
This is only possible when using compiler directives like the magic
_extern_ prefix on global variables.
2018-09-17 15:14:57 +02:00
Ayke van Laethem 77934f364f avr: fix corrupted .data byte
The stack and the .data section shared the first byte, leading to
corruption of the first byte of .data.
2018-09-17 15:10:52 +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 94358959f5 compiler: fix unsafe.Sizeof and friends for AVR
This fixes runtime.printptr().
2018-09-16 20:42:10 +02:00
Ayke van Laethem e04f0868ed compiler: fix constant globals on AVR
Turn const globals into non-const globals, at least until pointers have
the correct address space attribute.
2018-09-16 16:31:38 +02:00
Ayke van Laethem a02426948b avr: implement .data section
This doesn't completely work for some reason as the first character of
.data is corrupted, but otherwise it works.
2018-09-16 16:26:04 +02:00