Merge branch 'feat/freertos_in_flash_by_default' into 'master'

feat(freertos): Place FreeRTOS in flash by default

Closes IDF-12695

See merge request espressif/esp-idf!40579
This commit is contained in:
Sudeep Mohanty
2025-08-15 02:18:57 +02:00
61 changed files with 603 additions and 724 deletions

View File

@@ -5,8 +5,6 @@ CONFIG_COMPILER_OPTIMIZATION_NONE=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
# place non-ISR FreeRTOS functions in Flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
# twai driver uses assert in the ISR code path # twai driver uses assert in the ISR code path
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y

View File

@@ -3,8 +3,6 @@ CONFIG_ANA_CMPR_ISR_CACHE_SAFE=y
CONFIG_GPIO_CTRL_FUNC_IN_IRAM=y CONFIG_GPIO_CTRL_FUNC_IN_IRAM=y
CONFIG_ANA_CMPR_CTRL_FUNC_IN_IRAM=y CONFIG_ANA_CMPR_CTRL_FUNC_IN_IRAM=y
CONFIG_COMPILER_OPTIMIZATION_NONE=y CONFIG_COMPILER_OPTIMIZATION_NONE=y
# place non-ISR FreeRTOS functions in Flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y

View File

@@ -2,5 +2,3 @@ CONFIG_COMPILER_DUMP_RTL_FILES=y
CONFIG_DAC_ISR_IRAM_SAFE=y CONFIG_DAC_ISR_IRAM_SAFE=y
CONFIG_DAC_CTRL_FUNC_IN_IRAM=y CONFIG_DAC_CTRL_FUNC_IN_IRAM=y
CONFIG_COMPILER_OPTIMIZATION_NONE=y CONFIG_COMPILER_OPTIMIZATION_NONE=y
# place non-ISR FreeRTOS functions in Flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y

View File

@@ -1,8 +1,6 @@
CONFIG_COMPILER_DUMP_RTL_FILES=y CONFIG_COMPILER_DUMP_RTL_FILES=y
CONFIG_GPIO_CTRL_FUNC_IN_IRAM=y CONFIG_GPIO_CTRL_FUNC_IN_IRAM=y
CONFIG_COMPILER_OPTIMIZATION_NONE=y CONFIG_COMPILER_OPTIMIZATION_NONE=y
# place non-ISR FreeRTOS functions in Flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y

View File

@@ -1,7 +1,5 @@
CONFIG_COMPILER_DUMP_RTL_FILES=y CONFIG_COMPILER_DUMP_RTL_FILES=y
CONFIG_COMPILER_OPTIMIZATION_NONE=y CONFIG_COMPILER_OPTIMIZATION_NONE=y
# place non-ISR FreeRTOS functions in Flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y

View File

@@ -2,8 +2,6 @@ CONFIG_COMPILER_DUMP_RTL_FILES=y
CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM=y CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM=y
CONFIG_GPTIMER_ISR_CACHE_SAFE=y CONFIG_GPTIMER_ISR_CACHE_SAFE=y
CONFIG_COMPILER_OPTIMIZATION_NONE=y CONFIG_COMPILER_OPTIMIZATION_NONE=y
# place non-ISR FreeRTOS functions in Flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y

View File

@@ -5,3 +5,5 @@ CONFIG_COMPILER_OPTIMIZATION_NONE=y
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
CONFIG_I2C_ISR_IRAM_SAFE=y CONFIG_I2C_ISR_IRAM_SAFE=y
CONFIG_FREERTOS_IN_IRAM=y
CONFIG_RINGBUF_IN_IRAM=y

View File

@@ -5,5 +5,3 @@ CONFIG_COMPILER_OPTIMIZATION_NONE=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
# place non-ISR FreeRTOS functions in Flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y

View File

@@ -1,7 +1,5 @@
CONFIG_COMPILER_DUMP_RTL_FILES=y CONFIG_COMPILER_DUMP_RTL_FILES=y
CONFIG_COMPILER_OPTIMIZATION_NONE=y CONFIG_COMPILER_OPTIMIZATION_NONE=y
# place non-ISR FreeRTOS functions in Flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
# ledc driver uses assert in the ISR code path # ledc driver uses assert in the ISR code path

View File

@@ -6,5 +6,3 @@ CONFIG_COMPILER_OPTIMIZATION_NONE=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
# place non-ISR FreeRTOS functions in Flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y

View File

@@ -3,8 +3,6 @@ CONFIG_COMPILER_OPTIMIZATION_NONE=y
CONFIG_PARLIO_TX_ISR_CACHE_SAFE=y CONFIG_PARLIO_TX_ISR_CACHE_SAFE=y
CONFIG_PARLIO_RX_ISR_CACHE_SAFE=y CONFIG_PARLIO_RX_ISR_CACHE_SAFE=y
CONFIG_BITSCRAMBLER_CTRL_FUNC_IN_IRAM=y CONFIG_BITSCRAMBLER_CTRL_FUNC_IN_IRAM=y
# place non-ISR FreeRTOS functions in Flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y

View File

@@ -6,5 +6,3 @@ CONFIG_COMPILER_OPTIMIZATION_NONE=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
# place non-ISR FreeRTOS functions in Flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y

View File

@@ -7,8 +7,6 @@ CONFIG_BITSCRAMBLER_CTRL_FUNC_IN_IRAM=y
CONFIG_GDMA_ISR_HANDLER_IN_IRAM=y CONFIG_GDMA_ISR_HANDLER_IN_IRAM=y
CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y
CONFIG_COMPILER_OPTIMIZATION_NONE=y CONFIG_COMPILER_OPTIMIZATION_NONE=y
# place non-ISR FreeRTOS functions in Flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y

View File

@@ -1,8 +1,6 @@
CONFIG_COMPILER_DUMP_RTL_FILES=y CONFIG_COMPILER_DUMP_RTL_FILES=y
CONFIG_SDM_CTRL_FUNC_IN_IRAM=y CONFIG_SDM_CTRL_FUNC_IN_IRAM=y
CONFIG_COMPILER_OPTIMIZATION_NONE=y CONFIG_COMPILER_OPTIMIZATION_NONE=y
# place non-ISR FreeRTOS functions in Flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y

View File

@@ -3,7 +3,7 @@ menu "ESP-Driver:SPI Configurations"
config SPI_MASTER_IN_IRAM config SPI_MASTER_IN_IRAM
bool "Place transmitting functions of SPI master into IRAM" bool "Place transmitting functions of SPI master into IRAM"
default n default n
depends on !FREERTOS_PLACE_FUNCTIONS_INTO_FLASH depends on FREERTOS_IN_IRAM
select SPI_MASTER_ISR_IN_IRAM select SPI_MASTER_ISR_IN_IRAM
select ESP_SPI_BUS_LOCK_FUNCS_IN_IRAM select ESP_SPI_BUS_LOCK_FUNCS_IN_IRAM
help help
@@ -15,7 +15,7 @@ menu "ESP-Driver:SPI Configurations"
Enable this to put ``queue_trans``, ``get_trans_result`` and Enable this to put ``queue_trans``, ``get_trans_result`` and
``transmit`` functions into the IRAM to avoid possible cache miss. ``transmit`` functions into the IRAM to avoid possible cache miss.
This configuration won't be available if `CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH` is enabled. This configuration won't be available if `CONFIG_FREERTOS_IN_IRAM` is disabled.
During unit test, this is enabled to measure the ideal case of api. During unit test, this is enabled to measure the ideal case of api.

View File

@@ -1,3 +1,2 @@
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
CONFIG_SPI_MASTER_ISR_IN_IRAM=n CONFIG_SPI_MASTER_ISR_IN_IRAM=n
CONFIG_SPI_SLAVE_ISR_IN_IRAM=n CONFIG_SPI_SLAVE_ISR_IN_IRAM=n

View File

@@ -6,3 +6,4 @@ CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y
CONFIG_COMPILER_OPTIMIZATION_NONE=y CONFIG_COMPILER_OPTIMIZATION_NONE=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_FREERTOS_IN_IRAM=y

View File

@@ -5,3 +5,4 @@ CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y
CONFIG_COMPILER_OPTIMIZATION_NONE=y CONFIG_COMPILER_OPTIMIZATION_NONE=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_FREERTOS_IN_IRAM=y

View File

@@ -3,5 +3,3 @@ CONFIG_TEMP_SENSOR_ISR_IRAM_SAFE=y
CONFIG_COMPILER_OPTIMIZATION_NONE=y CONFIG_COMPILER_OPTIMIZATION_NONE=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
# place non-ISR FreeRTOS functions in Flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y

View File

@@ -1,6 +1,5 @@
CONFIG_COMPILER_DUMP_RTL_FILES=y CONFIG_COMPILER_DUMP_RTL_FILES=y
CONFIG_TWAI_ISR_CACHE_SAFE=y CONFIG_TWAI_ISR_CACHE_SAFE=y
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
CONFIG_COMPILER_OPTIMIZATION_NONE=y CONFIG_COMPILER_OPTIMIZATION_NONE=y
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y

View File

@@ -1,8 +1,6 @@
CONFIG_COMPILER_DUMP_RTL_FILES=y CONFIG_COMPILER_DUMP_RTL_FILES=y
CONFIG_UART_ISR_IN_IRAM=y CONFIG_UART_ISR_IN_IRAM=y
CONFIG_COMPILER_OPTIMIZATION_NONE=y CONFIG_COMPILER_OPTIMIZATION_NONE=y
# place non-ISR FreeRTOS functions in Flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y

View File

@@ -2,8 +2,6 @@ CONFIG_COMPILER_DUMP_RTL_FILES=y
CONFIG_UHCI_ISR_CACHE_SAFE=y CONFIG_UHCI_ISR_CACHE_SAFE=y
CONFIG_GPIO_CTRL_FUNC_IN_IRAM=y CONFIG_GPIO_CTRL_FUNC_IN_IRAM=y
CONFIG_COMPILER_OPTIMIZATION_NONE=y CONFIG_COMPILER_OPTIMIZATION_NONE=y
# place non-ISR FreeRTOS functions in Flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_HAL_ASSERTION_SILENT=y CONFIG_HAL_ASSERTION_SILENT=y

View File

@@ -3,6 +3,4 @@ CONFIG_COMPILER_OPTIMIZATION_NONE=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
# place non-ISR FreeRTOS functions in Flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
CONFIG_LCD_DSI_ISR_IRAM_SAFE=y CONFIG_LCD_DSI_ISR_IRAM_SAFE=y

View File

@@ -4,5 +4,3 @@ CONFIG_COMPILER_OPTIMIZATION_NONE=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
# place non-ISR FreeRTOS functions in Flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y

View File

@@ -1,17 +1,18 @@
menu "ESP Ringbuf" menu "ESP Ringbuf"
config RINGBUF_IN_IRAM
config RINGBUF_PLACE_FUNCTIONS_INTO_FLASH bool "Place ring buffer functions in IRAM"
bool "Place non-ISR ringbuf functions into flash"
default n default n
help help
Place non-ISR ringbuf functions (like xRingbufferCreate/xRingbufferSend) into flash. Place ring buffer functions in IRAM for better performance.
This frees up IRAM, but the functions can no longer be called when the cache is disabled. By default, ring buffer functions are placed in Flash to save IRAM.
Enable this option if you need maximum performance for ring buffer operations.
Note: This option increases IRAM usage.
config RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH config RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH
bool "Place ISR ringbuf functions into flash" bool "Place ISR ringbuf functions into flash"
depends on RINGBUF_PLACE_FUNCTIONS_INTO_FLASH depends on !RINGBUF_IN_IRAM
default n default n
help help
Place ISR ringbuf functions (like xRingbufferSendFromISR/xRingbufferReceiveFromISR) into flash. Place ISR ringbuf functions (like xRingbufferSendFromISR/xRingbufferReceiveFromISR) into flash.
@@ -21,5 +22,4 @@ menu "ESP Ringbuf"
This option is not compatible with ESP-IDF drivers which are configured to This option is not compatible with ESP-IDF drivers which are configured to
run the ISR from an IRAM context, e.g. CONFIG_UART_ISR_IN_IRAM. run the ISR from an IRAM context, e.g. CONFIG_UART_ISR_IN_IRAM.
endmenu endmenu

View File

