[<<][meta][>>][..]Thu Aug 19 22:37:40 CEST 2010
Data Structures in Flash
I'm worrying a bit about the memory usage of an application I'm
writing for a uC. It builds a large pointer-filled bookkeeping data
structure at startup. The whole structure is built in RAM, but the
result is completely determined by the (static) code.
Since the Flash memory size is 8x bigger than the RAM, this whole data
structure is better generated at compile time and put into Flash
storage. The result will probably be smaller in Flash than in RAM, as
the most compact reps can be chosen (i.e. arrays instead of lists).
The problem is that this needs a code generator. I don't think the
structure can be built just using the preprocessor alone.
But then, thinking further, why not put all the static data structures
in program Flash, i.e. most embedded apps do quite well with static nb
of threads etc.. Does it make sense to move the constant bookkeeping
data out of the RAM? How to implement something like that? Does it
Actually, this might be the niche for Staapl: compilation of static
structures into a base stack language. Once things are static, most
data structures can be combined with their "interpreter" into code
that executes them.