Files
esp-idf/components/freertos/linker_common.lf
Sudeep Mohanty 11b80a7f11 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
2025-08-15 02:18:57 +02:00

79 lines
4.7 KiB
Plaintext

# Linker fragment file for common FreeRTOS files (i.e., both "port_common.c" and "esp_additions/..."
# Flash function placements are listed per source file, in the order that they appear in the source file.
[mapping:freertos_common]
archive: libfreertos.a
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
# Placement Rules (FreeRTOS API Additions):
# - Default: Place all functions in flash.
# - CONFIG_FREERTOS_IN_IRAM: Place all functions in internal RAM for performance optimization.
# - xTaskIncrementTickOtherCores is always placed in internal RAM for better performance
# Placement Rules (Task Snapshot):
# - Default: Place all 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
# 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.
#
# ------------------------------------------------------------------------------------------------------------------
if FREERTOS_SMP = n && FREERTOS_UNICORE = n:
tasks:xTaskIncrementTickOtherCores (noflash_text)
if FREERTOS_PLACE_ISR_FUNCTIONS_INTO_FLASH = n:
tasks:vTaskGetSnapshot (noflash_text)
# ------------------------------------------------------------------------------------------------------------------
# idf_additions.c
# Placement Rules: Functions always in flash as they are never called from an ISR
# ------------------------------------------------------------------------------------------------------------------
idf_additions (default)
# ------------------------------------------------------------------------------------------------------------------
# idf_additions_event_groups.c
# Placement Rules: Functions always in flash as they are never called from an ISR
# ------------------------------------------------------------------------------------------------------------------
idf_additions_event_groups (default)
# ------------------------------------------------------------------------------------------------------------------
# app_startup.c
# Placement Rules: Functions always in flash as they are never called from an ISR
# ------------------------------------------------------------------------------------------------------------------
app_startup (default) # Place functions (but not Data and BSS) to flash
# ------------------------------------------------------------------------------------------------------------------
# heap_idf.c
# Placement Rules:
# - Default: Place all functions in flash.
# - CONFIG_FREERTOS_IN_IRAM: Place all functions in internal RAM for performance optimization.
# ------------------------------------------------------------------------------------------------------------------
if FREERTOS_IN_IRAM = y:
heap_idf (noflash_text) # All functions to internal RAM
# ------------------------------------------------------------------------------------------------------------------
# port_common.c
# Placement Rules:
# - Default: Place all functions in flash.
# - CONFIG_FREERTOS_IN_IRAM: Place all functions in internal RAM for performance optimization.
# ------------------------------------------------------------------------------------------------------------------
if FREERTOS_IN_IRAM = y:
port_common (noflash_text) # All functions to internal RAM
# ------------------------------------------------------------------------------------------------------------------
# port_systick.c
# - Place the entire port_systick in IRAM. It contains the tick ISR and its related functions, which are
# performance-critical and must always be in IRAM.
# - 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)
if IDF_TARGET_ARCH_RISCV = y:
port_systick:vPortSetupTimer (default)
if FREERTOS_SYSTICK_USES_SYSTIMER = y:
port_systick:vSystimerSetup (default)