@@ -1,49 +1,28 @@
[mapping:esp_ringbuf] [mapping:esp_ringbuf]
archive: libesp_ringbuf.a archive: libesp_ringbuf.a
entries: entries:
* (noflash_text) if RINGBUF_IN_IRAM = y:
if RINGBUF_PLACE_FUNCTIONS_INTO_FLASH = y: * (noflash_text) # All functions in IRAM
ringbuf: prvGetCurMaxSizeNoSplit (default) else:
ringbuf: prvGetCurMaxSizeAllowSplit (default) * (default) # All functions in Flash
ringbuf: prvGetCurMaxSizeByteBuf (default)
ringbuf: prvInitializeNewRingbuffer (default)
ringbuf: prvReceiveGeneric (default)
ringbuf: prvSendAcquireGeneric (default)
ringbuf: prvGetFreeSize (default)
ringbuf: vRingbufferDelete (default)
ringbuf: vRingbufferGetInfo (default)
ringbuf: vRingbufferReturnItem (default)
ringbuf: xRingbufferAddToQueueSetRead (default)
ringbuf: xRingbufferCreate (default)
ringbuf: xRingbufferCreateStatic (default)
ringbuf: xRingbufferCreateNoSplit (default)
ringbuf: xRingbufferReceive (default)
ringbuf: xRingbufferReceiveSplit (default)
ringbuf: xRingbufferReceiveUpTo (default)
ringbuf: xRingbufferRemoveFromQueueSetRead (default)
ringbuf: xRingbufferSend (default)
ringbuf: xRingbufferSendAcquire (default)
ringbuf: xRingbufferSendComplete (default)
ringbuf: xRingbufferPrintInfo (default)
ringbuf: xRingbufferGetMaxItemSize (default)
ringbuf: xRingbufferGetCurFreeSize (default)
if RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH = y: # Always keep ISR functions in IRAM unless explicitly placed in Flash
ringbuf: prvReturnItemByteBuf (default) if RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH = n:
ringbuf: prvReturnItemDefault (default) ringbuf: prvReturnItemByteBuf (noflash_text)
ringbuf: prvGetItemByteBuf (default) ringbuf: prvReturnItemDefault (noflash_text)
ringbuf: prvGetItemDefault (default) ringbuf: prvGetItemByteBuf (noflash_text)
ringbuf: prvCopyItemAllowSplit (default) ringbuf: prvGetItemDefault (noflash_text)
ringbuf: prvCopyItemByteBuf (default) ringbuf: prvCopyItemAllowSplit (noflash_text)
ringbuf: prvCopyItemNoSplit (default) ringbuf: prvCopyItemByteBuf (noflash_text)
ringbuf: prvAcquireItemNoSplit (default) ringbuf: prvCopyItemNoSplit (noflash_text)
ringbuf: prvCheckItemFitsByteBuffer (default) ringbuf: prvAcquireItemNoSplit (noflash_text)
ringbuf: prvCheckItemFitsDefault (default) ringbuf: prvCheckItemFitsByteBuffer (noflash_text)
ringbuf: prvCheckItemAvail (default) ringbuf: prvCheckItemFitsDefault (noflash_text)
ringbuf: prvSendItemDoneNoSplit (default) ringbuf: prvCheckItemAvail (noflash_text)
ringbuf: prvReceiveGenericFromISR (default) ringbuf: prvSendItemDoneNoSplit (noflash_text)
ringbuf: xRingbufferSendFromISR (default) ringbuf: prvReceiveGenericFromISR (noflash_text)
ringbuf: xRingbufferReceiveFromISR (default) ringbuf: xRingbufferSendFromISR (noflash_text)
ringbuf: xRingbufferReceiveSplitFromISR (default) ringbuf: xRingbufferReceiveFromISR (noflash_text)
ringbuf: xRingbufferReceiveUpToFromISR (default) ringbuf: xRingbufferReceiveSplitFromISR (noflash_text)
ringbuf: vRingbufferReturnItemFromISR (default) ringbuf: xRingbufferReceiveUpToFromISR (noflash_text)
ringbuf: vRingbufferReturnItemFromISR (noflash_text)

View File

@@ -133,7 +133,7 @@ TEST_CASE("Test ring buffer ISR", "[esp_ringbuf][qemu-ignore]")
* tested. * tested.
*/ */
#if !CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH && !CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH #if CONFIG_RINGBUF_IN_IRAM && !CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH
/* -------------------------- Test ring buffer IRAM ------------------------- */ /* -------------------------- Test ring buffer IRAM ------------------------- */
static IRAM_ATTR __attribute__((noinline)) bool iram_ringbuf_test(void) static IRAM_ATTR __attribute__((noinline)) bool iram_ringbuf_test(void)
@@ -159,7 +159,7 @@ TEST_CASE("Test ringbuffer functions work with flash cache disabled", "[esp_ring
{ {
TEST_ASSERT(iram_ringbuf_test()); TEST_ASSERT(iram_ringbuf_test());
} }
#endif /* !CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH && !CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH */ #endif /* CONFIG_RINGBUF_IN_IRAM && !CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH */
/* ------------------------ Test ring buffer 0 Item Size ----------------------- /* ------------------------ Test ring buffer 0 Item Size -----------------------
* The following test case tests that sending/acquiring an item/bytes of 0 size * The following test case tests that sending/acquiring an item/bytes of 0 size

View File

@@ -1,2 +1 @@
CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y
CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH=y CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH=y

View File

@@ -328,7 +328,7 @@ void vPortExitCritical(void);
// ---------------------- Yielding ------------------------- // ---------------------- Yielding -------------------------
static inline bool IRAM_ATTR xPortCanYield(void) static inline bool xPortCanYield(void)
{ {
#if SOC_INT_CLIC_SUPPORTED #if SOC_INT_CLIC_SUPPORTED
/* When CLIC is supported: /* When CLIC is supported:

View File

@@ -185,12 +185,12 @@ void vPortAssertIfInISR(void)
// ------------------ Critical Sections -------------------- // ------------------ Critical Sections --------------------
#if ( configNUMBER_OF_CORES > 1 ) #if ( configNUMBER_OF_CORES > 1 )
void IRAM_ATTR vPortTakeLock( portMUX_TYPE *lock ) void vPortTakeLock( portMUX_TYPE *lock )
{ {
spinlock_acquire( lock, portMUX_NO_TIMEOUT); spinlock_acquire( lock, portMUX_NO_TIMEOUT);
} }
void IRAM_ATTR vPortReleaseLock( portMUX_TYPE *lock ) void vPortReleaseLock( portMUX_TYPE *lock )
{ {
spinlock_release( lock ); spinlock_release( lock );
} }

View File

@@ -355,7 +355,7 @@ void vPortExitCritical(portMUX_TYPE *lock);
// ---------------------- Yielding ------------------------- // ---------------------- Yielding -------------------------
static inline bool IRAM_ATTR xPortCanYield(void) static inline bool xPortCanYield(void)
{ {
uint32_t ps_reg = 0; uint32_t ps_reg = 0;

View File

@@ -84,7 +84,7 @@ portMUX_TYPE port_xISRLock = portMUX_INITIALIZER_UNLOCKED;
// --------------------- Interrupts ------------------------ // --------------------- Interrupts ------------------------
BaseType_t IRAM_ATTR xPortInterruptedFromISRContext(void) BaseType_t xPortInterruptedFromISRContext(void)
{ {
return (port_interruptNesting[xPortGetCoreID()] != 0); return (port_interruptNesting[xPortGetCoreID()] != 0);
} }

View File

@@ -43,7 +43,7 @@ void vPortYieldOtherCore(BaseType_t coreid);
* @note dummy function for freertos simulator, always returns 0. * @note dummy function for freertos simulator, always returns 0.
@ return BaseType_t 0 @ return BaseType_t 0
*/ */
static inline BaseType_t IRAM_ATTR xPortGetCoreID(void) static inline BaseType_t xPortGetCoreID(void)
{ {
return (BaseType_t) 0; return (BaseType_t) 0;
} }

View File

@@ -473,7 +473,7 @@ void vPortAssertIfInISR(void)
configASSERT(xPortInIsrContext() == 0); configASSERT(xPortInIsrContext() == 0);
} }
BaseType_t IRAM_ATTR xPortInterruptedFromISRContext(void) BaseType_t xPortInterruptedFromISRContext(void)
{ {
/* Return the interrupt nesting counter for this core */ /* Return the interrupt nesting counter for this core */
return port_uxInterruptNesting[xPortGetCoreID()]; return port_uxInterruptNesting[xPortGetCoreID()];

View File

@@ -458,7 +458,7 @@ void vPortAssertIfInISR(void)
configASSERT(xPortInIsrContext() == 0); configASSERT(xPortInIsrContext() == 0);
} }
BaseType_t IRAM_ATTR xPortInterruptedFromISRContext(void) BaseType_t xPortInterruptedFromISRContext(void)
{ {
return (port_interruptNesting[xPortGetCoreID()] != 0); return (port_interruptNesting[xPortGetCoreID()] != 0);
} }

View File

@@ -556,16 +556,19 @@ menu "FreeRTOS"
the maximum frequency of 240MHz, it will overflow in approximately 17 seconds. the maximum frequency of 240MHz, it will overflow in approximately 17 seconds.
endchoice # FREERTOS_RUN_TIME_STATS_CLK endchoice # FREERTOS_RUN_TIME_STATS_CLK
config FREERTOS_PLACE_FUNCTIONS_INTO_FLASH config FREERTOS_IN_IRAM
bool "Place FreeRTOS functions into Flash" bool "Place FreeRTOS functions in IRAM"
default n default n
help help
When enabled the selected Non-ISR FreeRTOS functions will be placed into Flash memory instead of IRAM. Place FreeRTOS functions in IRAM for better performance.
This saves up to 8KB of IRAM depending on which functions are used. By default, FreeRTOS functions are placed in Flash to save IRAM.
Enable this option if you need maximum performance for FreeRTOS operations.
Note: This option increases IRAM usage.
config FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH config FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH
bool "Place FreeRTOS functions called from ISR context into Flash" bool "Place FreeRTOS functions called from ISR context into Flash"
depends on SPI_FLASH_AUTO_SUSPEND && FREERTOS_PLACE_FUNCTIONS_INTO_FLASH depends on SPI_FLASH_AUTO_SUSPEND
default n default n
help help
When enabled additional FreeRTOS functions which maybe called from an ISR context are When enabled additional FreeRTOS functions which maybe called from an ISR context are
@@ -659,9 +662,4 @@ menu "FreeRTOS"
default 1 if FREERTOS_UNICORE default 1 if FREERTOS_UNICORE
default 2 if !FREERTOS_UNICORE default 2 if !FREERTOS_UNICORE
config FREERTOS_IN_IRAM
# Invisible option enabled by default to place all freertos functions in internal RAM
# Todo: See linker.lf (IDF-12695)
bool
default y
endmenu # FreeRTOS endmenu # FreeRTOS

View File

