user920: Is there an similar function in AVR-libc/Arduino C++ to mmap()? I'm looking for a way to place machine code in memory at runtime and make it executable.

user612: No.
First, mmap() makes almost no sense on an AVR, as there's no memory management unit or concept of process memory to configure.  Some related concepts like sbrk() are occasionally implemented in a minimalist fashion to let library functions designed for larger computers work, but they typically only update a tracking variable or fail.  For things that are physically realizable you can write your own mmap() if you really want, either allowing (assigning) or disallowing a region, and even if you really want automatically copying part of a file off an SD card or whatever...
But more importantly, your actual goal is entirely unachievable, as the AVR is a strict Harvard Architecture which can only execute instructions from flash, never from RAM.
If you want to execute from RAM, try one of the various small ARM Cortex M0/M4/M3 platforms (many of which have Arduino ports), or even consider a larger Embedded Linux system, which will not necessarily be any more expensive than an Arduino.

920: <p>Is there an similar function in AVR-libc/Arduino C++ to mmap()? I'm looking for a way to place machine code in memory at runtime and make it executable.</p>
 612: <p>No.</p>

<p>First, mmap() makes almost no sense on an AVR, as there's no memory management unit or concept of process memory to configure.  Some related concepts like sbrk() are occasionally implemented in a minimalist fashion to let library functions designed for larger computers work, but they typically only update a tracking variable or fail.  For things that are physically realizable you can write your own mmap() if you really want, either allowing (assigning) or disallowing a region, and even if you really want automatically copying part of a file off an SD card or whatever...</p>

<p>But more importantly, your actual goal is entirely unachievable, as the AVR is a strict Harvard Architecture which <strong>can only execute instructions from flash</strong>, never from RAM.</p>

<p>If you want to execute from RAM, try one of the various small ARM Cortex M0/M4/M3 platforms (many of which have Arduino ports), or even consider a larger Embedded Linux system, which will not necessarily be any more expensive than an Arduino.</p>
