E. Weddington wrote:
Basically, trampolines don't work for the AVR because it is a Harvard Architecture device.
Nearly all the processors on which trampolines are implemented are Harvard architecture, it's really standard these days. That means that cache flushing is a standard part of implementation of trampolines on many systems, even I believe requiring system calls in some cases, and yes, this is horribly expensive!
Any alternatives that would work for Harvard Architecture devices such as the AVR would be welcome.
There are no alternatives that do not have an overhead in the case where pointers to nested functions are *not* used, which seems unacceptable in C. You could introduce some kind of pragma for a special kind of pointer I suppose, but it seems the feature is so little used in C that this would be overkill.