@@ -3,25 +3,14 @@
# Flash function placements are listed per source file, in the order that they appear in the source file. # Flash function placements are listed per source file, in the order that they appear in the source file.
# #
# Placement Rules: # Placement Rules:
# - Default: Place all functions in internal RAM. # - Default behavior: All FreeRTOS functions are placed in Flash by default, except for:
# - CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH: # - FromISR() functions (placed in IRAM by default)
# - Place functions in flash if they are never called from an ISR context (directly or indirectly). # - Performance-critical functions, such as critical section APIs and code related to context switching
# - Some functions that are called often (such as critical sections) are placed in internal RAM for speed. # - CONFIG_FREERTOS_IN_IRAM:
# - CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH: # - This option is presented to users as a performance optimization feature, with the trade-off of reduced
# - Place additional functions such as the FromISR() variants in flash as well. # internal RAM availability. This option is disabled by default.
# # - CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH
# TODO: In IDF 6.0, evaluate the possibility of (IDF-12695): # - If SPI_FLASH_AUTO_SUSPEND is supported, this option allows placing FromISR() functions in Flash.
# 1. Default behavior: All FreeRTOS functions should be placed in flash by default, except for:
# - FromISR() functions
# - Performance-critical functions, such as critical section APIs and code related to context switching
# 2. Deprecate the FREERTOS_PLACE_FUNCTIONS_INTO_FLASH Kconfig option and unhide the FREERTOS_IN_IRAM Kconfig
# option. Present FREERTOS_IN_IRAM config option to users as a performance optimization feature, with the
# trade-off of reduced internal RAM availability. This option would be disabled by default.
# 3. FREERTOS_IN_IRAM config option should be user-configurable only if SPI_FLASH_AUTO_SUSPEND is supported.
# If not supported, it should be enabled by default and follow the placement rules stated above.
# 4. If SPI_FLASH_AUTO_SUSPEND is supported, place additional FreeRTOS functions - including FromISR()
# variants, in Flash. Control this behavior using the FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH
# config option.
# ---------------------------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------------------------
[mapping:freertos_idf] [mapping:freertos_idf]
@@ -29,32 +18,17 @@ archive: libfreertos.a
entries: entries:
if FREERTOS_IN_IRAM = y: if FREERTOS_IN_IRAM = y:
* (noflash_text) # All FreeRTOS functions to IRAM * (noflash_text) # All FreeRTOS functions to IRAM
#else else:
# TODO: Enable in IDF 6.0 * (default) # All FreeRTOS functions to Flash
# * (default) # All FreeRTOS functions to Flash
if FREERTOS_PLACE_FUNCTIONS_INTO_FLASH = y:
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
# event_groups.c # event_groups.c
# - Exclude all ...FromISR() functions and their dependents
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
event_groups:xEventGroupCreateStatic (default) if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = n:
event_groups:xEventGroupCreate (default) event_groups:xEventGroupClearBitsFromISR (noflash_text)
event_groups:xEventGroupSync (default) event_groups:xEventGroupGetBitsFromISR (noflash_text)
event_groups:xEventGroupWaitBits (default) event_groups:xEventGroupSetBitsFromISR (noflash_text)
event_groups:xEventGroupClearBits (default)
event_groups:xEventGroupSetBits (default)
event_groups:vEventGroupDelete (default)
event_groups: xEventGroupGetStaticBuffer (default)
event_groups:vEventGroupSetBitsCallback (default)
event_groups:vEventGroupClearBitsCallback (default)
event_groups:prvTestWaitCondition (default)
if FREERTOS_USE_TRACE_FACILITY = y:
event_groups: uxEventGroupGetNumber (default)
event_groups: vEventGroupSetNumber (default)
if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = y:
event_groups: xEventGroupClearBitsFromISR (default)
event_groups: xEventGroupGetBitsFromISR (default)
event_groups: xEventGroupSetBitsFromISR (default)
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
# list.c # list.c
# - List/List Item initialization functions are never called from ISR # - List/List Item initialization functions are never called from ISR
@@ -62,315 +36,150 @@ entries:
# - Remaining List insertion/removal functions can be called from an ISR context and hence place them in flash # - Remaining List insertion/removal functions can be called from an ISR context and hence place them in flash
# only when CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH is enabled # only when CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH is enabled
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
list:vListInitialise (default) if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = n:
list:vListInitialiseItem (default) list:vListInsertEnd (noflash_text)
list:vListInsert (default) list:uxListRemove (noflash_text)
if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = y:
list:vListInsertEnd (default)
list:uxListRemove (default)
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
# queue.c # queue.c
# - Keep all ...FromISR() functions (and their prv... calls) in internal RAM
# - All other functions can be moved to flash
# - Queue lock related functions are only used in single core builds
# - If CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH is enabled, place all FromISR() functions and their
# dependents in flash as well
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
queue:xQueueGenericReset (default) if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = n:
queue:xQueueGenericCreateStatic (default) queue:xQueueGetMutexHolderFromISR (noflash_text)
queue:xQueueGenericGetStaticBuffers (default) queue:xQueueGenericSendFromISR (noflash_text)
queue:xQueueGenericCreate (default) queue:prvCopyDataToQueue (noflash_text)
queue:prvInitialiseNewQueue (default) queue:prvNotifyQueueSetContainer (noflash_text)
queue:prvInitialiseMutex (default) queue:xQueueGiveFromISR (noflash_text)
queue:xQueueCreateMutex (default) queue:xQueueReceiveFromISR (noflash_text)
queue:xQueueCreateMutexStatic (default) queue:prvCopyDataFromQueue (noflash_text)
queue:xQueueGetMutexHolder (default) queue:xQueuePeekFromISR (noflash_text)
queue:xQueueGiveMutexRecursive (default) queue:uxQueueMessagesWaitingFromISR (noflash_text)
queue:xQueueTakeMutexRecursive (default) queue:xQueueIsQueueEmptyFromISR (noflash_text)
queue:xQueueCreateCountingSemaphoreStatic (default) queue:xQueueIsQueueFullFromISR (noflash_text)
queue:xQueueCreateCountingSemaphore (default) queue:xQueueSelectFromSetFromISR (noflash_text)
queue:xQueueGenericSend (default)
queue:xQueueReceive (default)
queue:xQueueSemaphoreTake (default)
queue:xQueuePeek (default)
queue:uxQueueMessagesWaiting (default)
queue:uxQueueSpacesAvailable (default)
queue:vQueueDelete (default)
if FREERTOS_USE_TRACE_FACILITY = y:
queue:uxQueueGetQueueNumber (default)
queue:vQueueSetQueueNumber (default)
queue:ucQueueGetQueueType (default)
queue:prvGetDisinheritPriorityAfterTimeout (default)
if FREERTOS_UNICORE = y:
queue:prvUnlockQueue (default)
queue:prvIsQueueEmpty (default)
queue:prvIsQueueFull (default)
if FREERTOS_QUEUE_REGISTRY_SIZE > 0:
queue:vQueueAddToRegistry (default)
queue:pcQueueGetName (default)
queue:vQueueUnregisterQueue (default)
queue:vQueueWaitForMessageRestricted (default)
queue:xQueueCreateSet (default)
queue:xQueueAddToSet (default)
queue:xQueueRemoveFromSet (default)
queue:xQueueSelectFromSet (default)
if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = y:
queue:xQueueGetMutexHolderFromISR (default)
queue:xQueueGenericSendFromISR (default)
queue:prvCopyDataToQueue (default)
queue:prvNotifyQueueSetContainer (default)
queue:xQueueGiveFromISR (default)
queue:xQueueReceiveFromISR (default)
queue:prvCopyDataFromQueue (default)
queue:xQueuePeekFromISR (default)
queue:uxQueueMessagesWaitingFromISR (default)
queue:xQueueIsQueueEmptyFromISR (default)
queue:xQueueIsQueueFullFromISR (default)
queue:xQueueSelectFromSetFromISR (default)
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
# stream_buffer.c # stream_buffer.c
# - If CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH is enabled, place all FromISR() functions and their
# dependents in flash as well
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
stream_buffer:xStreamBufferGenericCreate (default) if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = n:
stream_buffer:xStreamBufferGenericCreateStatic (default) stream_buffer:xStreamBufferSendFromISR (noflash_text)
stream_buffer:xStreamBufferGetStaticBuffers (default) stream_buffer:prvWriteMessageToBuffer (noflash_text)
stream_buffer:vStreamBufferDelete (default) stream_buffer:xStreamBufferReceiveFromISR (noflash_text)
stream_buffer:xStreamBufferReset (default) stream_buffer:prvReadMessageFromBuffer (noflash_text)
stream_buffer:xStreamBufferSetTriggerLevel (default) stream_buffer:xStreamBufferSendCompletedFromISR (noflash_text)
stream_buffer:xStreamBufferSpacesAvailable (default) stream_buffer:xStreamBufferReceiveCompletedFromISR (noflash_text)
stream_buffer:xStreamBufferBytesAvailable (default) stream_buffer:prvBytesInBuffer (noflash_text)
stream_buffer:xStreamBufferSend (default)
stream_buffer:xStreamBufferReceive (default)
stream_buffer:xStreamBufferNextMessageLengthBytes (default)
stream_buffer:xStreamBufferIsEmpty (default)
stream_buffer:xStreamBufferIsFull (default)
stream_buffer:prvWriteBytesToBuffer (default)
stream_buffer:prvReadBytesFromBuffer (default)
stream_buffer:prvInitialiseNewStreamBuffer (default)
if FREERTOS_USE_TRACE_FACILITY = y:
stream_buffer:uxStreamBufferGetStreamBufferNumber (default)
stream_buffer:vStreamBufferSetStreamBufferNumber (default)
stream_buffer:ucStreamBufferGetStreamBufferType (default)
if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = y:
stream_buffer:xStreamBufferSendFromISR (default)
stream_buffer:prvWriteMessageToBuffer (default)
stream_buffer:xStreamBufferReceiveFromISR (default)
stream_buffer:prvReadMessageFromBuffer (default)
stream_buffer:xStreamBufferSendCompletedFromISR (default)
stream_buffer:xStreamBufferReceiveCompletedFromISR (default)
stream_buffer:prvBytesInBuffer (default)
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
# tasks.c # tasks.c
# - The following functions are always kept in internal RAM as they are frequently called during context switches # - The following functions are always kept in internal RAM as they are frequently called during context switches
# or are called with cache disabled
# - xTaskIncrementTick # - xTaskIncrementTick
# - prvSelectHighestPriorityTaskSMP # - prvSelectHighestPriorityTaskSMP
# - vTaskSwitchContext # - vTaskSwitchContext
# - xTaskGetSchedulerState
# - xTaskGetTickCount
# - Tickless idle functions (i.e., step tick) are left in internal RAM for speed unless # - Tickless idle functions (i.e., step tick) are left in internal RAM for speed unless
# CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH is enabled # CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH is enabled
# - Place all functions that are called from an ISR context into Flash if # - Place all functions that are called from an ISR context into Flash if
# CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH is enabled # CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH is enabled
# - The following functions are called when the cache is disabled, thus they are excluded from the list below
# (i.e., called after "spi_flash_disable_interrupts_caches_and_other_cpu()" is called).
# - "xTaskGetSchedulerState"
# - "xTaskGetTickCount"
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
tasks:xTaskCreateRestrictedStatic (default) tasks:xTaskIncrementTick (noflash_text)
tasks:xTaskCreateRestricted (default) if FREERTOS_UNICORE = n:
tasks:prvInitialiseNewTask (default) tasks:prvSelectHighestPriorityTaskSMP (noflash_text)
tasks:prvAddNewTaskToReadyList (default) tasks:vTaskSwitchContext (noflash_text)
tasks:vTaskDelete (default) tasks:xTaskGetSchedulerState (noflash_text)
tasks:xTaskDelayUntil (default) tasks:xTaskGetTickCount (noflash_text)
tasks:vTaskDelay (default) if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = n:
tasks:eTaskGetState (default) if FREERTOS_UNICORE = n:
tasks:uxTaskPriorityGet (default) tasks:prvIsYieldRequiredSMP (noflash_text)
tasks:vTaskPrioritySet (default) tasks:prvCheckTaskCanBeScheduledSMP (noflash_text)
tasks:vTaskSuspend (default) tasks:uxTaskPriorityGetFromISR (noflash_text)
tasks:vTaskResume (default) tasks:prvTaskIsTaskSuspended (noflash_text)
tasks:prvCreateIdleTasks (default) tasks:xTaskResumeFromISR (noflash_text)
tasks:vTaskStartScheduler (default) tasks:xTaskGetTickCountFromISR (noflash_text)
tasks:vTaskEndScheduler (default) tasks:xTaskGetApplicationTaskTagFromISR (noflash_text)
tasks:vTaskSuspendAll (default) tasks:xTaskRemoveFromEventList (noflash_text)
if FREERTOS_USE_TICKLESS_IDLE = y: tasks:prvResetNextTaskUnblockTime (noflash_text)
tasks:prvGetExpectedIdleTime (default) tasks:xTaskGenericNotifyFromISR (noflash_text)
tasks:eTaskConfirmSleepModeStatus (default) tasks:vTaskGenericNotifyGiveFromISR (noflash_text)
tasks:xTaskResumeAll (default)
tasks:uxTaskGetNumberOfTasks (default)
tasks:pcTaskGetName (default)
tasks:prvSearchForNameWithinSingleList (default)
tasks:xTaskGetHandle (default)
tasks:xTaskGetStaticBuffers (default)
tasks:xTaskGetIdleTaskHandle (default)
tasks:xTaskCatchUpTicks (default)
tasks:xTaskAbortDelay (default)
if FREERTOS_USE_APPLICATION_TASK_TAG = y:
tasks:vTaskSetApplicationTaskTag (default)
tasks:xTaskGetApplicationTaskTag (default)
tasks:xTaskCallApplicationTaskHook (default)
tasks:vTaskPlaceOnEventList (default)
tasks:vTaskPlaceOnUnorderedEventList (default)
tasks:vTaskPlaceOnEventListRestricted (default)
tasks:vTaskRemoveFromUnorderedEventList (default)
tasks:vTaskSetTimeOutState (default)
tasks:vTaskInternalSetTimeOutState (default)
tasks:xTaskCheckForTimeOut (default)
tasks:vTaskMissedYield (default)
tasks:prvIdleTask (default)
if FREERTOS_THREAD_LOCAL_STORAGE_POINTERS != 0:
tasks:vTaskSetThreadLocalStoragePointer (default)
tasks:pvTaskGetThreadLocalStoragePointer (default)
tasks:prvInitialiseTaskLists (default)
tasks:prvCheckTasksWaitingTermination (default)
tasks:prvTaskCheckFreeStackSpace (default)
tasks:uxTaskGetStackHighWaterMark2 (default)
tasks:uxTaskGetStackHighWaterMark (default)
tasks:prvDeleteTCB (default)
tasks:xTaskGetCurrentTaskHandle (default)
tasks:xTaskPriorityInherit (default)
tasks:xTaskPriorityDisinherit (default)
tasks:vTaskPriorityDisinheritAfterTimeout (default)
if FREERTOS_USE_TRACE_FACILITY = y && FREERTOS_USE_STATS_FORMATTING_FUNCTIONS = y:
tasks:prvWriteNameToBuffer (default)
tasks:vTaskList (default)
if FREERTOS_GENERATE_RUN_TIME_STATS = y && FREERTOS_USE_STATS_FORMATTING_FUNCTIONS = y:
tasks:vTaskGetRunTimeStats (default)
tasks:uxTaskResetEventItemValue (default)
tasks:pvTaskIncrementMutexHeldCount (default)
tasks:ulTaskGenericNotifyTake (default)
tasks:xTaskGenericNotifyWait (default)
tasks:xTaskGenericNotify (default)
tasks:xTaskGenericNotifyStateClear (default)
tasks:ulTaskGenericNotifyValueClear (default)
if FREERTOS_GENERATE_RUN_TIME_STATS = y:
tasks:ulTaskGetIdleRunTimeCounter (default)
tasks:ulTaskGetIdleRunTimePercent (default)
tasks:prvAddCurrentTaskToDelayedList (default)
if FREERTOS_USE_TRACE_FACILITY = y:
tasks:uxTaskGetSystemState (default)
tasks:uxTaskGetTaskNumber (default)
tasks:vTaskSetTaskNumber (default)
tasks:vTaskGetInfo (default)
tasks:prvListTasksWithinSingleList (default)
if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = y:
tasks:prvIsYieldRequiredSMP (default)
tasks:prvCheckTaskCanBeScheduledSMP (default)
tasks:uxTaskPriorityGetFromISR (default)
tasks:prvTaskIsTaskSuspended (default)
tasks:xTaskResumeFromISR (default)
tasks:xTaskGetTickCountFromISR (default)
tasks:xTaskGetApplicationTaskTagFromISR (default)
tasks:xTaskRemoveFromEventList (default)
tasks:prvResetNextTaskUnblockTime (default)
tasks:xTaskGenericNotifyFromISR (default)
tasks:vTaskGenericNotifyGiveFromISR (default)
if FREERTOS_USE_TICKLESS_IDLE = y: if FREERTOS_USE_TICKLESS_IDLE = y:
tasks:vTaskStepTick (default) tasks:vTaskStepTick (noflash_text)
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
# timers.c # timers.c
# - xTimerGenericCommand() is used for ISR calls as well. Thus leave it (and its dependents) in internal RAM # - xTimerGenericCommand() is used for ISR calls as well. Thus leave it (and its dependents) in internal RAM
# unless CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH is enabled # unless CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH is enabled
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
timers:xTimerCreateTimerTask (default) if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = n:
timers:xTimerCreate (default) timers:xTimerGenericCommand (noflash_text)
timers:xTimerCreateStatic (default) timers:xTimerPendFunctionCallFromISR (noflash_text)
timers:prvInitialiseNewTimer (default)
timers:xTimerGetTimerDaemonTaskHandle (default)
timers:xTimerGetPeriod (default)
timers:vTimerSetReloadMode (default)
timers:xTimerGetReloadMode (default)
timers:uxTimerGetReloadMode (default)
timers:xTimerGetExpiryTime (default)
timers:xTimerGetStaticBuffer (default)
timers:pcTimerGetName (default)
timers:prvReloadTimer (default)
timers:prvProcessExpiredTimer (default)
timers:prvTimerTask (default)
timers:prvProcessTimerOrBlockTask (default)
timers:prvGetNextExpireTime (default)
timers:prvSampleTimeNow (default)
timers:prvInsertTimerInActiveList (default)
timers:prvProcessReceivedCommands (default)
timers:prvSwitchTimerLists (default)
timers:prvCheckForValidListAndQueue (default)
timers:xTimerIsTimerActive (default)
timers:pvTimerGetTimerID (default)
timers:vTimerSetTimerID (default)
timers:xTimerPendFunctionCall (default)
if FREERTOS_USE_TRACE_FACILITY = y:
timers:uxTimerGetTimerNumber (default)
timers:vTimerSetTimerNumber (default)
if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = y:
timers:xTimerGenericCommand (default)
timers:xTimerPendFunctionCallFromISR (default)
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
# portable/xtensa/port.c # portable/xtensa/port.c
# - Most functions are called from an ISR context, except for scheduler/task init/deinit functions. Functions # - The following functions are performance-critical and are always placed in IRAM.
# called from ISR context are placed in flash only when CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH # - Critical section functions are frequently called.
# is enabled # - Yielding functions related to context switching.
# - Critical sections functions are always placed in internal RAM for better performance # - vPortSetStackWatchpoint is called from vTaskSwitchContext, which is in IRAM.
# - The following functions are also placed in internal RAM as they are called from vTaskSwitchContext, which is # - The following functions are called from an ISR context, thus are placed in IRAM unless ISR functions are
# also always placed in internal RAM # placed into flash.
# - vPortSetStackWatchpoint # - xPortInIsrContext
# - vPortAssertIfInISR
# - xPortInterruptedFromISRContext
# - The following functions directly call portasm functions which are always in IRAM
# - xPortStartScheduler
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
if IDF_TARGET_ARCH_XTENSA = y: if IDF_TARGET_ARCH_XTENSA = y:
port:xPortStartScheduler (default) port:xPortStartScheduler (noflash_text)
port:vPortEndScheduler (default) port:xPortEnterCriticalTimeout (noflash_text)
port:vApplicationStackOverflowHook (default) port:vPortExitCritical (noflash_text)
if FREERTOS_TASK_FUNCTION_WRAPPER = y: port:vPortYieldOtherCore (noflash_text)
port:vPortTaskWrapper (default) port:vPortSetStackWatchpoint (noflash_text)
if SOC_CPU_COPROC_NUM > 0: if FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE = y:
port:uxInitialiseStackCPSA (default) port:xPortEnterCriticalTimeoutCompliance (noflash_text)
port:uxInitialiseStackTLS (default) port:vPortExitCriticalCompliance (noflash_text)
port:uxInitialiseStackFrame (default) if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = n:
port:pxPortInitialiseStack (default) port:xPortInIsrContext (noflash_text)
port:xPortGetTickRateHz (default) port:vPortAssertIfInISR (noflash_text)
if FREERTOS_TLSP_DELETION_CALLBACKS = y: port:xPortInterruptedFromISRContext (noflash_text)
port:vPortTLSPointersDelCb (default)
if SOC_CPU_COPROC_NUM > 0:
port:vPortCleanUpCoprocArea (default)
port:vPortTCBPreDeleteHook (default)
if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = y:
port:xPortInIsrContext (default)
port:vPortAssertIfInISR (default)
port:xPortInterruptedFromISRContext (default)
port:vPortYieldOtherCore (default)
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
# portable/riscv/port.c # portable/riscv/port.c
# - Most functions are called from an ISR context, except for scheduler/task init/deinit functions. Functions # - The following functions are performance-critical and are always placed in IRAM.
# called from ISR context are placed in flash only when CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH # - Critical section functions are frequently called.
# is enabled # - Yielding functions related to context switching.
# - Critical sections functions are always placed in internal RAM for better performance # - vPortSetStackWatchpoint is called from vTaskSwitchContext, which is in IRAM.
# - The following functions are also placed in internal RAM as they are called from vTaskSwitchContext, which is
# also always placed in internal RAM
# - vPortSetStackWatchpoint
# - vPortCoprocUsedInISR is directly called from RISC-V assembly code with a direct branch instruction which # - vPortCoprocUsedInISR is directly called from RISC-V assembly code with a direct branch instruction which
# may be too far when placed in Flash. Hence, it is always placed in internal RAM # may be too far when placed in Flash. Hence, it is always placed in internal RAM
# - The following functions are called from an ISR context, thus are placed in IRAM unless ISR functions are
# placed into flash.
# - xPortInIsrContext
# - vPortAssertIfInISR
# - xPortInterruptedFromISRContex
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
if IDF_TARGET_ARCH_RISCV = y: if IDF_TARGET_ARCH_RISCV = y:
port:xPortStartScheduler (default) port:xPortSetInterruptMaskFromISR (noflash_text)
port:vPortEndScheduler (default) port:vPortClearInterruptMaskFromISR (noflash_text)
port:vApplicationStackOverflowHook (default) port:vPortEnterCritical (noflash_text)
port:uxInitialiseStackTLS (default) port:vPortExitCritical (noflash_text)
if FREERTOS_TASK_FUNCTION_WRAPPER = y: port:vPortYield (noflash_text)
port:vPortTaskWrapper (default) port:vPortYieldFromISR (noflash_text)
if SOC_CPU_COPROC_NUM > 0: port:vPortYieldOtherCore (noflash_text)
port:pxRetrieveCoprocSaveAreaFromStackPointer (default) port:vPortSetStackWatchpoint (noflash_text)
port:uxInitialiseCoprocSaveArea (default) port:vPortCoprocUsedInISR (noflash_text)
port:vPortCleanUpCoprocArea (default) if FREERTOS_UNICORE = n:
port:pxPortGetCoprocArea (default) port:xPortEnterCriticalTimeout (noflash_text)
port:pxPortUpdateCoprocOwner (default) port:vPortExitCriticalMultiCore (noflash_text)
if FREERTOS_UNICORE = n: if FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE = y:
port:vPortTaskPinToCore (default) port:xPortEnterCriticalTimeoutCompliance (noflash_text)
port:uxInitialiseStackFrame (default) port:vPortExitCriticalCompliance (noflash_text)
port:pxPortInitialiseStack (default) if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = n:
port:vPortYield (default) port:xPortInIsrContext (noflash_text)
port:xPortGetTickRateHz (default) port:vPortAssertIfInISR (noflash_text)
if FREERTOS_TLSP_DELETION_CALLBACKS = y: port:xPortInterruptedFromISRContext (noflash_text)
port:vPortTLSPointersDelCb (default)
port:vPortTCBPreDeleteHook (default) # --------------------------------------------------------------------------------------------------------------
if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = y: # portasm.S
port:xPortInIsrContext (default) # - Place the entire portasm object file in IRAM. It contains critical context switching and interrupt entry/exit
port:vPortAssertIfInISR (default) # code that must always be in IRAM for better performance.
port:xPortInterruptedFromISRContext (default) # --------------------------------------------------------------------------------------------------------------
port:vPortYieldFromISR (default) portasm (noflash_text)
port:vPortYieldOtherCore (default)

