freertos: Add linker fragments for common functions

This commit adds a separate linker fragment file "linker_common.lf" for the
functions in "port_common.c". The placement rules are now clearly specified
inside the linker fragment file.
pull/9842/merge
Darian Leung 2022-12-01 18:29:12 +08:00
rodzic dba0718f47
commit 0574e63e6f
5 zmienionych plików z 69 dodań i 50 usunięć

Wyświetl plik

@ -60,7 +60,7 @@ else()
"esp_additions/private_include") # For include "freertos_tasks_c_additions.h"
if(CONFIG_FREERTOS_SMP)
set(ldfragments linker_smp.lf)
set(ldfragments linker_smp.lf linker_common.lf)
list(APPEND include_dirs "${kernel_dir}/portable/${arch}/include/freertos") # Xtensa headers via #include "xx.h"
else()
list(APPEND srcs
@ -69,7 +69,7 @@ else()
list(APPEND private_include_dirs "${kernel_dir}/portable/priv_include") # For port_systick.h on normal FreeRTOS
set(ldfragments linker.lf)
set(ldfragments linker.lf linker_common.lf)
endif()
list(APPEND private_requirements soc esp_pm)

Wyświetl plik

@ -1,9 +1,10 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
*/
/*
* Since at least FreeRTOS V7.5.3 uxTopUsedPriority is no longer
* present in the kernel, so it has to be supplied by other means for
* OpenOCD's threads awareness.
@ -15,7 +16,6 @@
*/
#include "FreeRTOS.h"
#include "esp_attr.h"
#include "sdkconfig.h"
#ifdef __GNUC__
@ -25,5 +25,5 @@
#endif
#ifdef CONFIG_FREERTOS_DEBUG_OCDAWARE
const int USED DRAM_ATTR uxTopUsedPriority = configMAX_PRIORITIES - 1; //will be removed
const int USED uxTopUsedPriority = configMAX_PRIORITIES - 1; //will be removed
#endif

Wyświetl plik

@ -3,12 +3,6 @@
archive: libfreertos.a
entries:
* (noflash_text)
if FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH = y:
# 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
tasks: pxTaskGetNext (default)
tasks: uxTaskGetSnapshotAll (default)
tasks: pxGetNextTaskList (default)
if FREERTOS_PLACE_FUNCTIONS_INTO_FLASH = y:
port: pxPortInitialiseStack (default)
port: xPortStartScheduler (default)
@ -31,11 +25,7 @@ entries:
tasks: vTaskRemoveFromUnorderedEventList (default)
tasks: uxTaskPriorityGet (default)
tasks: vTaskPrioritySet (default)
tasks: prvTaskPriorityRaise (default)
tasks: prvTaskPriorityRestore (default)
tasks: vTaskSetThreadLocalStoragePointerAndDelCallback (default)
tasks: pvTaskGetThreadLocalStoragePointer (default)
tasks: xTaskGetCurrentTaskHandleForCPU (default)
tasks: vTaskDelete (default)
tasks: vTaskDelayUntil (default)
tasks: xTaskDelayUntil (default)
@ -54,8 +44,6 @@ entries:
tasks: vTaskEndScheduler (default)
tasks: vTaskMissedYield (default)
tasks: vTaskSetThreadLocalStoragePointer (default)
tasks: xTaskGetAffinity (default)
tasks: xTaskGetIdleTaskHandleForCPU (default)
if FREERTOS_USE_TRACE_FACILITY = y:
tasks: uxTaskGetSystemState (default)
tasks: uxTaskGetTaskNumber (default)
@ -127,12 +115,3 @@ entries:
queue: uxQueueGetQueueNumber (default)
queue: vQueueSetQueueNumber (default)
queue: ucQueueGetQueueType (default)
# app_startup.c
app_startup: esp_startup_start_app (default)
if CONFIG_FREERTOS_UNICORE = n:
app_startup: esp_startup_start_app_other_cores (default)
app_startup: other_cpu_startup_idle_hook_cb (default)
app_startup: main_task (default)
# port_common.c Functions
port_common:vApplicationGetIdleTaskMemory (default)
port_common:vApplicationGetTimerTaskMemory (default)

Wyświetl plik

@ -0,0 +1,62 @@
# 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:
# ------------------------------------------------------------------------------------------------------------------
# esp_additions/private_include/freertos_tasks_c_additions.h
# Placement Rules (Task Snapshot):
# - Default: Place all functions in internal RAM.
# - CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH: Place functions in flash
# - 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
# Placement Rules (FreeRTOS API Additions):
# - Default: Place all functions in internal RAM.
# - CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH: Place functions in flash if they are never called from an ISR
# context (directly or indirectly).
# ------------------------------------------------------------------------------------------------------------------
# Task Snapshot
if FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH = y:
tasks:pxGetNextTaskList (default)
tasks:pxTaskGetNext (default)
tasks:uxTaskGetSnapshotAll (default)
# FreeRTOS API Additions
if FREERTOS_PLACE_FUNCTIONS_INTO_FLASH = y:
if FREERTOS_SMP = y:
tasks:xTaskCreatePinnedToCore (default)
tasks:xTaskCreateStaticPinnedToCore (default)
tasks:xTaskGetCurrentTaskHandleForCPU (default)
tasks:xTaskGetIdleTaskHandleForCPU (default)
tasks:xTaskGetAffinity (default)
if FREERTOS_TLSP_DELETION_CALLBACKS = y:
tasks:vTaskSetThreadLocalStoragePointerAndDelCallback (default)
tasks:prvTaskPriorityRaise (default)
tasks:prvTaskPriorityRestore (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
# ------------------------------------------------------------------------------------------------------------------
# FreeRTOS-openocd.c
# Placement Rules: All functions/data in internal RAM as they are called/used by OpenOCD
# ------------------------------------------------------------------------------------------------------------------
FreeRTOS-openocd (noflash)
# ------------------------------------------------------------------------------------------------------------------
# port_common.c
# Placement Rules:
# - Default: Place all functions in internal RAM.
# - CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH: Place functions in flash if they are never called from an ISR
# context (directly or indirectly).
# ------------------------------------------------------------------------------------------------------------------
port_common (noflash_text) # Default all functions to internal RAM
if FREERTOS_PLACE_FUNCTIONS_INTO_FLASH = y:
if FREERTOS_SMP = n:
port_common:xPortCheckValidTCBMem (default)
port_common:xPortcheckValidStackMem (default)
port_common:vApplicationGetIdleTaskMemory (default)
port_common:vApplicationGetTimerTaskMemory (default)

Wyświetl plik

@ -76,8 +76,6 @@ entries:
tasks: eTaskGetState (default)
tasks: uxTaskPriorityGet (default)
tasks: vTaskPrioritySet (default)
tasks: prvTaskPriorityRaise (default)
tasks: prvTaskPriorityRestore (default)
tasks: vTaskSuspend (default)
tasks: vTaskResume (default)
tasks: prvCreateIdleTasks (default)
@ -127,29 +125,9 @@ entries:
tasks: xTaskGenericNotify (default)
tasks: xTaskGenericNotifyStateClear (default)
tasks: ulTaskGenericNotifyValueClear (default)
# tasks.c: Additions
if FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH = y:
tasks: non_ready_task_lists (default)
tasks: pxGetNextTaskList (default)
tasks: pxTaskGetNext (default)
tasks: vTaskGetSnapshot (default)
tasks: uxTaskGetSnapshotAll (default)
tasks: xTaskCreatePinnedToCore (default)
tasks: xTaskCreateStaticPinnedToCore (default)
tasks: xTaskGetCurrentTaskHandleForCPU (default)
tasks: xTaskGetIdleTaskHandleForCPU (default)
tasks: xTaskGetAffinity (default)
if FREERTOS_TLSP_DELETION_CALLBACKS = y:
tasks: vTaskSetThreadLocalStoragePointerAndDelCallback (default)
# port
port: pxPortInitialiseStack (default)
port: xPortStartScheduler (default)
# app_startup.c
app_startup: esp_startup_start_app (default)
if CONFIG_FREERTOS_UNICORE = n:
app_startup: esp_startup_start_app_other_cores (default)
app_startup: other_cpu_startup_idle_hook_cb (default)
app_startup: main_task (default)
# timers.c
timers: xTimerCreateTimerTask (default)
timers: xTimerCreate (default)