asm_tools
Macro languages for deeply embedded software
development
asm_tools
is a collection of code analysis and code generation tools
implemented as Haskell libraries built
around
tagless-final
eDSLs.
In a nutshell this approach allows using Haskell as a macro
language, while providing multiple interpretations of the same low
level code fragment, e.g. target code generation and custom
emulation and instrumentation to test the code.
It currently contains a macro assembler for the TI AM335x PRU-ICSS,
used to construct embedded control programs via the technique of
"static weaving", together with QuickCheck test instrumentation and
gtkwave output.
It also contains Seq, an RTL macro language that targets MyHDL and
Verilog directly, together with a control CPU written in Seq, and
tools to support hardware/software codesign. Basically, CPU code
and the RTL code of the bus it talks to can be in the same Haskell
module.
A third leg is under development, targeting LLVM for Digital Signal
Processing code fragments. This is roughly a port of RAI together with some older
experimental work.
Note that these techniques are in no way new. However, tools that
implement them are often closed source and very expensive, or
burried in research papers and never polished. The purpose of this
library is to take the bare essentials of the ideas, getting into
useful territory with a fraction of the resources. Real work is
being supported with these tools.
uc_tools, erl_tools
Embedded software upport
libraries
uc_tools
and
erl_tools are
the low level and high level components of the "hub and spokes"
model I've been using in one form or another in most of my embedded
software work: a Linux machine running some kind of dynamically
typed language to orchestrate a collection of native code programs
running on the local machines, or on microcontrollers connected
through some kind of bus, where the native code is often kept
"dumb". I have settled on Erlang as the dynamically typed language
for various reasons, mostly releated to its protocol-oriented nature
and its ability to support a low-latency incremental development
style without needing full system resets. Erlang effectively takes
the role of a distributed systems OS. For the lower level bits
running on the Linux application processors, servers and and bare
uC, I use mostly C, and more recently also Rust. These libraries
contain the current incarnation of support code for this type of
archtecture.