View File

@@ -4,57 +4,29 @@
[mapping:freertos_common] [mapping:freertos_common]
archive: libfreertos.a archive: libfreertos.a
entries: entries:
if FREERTOS_IN_IRAM = y:
* (noflash_text) # All FreeRTOS functions to IRAM
else:
* (default) # All FreeRTOS functions to Flash
# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
# esp_additions/private_include/freertos_tasks_c_additions.h # esp_additions/private_include/freertos_tasks_c_additions.h
# Placement Rules (FreeRTOS API Additions): # Placement Rules (FreeRTOS API Additions):
# - Default: Place all functions in internal RAM. # - Default: Place all functions in flash.
# - CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH: Place functions in flash if they are never called from an ISR # - CONFIG_FREERTOS_IN_IRAM: Place all functions in internal RAM for performance optimization.
# context (directly or indirectly).
# - xTaskIncrementTickOtherCores is always placed in internal RAM for better performance # - xTaskIncrementTickOtherCores is always placed in internal RAM for better performance
# Placement Rules (Task Snapshot): # Placement Rules (Task Snapshot):
# - Default: Place all functions in internal RAM. # - Default: Place all functions in flash.
# - CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH: Place functions in flash # - CONFIG_FREERTOS_IN_IRAM: Place all functions in internal RAM for performance optimization.
# - vTaskGetSnapshot is omitted on purpose as it is used to by the Task Watchdog (TWDT) interrupt handler, we want # - vTaskGetSnapshot is omitted on purpose as it is used to by the Task Watchdog (TWDT) interrupt handler, we want
# to always keep it in IRAM unless CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH is enabled in which case # to always keep it in IRAM unless CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH is enabled in which case
# we can place it in flash. # we can place it in flash.
# #
# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
if FREERTOS_PLACE_FUNCTIONS_INTO_FLASH = y: if FREERTOS_SMP = n && FREERTOS_UNICORE = n:
# Kernel Control tasks:xTaskIncrementTickOtherCores (noflash_text)
if FREERTOS_SMP = n && FREERTOS_UNICORE = n: if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = n:
tasks:prvTakeKernelLock (default) tasks:vTaskGetSnapshot (noflash_text)
tasks:prvReleaseKernelLock (default)
# Task Creation
tasks:xTaskCreatePinnedToCore (default)
tasks:xTaskCreateStaticPinnedToCore (default)
# Task Utilities
tasks:xTaskGetCoreID (default)
tasks:xTaskGetIdleTaskHandleForCore (default)
tasks:xTaskGetCurrentTaskHandleForCore (default)
if FREERTOS_SMP = n && FREERTOS_GENERATE_RUN_TIME_STATS = y:
tasks:ulTaskGetIdleRunTimeCounterForCore (default)
tasks:ulTaskGetIdleRunTimePercentForCore (default)
tasks:pxTaskGetStackStart (default)
tasks:prvTaskPriorityRaise (default)
tasks:prvTaskPriorityRestore (default)
# TLSP Deletion Callbacks
if FREERTOS_TLSP_DELETION_CALLBACKS = y:
tasks:vTaskSetThreadLocalStoragePointerAndDelCallback (default)
# Newlib re-entrancy
tasks:__getreent (default)
# Miscellaneous
tasks:pvTaskGetCurrentTCBForCore (default)
if SPIRAM = y:
# PSRAM
tasks:prvTaskCreateDynamicPinnedToCoreWithCaps (default)
# Task Snapshot
if FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH = y:
tasks:pxGetTaskListByIndex (default)
tasks:xTaskGetNext (default)
tasks:uxTaskGetSnapshotAll (default)
if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = y:
tasks:vTaskGetSnapshot (default)
# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
# idf_additions.c # idf_additions.c
@@ -77,43 +49,30 @@ entries:
# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
# heap_idf.c # heap_idf.c
# Placement Rules: # Placement Rules:
# - Default: Place all functions in internal RAM. # - Default: Place all functions in flash.
# - CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH: Place functions in flash if they are never called from an ISR # - CONFIG_FREERTOS_IN_IRAM: Place all functions in internal RAM for performance optimization.
# context (directly or indirectly).
# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
heap_idf (noflash_text) # Default all functions to internal RAM if FREERTOS_IN_IRAM = y:
if FREERTOS_PLACE_FUNCTIONS_INTO_FLASH = y: heap_idf (noflash_text) # All functions to internal RAM
heap_idf:pvPortMalloc (default)
heap_idf:vPortFree (default)
heap_idf:xPortGetFreeHeapSize (default)
heap_idf:xPortGetMinimumEverFreeHeapSize (default)
heap_idf:xPortCheckValidListMem (default)
if FREERTOS_SMP = n:
heap_idf:xPortCheckValidTCBMem (default)
heap_idf:xPortcheckValidStackMem (default)
# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
# port_common.c # port_common.c
# Placement Rules: # Placement Rules:
# - Default: Place all functions in internal RAM. # - Default: Place all functions in flash.
# - CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH: Place functions in flash if they are never called from an ISR # - CONFIG_FREERTOS_IN_IRAM: Place all functions in internal RAM for performance optimization.
# context (directly or indirectly).
# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
port_common (noflash_text) # Default all functions to internal RAM if FREERTOS_IN_IRAM = y:
if FREERTOS_PLACE_FUNCTIONS_INTO_FLASH = y: port_common (noflash_text) # All functions to internal RAM
port_common:vApplicationGetIdleTaskMemory (default)
if FREERTOS_SMP = y && FREERTOS_UNICORE = n:
port_common:vApplicationGetPassiveIdleTaskMemory (default)
port_common:vApplicationGetTimerTaskMemory (default)
# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
# port_systick.c # port_systick.c
# - Default: Place all functions in internal RAM. # - Place the entire port_systick in IRAM. It contains the tick ISR and its related functions, which are
# - CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH: Place functions in flash if they are never called from an ISR # performance-critical and must always be in IRAM.
# context (directly or indirectly). # - For RISC-V targets, the timer setup functions can be placed in Flash. For Xtensa targets this is not possible
# as the timer setup function is called from xPortStartScheduler() which is in IRAM.
# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
port_systick(noflash_text) port_systick (noflash_text)
if FREERTOS_PLACE_FUNCTIONS_INTO_FLASH = y: if IDF_TARGET_ARCH_RISCV = y:
port_systick:vPortSetupTimer (default)
if FREERTOS_SYSTICK_USES_SYSTIMER = y: if FREERTOS_SYSTICK_USES_SYSTIMER = y:
port_systick:vSystimerSetup (default) port_systick:vSystimerSetup (default)
port_systick:vPortSetupTimer (default)

