esp-idf/components/freertos/linker.lf
Darian Leung ae3383ddc5 freertos: Remove/restore queue locks for multi-core/single-core
This commit removes the updates the usage of queue locks in IDF FreeRTOS

Queue locks are present in Vanilla FreeRTOS to ensure that queue functions
behave deterministicly in critical sections (i.e., no walking linked lists
while interrupts are disabled). However, currently in IDF FreeRTOS...

- When configNUM_CORES > 1, IDF FreeRTOS drops the determinism requirement.
Thus, queue functions could be simplified if queue locks were not used at all
(and have a queue function do everything inside the same critical section).

- When configNUM_CORES == 1, the current queue implementation in IDF FreeRTOS
does not meet the determinism requirements, as critical sections are used
(instead of scheduler suspension) when locking/unlocking the queues.

There, this commit updates multiple queue functions so that

- When configNUM_CORES > 1
    - Queue locks are no longer used. All actions are done within the same
      critical section.
    - Affected queue functions now need 40% less CPU clock cycles when blocking
- When configNUM_CORES = 1
    - Queue locks are still used.
    - Vanilla behavior of suspending the scheduler is restored when locking
      the queue. Thus queue fucntions are now deterministic and have the same
      behavior as Vanilla FreeRTOS.
    - Affected queue functions now takes 36% more CPU clock cycles when
      blocking (due to the scheduler suspension/resumption).
2022-11-10 14:39:47 +08:00

144 lines
6.6 KiB
Plaintext

# Linker fragment file for IDF FreeRTOS (i.e., CONFIG_FREERTOS_SMP=n)
[mapping:freertos]
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)
if IDF_TARGET_ESP32 = y || IDF_TARGET_ESP32S3 = y :
port: vPortReleaseTaskMPUSettings (default)
tasks: xTaskCreateRestricted (default)
port: vPortStoreTaskMPUSettings (default)
tasks: vTaskAllocateMPURegions (default)
tasks: prvTaskCheckFreeStackSpace (default)
tasks: prvInitialiseNewTask (default)
tasks: prvInitialiseTaskLists (default)
tasks: prvDeleteTCB (default)
tasks: prvCheckTasksWaitingTermination (default)
tasks: prvIdleTask (default)
tasks: prvAddNewTaskToReadyList (default)
tasks: xTaskCreatePinnedToCore (default)
tasks: xTaskCreateStaticPinnedToCore (default)
tasks: vTaskResume (default)
tasks: vTaskStartScheduler (default)
tasks: vTaskSuspendAll (default)
tasks: uxTaskGetNumberOfTasks (default)
tasks: xTaskGetIdleTaskHandle (default)
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)
tasks: vTaskDelay (default)
tasks: vTaskSuspend (default)
tasks: xTaskResumeAll (default)
tasks: uxTaskResetEventItemValue (default)
tasks: ulTaskNotifyTake (default)
tasks: ulTaskGenericNotifyTake (default)
tasks: xTaskNotifyWait (default)
tasks: xTaskGenericNotifyWait (default)
tasks: xTaskGenericNotify (default)
tasks: eTaskGetState (default)
tasks: pxTaskGetStackStart (default)
tasks: uxTaskGetStackHighWaterMark (default)
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)
tasks: vTaskSetTaskNumber (default)
if FREERTOS_USE_STATS_FORMATTING_FUNCTIONS = y:
tasks: vTaskList (default)
if FREERTOS_GENERATE_RUN_TIME_STATS = y:
tasks: vTaskGetRunTimeStats (default)
timers: prvInsertTimerInActiveList (default)
timers: prvCheckForValidListAndQueue (default)
timers: prvInitialiseNewTimer (default)
timers: prvTimerTask (default)
timers: prvSwitchTimerLists (default)
timers: prvSampleTimeNow (default)
timers: prvProcessExpiredTimer (default)
timers: prvProcessTimerOrBlockTask (default)
timers: prvProcessReceivedCommands (default)
timers: xTimerCreateTimerTask (default)
timers: xTimerCreate (default)
timers: xTimerCreateStatic (default)
timers: xTimerGenericCommand (default)
timers: xTimerGetPeriod (default)
timers: xTimerGetExpiryTime (default)
timers: xTimerIsTimerActive (default)
timers: pvTimerGetTimerID (default)
timers: vTimerSetTimerID (default)
timers: prvGetNextExpireTime (default)
if FREERTOS_USE_TRACE_FACILITY = y:
timers: uxTimerGetTimerNumber (default)
timers: vTimerSetTimerNumber (default)
event_groups: prvTestWaitCondition (default)
event_groups: xEventGroupCreate (default)
event_groups: xEventGroupCreateStatic (default)
event_groups: xEventGroupWaitBits (default)
event_groups: xEventGroupClearBits (default)
event_groups: xEventGroupSetBits (default)
event_groups: xEventGroupSync (default)
event_groups: vEventGroupDelete (default)
if FREERTOS_UNICORE = y:
queue: prvUnlockQueue (default)
queue: prvIsQueueEmpty (default)
queue: prvIsQueueFull (default)
queue: prvInitialiseNewQueue (default)
queue: prvInitialiseMutex (default)
queue: uxQueueSpacesAvailable (default)
queue: xQueueGenericReset (default)
queue: xQueueGenericCreate (default)
queue: xQueueGetMutexHolder (default)
queue: xQueueCreateCountingSemaphore (default)
queue: xQueueGenericSend (default)
queue: xQueueCreateMutex (default)
queue: xQueueGiveMutexRecursive (default)
queue: xQueueTakeMutexRecursive (default)
queue: uxQueueMessagesWaiting (default)
queue: vQueueDelete (default)
queue: vQueueWaitForMessageRestricted (default)
queue: xQueueCreateSet (default)
queue: xQueueAddToSet (default)
queue: xQueueRemoveFromSet (default)
queue: xQueueSelectFromSet (default)
queue: xQueueGenericCreateStatic (default)
queue: xQueueCreateMutexStatic (default)
queue: xQueueCreateCountingSemaphoreStatic (default)
if FREERTOS_QUEUE_REGISTRY_SIZE > 0:
queue: pcQueueGetName (default)
queue: vQueueAddToRegistry (default)
queue: vQueueUnregisterQueue (default)
if FREERTOS_USE_TRACE_FACILITY = y:
queue: uxQueueGetQueueNumber (default)
queue: vQueueSetQueueNumber (default)
queue: ucQueueGetQueueType (default)
# port.c Functions
port: esp_startup_start_app (default)
if ESP_SYSTEM_SINGLE_CORE_MODE = n:
port: esp_startup_start_app_other_cores (default)
# port_common.c Functions
port_common:main_task (default)
port_common:esp_startup_start_app_common (default)
port_common:vApplicationGetIdleTaskMemory (default)
port_common:vApplicationGetTimerTaskMemory (default)
if FREERTOS_UNICORE = n:
port_common:other_cpu_startup_idle_hook_cb (default)