Last year I did a port of Fuzix (a minimal Unix-like operating system) to the ESP8266; it worked really well. (<plug>http://cowlark.com/2021-02-09-esp8266-fuzix</plug>) I'd like to now do a port for the ESP32.
As the ESP32 has a MMU, it'd be really nice to use it. This would have a number of benefits including faster context switches and having all processes load at the same virtual address, but it seems that the WROVER and WROOM units I have don't support using external SRAM for code, so I'm limited to the internal 128kB+128kB RAM. That's lots, TBH, particularly when it's backed up by swap.
However I don't know how easy it is to use the MMU alongside the IDF. The simplest thing would be to run the entire Fuzix kernel as a FreeRTOS task, possibly tied to the second core, with kernel code in flash and the process code in SRAM0 and 2 (and ESP-IDF configured to ignore these areas). However, for the MMU to work at all I have to configure the PID to be 2..7. I know that FreeRTOS doesn't use the MMU at all; does it also not touch the PID system? Would there be any problems if I run the entire system at PID 2?
Using the MMU with ESP-IDF
Re: Using the MMU with ESP-IDF
Having done some more poring through the Technical Reference I see that there's actually quite a lot of things which don't work unless you're in supervisor mode (PID 0 or 1). So no, setting the PID globally to 2 won't work because SRAM1 and ROM0/1 will become unavailable.
I think the only option here is to somehow run FreeRTOS on PRO_CORE only and keep APP_CORE completely reserved for my own use. That way, FreeRTOS can run with PID 0 and the Fuzix code can switch between PID 0 and 2 depending on whether it's running Fuzix kernel or user code. This is actually rather elegant, as FreeRTOS will own one core and Fuzix the other. But I've seen people asking about this before with rather mixed results some people say it's almost impossible, others refer to CONFIG_FREERTOS_UNICORE which looks like it does what I want? Has anyone done this in real life?
I think the only option here is to somehow run FreeRTOS on PRO_CORE only and keep APP_CORE completely reserved for my own use. That way, FreeRTOS can run with PID 0 and the Fuzix code can switch between PID 0 and 2 depending on whether it's running Fuzix kernel or user code. This is actually rather elegant, as FreeRTOS will own one core and Fuzix the other. But I've seen people asking about this before with rather mixed results some people say it's almost impossible, others refer to CONFIG_FREERTOS_UNICORE which looks like it does what I want? Has anyone done this in real life?
Who is online
Users browsing this forum: Baidu [Spider], Google [Bot] and 70 guests