View File

@@ -3,235 +3,149 @@
# Flash function placements are listed per source file, in the order that they appear in the source file. # Flash function placements are listed per source file, in the order that they appear in the source file.
# #
# Placement Rules: # Placement Rules:
# - Default: Place all functions in internal RAM. # - Default behavior: All FreeRTOS functions are placed in Flash by default, except for:
# - CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH: # - FromISR() functions (placed in IRAM by default)
# - Place functions in flash if they are never called from an ISR context (directly or indirectly). # - Performance-critical functions, such as critical section APIs and code related to context switching
# - Some functions that are called often (such as critical sections) are placed in internal RAM for speed. # - CONFIG_FREERTOS_IN_IRAM:
# - This option is presented to users as a performance optimization feature, with the trade-off of reduced
# internal RAM availability. This option is disabled by default.
# - CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH
# - If SPI_FLASH_AUTO_SUSPEND is supported, this option allows placing FromISR() functions in Flash.
# ---------------------------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------------------------
[mapping:freertos_smp] [mapping:freertos_smp]
archive: libfreertos.a archive: libfreertos.a
entries: entries:
* (noflash_text) # Default all FreeRTOS functions to IRAM if FREERTOS_IN_IRAM = y:
if FREERTOS_PLACE_FUNCTIONS_INTO_FLASH = y: * (noflash_text) # All FreeRTOS functions to IRAM
else:
* (default) # All FreeRTOS functions to Flash
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
# event_groups.c # event_groups.c
# - Exclude all ...FromISR() functions and their dependents
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
event_groups:xEventGroupCreateStatic (default) if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = n:
event_groups:xEventGroupCreate (default) event_groups:xEventGroupClearBitsFromISR (noflash_text)
event_groups:xEventGroupSync (default) event_groups:xEventGroupGetBitsFromISR (noflash_text)
event_groups:xEventGroupWaitBits (default) event_groups:xEventGroupSetBitsFromISR (noflash_text)
event_groups:xEventGroupClearBits (default)
event_groups:xEventGroupSetBits (default)
event_groups:vEventGroupDelete (default)
event_groups:vEventGroupSetBitsCallback (default)
event_groups:vEventGroupClearBitsCallback (default)
event_groups:prvTestWaitCondition (default)
if FREERTOS_USE_TRACE_FACILITY = y:
event_groups: uxEventGroupGetNumber (default)
event_groups: vEventGroupSetNumber (default)
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
# list.c # list.c
# - List/List Item initialization functions are never called from ISR # - List/List Item initialization functions are never called from ISR
# - vListInsert is never called from an ISR context
# - Remaining List insertion/removal functions can be called from an ISR context and hence place them in flash
# only when CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH is enabled
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
list:vListInitialise (default) if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = n:
list:vListInitialiseItem (default) list:vListInsertEnd (noflash_text)
list:uxListRemove (noflash_text)
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
# queue.c # queue.c
# - Keep all ...FromISR() functions (and their prv... calls) in internal RAM
# - All other functions can be moved to flash
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
queue:xQueueGenericReset (default) if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = n:
queue:xQueueGenericCreateStatic (default) queue:xQueueGetMutexHolderFromISR (noflash_text)
queue:xQueueGenericCreate (default) queue:xQueueGenericSendFromISR (noflash_text)
queue:prvInitialiseNewQueue (default) queue:prvCopyDataToQueue (noflash_text)
queue:prvInitialiseMutex (default) queue:xQueueGiveFromISR (noflash_text)
queue:xQueueCreateMutex (default) queue:xQueueReceiveFromISR (noflash_text)
queue:xQueueCreateMutexStatic (default) queue:prvCopyDataFromQueue (noflash_text)
queue:xQueueGetMutexHolder (default) queue:xQueuePeekFromISR (noflash_text)
queue:xQueueGiveMutexRecursive (default) queue:uxQueueMessagesWaitingFromISR (noflash_text)
queue:xQueueTakeMutexRecursive (default) queue:xQueueIsQueueEmptyFromISR (noflash_text)
queue:xQueueCreateCountingSemaphoreStatic (default) queue:xQueueIsQueueFullFromISR (noflash_text)
queue:xQueueCreateCountingSemaphore (default) queue:xQueueSelectFromSetFromISR (noflash_text)
queue:xQueueGenericSend (default)
queue:xQueueReceive (default)
queue:xQueueSemaphoreTake (default)
queue:xQueuePeek (default)
queue:uxQueueMessagesWaiting (default)
queue:uxQueueSpacesAvailable (default)
queue:vQueueDelete (default)
if FREERTOS_USE_TRACE_FACILITY = y:
queue:uxQueueGetQueueNumber (default)
queue:vQueueSetQueueNumber (default)
queue:ucQueueGetQueueType (default)
queue:prvGetDisinheritPriorityAfterTimeout (default)
queue:prvUnlockQueue (default)
queue:prvIsQueueEmpty (default)
queue:prvIsQueueFull (default)
if FREERTOS_QUEUE_REGISTRY_SIZE > 0:
queue:vQueueAddToRegistry (default)
queue:pcQueueGetName (default)
queue:vQueueUnregisterQueue (default)
queue:vQueueWaitForMessageRestricted (default)
queue:xQueueCreateSet (default)
queue:xQueueAddToSet (default)
queue:xQueueRemoveFromSet (default)
queue:xQueueSelectFromSet (default)
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
# stream_buffer.c # stream_buffer.c
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
stream_buffer:xStreamBufferGenericCreate (default) if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = n:
stream_buffer:xStreamBufferGenericCreateStatic (default) stream_buffer:xStreamBufferSendFromISR (noflash_text)
stream_buffer:vStreamBufferDelete (default) stream_buffer:prvWriteMessageToBuffer (noflash_text)
stream_buffer:xStreamBufferReset (default) stream_buffer:xStreamBufferReceiveFromISR (noflash_text)
stream_buffer:xStreamBufferSetTriggerLevel (default) stream_buffer:prvReadMessageFromBuffer (noflash_text)
stream_buffer:xStreamBufferBytesAvailable (default) stream_buffer:xStreamBufferSendCompletedFromISR (noflash_text)
stream_buffer:xStreamBufferSend (default) stream_buffer:xStreamBufferReceiveCompletedFromISR (noflash_text)
stream_buffer:xStreamBufferReceive (default) stream_buffer:prvBytesInBuffer (noflash_text)
stream_buffer:xStreamBufferNextMessageLengthBytes (default)
stream_buffer:xStreamBufferIsEmpty (default)
stream_buffer:xStreamBufferIsFull (default)
stream_buffer:prvWriteBytesToBuffer (default)
stream_buffer:prvReadBytesFromBuffer (default)
stream_buffer:prvInitialiseNewStreamBuffer (default)
if FREERTOS_USE_TRACE_FACILITY = y:
stream_buffer:uxStreamBufferGetStreamBufferNumber (default)
stream_buffer:vStreamBufferSetStreamBufferNumber (default)
stream_buffer:ucStreamBufferGetStreamBufferType (default)
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
# tasks.c # tasks.c
# - The following functions are called when the cache is disabled, thus they are excluded from the list below # - The following functions are always kept in internal RAM as they are frequently called during context switches
# (i.e., called after "spi_flash_disable_interrupts_caches_and_other_cpu()" is called). # or are called with cache disabled
# - "xTaskGetSchedulerState" # - xTaskIncrementTick
# - "xTaskGetTickCount" # - prvSelectHighestPriorityTaskSMP
# - vTaskSwitchContext
# - xTaskGetSchedulerState
# - xTaskGetTickCount
# - Place all functions that are called from an ISR context into Flash if
# CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH is enabled
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
tasks:xTaskCreateStatic (default) tasks:xTaskIncrementTick (noflash_text)
tasks:xTaskCreate (default) tasks:prvSelectHighestPriorityTaskSMP (noflash_text)
if FREERTOS_UNICORE = n: tasks:vTaskSwitchContext (noflash_text)
tasks:xTaskCreateStaticAffinitySet (default) tasks:xTaskGetSchedulerState (noflash_text)
tasks:xTaskCreateAffinitySet (default) tasks:xTaskGetTickCount (noflash_text)
tasks:vTaskCoreAffinitySet (default) if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = n:
tasks:vTaskCoreAffinityGet (default) tasks:uxTaskPriorityGetFromISR (noflash_text)
tasks:prvMinimalIdleTask (default) tasks:prvTaskIsTaskSuspended (noflash_text)
tasks:prvInitialiseNewTask (default) tasks:xTaskResumeFromISR (noflash_text)
tasks:prvAddNewTaskToReadyList (default) tasks:xTaskGetTickCountFromISR (noflash_text)
tasks:vTaskDelete (default) tasks:xTaskGetApplicationTaskTagFromISR (noflash_text)
tasks:xTaskDelayUntil (default) tasks:xTaskRemoveFromEventList (noflash_text)
tasks:vTaskDelay (default) tasks:prvResetNextTaskUnblockTime (noflash_text)
tasks:eTaskGetState (default) tasks:xTaskGenericNotifyFromISR (noflash_text)
tasks:uxTaskPriorityGet (default) tasks:vTaskGenericNotifyGiveFromISR (noflash_text)
tasks:vTaskPrioritySet (default)
tasks:vTaskSuspend (default)
tasks:vTaskResume (default)
tasks:prvCreateIdleTasks (default)
tasks:vTaskStartScheduler (default)
tasks:vTaskEndScheduler (default)
tasks:vTaskSuspendAll (default)
#Todo:prvGetExpectedIdleTime
tasks:xTaskResumeAll (default)
tasks:uxTaskGetNumberOfTasks (default)
tasks:pcTaskGetName (default)
tasks:prvSearchForNameWithinSingleList (default)
tasks:xTaskGetHandle (default)
if FREERTOS_USE_TRACE_FACILITY = y:
tasks:uxTaskGetSystemState (default)
tasks:uxTaskGetTaskNumber (default)
tasks:vTaskSetTaskNumber (default)
tasks:vTaskGetInfo (default)
tasks:prvListTasksWithinSingleList (default)
tasks:prvTaskCheckFreeStackSpace (default)
tasks:xTaskGetIdleTaskHandle (default)
tasks:xTaskAbortDelay (default)
tasks:vTaskPlaceOnEventList (default)
tasks:vTaskRemoveFromUnorderedEventList (default)
tasks:vTaskPlaceOnEventListRestricted (default)
tasks:vTaskSetTimeOutState (default)
tasks:vTaskInternalSetTimeOutState (default)
tasks:xTaskCheckForTimeOut (default)
tasks:vTaskMissedYield (default)
tasks:prvIdleTask (default)
if FREERTOS_THREAD_LOCAL_STORAGE_POINTERS > 0:
tasks:vTaskSetThreadLocalStoragePointer (default)
tasks:pvTaskGetThreadLocalStoragePointer (default)
tasks:prvInitialiseTaskLists (default)
tasks:prvCheckTasksWaitingTermination (default)
tasks:uxTaskGetStackHighWaterMark2 (default)
tasks:uxTaskGetStackHighWaterMark (default)
tasks:prvDeleteTCB (default)
if FREERTOS_USE_STATS_FORMATTING_FUNCTIONS = y:
tasks:prvWriteNameToBuffer (default)
tasks:vTaskList (default)
if FREERTOS_GENERATE_RUN_TIME_STATS = y:
tasks:vTaskGetRunTimeStats (default)
tasks:ulTaskGetIdleRunTimeCounter (default)
tasks:uxTaskResetEventItemValue (default)
tasks:pvTaskIncrementMutexHeldCount (default)
tasks:ulTaskGenericNotifyTake (default)
tasks:xTaskGenericNotifyWait (default)
tasks:xTaskGenericNotify (default)
tasks:xTaskGenericNotifyStateClear (default)
tasks:ulTaskGenericNotifyValueClear (default)
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
# timers.c # timers.c
# - Only timer function called from ISR is xTimerGenericCommandFromISR() and its dependents # - xTimerGenericCommand() is used for ISR calls as well. Thus leave it (and its dependents) in internal RAM
# unless CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH is enabled
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
timers:xTimerCreateTimerTask (default) if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = n:
timers:xTimerCreate (default) timers:xTimerGenericCommand (noflash_text)
timers:xTimerCreateStatic (default) timers:xTimerPendFunctionCallFromISR (noflash_text)
timers:prvInitialiseNewTimer (default)
timers:xTimerGenericCommandFromTask (default)
timers:xTimerGetTimerDaemonTaskHandle (default)
timers:xTimerGetPeriod (default)
timers:vTimerSetReloadMode (default)
timers:uxTimerGetReloadMode (default)
timers:xTimerGetExpiryTime (default)
timers:pcTimerGetName (default)
timers:prvProcessExpiredTimer (default)
timers:prvTimerTask (default)
timers:prvProcessTimerOrBlockTask (default)
timers:prvGetNextExpireTime (default)
timers:prvSampleTimeNow (default)
timers:prvInsertTimerInActiveList (default)
timers:prvProcessReceivedCommands (default)
timers:prvSwitchTimerLists (default)
timers:prvCheckForValidListAndQueue (default)
timers:xTimerIsTimerActive (default)
timers:pvTimerGetTimerID (default)
timers:vTimerSetTimerID (default)
timers:xTimerPendFunctionCall (default)
if FREERTOS_USE_TRACE_FACILITY = y:
timers:uxTimerGetTimerNumber (default)
timers:vTimerSetTimerNumber (default)
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
# portable/xtensa/port.c # portable/xtensa/port.c
# - Most functions are called from an ISR context, except for scheduler/task init/deinit functions # - Critical sections and interrupt context checking functions are always placed in internal RAM for better
# performance and correctness.
# - vPortSetStackWatchpoint is placed in IRAM as it is called from vTaskSwitchContext.
# - The following functions directly call portasm functions which are always in IRAM
# - xPortStartScheduler
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
if IDF_TARGET_ARCH_XTENSA = y: if IDF_TARGET_ARCH_XTENSA = y:
port:xPortStartScheduler (default) port:xPortStartScheduler (noflash_text)
port:vPortEndScheduler (default) port:vPortEnterCritical (noflash_text)
port:pvPortMalloc (default) port:vPortExitCritical (noflash_text)
port:vPortFree (default) port:xPortEnterCriticalTimeout (noflash_text)
port:vPortInitialiseBlocks (default) port:vPortExitCriticalIDF (noflash_text)
port:xPortGetFreeHeapSize (default) port:vPortSetStackWatchpoint (noflash_text)
port:pxPortInitialiseStack (default) port:xPortCheckIfInISR (noflash_text)
if FREERTOS_UNICORE = n: port:vPortAssertIfInISR (noflash_text)
port:vPortCleanUpCoprocArea (default)
if FREERTOS_TLSP_DELETION_CALLBACKS = y:
port:vPortTLSPointersDelCb (default)
port:vPortTCBPreDeleteHook (default)
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
# portable/riscv/port.c # portable/riscv/port.c
# - Most functions are called from an ISR context, except for scheduler/task init/deinit functions # - Critical sections, interrupt masking, and yielding functions are always placed in internal RAM for better
# performance and correctness.
# - vPortSetStackWatchpoint is placed in IRAM as it is called from vTaskSwitchContext.
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
if IDF_TARGET_ARCH_RISCV = y: if IDF_TARGET_ARCH_RISCV = y:
port:xPortStartScheduler (default) port:vPortEnterCritical (noflash_text)
port:vPortEndScheduler (default) port:vPortExitCritical (noflash_text)
port:pvPortMalloc (default) port:ulPortSetInterruptMask (noflash_text)
port:vPortFree (default) port:vPortClearInterruptMask (noflash_text)
port:vPortInitialiseBlocks (default) port:vPortYield (noflash_text)
port:xPortGetFreeHeapSize (default) port:vPortYieldFromISR (noflash_text)
port:pxPortInitialiseStack (default) port:vPortSetStackWatchpoint (noflash_text)
if FREERTOS_TLSP_DELETION_CALLBACKS = y: port:xPortSetInterruptMaskFromISR (noflash_text)
port:vPortTLSPointersDelCb (default) port:vPortClearInterruptMaskFromISR (noflash_text)
port:vPortTCBPreDeleteHook (default) port:vPortCoprocUsedInISR (noflash_text)
port:xPortCheckIfInISR (noflash_text)
port:vPortAssertIfInISR (noflash_text)
# --------------------------------------------------------------------------------------------------------------
# portasm.S
# - Place the entire portasm object file in IRAM. It contains critical context switching and interrupt entry/exit
# code that must always be in IRAM for better performance.
# --------------------------------------------------------------------------------------------------------------
portasm (noflash_text)

