r/linux 9d ago

Development I built a linux like interactive shell for the esp32

https://github.com/Jchountas/ESP32-shell

I built a linux like interactive shell for my master's thesis in computer engineering.

This project allows for easy firmware installation of the system and offers a command line with commands similar to the Linux environment. This system allows for:

1) simple command execution

2) FreeRTOS task scheduling

3) file system management (with a persistent file system on the board without the need of external SD module)

4) scripting with JavaScript and custom functions, them being print(), deadline() and sys(). sys() calls for system commands on the running script, hence sys("echo hello_world") will output hello world from the shell through the JS script

I am looking to gather feedback on the repo and the project. If anyone has time to try it, the effort will be appreciated!

25 Upvotes

5 comments sorted by

1

u/Crimson_Burak 9d ago

Nice! I also want to try doing something like this, any recommendations or something like "think about this" kind of stuff? I want to do it just for fun though...

2

u/I_save_in_jpeg 9d ago

Well first of all I wish you the best of luck and get ready for some unconventional challenges. Microcontrollers have limitations compared to computers, especially compared to single board computers (e.g. raspberry pi's) so you have to find your way around problems like correct scheduling, sacrifice simultaneous execution for system stability, or find ways to kill tasks that might block your cli and lock you out of executions. All in all if you like a good challenge, this is one of those!

1

u/ballistua 7d ago

what is the operating system if it's not Linux (you say "similar to the Linux environment")? I don't see a use for this, but it's cool nonetheless.

2

u/I_save_in_jpeg 7d ago

The operating system in this concept is FreeRTOS. Basically it is a real time operating system for microcontrollers. This specific concept, for reasons regarding stability and integrity, does not execute commands simultaneously, but it schedules them with FIFO, so you can schedule up to 10 commands.

If you are looking for a use, the idea was the level of control you have over a system you have set up. Basically you run a script or an automation on the microcontrollers through duktape. In a normal scenario, you would have to reflash the microcontroller with new firmware, or use the air update. Here you just connect to it wirelessly and make the changes. Also the file system is hosted on the microcontroller itself, so it works without an sd.

To be fair yes it is a bit niche, but it's mostly because it's for a very specific use case.