Ayke van Laethem
a5ed993f8d
all: add compiler support for interrupts
...
This commit lets the compiler know about interrupts and allows
optimizations to be performed based on that: interrupts are eliminated
when they appear to be unused in a program. This is done with a new
pseudo-call (runtime/interrupt.New) that is treated specially by the
compiler.
2020-01-20 21:19:12 +01:00
Ayke van Laethem
dffb9fbfa7
tools: use byte padding to skip unused register ranges
...
This simplifies the code. The fields are blank anyway so there is no way
to access them anyway (volatile or not).
Also do some other related simplifications of the code that result from
this change.
2019-12-21 19:59:41 +01:00
Ayke van Laethem
cf32607306
tools: rewrite gen-device-svd in Go
...
This should make it more maintainable. Another big advantage that
generation time (including gofmt) is now 3 times faster. No real attempt
at refactoring has been made, that will need to be done at a later time.
2019-12-14 22:27:45 +01:00
Ayke van Laethem
06647aab24
tools/gen-device-avr: process files in parallel
...
This significantly speeds up processing of the files.
2019-12-07 16:04:47 +01:00
Ayke van Laethem
24259cbb5f
tools: rewrite gen-device-avr in Go
...
This brings a big speedup. Not counting gofmt time,
`make gen-device-avr` became about 3x faster. In the future, it might be
an idea to generate the AST in-memory and write it out already
formatted.
2019-12-07 16:04:47 +01:00
Ayke van Laethem
93a06d1157
tools: avoid _paddingX in generated struct fields
...
This makes the generation script slightly simpler.
2019-12-04 23:11:42 +01:00
Ron Evans
fb1a476033
generator: handle fields that use bitRange element and ensure all caps for attributes that are not already capitalized or start with number.
...
Also handle subclusters.
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-10-09 18:36:03 +02:00
Ron Evans
656fb4e372
tools/generator: correctly handle padding when it is 3 bytes long
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-13 00:40:25 +02:00
Elliott Sales de Andrade
7c5f943564
Fix a Python SyntaxWarning.
...
Using 'is' for literals is incorrect, and only should be done for
singletons.
2019-08-27 14:17:17 +02:00
Ayke van Laethem
7938740bf3
tools: make tools python2 compatible
...
This allows the tools to be used for Python 2 and Python 3.
2019-08-26 16:39:28 +02:00
Ayke van Laethem
ffa38b183b
all: add HiFive1 rev B board with RISC-V architecture
...
This page has been a big help in adding support for this new chip:
https://wiki.osdev.org/HiFive-1_Bare_Bones
2019-07-07 14:03:24 +02:00
Ayke van Laethem
fa928e8cd3
tools/gen-device-svd: be a bit more forgiving for stm32 svd files
...
Some newer files have a few mistakes. Allow them to be processed.
2019-07-06 17:16:18 +02:00
Ayke van Laethem
c49d80628c
tools/gen-device-svd: refactor to make the code more declarative
2019-07-06 17:16:18 +02:00
Ayke van Laethem
9673ad3774
all: move Register{8,16,32} values into runtime/volatile
...
This avoids duplication of code. None of the smoke tests have changed
their output.
2019-06-06 19:46:49 +02:00
Ron Evans
90cd3f8ea5
tools: generate volatile HasBits() method in device wrappers to simplify bit comparison code
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-05-27 18:43:11 +02:00
Ron Evans
3a73e64557
tools/gen-device: complete refactor to new generator based on volatile package
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-05-24 16:28:47 +02:00
Ron Evans
de032cddd2
machine/sam: Refactor all machine/runtime code to use new volatile package/API
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-05-19 19:53:11 +02:00
Ayke van Laethem
e0cf74e638
avr: use register wrappers that use runtime/volatile.*Uint8 calls
...
This avoids the //go:volatile pragma on types in Go source code, at
least for AVR targets.
2019-05-14 12:24:01 +02:00
Ron Evans
f89c695c8c
generators: correctly handle clustered subtypes used in Atmel SAMD21 SVD for important peripherals
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-01-20 18:40:49 +01:00
Ron Evans
9ac2f39acc
tools/gen-device-svd: handle case with nested registers that have same address to avoid duplicates
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-01-15 11:00:56 +01:00
Ron Evans
8d1284cfe7
generator: generate device wrappers for Atmel SAM family
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-01-13 18:59:56 +01:00
j7b
fad4a735e6
tools: use env to search path for python3
2019-01-08 12:52:47 -08:00
Ron Evans
70830cd9da
tools: correct error generating board files that calculated the address incorrectly after a cluster type
...
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2018-12-01 18:17:28 +01:00
Ayke van Laethem
4a8ced590b
tools/gen-device-svd: generate .s files compatible with lld
...
The llvm linker expects some flags to line up in input sections mapped
to a particular output section, which the GNU linker ignored. Make sure
this flag is set in the input section, see:
https://svnweb.freebsd.org/base/stable/11/sys/arm/arm/locore-v4.S?r1=321049&r2=321048&pathrev=321049
2018-11-22 12:35:17 +01:00
Ayke van Laethem
9392ef900d
avr: add support for the digispark
...
Blinking the on-board LED works. Nothing else has been tested yet.
2018-11-20 18:50:24 +01:00
Ayke van Laethem
bc9210b674
nrf: add micro:bit board
2018-10-06 13:04:14 +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
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
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
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
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
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
3076ad470e
tools/gen-device-svd: fix script filename in output
2018-09-23 20:50:44 +02:00
Ayke van Laethem
b9638315d2
avr: automatically generate interrupt vectors
2018-09-23 20:37:22 +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
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
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
505b1f750d
all: generate interrupt vector from .svd file
2018-09-21 15:38:28 +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
18b3e8d156
gen-device: move to new tools directory
2018-09-13 00:55:18 +02:00