A few months ago I managed to compile a very minimalistic squirrel virtual machine on the Teensy 3.1. The only function that I implemented was 'print()' and then I got distracted by other projects. The squirrel language is pretty awesome though, and this VM on a Teensy idea is something I'm thinking about working on a bit more.
The idea is that the VM runs on the Teensy and loads the bytecode program from an SD card. The actual script would be compiled into bytecode on a computer and then transferred to the SD card. I should mention the next Teensy is rumoured to have a uSD card slot.
Advantages are
The biggest hurdle of course is building Arduino functions into the VM. That'll be a huge task. Would the Teensy even have enough flash to handle a VM with all the popular libraries built in? Which libraries should be built into the VM and which ones could be implemented in bytecode?
So really, before I start getting into this, I'm hoping to get some feedback on feasibility. Questions or feedback anyone?
The idea is that the VM runs on the Teensy and loads the bytecode program from an SD card. The actual script would be compiled into bytecode on a computer and then transferred to the SD card. I should mention the next Teensy is rumoured to have a uSD card slot.
Advantages are
- Size of bytecode / program is limited by size of SD card rather than FLASH
- Given that the script loads from an SD card, the Squirrel script will have access to a file system.
- No difficult compiler toolchains.
- Squirrel has cooperative threads and memory management built in.
- Squirrel is fast and is real-time enough for applications like video games (and possibly time critical control applications).
- The interpreter is tiny and there is heaps of RAM left to have a huge (32KB maybe?) VM stack.
The biggest hurdle of course is building Arduino functions into the VM. That'll be a huge task. Would the Teensy even have enough flash to handle a VM with all the popular libraries built in? Which libraries should be built into the VM and which ones could be implemented in bytecode?
So really, before I start getting into this, I'm hoping to get some feedback on feasibility. Questions or feedback anyone?