GenBoard/UnderDevelopment/FirmWare/DynamicConfigRelated (2006-10-30 08:04:44)

Versatility and saving SRAM space


Important warning: tuningsoftware issues

Unfortunately the worst part of this is the tuningsw side, to make it configurable that is. We will NOT DEPEND ON THIS UNTIL that is solved

Might not be hard, as MegaTune vemsv3.ini can be generated from a particular dynamic configuration. But anyway, must be solved.

Textually configurable

yacc / lex / whatever can be used to generate the binary translation of the human-editable language

Graphically

The dynamic config will originally not be graphically editable.

TuningSoftware support for revpol is not more complex than other competing schemes (at least when considering only the cases that less effective scheme ssupport).

Full graphical editor for the reverse-polish language will not be available this week, unless it is already implemented somewhere on sourceforge, look for graph editors on LogAnalysis.

After all, all it takes is connecting the (input/output) ports of building blocks (like "blend" is a building block in our exampe below).


Dynamic configuration - THE best approach

Far the best way for dynamic configurability is

Eg. a stack-based reverse-polish language (in short, let's call "revpol"), like postscript. (and maybe Forth ?). But stored in binary form.

This means a user-specified function like\n

blend(
tablelookup( vetable, RPM, MAP ),
tablelookup( vetable, RPM, TPS ),
curvelookup( MAP_TPS_blend, RPM )
)

can be stored in appr 15 bytes. with 4 function codes.

The blend function code is the very last byte, it eats 3 variables from the stack, calculates the blend result that it pushes back to the stack.

Another example:

But remember we mostly use it for complex functions like

The implementation is very fast, takes little SRAM and flash, and very efficient. Some functions must allow to load/store data from SRAM (/ flash / EEPROM), not just stack (the tablelookup above is a clear example).

When someone wants to blend between 2 tables according to a manually actuated switch, the other according to actual position of the variable valves, we really want to avoid the configuration (+documentation) blowup that happens with the traditional config method.

Scheme language might be good to look at, maybe there is an "embedded scheme" implementation that could be used with little effort

FORTH is another language that might be worth investigating. Although many of us will know it from Apple and Sun Firmware or CompSci classes, it was originally designed for embedded applications (telescope control, specifically) and has been used on spacecraft by NASA, and on Boeing 777 avionics. It is available for AVR and ARM, and can be pre-compiled rather than interpreted if required.

"Hardware engineers love Forth. Traditional computer scientists hate it." -- John Catsoulis, Designing Embedded Hardware, O'Reilly, 2005.

Links about FORTH:

Implementations for the AVR: