Is the FreeRTOS in esp-idf utilized to the smallest?

aifer2007
Posts: 5
Joined: Fri Jun 02, 2017 3:24 pm

Is the FreeRTOS in esp-idf utilized to the smallest?

Postby aifer2007 » Sun Jun 04, 2017 3:07 pm

Is the FreeRTOS in esp-idf/componnents utilized to the smallest sytem for esp32?

edmund-huber
Posts: 15
Joined: Wed Apr 12, 2017 8:30 pm

Re: Is the FreeRTOS in esp-idf utilized to the smallest?

Postby edmund-huber » Sun Jun 04, 2017 10:27 pm

Can you clarify what you are trying to figure out, or what you mean?

In general, I would say that there is room for ESP-IDF to be better about RAM usage, but also you can slim down ESP-IDF quite a bit through sdkconfig options. Where it comes to Flash, the linker in the esp32 toolchain (ld) does a good job of stripping unused code and data thanks to "-fdata-sections -ffunction-sections" and "-Wl,--gc-sections".

aifer2007
Posts: 5
Joined: Fri Jun 02, 2017 3:24 pm

Re: Is the FreeRTOS in esp-idf utilized to the smallest?

Postby aifer2007 » Mon Jun 05, 2017 6:22 am

Thank you.

I just want to get more RAM on esp32.

Esp32 has 512K RAM, but in fact, only less then 200K can be used by user app(with FreeRTOS).

I want to know how to slim down the RAM userd by esp32 system function and/or FreeRTOS.

edmund-huber
Posts: 15
Joined: Wed Apr 12, 2017 8:30 pm

Re: Is the FreeRTOS in esp-idf utilized to the smallest?

Postby edmund-huber » Mon Jun 05, 2017 7:00 am

Try building in release mode.

If you're not using WiFi or Bluetooth, disable either or both under "Component config"

If you're only using BLE, not BT Classic, find the "Release DRAM from Classic BT Controller" option and try that out. That's about 30KB according to the documentation for that option.

Under WiFi options, check out "Max number of WiFi dynamic RX buffers" and "Max number of WiFi dynamic TX buffers". You might be able to squeeze another 20-ish KB out of there.

I'm not sure what else to try .. I'm interested to see what other people have to say.

f.h-f.s.
Posts: 215
Joined: Thu Dec 08, 2016 2:53 pm

Re: Is the FreeRTOS in esp-idf utilized to the smallest?

Postby f.h-f.s. » Mon Jun 05, 2017 8:23 am

Memory is divided into 5 parts. SRAM0-0 (32KB), 0-1(32KB), 0-2(128KB), 1(128KB), 2(200KB).
SRAM0-0 and 0-1 are CPU0 CPU1 instruction cache regions for instructions loaded from flash.
SRAM0-2 is used for instructions too.
SRAM1 and 2 are used for normal malloc's since it's 8bit accessible. Program data, is stored there too. If BT or Wifi are enabled each will reserve 64KB here and will allocate some more at runtime.

I needed a little space too, so I disabled CPU1 which gave me 32KB. You have to use the FreeRTOS functions to malloc in 32bit regions.
Have a look at esp-idf/components/esp32/heap_alloc_caps.c

aifer2007
Posts: 5
Joined: Fri Jun 02, 2017 3:24 pm

Re: Is the FreeRTOS in esp-idf utilized to the smallest?

Postby aifer2007 » Mon Jun 05, 2017 10:30 am

Great!
All the aboves work well.


Is a var declared as const storaged in FLASH?
Or I must add ICACHE_RODATA_ATTR before const?

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: Is the FreeRTOS in esp-idf utilized to the smallest?

Postby ESP_igrr » Mon Jun 05, 2017 11:46 am

const data is stored in flash by default.

aifer2007
Posts: 5
Joined: Fri Jun 02, 2017 3:24 pm

Re: Is the FreeRTOS in esp-idf utilized to the smallest?

Postby aifer2007 » Tue Jun 06, 2017 9:53 am

OK, Thanks

Who is online

Users browsing this forum: Google [Bot] and 170 guests