Currently the way save-image works is it just compacts the used cells into the smallest contiguous block of memory possible and then dumps the workspace as a binary blob. If you're saving this blob to an SD card and you want to use it between multiple platforms running different revisions of uLisp, it won't work (memory/workspace locations, sizeof(void*) differences, builtin symbol indexes, etc)
Could a portable format for storing "compressed" images be developed? Then if the save-image source is the SD card, it can be saved to the portable format. That way if I'm developing a program on one microcontroller, get it to work, and then transfer the image to another microcontroller with a different feature set, it will still work.
My idea for a portable format would be to save the bit size of the microcontroller, so pointers can be resized appropriately, and then only save the offset of the object from the beginning of the array, so it can be loaded regardless of what the value of &Workspace[0] is (i.e. instead of writing (uintptr_t)obj, write (((uintptr_t)obj - &Workspace[0]) / sizeof(struct sobject))).
The other problem is it will still clobber over existing code when it is loaded. If only there were a way to compile a module file on a SD card, and then only load the compiled binary image of the module without clobbering the existing code!
Currently the way
save-imageworks is it just compacts the used cells into the smallest contiguous block of memory possible and then dumps the workspace as a binary blob. If you're saving this blob to an SD card and you want to use it between multiple platforms running different revisions of uLisp, it won't work (memory/workspace locations,sizeof(void*)differences, builtin symbol indexes, etc)Could a portable format for storing "compressed" images be developed? Then if the save-image source is the SD card, it can be saved to the portable format. That way if I'm developing a program on one microcontroller, get it to work, and then transfer the image to another microcontroller with a different feature set, it will still work.
My idea for a portable format would be to save the bit size of the microcontroller, so pointers can be resized appropriately, and then only save the offset of the object from the beginning of the array, so it can be loaded regardless of what the value of
&Workspace[0]is (i.e. instead of writing(uintptr_t)obj, write(((uintptr_t)obj - &Workspace[0]) / sizeof(struct sobject))).The other problem is it will still clobber over existing code when it is loaded. If only there were a way to compile a module file on a SD card, and then only load the compiled binary image of the module without clobbering the existing code!