Hi all,
I am trying to squeeze an app into the ESP32 which uses Bluetooth and Wifi and heap space is under pressure. I do not need a lot of CPU so I am happy to disable the second CPU to free some RAM.
I disabled CONFIG_MEMMAP_SMP and I enabled CONFIG_FREERTOS_UNICORE and this gives me 5748 additional bytes of RAM.
I was actually expecting that the flash-cache for the second core gets disabled as well and that I get an additional 32 kBytes of RAM, but apparently this does not happen automatically.
What do I have to change to disable the flash-cache of the second core?
Any pointers welcome.
Cheers,
Johannes
Use single core to free RAM/heap (disable flash-cache of 2nd core)
-
- Posts: 13
- Joined: Tue May 02, 2017 9:33 am
Re: Use single core to free RAM/heap (disable flash-cache of 2nd core)
Currently APP CPU cache region is not added to the allocator even if you enable single core mode.
You can easily change this however, if you remove the following line in components/esp32/heap_alloc_caps.c:
Note however that this will not increase the size of byte addressable heap memory, which the "normal" heap used by malloc/calloc/realloc.
Instruction memory can only be accessed as 32-bit words, and you can allocate it using pvPortMallocCaps function with MALLOC_CAP_32BIT argument.
You can easily change this however, if you remove the following line in components/esp32/heap_alloc_caps.c:
Code: Select all
disable_mem_region((void*)0x40078000, (void*)0x40080000); //CPU1 cache region
Instruction memory can only be accessed as 32-bit words, and you can allocate it using pvPortMallocCaps function with MALLOC_CAP_32BIT argument.
-
- Posts: 13
- Joined: Tue May 02, 2017 9:33 am
Re: Use single core to free RAM/heap (disable flash-cache of 2nd core)
Many thanks for the fast and precise reply. I see the 32 kBytes now as IRAM in the boot-up messages, and as you said they do not increase the size reported by esp_get_free_heap_size() used by malloc() etc.
Unfortunately when enabling Bluetooth this also does not re-use this IRAM region automatically. I was hoping some part of the Bluetooth driver would make use of IRAM, but apparently is lives entirely on DRAM. Bluetooth uses 140 kBytes of DRAM (without any application) which I find excessive. Almost a show stopper when using Bluetooth+Wifi.
Cheers,
Johannes
Unfortunately when enabling Bluetooth this also does not re-use this IRAM region automatically. I was hoping some part of the Bluetooth driver would make use of IRAM, but apparently is lives entirely on DRAM. Bluetooth uses 140 kBytes of DRAM (without any application) which I find excessive. Almost a show stopper when using Bluetooth+Wifi.
Cheers,
Johannes
-
- Posts: 263
- Joined: Sun Jun 19, 2016 12:00 am
Re: Use single core to free RAM/heap (disable flash-cache of 2nd core)
Not sure its 140 kBytes, but I agree advanced apps are hard to do with the current memory limitations. Wrover will hopefully change that.Bluetooth uses 140 kBytes of DRAM (without any application) which I find excessive. Almost a show stopper when using Bluetooth+Wifi.
Who is online
Users browsing this forum: Baidu [Spider], Google [Bot] and 96 guests