Reputation: 9
I am developing a device based on RP2040. By using high capacity storage devices such as SD Card or **eMMC **in this device, I want my device to have more features. I want the codes/scripts uploaded to this storage medium (SD Card or eMMC) to be interpreted by my device and used as if it were a new feature. In other words, I want it to be used as if I were installing an application to an operating system. I am open to all the methods you can suggest at this stage.
Note: There is also a device called Flipper Zero that does exactly what I want. This device can interpret and execute code loaded on the SD card.
For example, I can develop an operating system-like structure that can interpret code loaded directly to the SD Card or eMMC. Or I can think of a way to establish a connection between the internal memory of the MCU and the SD Card/eMMC so that the script/code to be used is temporarily moved to the memory and then deleted from the memory after it is finished using it. (If it does not do this and keeps it in the memory all the time, the internal memory of the device may fill up and this can be a big problem). However, I am not sure if these methods are possible or if they will work. If it can be done, I have no idea how it can be done. Can you guide me in this matter?
Upvotes: 0
Views: 133
Reputation: 2779
You can possibly run MicroPython or CircuitPython variants that can load python code from SD cards. I've tested this in one of my projects. It's a handheld game console based on RP2040 MCU. Primary OS that has GB emulator can load ROMs from SD card. Micropython variant can load the python code from SD card. There are custom implementations and you can see the code here. https://github.com/codetiger/GameTiger-Console
Upvotes: 0
Reputation: 93556
You cannot run native code directly from an SD card filesystem as it is not memory mapped, it would be necessary to load code into memory. The difficulty then is linking. Unless the stored applications are entirely standalone and fully linked, you will need a way of linking with the core services. There was a question related to that a while back which may give you some ideas.
The Arduino based Gamebuino has a bootloader that allows you to select an image from SD card via a menu, from which it reflashes the application space and launches it. That is a relatively simple solution, but is not really "adding features", but rather switching applications.
It would be possible to load and run interpreted code from SD card, but that would restrict performance and functionality to that if whatever language interpreter you were able to implement. You may even have to build your own interpreter. It would however meet the requirements of being able to "add features" to a core system.
Upvotes: 0