Extra memory after "run FreeRTOS only on first core"

burakss
Posts: 3
Joined: Fri Mar 11, 2022 8:01 am

Extra memory after "run FreeRTOS only on first core"

Postby burakss » Tue May 17, 2022 8:55 am

Hi,
I have two questions that are related to each other:

1)
After enabling the "run FreeRTOS only on first core" option, I observed the following memory increases:
~51 KB for MALLOC_CAP_EXEC
~17.5 KB for free_heap_size, MALLOC_CAP_DMA, MALLOC_CAP_8BIT, and MALLOC_CAP_DEFAULT

I understand that enabling this option free the cache1 which is 32 KB. However, it does not explain the numbers above totally. Any idea?

2)
I observe the following changes in sdkconfig after enabling only "run FreeRTOS only on first core" :
-CONFIG_BTDM_CTRL_PINNED_TO_CORE_0=y
-CONFIG_BLUEDROID_PINNED_TO_CORE_0=y
-CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y
+CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE=y

What does it mean?

Extra: Is there anything that uses cache1 different than freertos?

ESP_Sprite
Posts: 8884
Joined: Thu Nov 26, 2015 4:08 am

Re: Extra memory after "run FreeRTOS only on first core"

Postby ESP_Sprite » Wed May 18, 2022 11:59 am

There's a bunch of things that are allocated on a per-core basis. Think interrupt vector tables, coprocessor status pointers etc. You don't need those for the 2nd core if you only use one.

burakss
Posts: 3
Joined: Fri Mar 11, 2022 8:01 am

Re: Extra memory after "run FreeRTOS only on first core"

Postby burakss » Wed May 18, 2022 1:18 pm

I understand but I use both of the cores. I pin my application tasks to APP_CPU with xTaskCreatePinnedToCore. Other things like wifi, ble runs on PRO_CPU. I only changed the "run FreeRTOS only on first core" option.

Before enabling the "run FreeRTOS only on first core" option:
I (815) psram: This chip is ESP32-D0WD
I (816) spiram: Found 64MBit SPI RAM device
I (816) spiram: SPI RAM mode: flash 40m sram 40m
I (821) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (828) cpu_start: Pro cpu up.
I (832) cpu_start: Starting app cpu, entry point is 0x400812fc
0x400812fc: call_start_cpu1 at /home/buraks/esp/esp-idf/components/esp_system/port/cpu_start.c:156

I (0) cpu_start: App cpu up.
I (1717) spiram: SPI SRAM memory test OK
I (1727) cpu_start: Pro cpu start user code
After enabling:
I (807) psram: This chip is ESP32-D0WD
I (808) spiram: Found 64MBit SPI RAM device
I (808) spiram: SPI RAM mode: flash 40m sram 40m
I (813) spiram: PSRAM initialized, cache is in normal (1-core) mode.
I (820) cpu_start: Pro cpu up.
I (824) cpu_start: Single core mode
I (1719) spiram: SPI SRAM memory test OK
I (1729) cpu_start: Pro cpu start user code

I call the following code for many tasks :

Code: Select all

#define PRO_CPU_NUM (0)
#define APP_CPU_NUM (1)
xTaskCreatePinnedToCore(something, "SomeTask", 1024 * 6, NULL, 1, &some_task,  APP_CPU_NUM) ;
So, how can the tasks run on PRO_CPU if they are pinned to APP_CPU?

Thanks in advance.

ESP_Sprite
Posts: 8884
Joined: Thu Nov 26, 2015 4:08 am

Re: Extra memory after "run FreeRTOS only on first core"

Postby ESP_Sprite » Wed May 18, 2022 1:51 pm

The answer is they cannot. I'm not sure what the behaviour is if you pin to a core that can't be used; it either may set it to the PRO cpu, run it as unpinned, or not run it at all, I don't remember.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Extra memory after "run FreeRTOS only on first core"

Postby WiFive » Wed May 18, 2022 9:35 pm

It does default to the pro cpu. If you are not running freertos on the app cpu then you are not using the app cpu.

Who is online

Users browsing this forum: No registered users and 52 guests