Run linux on the ESP32?
Run linux on the ESP32?
Hi there!
I recently read that there are ESP32 modules with 4MB and I heard even 8MB ram. This made me wonder if we can run Linux?
Now I know Linux needs a MMU, but I thought older Linux versions(3.x?) that had the UClinux changes integrated and thus can compile without MMU.
Is it maybe interesting for someone to try?
Or would it at least be possible?
Thanks!
I recently read that there are ESP32 modules with 4MB and I heard even 8MB ram. This made me wonder if we can run Linux?
Now I know Linux needs a MMU, but I thought older Linux versions(3.x?) that had the UClinux changes integrated and thus can compile without MMU.
Is it maybe interesting for someone to try?
Or would it at least be possible?
Thanks!
Re: Run linux on the ESP32?
You'd be stretching yourself to thin in doing so, not to mention what real gain would you get by doing so.
For just a few more bucks you can get a Allwinner H2+, Quad-core Cortex-A7 that is meant to run it
https://www.friendlyarm.com/index.php?r ... uct_id=197
For just a few more bucks you can get a Allwinner H2+, Quad-core Cortex-A7 that is meant to run it
https://www.friendlyarm.com/index.php?r ... uct_id=197
Re: Run linux on the ESP32?
.... for technical completeness, the ESP32 does indeed have an MMU as well as hardware assistance for process instance isolation of memory.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: Run linux on the ESP32?
I thought that one was not complete enough for Linux?kolban wrote:.... for technical completeness, the ESP32 does indeed have an MMU as well as hardware assistance for process instance isolation of memory.
But what is it needed for anyway? Is it just preventing a process from modifying another process's ram?(Hacking or something)
Re: Run linux on the ESP32?
Typically memory isolation is used for robustness. In a privileged address space (ESP32 default), an error in an application or subroutine or task could merrily step all over the memory of other applications. By leveraging process isolation, one adds an extra degree of resiliency to a solution. Assuming an application is composed of multiple coarse grained components, each of those components could be insulated and isolated from the others so a logic error in one component would have that much more resiliency from interfering with the operation of another. While security is a possible utilization, historically, memory isolation between processes was designed for robustness and form simplifcation of the overall environment in which applications run.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: Run linux on the ESP32?
That's interesting. So if I e.g. am writing outside of an array, into another process. The MMU(if active) would just terminate the process? Or reset the ESP?kolban wrote:Typically memory isolation is used for robustness. In a privileged address space (ESP32 default), an error in an application or subroutine or task could merrily step all over the memory of other applications. By leveraging process isolation, one adds an extra degree of resiliency to a solution. Assuming an application is composed of multiple coarse grained components, each of those components could be insulated and isolated from the others so a logic error in one component would have that much more resiliency from interfering with the operation of another. While security is a possible utilization, historically, memory isolation between processes was designed for robustness and form simplifcation of the overall environment in which applications run.
Also I did some research on MMU's, and one thing I read was that it gives each process it's own memory space. Is that correct?
If so, does this mean, I could load precompiled programs from an SD, into memory. Give a process a memory space(using the MMU), and have multiple programs running?
As I would love to turn an ESP into some mini PC, developing my own mini OS.
Thanks!
Re: Run linux on the ESP32?
There is a super detailed ESP32 manual called the ESP32 Technical Reference. In chapter "26 - PID/MPU/MMU" there are descriptions of the hardware support for these areas of functions. What I would suggest is to have a good slow read of that section and see how much of it makes sense. I had to read it multiple times and am still novice level.
See:
https://www.espressif.com/sites/default ... ual_en.pdf
See:
https://www.espressif.com/sites/default ... ual_en.pdf
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: Run linux on the ESP32?
I must admit I also don't understand quite well how exactly memory management looks like.
What I found out is that it is all done by special memory mapping tables that assign certain context of the process to addressees.
I don't understand why PSRAM space cannot be executed by CPU - is it because MPU disallows it meaning the addresses don't exist in the tables or they have forbidden access flags assigned. This is supposed to be more straightforward.
What I found out is that it is all done by special memory mapping tables that assign certain context of the process to addressees.
I don't understand why PSRAM space cannot be executed by CPU - is it because MPU disallows it meaning the addresses don't exist in the tables or they have forbidden access flags assigned. This is supposed to be more straightforward.
Re: Run linux on the ESP32?
Thanks, I'll read it when I have some time!kolban wrote:There is a super detailed ESP32 manual called the ESP32 Technical Reference. In chapter "26 - PID/MPU/MMU" there are descriptions of the hardware support for these areas of functions. What I would suggest is to have a good slow read of that section and see how much of it makes sense. I had to read it multiple times and am still novice level.
See:
https://www.espressif.com/sites/default ... ual_en.pdf
PSRAM can't contain executable instructions? That's unfortunate. Would have been useful for making a little OS that can load programs into ram and execute them.Deouss wrote:I must admit I also don't understand quite well how exactly memory management looks like.
What I found out is that it is all done by special memory mapping tables that assign certain context of the process to addressees.
I don't understand why PSRAM space cannot be executed by CPU - is it because MPU disallows it meaning the addresses don't exist in the tables or they have forbidden access flags assigned. This is supposed to be more straightforward.
Re: Run linux on the ESP32?
Hello.
Today I saw an article about Linux running over no MMU processors, included some xtensa.
I hope someday I can to run Linux on ESP32.
https://www.cnx-software.com/2019/12/03 ... -go-board/
Today I saw an article about Linux running over no MMU processors, included some xtensa.
I hope someday I can to run Linux on ESP32.
https://www.cnx-software.com/2019/12/03 ... -go-board/
Who is online
Users browsing this forum: No registered users and 115 guests