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


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

Note that we already have a full working expression evaluation implementation in v3gui that supports parentheses too (more convenient for power-users than reverse-polish). Maybe possible to generate a tokenized output that can be interpreted by the firmware.

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

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.

There are offtheshelf languages on this concept.

Eg. [Joy]

We most likely need 2 (not 1) stack and a heap (pointers to which can be passed on stack).

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:

Q) What would be a good (but small!) proof of concept application (on AVR, ARM, or PC) for this approach?

I got SwiftX Forth running on the PRIIO Dev Board, although I'll have to have some of the system code to use both serial ports (1 for the "XTL" console/debugger and one of the serial comms to whatever). It's a very cool system, writing software using almost natural languag - too bad the AVR version doesn't support defining new words (compiling new functions) on the target. pfAVR might be worth a look now.