View File

@@ -85,7 +85,7 @@ TEST_CASE("Yield from lower priority task, same CPU", "[freertos]")
} }
} }
#if (CONFIG_FREERTOS_NUMBER_OF_CORES == 2) && !CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH #if (CONFIG_FREERTOS_NUMBER_OF_CORES == 2) && CONFIG_FREERTOS_IN_IRAM
TEST_CASE("Yield from lower priority task, other CPU", "[freertos]") TEST_CASE("Yield from lower priority task, other CPU", "[freertos]")
{ {
uint32_t trigger_ccount, yield_ccount, now_ccount, delta; uint32_t trigger_ccount, yield_ccount, now_ccount, delta;

View File

@@ -0,0 +1,209 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* This test is a baseline test to calculate the performance of some of the frequently used FreeRTOS APIs.
* It measures the execution time (in CPU cycles) of various FreeRTOS functions to help developers
* understand the performance characteristics of different memory placement configurations.
*
* Usage:
* Users can add other functions as desired by following the same measurement pattern.
* Users can experiment with different memory placement configurations such as CONFIG_FREERTOS_IN_IRAM.
*
* Performance Factors:
* Performance depends on several factors such as:
* - Flash cache patterns and hit rates
* - Frequency of API usage in the application
* - Compiler optimizations and code generation
* - System load and interrupt frequency
* - Flash memory speed and timing
*
* Results Interpretation:
* - Lower cycle counts indicate better performance
* - Consider memory cost vs performance benefit trade-offs
*/
#include <esp_types.h>
#include <stdio.h>
#include <inttypes.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "freertos/queue.h"
#include "freertos/event_groups.h"
#include "freertos/stream_buffer.h"
#include "freertos/timers.h"
#include "esp_cpu.h"
#include "unity.h"
#include "test_utils.h"
#define NUMBER_OF_SAMPLES 1000
static int compare_uint32(const void *a, const void *b)
{
return (*(uint32_t *)a - * (uint32_t *)b);
}
static uint32_t calculate_median(uint32_t *values, int size)
{
/* Sort the array of values containing the execution time of each iteration */
qsort(values, size, sizeof(uint32_t), compare_uint32);
/* Return the median value */
return values[size / 2];
}
static uint32_t calculate_average(uint32_t *values, int size)
{
uint64_t sum = 0;
for (int i = 0; i < size; i++) {
sum += values[i];
}
return (uint32_t)(sum / size);
}
TEST_CASE("freertos api performance test", "[freertos][ignore]")
{
printf("=== FreeRTOS API Performance Test ===\n");
printf("This test measures execution time of commonly used FreeRTOS APIs.\n");
printf("Results help evaluate the impact of memory placement (Flash vs IRAM).\n\n");
#if defined(CONFIG_FREERTOS_IN_IRAM)
printf("FreeRTOS functions placed in IRAM.\r\n");
#else
printf("FreeRTOS functions placed in Flash.\r\n");
#endif
printf("Testing with %d samples per API\n", NUMBER_OF_SAMPLES);
printf("Note: Performance varies by target architecture, flash cache, and system load.\n\n");
uint32_t execution_times[NUMBER_OF_SAMPLES];
uint32_t test_data = 0x12345678;
// Initialize test objects
QueueHandle_t test_queue = xQueueCreate(10, sizeof(uint32_t));
SemaphoreHandle_t test_semaphore = xSemaphoreCreateBinary();
EventGroupHandle_t test_event_group = xEventGroupCreate();
StreamBufferHandle_t test_stream_buffer = xStreamBufferCreate(1024, 1);
TEST_ASSERT(test_queue != NULL);
TEST_ASSERT(test_semaphore != NULL);
TEST_ASSERT(test_event_group != NULL);
TEST_ASSERT(test_stream_buffer != NULL);
// Test 1: Queue APIs
printf("1. Testing Queue APIs...\n");
// xQueueSend
for (int i = 0; i < NUMBER_OF_SAMPLES; i++) {
uint32_t start_cycles = esp_cpu_get_cycle_count();
xQueueSend(test_queue, &test_data, 0);
execution_times[i] = esp_cpu_get_cycle_count() - start_cycles;
}
uint32_t queue_send_median = calculate_median(execution_times, NUMBER_OF_SAMPLES);
uint32_t queue_send_avg = calculate_average(execution_times, NUMBER_OF_SAMPLES);
printf(" xQueueSend: Median=%"PRIu32" cycles, Average=%"PRIu32" cycles\n", queue_send_median, queue_send_avg);
// xQueueReceive
for (int i = 0; i < NUMBER_OF_SAMPLES; i++) {
uint32_t start_cycles = esp_cpu_get_cycle_count();
xQueueReceive(test_queue, &test_data, 0);
execution_times[i] = esp_cpu_get_cycle_count() - start_cycles;
}
uint32_t queue_receive_median = calculate_median(execution_times, NUMBER_OF_SAMPLES);
uint32_t queue_receive_avg = calculate_average(execution_times, NUMBER_OF_SAMPLES);
printf(" xQueueReceive: Median=%"PRIu32" cycles, Average=%"PRIu32" cycles\n", queue_receive_median, queue_receive_avg);
// Test 2: Semaphore APIs
printf("\n2. Testing Semaphore APIs...\n");
// xSemaphoreGive
for (int i = 0; i < NUMBER_OF_SAMPLES; i++) {
uint32_t start_cycles = esp_cpu_get_cycle_count();
xSemaphoreGive(test_semaphore);
execution_times[i] = esp_cpu_get_cycle_count() - start_cycles;
}
uint32_t sem_give_median = calculate_median(execution_times, NUMBER_OF_SAMPLES);
uint32_t sem_give_avg = calculate_average(execution_times, NUMBER_OF_SAMPLES);
printf(" xSemaphoreGive: Median=%"PRIu32" cycles, Average=%"PRIu32" cycles\n", sem_give_median, sem_give_avg);
// xSemaphoreTake
for (int i = 0; i < NUMBER_OF_SAMPLES; i++) {
uint32_t start_cycles = esp_cpu_get_cycle_count();
xSemaphoreTake(test_semaphore, 0);
execution_times[i] = esp_cpu_get_cycle_count() - start_cycles;
}
uint32_t sem_take_median = calculate_median(execution_times, NUMBER_OF_SAMPLES);
uint32_t sem_take_avg = calculate_average(execution_times, NUMBER_OF_SAMPLES);
printf(" xSemaphoreTake: Median=%"PRIu32" cycles, Average=%"PRIu32" cycles\n", sem_take_median, sem_take_avg);
// Test 3: Event Group APIs
printf("\n3. Testing Event Group APIs...\n");
// xEventGroupSetBits
for (int i = 0; i < NUMBER_OF_SAMPLES; i++) {
uint32_t start_cycles = esp_cpu_get_cycle_count();
xEventGroupSetBits(test_event_group, 0x01);
execution_times[i] = esp_cpu_get_cycle_count() - start_cycles;
}
uint32_t event_set_median = calculate_median(execution_times, NUMBER_OF_SAMPLES);
uint32_t event_set_avg = calculate_average(execution_times, NUMBER_OF_SAMPLES);
printf(" xEventGroupSetBits: Median=%"PRIu32" cycles, Average=%"PRIu32" cycles\n", event_set_median, event_set_avg);
// xEventGroupGetBits
for (int i = 0; i < NUMBER_OF_SAMPLES; i++) {
uint32_t start_cycles = esp_cpu_get_cycle_count();
xEventGroupGetBits(test_event_group);
execution_times[i] = esp_cpu_get_cycle_count() - start_cycles;
}
uint32_t event_get_median = calculate_median(execution_times, NUMBER_OF_SAMPLES);
uint32_t event_get_avg = calculate_average(execution_times, NUMBER_OF_SAMPLES);
printf(" xEventGroupGetBits: Median=%"PRIu32" cycles, Average=%"PRIu32" cycles\n", event_get_median, event_get_avg);
// Test 4: Stream Buffer APIs
printf("\n4. Testing Stream Buffer APIs...\n");
// xStreamBufferSend
for (int i = 0; i < NUMBER_OF_SAMPLES; i++) {
uint32_t start_cycles = esp_cpu_get_cycle_count();
xStreamBufferSend(test_stream_buffer, &test_data, sizeof(uint32_t), 0);
execution_times[i] = esp_cpu_get_cycle_count() - start_cycles;
}
uint32_t stream_send_median = calculate_median(execution_times, NUMBER_OF_SAMPLES);
uint32_t stream_send_avg = calculate_average(execution_times, NUMBER_OF_SAMPLES);
printf(" xStreamBufferSend: Median=%"PRIu32" cycles, Average=%"PRIu32" cycles\n", stream_send_median, stream_send_avg);
// xStreamBufferReceive
for (int i = 0; i < NUMBER_OF_SAMPLES; i++) {
uint32_t start_cycles = esp_cpu_get_cycle_count();
xStreamBufferReceive(test_stream_buffer, &test_data, sizeof(uint32_t), 0);
execution_times[i] = esp_cpu_get_cycle_count() - start_cycles;
}
uint32_t stream_receive_median = calculate_median(execution_times, NUMBER_OF_SAMPLES);
uint32_t stream_receive_avg = calculate_average(execution_times, NUMBER_OF_SAMPLES);
printf(" xStreamBufferReceive: Median=%"PRIu32" cycles, Average=%"PRIu32" cycles\n", stream_receive_median, stream_receive_avg);
// Test 5: Task APIs
printf("\n5. Testing Task APIs...\n");
// xTaskGetTickCount
for (int i = 0; i < NUMBER_OF_SAMPLES; i++) {
uint32_t start_cycles = esp_cpu_get_cycle_count();
xTaskGetTickCount();
execution_times[i] = esp_cpu_get_cycle_count() - start_cycles;
}
uint32_t task_tick_median = calculate_median(execution_times, NUMBER_OF_SAMPLES);
uint32_t task_tick_avg = calculate_average(execution_times, NUMBER_OF_SAMPLES);
printf(" xTaskGetTickCount: Median=%"PRIu32" cycles, Average=%"PRIu32" cycles\n", task_tick_median, task_tick_avg);
printf("\n=== Performance Test Complete ===\n");
printf("Note: Compare results between Flash and IRAM configurations.\n");
printf("Consider memory cost vs performance benefit for your application.\n");
// Cleanup
vStreamBufferDelete(test_stream_buffer);
vEventGroupDelete(test_event_group);
vSemaphoreDelete(test_semaphore);
vQueueDelete(test_queue);
}

View File

@@ -3,5 +3,4 @@ CONFIG_SPI_FLASH_AUTO_SUSPEND=y
CONFIG_SPI_FLASH_FORCE_ENABLE_XMC_C_SUSPEND=y CONFIG_SPI_FLASH_FORCE_ENABLE_XMC_C_SUSPEND=y
# Enable FreeRTOS in Flash feature # Enable FreeRTOS in Flash feature
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH=y CONFIG_FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH=y

View File

@@ -14,7 +14,7 @@ CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y
CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y
CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y
CONFIG_FREERTOS_RUN_TIME_COUNTER_TYPE_U64=y CONFIG_FREERTOS_RUN_TIME_COUNTER_TYPE_U64=y
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y CONFIG_FREERTOS_IN_IRAM=y
CONFIG_FREERTOS_FPU_IN_ISR=y CONFIG_FREERTOS_FPU_IN_ISR=y
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2 CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES=y CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES=y

View File

@@ -4,3 +4,4 @@ CONFIG_ESP_SYSTEM_MEMPROT=n # for c2 and c6 this config must be disabled for cer
CONFIG_COMPILER_STACK_CHECK_MODE_ALL=y CONFIG_COMPILER_STACK_CHECK_MODE_ALL=y
CONFIG_COMPILER_STACK_CHECK=y CONFIG_COMPILER_STACK_CHECK=y
CONFIG_FREERTOS_IN_IRAM=y

View File

@@ -3,5 +3,4 @@ CONFIG_ESP_TASK_WDT_EN=n
CONFIG_PARTITION_TABLE_CUSTOM=y CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
CONFIG_ESP_SYSTEM_MEMPROT=n CONFIG_ESP_SYSTEM_MEMPROT=n
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
CONFIG_COMPILER_OPTIMIZATION_NONE=y CONFIG_COMPILER_OPTIMIZATION_NONE=y

View File

@@ -1,6 +1,5 @@
# This config lists merged freertos_flash no_optimization in UT all together. # This config lists merged freertos_flash no_optimization in UT all together.
CONFIG_ESP_SYSTEM_MEMPROT=n CONFIG_ESP_SYSTEM_MEMPROT=n
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
CONFIG_COMPILER_OPTIMIZATION_NONE=y CONFIG_COMPILER_OPTIMIZATION_NONE=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
CONFIG_COMPILER_DUMP_RTL_FILES=y CONFIG_COMPILER_DUMP_RTL_FILES=y

View File

@@ -179,8 +179,8 @@ The following options will reduce IRAM usage of some ESP-IDF features:
.. list:: .. list::
- Enable :ref:`CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH`. Provided these functions are not incorrectly used from ISRs, this option is safe to enable in all configurations. - Disable :ref:`CONFIG_FREERTOS_IN_IRAM` if enabled to place FreeRTOS functions in Flash instead of IRAM. By default, FreeRTOS functions are already placed in Flash to save IRAM.
- Enable :ref:`CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH`. Provided these functions are not incorrectly used from ISRs, this option is safe to enable in all configurations. - Disable :ref:`CONFIG_RINGBUF_IN_IRAM` if enabled to place ring buffer functions in Flash instead of IRAM. By default, ring buffer functions are already placed in Flash to save IRAM.
- Enable :ref:`CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH`. This option is not safe to use if the ISR ringbuf functions are used from an IRAM interrupt context, e.g., if :ref:`CONFIG_UART_ISR_IN_IRAM` is enabled. For the ESP-IDF drivers where this is the case, you can get an error at run-time when installing the driver in question. - Enable :ref:`CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH`. This option is not safe to use if the ISR ringbuf functions are used from an IRAM interrupt context, e.g., if :ref:`CONFIG_UART_ISR_IN_IRAM` is enabled. For the ESP-IDF drivers where this is the case, you can get an error at run-time when installing the driver in question.
:SOC_WIFI_SUPPORTED: - Disabling Wi-Fi options :ref:`CONFIG_ESP_WIFI_IRAM_OPT` and/or :ref:`CONFIG_ESP_WIFI_RX_IRAM_OPT` options frees available IRAM at the cost of Wi-Fi performance. :SOC_WIFI_SUPPORTED: - Disabling Wi-Fi options :ref:`CONFIG_ESP_WIFI_IRAM_OPT` and/or :ref:`CONFIG_ESP_WIFI_RX_IRAM_OPT` options frees available IRAM at the cost of Wi-Fi performance.
:CONFIG_ESP_ROM_HAS_SPI_FLASH: - Enabling :ref:`CONFIG_SPI_FLASH_ROM_IMPL` frees some IRAM but means that esp_flash bugfixes and new flash chip support are not available, see :doc:`/api-reference/peripherals/spi_flash/spi_flash_idf_vs_rom` for details. :CONFIG_ESP_ROM_HAS_SPI_FLASH: - Enabling :ref:`CONFIG_SPI_FLASH_ROM_IMPL` frees some IRAM but means that esp_flash bugfixes and new flash chip support are not available, see :doc:`/api-reference/peripherals/spi_flash/spi_flash_idf_vs_rom` for details.

View File

@@ -156,6 +156,8 @@ The following changes increase the speed of a chosen part of the firmware applic
- Jump table optimizations can be re-enabled for individual source files that do not need to be placed in IRAM. For hot paths in large ``switch cases``, this improves performance. For instructions on how to add the ``-fjump-tables`` and ``-ftree-switch-conversion`` options when compiling individual source files, see :ref:`component_build_control` - Jump table optimizations can be re-enabled for individual source files that do not need to be placed in IRAM. For hot paths in large ``switch cases``, this improves performance. For instructions on how to add the ``-fjump-tables`` and ``-ftree-switch-conversion`` options when compiling individual source files, see :ref:`component_build_control`
- Many ESP-IDF components and drivers provide configuration options to place performance-critical functions in IRAM for reduced latency and improved speed. These options typically have names like ``CONFIG_*_IN_IRAM``, ``CONFIG_*_ISR_IN_IRAM``, or ``CONFIG_*_IRAM_OPT``. Some examples are :ref:`CONFIG_FREERTOS_IN_IRAM` for FreeRTOS functions, :ref:`CONFIG_ESP_WIFI_IRAM_OPT` for Wi-Fi operations, :ref:`CONFIG_UART_ISR_IN_IRAM` for UART interrupt handling, and :ref:`CONFIG_SPI_MASTER_ISR_IN_IRAM` for SPI operations. These options trade IRAM usage for speed, so they should be used selectively based on your application's performance requirements and available IRAM space.
Improving Startup Time Improving Startup Time
---------------------- ----------------------

View File

@@ -612,7 +612,7 @@ The default config puts only the ISR into the IRAM. Other SPI-related functions,
.. note:: .. note::
SPI driver implementation is based on FreeRTOS APIs, to use :ref:`CONFIG_SPI_MASTER_IN_IRAM`, you should not enable :ref:`CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH`. SPI driver implementation is based on FreeRTOS APIs, to use :ref:`CONFIG_SPI_MASTER_IN_IRAM`, you should enable :ref:`CONFIG_FREERTOS_IN_IRAM`.
For an interrupt transaction, the overall cost is **20+8n/Fspi[MHz]** [µs] for n bytes transferred in one transaction. Hence, the transferring speed is: **n/(20+8n/Fspi)**. An example of transferring speed at 8 MHz clock speed is given in the following table. For an interrupt transaction, the overall cost is **20+8n/Fspi[MHz]** [µs] for n bytes transferred in one transaction. Hence, the transferring speed is: **n/(20+8n/Fspi)**. An example of transferring speed at 8 MHz clock speed is given in the following table.

View File

@@ -153,3 +153,17 @@ LCD
- The ``color_space`` and ``rgb_endian`` configuration options in the :cpp:type:`esp_lcd_panel_dev_config_t` structure have been replaced by the :cpp:member:`esp_lcd_panel_dev_config_t::rgb_ele_order` member, which sets the RGB element order. The corresponding types ``lcd_color_rgb_endian_t`` and ``esp_lcd_color_space_t`` have also been removed; use :cpp:type:`lcd_rgb_element_order_t` instead. - The ``color_space`` and ``rgb_endian`` configuration options in the :cpp:type:`esp_lcd_panel_dev_config_t` structure have been replaced by the :cpp:member:`esp_lcd_panel_dev_config_t::rgb_ele_order` member, which sets the RGB element order. The corresponding types ``lcd_color_rgb_endian_t`` and ``esp_lcd_color_space_t`` have also been removed; use :cpp:type:`lcd_rgb_element_order_t` instead.
- The ``esp_lcd_panel_disp_off`` function has been removed. Please use the :func:`esp_lcd_panel_disp_on_off` function to control display on/off. - The ``esp_lcd_panel_disp_off`` function has been removed. Please use the :func:`esp_lcd_panel_disp_on_off` function to control display on/off.
- The ``on_bounce_frame_finish`` member in :cpp:type:`esp_lcd_rgb_panel_event_callbacks_t` has been replaced by :cpp:member:`esp_lcd_rgb_panel_event_callbacks_t::on_frame_buf_complete`, which indicates that a complete frame buffer has been sent to the LCD controller. - The ``on_bounce_frame_finish`` member in :cpp:type:`esp_lcd_rgb_panel_event_callbacks_t` has been replaced by :cpp:member:`esp_lcd_rgb_panel_event_callbacks_t::on_frame_buf_complete`, which indicates that a complete frame buffer has been sent to the LCD controller.
SPI
---
The :ref:`CONFIG_SPI_MASTER_IN_IRAM` option is now invisible by default in menuconfig and depends on :ref:`CONFIG_FREERTOS_IN_IRAM`. This change was made to prevent potential crashes when SPI functions in IRAM call FreeRTOS functions that are placed in Flash.
To enable SPI master IRAM optimization:
1. Navigate to ``Component config````FreeRTOS````Port`` in menuconfig
2. Enable ``Place FreeRTOS functions in IRAM`` (:ref:`CONFIG_FREERTOS_IN_IRAM`)
3. Navigate to ``Component config````ESP-Driver:SPI Configurations``
4. Enable ``Place transmitting functions of SPI master into IRAM`` (:ref:`CONFIG_SPI_MASTER_IN_IRAM`)
Note that enabling :ref:`CONFIG_FREERTOS_IN_IRAM` will increase IRAM usage. Consider this trade-off when optimizing for SPI performance.

View File

@@ -103,6 +103,19 @@ The following compatibility functions have been removed in ESP-IDF v6.0. These f
The function :cpp:func:`pxTaskGetStackStart` has been deprecated. Use :cpp:func:`xTaskGetStackStart` instead for improved type safety. The function :cpp:func:`pxTaskGetStackStart` has been deprecated. Use :cpp:func:`xTaskGetStackStart` instead for improved type safety.
**Memory Placement**
To reduce IRAM usage, the default placement for most FreeRTOS functions has been changed from IRAM to Flash. Consequently, the ``CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH`` option has been removed. This change saves a significant amount of IRAM but may have a slight performance impact. For performance-critical applications, the previous behavior can be restored by enabling the new :ref:`CONFIG_FREERTOS_IN_IRAM` option.
When deciding whether to enable ``CONFIG_FREERTOS_IN_IRAM``, consider conducting performance testing to measure the actual impact on your specific use case. Performance differences between Flash and IRAM configurations can vary depending on flash cache efficiency, API usage patterns, and system load.
A baseline performance test is provided in ``components/freertos/test_apps/freertos/performance/test_freertos_api_performance.c`` that measures the execution time of commonly used FreeRTOS APIs. This test can help you evaluate the performance impact of memory placement for your target hardware and application requirements.
Ring Buffer
-----------
**Memory Placement**
To reduce IRAM usage, the default placement for `esp_ringbuf` functions has been changed from IRAM to Flash. Consequently, the ``CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH`` option has been removed. This change saves a significant amount of IRAM but may have a slight performance impact. For performance-critical applications, the previous behavior can be restored by enabling the new :ref:`CONFIG_RINGBUF_IN_IRAM` option.
Core Dump Core Dump
--------- ---------

View File

@@ -179,8 +179,8 @@ IRAM 优化
.. list:: .. list::
- 启用 :ref:`CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH`。只要没有从 ISR 中错误地调用这些函数,就可以在所有配置中安全启用此选项 - 如果启用 :ref:`CONFIG_FREERTOS_IN_IRAM`,可以禁用它以将 FreeRTOS 函数放置在 Flash 中而不是 IRAM 中。默认情况下FreeRTOS 函数已经被放置在 Flash 中以节省 IRAM
- 启用 :ref:`CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH`。只要没有从 ISR 中错误地调用这些函数,就可以在所有配置中安全启用此选项 - 如果启用 :ref:`CONFIG_RINGBUF_IN_IRAM`,可以禁用它以将环形缓冲区函数放置在 Flash 中而不是 IRAM 中。默认情况下,环形缓冲区函数已经被放置在 Flash 中以节省 IRAM
- 启用 :ref:`CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH`。如果从 IRAM 中的中断上下文中使用 ISR ringbuf 函数,例如启用了 :ref:`CONFIG_UART_ISR_IN_IRAM`,则无法安全使用此选项。在此情况下,安装 ESP-IDF 相关驱动程序时,将在运行时报错。 - 启用 :ref:`CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH`。如果从 IRAM 中的中断上下文中使用 ISR ringbuf 函数,例如启用了 :ref:`CONFIG_UART_ISR_IN_IRAM`,则无法安全使用此选项。在此情况下,安装 ESP-IDF 相关驱动程序时,将在运行时报错。
:SOC_WIFI_SUPPORTED: - 禁用 Wi-Fi 选项 :ref:`CONFIG_ESP_WIFI_IRAM_OPT` 和/或 :ref:`CONFIG_ESP_WIFI_RX_IRAM_OPT` 会释放可用 IRAM但会牺牲部分 Wi-Fi 性能。 :SOC_WIFI_SUPPORTED: - 禁用 Wi-Fi 选项 :ref:`CONFIG_ESP_WIFI_IRAM_OPT` 和/或 :ref:`CONFIG_ESP_WIFI_RX_IRAM_OPT` 会释放可用 IRAM但会牺牲部分 Wi-Fi 性能。
:CONFIG_ESP_ROM_HAS_SPI_FLASH: - 启用 :ref:`CONFIG_SPI_FLASH_ROM_IMPL` 选项可以释放一些 IRAM但此时 esp_flash 错误修复程序及新的 flash 芯片支持将失效,详情请参阅 :doc:`/api-reference/peripherals/spi_flash/spi_flash_idf_vs_rom` :CONFIG_ESP_ROM_HAS_SPI_FLASH: - 启用 :ref:`CONFIG_SPI_FLASH_ROM_IMPL` 选项可以释放一些 IRAM但此时 esp_flash 错误修复程序及新的 flash 芯片支持将失效,详情请参阅 :doc:`/api-reference/peripherals/spi_flash/spi_flash_idf_vs_rom`

View File

@@ -156,6 +156,8 @@
- 针对不需要放置在 IRAM 中的单个源文件,可以重新启用跳转表优化。这将提高大型 ``switch cases`` 代码中的热路径性能。关于如何在编译单个源文件时添加 -fjump-tables -ftree-switch-conversion 选项,参见 :ref:`component_build_control` - 针对不需要放置在 IRAM 中的单个源文件,可以重新启用跳转表优化。这将提高大型 ``switch cases`` 代码中的热路径性能。关于如何在编译单个源文件时添加 -fjump-tables -ftree-switch-conversion 选项,参见 :ref:`component_build_control`
- 许多 ESP-IDF 组件和驱动程序提供配置选项,将性能关键函数放置在 IRAM 中以减少延迟并提高速度。这些选项通常具有类似 ``CONFIG_*_IN_IRAM````CONFIG_*_ISR_IN_IRAM````CONFIG_*_IRAM_OPT`` 的名称。一些示例包括 :ref:`CONFIG_FREERTOS_IN_IRAM` 用于 FreeRTOS 函数,:ref:`CONFIG_ESP_WIFI_IRAM_OPT` 用于 Wi-Fi 操作,:ref:`CONFIG_UART_ISR_IN_IRAM` 用于 UART 中断处理,:ref:`CONFIG_SPI_MASTER_ISR_IN_IRAM` 用于 SPI 操作。这些选项以 IRAM 使用量换取速度,因此应根据应用程序的性能要求和可用 IRAM 空间有选择地使用。
减少启动时间 减少启动时间
---------------------------- ----------------------------

View File

@@ -612,7 +612,7 @@ GPSPI 外设的时钟源可以通过设置 :cpp:member:`spi_device_interface_con
.. note:: .. note::
SPI 驱动是基于 FreeRTOS 的 API 实现的,在使用 :ref:`CONFIG_SPI_MASTER_IN_IRAM` 时,不得启用 :ref:`CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH` SPI 驱动是基于 FreeRTOS 的 API 实现的,在使用 :ref:`CONFIG_SPI_MASTER_IN_IRAM` 时,启用 :ref:`CONFIG_FREERTOS_IN_IRAM`
单个中断传输事务传输 n 字节的总成本为 **20+8n/Fspi[MHz]** [µs],故传输速度为 **n/(20+8n/Fspi)**。8 MHz 时钟速度的传输速度见下表。 单个中断传输事务传输 n 字节的总成本为 **20+8n/Fspi[MHz]** [µs],故传输速度为 **n/(20+8n/Fspi)**。8 MHz 时钟速度的传输速度见下表。

View File

@@ -153,3 +153,17 @@ LCD
- :cpp:type:`esp_lcd_panel_dev_config_t` 结构体中的 ``color_space````rgb_endian`` 配置均已被 :cpp:member:`esp_lcd_panel_dev_config_t::rgb_ele_order` 成员取代,用来设置 RGB 元素的排列顺序。对应的类型 ``lcd_color_rgb_endian_t````esp_lcd_color_space_t`` 也已被移除,请使用 :cpp:type:`lcd_rgb_element_order_t` 替代。 - :cpp:type:`esp_lcd_panel_dev_config_t` 结构体中的 ``color_space````rgb_endian`` 配置均已被 :cpp:member:`esp_lcd_panel_dev_config_t::rgb_ele_order` 成员取代,用来设置 RGB 元素的排列顺序。对应的类型 ``lcd_color_rgb_endian_t````esp_lcd_color_space_t`` 也已被移除,请使用 :cpp:type:`lcd_rgb_element_order_t` 替代。
- ``esp_lcd_panel_disp_off`` 函数已被移除。请使用 :func:`esp_lcd_panel_disp_on_off` 函数来控制显示内容的开关。 - ``esp_lcd_panel_disp_off`` 函数已被移除。请使用 :func:`esp_lcd_panel_disp_on_off` 函数来控制显示内容的开关。
- :cpp:type:`esp_lcd_rgb_panel_event_callbacks_t` 中的 ``on_bounce_frame_finish`` 成员已被 :cpp:member:`esp_lcd_rgb_panel_event_callbacks_t::on_frame_buf_complete` 成员取代,用于指示一个完整的帧缓冲区已被发送给 LCD 控制器。 - :cpp:type:`esp_lcd_rgb_panel_event_callbacks_t` 中的 ``on_bounce_frame_finish`` 成员已被 :cpp:member:`esp_lcd_rgb_panel_event_callbacks_t::on_frame_buf_complete` 成员取代,用于指示一个完整的帧缓冲区已被发送给 LCD 控制器。
SPI
---
:ref:`CONFIG_SPI_MASTER_IN_IRAM` 选项现在在 menuconfig 中默认不可见,并且依赖于 :ref:`CONFIG_FREERTOS_IN_IRAM`。此更改是为了防止位于 IRAM 中的 SPI 函数调用位于 Flash 中的 FreeRTOS 函数时可能发生的崩溃。
要启用 SPI 主机 IRAM 优化:
1. 在 menuconfig 中导航到 ``Component config````FreeRTOS````Port``
2. 启用 ``Place FreeRTOS functions in IRAM`` (:ref:`CONFIG_FREERTOS_IN_IRAM`)
3. 导航到 ``Component config````ESP-Driver:SPI Configurations``
4. 启用 ``Place transmitting functions of SPI master into IRAM`` (:ref:`CONFIG_SPI_MASTER_IN_IRAM`)
请注意,启用 :ref:`CONFIG_FREERTOS_IN_IRAM` 会显著增加 IRAM 使用量。在为 SPI 性能进行优化时,请考虑此权衡。

View File

@@ -103,6 +103,19 @@ FreeRTOS
函数 :cpp:func:`pxTaskGetStackStart` 已弃用。请使用 :cpp:func:`xTaskGetStackStart` 替代以提高类型安全性。 函数 :cpp:func:`pxTaskGetStackStart` 已弃用。请使用 :cpp:func:`xTaskGetStackStart` 替代以提高类型安全性。
**内存布局**
为了减少 IRAM 的使用,大多数 FreeRTOS 函数的默认位置已从 IRAM 更改为 Flash。因此``CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH`` 选项已被移除。此举可节省大量 IRAM但可能会对性能造成轻微影响。对于性能要求严苛的应用程序可通过启用新增的 :ref:`CONFIG_FREERTOS_IN_IRAM` 选项来恢复之前的行为。
在决定是否启用 ``CONFIG_FREERTOS_IN_IRAM``建议进行性能测试以测量对特定用例的实际影响。Flash 和 IRAM 配置之间的性能差异可能因 Flash 缓存效率、API 使用模式和系统负载而异。
``components/freertos/test_apps/freertos/performance/test_freertos_api_performance.c`` 中提供了基准性能测试,用于测量常用 FreeRTOS API 的执行时间。此测试可帮助您评估内存布局对目标硬件和应用程序要求的性能影响。
环形缓冲区
----------
**内存布局**
为了减少 IRAM 的使用,`esp_ringbuf` 函数的默认位置已从 IRAM 更改为 Flash。因此``CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH`` 选项已被移除。此举可节省大量 IRAM但可能会对性能造成轻微影响。对于性能要求严苛的应用程序可通过启用新增的 :ref:`CONFIG_RINGBUF_IN_IRAM` 选项来恢复之前的行为。
核心转储 核心转储
-------- --------

View File

@@ -1,4 +1,3 @@
# Place FreeRTOS functions into flash to save some IRAM on the ESP32 # Place FreeRTOS functions into flash to save some IRAM on the ESP32
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
# Use the SINGLE_APP_LARGE partition to ensure the partition has enough space for the ESP32 build # Use the SINGLE_APP_LARGE partition to ensure the partition has enough space for the ESP32 build
CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y

View File

@@ -1,2 +0,0 @@
# Place FreeRTOS functions into flash to save some IRAM on the ESP32
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y

View File

@@ -37,8 +37,6 @@ CONFIG_GDMA_ISR_HANDLER_IN_IRAM=n
# CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY=y # CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY=y
# System # System
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y
CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH=y CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH=y
CONFIG_LIBC_LOCKS_PLACE_IN_IRAM=n CONFIG_LIBC_LOCKS_PLACE_IN_IRAM=n
CONFIG_HAL_ASSERTION_SILENT=y CONFIG_HAL_ASSERTION_SILENT=y

View File

@@ -1,4 +1,2 @@
CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_SIZE=y
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y
CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH=y CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH=y

View File

@@ -14,8 +14,5 @@ CONFIG_ESP_TASK_WDT_PANIC=y
# For vTaskGetInfo() used in test_stack_overflow() # For vTaskGetInfo() used in test_stack_overflow()
CONFIG_FREERTOS_USE_TRACE_FACILITY=y CONFIG_FREERTOS_USE_TRACE_FACILITY=y
# Reduce IRAM size
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
# Increase main task stack size # Increase main task stack size
CONFIG_ESP_MAIN_TASK_STACK_SIZE=4096 CONFIG_ESP_MAIN_TASK_STACK_SIZE=4096