Most recent activity
-
I was trying to build Espruino 2v08 for ESP32 with reduced libraries. I managed to remove all libraries from ESP32 in the
BOARD.py
file, but "NET" was the only one I could not remove. (the build failed after removing it)Here is my
info.build
fromboards/ESP32.py
:{ 'optimizeflags' : '-Og', 'libraries' : [ ], 'makefile' : [ 'DEFINES+=-DESP_PLATFORM -DESP32=1', 'DEFINES+=-DESP_STACK_SIZE=25000', 'DEFINES+=-DJSVAR_MALLOC', # Allocate space for variables at jsvInit time 'DEFINES+=-DUSE_FONT_6X8', 'ESP32_FLASH_MAX=1572864', 'USE_NETWORK_JS=0', ] }
Here is the error message from build:
targets/esp32/jshardware.c:48:34: fatal error: jswrap_esp32_network.h: No such file or directory compilation terminated. Makefile:777: recipe for target 'targets/esp32/jshardware.o' failed make: *** [targets/esp32/jshardware.o] Error 1 make: *** Waiting for unfinished jobs.... make: *** wait: No child processes. Stop.
I tried to remove the
#include <jswrap_esp32_network.h>
fromjshardware.c
but there are still other dependencies broken. Am I doing anything wrong?Any help will be appreciated.
-
- 8 comments
- 13,051 views
-
Try to answer question 2:
Just realized2300
is actually the number of JsVars allocated for Espruino. The number is automatically calculated in targets/esp32/main.c based on the available heap - 40000 bytes (I guess it's for the Bluetooth stack?).
So the approaches to increase the number of JsVars (e.g. RAM for Espruino) could be:- remove unused libraries from build to save more heap space (remove that 40000 if Bluetooth stack is removed)
- decrease the ESP_STACK_SIZE to allocate less DRAM heap for Espruino task's stack
- remove unused libraries from build to save more heap space (remove that 40000 if Bluetooth stack is removed)
-
Try to answer question 1:
Since Espruino creates its task with xTAskCreatePinnedToCore() in task_init(), the available RAM size for Espruino depends on the available DRAM heap which is dynamically allocated from the data RAM (composed of DRAM and I/DRAM in several non-contiguous regions).The available heap for a FreeRTOS task is all of the data RAM which is not statically allocated. https://github.com/espressif/esp-idf/issues/2042#issuecomment-396101249
Since ESP32 has 328 KiB of data RAM, the theoretical maximum DRAM heap for Espruino is 328 KiB. But the stack size needs to be allocated from the heap. Other tasks also take up the data RAM.
In the end, the total available heap (data RAM) for Espruino may be less than 190 KiB if the Bluetooth stack is used. -
Answer to question 3:
Seems ESP_STACK_SIZE is used byxTAskCreatePinnedToCore()
in task_init() as an input argument. The function creates a FreeRTOS task to run Espruino, andESP_STACK_SIZE
defines the stack size for the task. -
-
Some questions regarding the RAM size and board definition file for Espruino on ESP32.
What is the theoretical maximum number of the available RAM for Espruino on ESP32? Since ESP32's RAM is not contiguous, is Espruino taking up only one of the chunks? Is that configurable somewhere?
How can I increase the current
2300
blocks of total available RAM?>process.memory() ={ free: 2259, usage: 41, total: 2300, history: 13, gc: 0, gctime: 2.346, blocksize: 16 }
(I tried with reducing
ESP_STACK_SIZE
from theboards/*.py
file and it worked.
I tried removingBLUETOOTH
but build failed with errors)What does
ESP_STACK_SIZE
mean inboards/ESP32.py
? Is that reserved for function calls in JS code? Is the stack here using the same RAM chunk as the runtime RAM?
Understood. Thank you :)