Ayke van Laethem
5bace979ea
avr: use the correct RAM start address
Previously, the RAM was set to start at address 0. This is incorrect: on
AVR, the first few addresses are taken up by memory-mapped I/O. The
reason this didn't lead to problems (yet) was because the stack was
usually big enough to avoid real problems.
5 years ago
Ayke van Laethem
415c60551e
runtime/fe310: add support for PLIC interrupts
This commit adds support for software vectoring in the PLIC interrupt.
The interrupt table is created by the compiler, which leads to very
compact code while retaining the flexibility that the interrupt API
provides.
5 years ago
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.
5 years ago
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.
5 years ago
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.
5 years ago
Ayke van Laethem
06647aab24
tools/gen-device-avr: process files in parallel
This significantly speeds up processing of the files.
5 years ago
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.
5 years ago
Ayke van Laethem
93a06d1157
tools: avoid _paddingX in generated struct fields
This makes the generation script slightly simpler.
5 years ago
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>
5 years ago
Ron Evans
656fb4e372
tools/generator: correctly handle padding when it is 3 bytes long
Signed-off-by: Ron Evans <ron@hybridgroup.com>
5 years ago
Elliott Sales de Andrade
7c5f943564
Fix a Python SyntaxWarning.
Using 'is' for literals is incorrect, and only should be done for
singletons.
5 years ago
Ayke van Laethem
7938740bf3
tools: make tools python2 compatible
This allows the tools to be used for Python 2 and Python 3.
5 years ago
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
6 years ago
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.
5 years ago
Ayke van Laethem
c49d80628c
tools/gen-device-svd: refactor to make the code more declarative
5 years ago
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.
6 years ago
Ron Evans
90cd3f8ea5
tools: generate volatile HasBits() method in device wrappers to simplify bit comparison code
Signed-off-by: Ron Evans <ron@hybridgroup.com>
6 years ago
Ron Evans
3a73e64557
tools/gen-device: complete refactor to new generator based on volatile package
Signed-off-by: Ron Evans <ron@hybridgroup.com>
6 years ago
Ron Evans
de032cddd2
machine/sam: Refactor all machine/runtime code to use new volatile package/API
Signed-off-by: Ron Evans <ron@hybridgroup.com>
6 years ago
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.
6 years ago
Ron Evans
f89c695c8c
generators: correctly handle clustered subtypes used in Atmel SAMD21 SVD for important peripherals
Signed-off-by: Ron Evans <ron@hybridgroup.com>
6 years ago
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>
6 years ago
Ron Evans
8d1284cfe7
generator: generate device wrappers for Atmel SAM family
Signed-off-by: Ron Evans <ron@hybridgroup.com>
6 years ago
j7b
fad4a735e6
tools: use env to search path for python3
6 years ago
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>
6 years ago
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
6 years ago
Ayke van Laethem
9392ef900d
avr: add support for the digispark
Blinking the on-board LED works. Nothing else has been tested yet.
6 years ago
Ayke van Laethem
bc9210b674
nrf: add micro:bit board
6 years ago
Ayke van Laethem
b36b9c24a2
tools/gen-device-svd: fix interrupts for derived peripherals
6 years ago
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.
6 years ago
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.
6 years ago
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.
6 years ago
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.
6 years ago
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.
6 years ago
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.
6 years ago
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).
6 years ago
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
6 years ago
Ayke van Laethem
3076ad470e
tools/gen-device-svd: fix script filename in output
6 years ago
Ayke van Laethem
b9638315d2
avr: automatically generate interrupt vectors
6 years ago
Ayke van Laethem
eadec6f766
tools/gen-device-svd: avoid _Msk for single-bit fields
6 years ago
Ayke van Laethem
a577bc2a1b
tools/gen-device-svd: show better error messages
Show an error message when input .svd files cannot be found.
6 years ago
Ayke van Laethem
7c16f6c904
tools/gen-device-svd: make source URL configurable
6 years ago
Ayke van Laethem
b705b332a7
tools/gen-device-svd: indentation in .s file
6 years ago
Ayke van Laethem
e0d13f489f
tools/gen-device/svd: auto-generate output directory
6 years ago
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.
6 years ago
Ayke van Laethem
9fa08bf51d
all: use groupName in peripherals
This is needed for support for multiple instances of a peripheral type.
6 years ago
Ayke van Laethem
110230a50d
tools/gen-device-svd: make svd files deal with stm32
First concrete preparation for stm32 support at some point.
6 years ago
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.
6 years ago
Ayke van Laethem
505b1f750d
all: generate interrupt vector from .svd file
6 years ago
Ron Evans
fc0ff3a987
avr: initial implementation for PWM
Signed-off-by: Ron Evans <ron@hybridgroup.com>
Edited slightly by Ayke van Laethem
6 years ago