This commit makes v10.5.1 the default FreeRTOS kernel in ESP-IDF by removing
the CONFIG_FREERTOS_USE_KERNEL_10_5_1 option and v10.4.3 specific code
blocks.
This commit adds the key kernel changes to the v10.5.1 kernel to support
dual-core SMP. These changes are temporarily documented in the `idf_changes.md`
document. This commit...
- Added changes to kernel data structures to support multiple cores
- Changes to scheduling algorithm support SMP scheduling.
- Changes to each FreeRTOS function to support multiple cores and SMP
scheduling algorithm.
This commit moves/merges the IDF FreeRTOS "PinnedToCore" task creation
functions from tasks.c/task.h to idf_additions.h/freertos_task_c_additions.h.
Also updated FreeRTOS Mock component to provide mocks for "idf_additions.h"
headers for our mock tests.
This function moves ulTaskNotifyTake()/xTaskNotifyWait() from IDF FreeRTOS
`tasks.c` to `freertos_compatibility.c`. These functions were kept for
pre-compiled library compatibilty. Move them reduces the kernel source code
difference when compared to upstream FreeRTOS.
This commit combines various task utility API additions in IDF FreeRTOS and with
their Amazon SMP FreeRTOS addition counterparts. The folloiwng functions have
been moved to freertos_tasks_c_additions.h and idf_additions.h as these API
are considered public:
- xTaskGetCurrentTaskHandleForCPU()
- xTaskGetIdleTaskHandleForCPU()
- xTaskGetAffinity()
- pxTaskGetStackStart()
Also fixed in missing #if macros when vTaskCoreAffinityGet() is called in
Amazon SMP FreerTOS tests.
- The following IDF API additions are moved to freertos_tasks_c_additions.h
(implementation) and freertos_idf_additions_priv.h (declaration) as APIs are
private. This reduces the source code difference from upstream.
- prvENTER_CRITICAL_OR_SUSPEND_ALL()
- prvEXIT_CRITICAL_OR_RESUME_ALL()
- prvENTER_CRITICAL_OR_MASK_ISR()
- prvEXIT_CRITICAL_OR_UNMASK_ISR()
- vTaskTakeKernelLock()
- vTaskReleaseKernelLock()
- Rename vTask[Take/Release]KernelLock() to prv[Take/Release]KernelLock() to
indicate that the this API is private.
Previously, TLSP deletion callbacks were...
- Stored in a seprate TCB member "pvThreadLocalStoragePointersDelCallback"
- Called separately via multipole prvDeleteTLS() insertions in tasks.c
This commit refactors how TLSP deletion callbacks are stored and called:
- TLSP deletion callbacks are now stored in "pvThreadLocalStoragePointers"
directly. configNUM_THREAD_LOCAL_STORAGE_POINTERS is doubled in size so that
the deletion callbacks are stored in the latter half of the array
- The callbacks are now called via "portCLEAN_UP_TCB()". As such, the
prvDeleteTLS() additions are no longer needed and the function can be removed
- Removed some legacy TLSP tests using the old method of storing the callback
pointers.
This commit reduces the source code diff between IDF FreeRTOS and upstream
vanilla FreeRTOS, in preparation for v10.5.1 upgrade.
portCLEAN_UP_COPROC() was an IDF specific addition to FreeRTOS, where the
macro was called from prvDeleteTCB() to clean up the coprocessor context of a
deleted task.
This commit removes portCLEAN_UP_COPROC(). The coprocessor cleanup routine
(i.e., vPortCleanUpCoprocArea()) is now called via portCLEAN_UP_TCB()->
vPortTCBPreDeleteHook().
This removes a minor code difference between IDF FreeRTOS and upstream.
This commit updates the linker fragment file for IDF FreeRTOS.
- Linker fragment file's formatting was updated
- Placement rules of functions is now clearly specified inside the linker
fragment file.
- Some extra functions are now placed in flash in accordance to the new
placement rules.
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.
This commit removes the dependency on portUSING_MPU_WRAPPERS on the Xtensa port
of IDF FreeRTOS. This dependency was added due to a hack implemented in the
upstream port that required the usage of the "xMPUSettings" member of the TCB.
The "xMPUSettings" would be used as a pointer to the task's coprocessor save
area on the stack, even though FreeRTOS MPU support was not available.
The hack has now been removed, and the CPSA pointer is now calculated using
a combination of constant offsets values and the pxEndOfStack member of the
TCB.
Note: This impelemtation was copied from the Xtensa port of Amazon SMP FreeRTOS.
This commit refactors the OS startup functions as follows:
- Moved the OS/app startup functions listed below to "app_startup.c". Their
implementations are now common to all ports (RISC-V and Xtensa) of all
FreeRTOS implementations (IDF and Amazon SMP).
- esp_startup_start_app()
- esp_startup_start_app_other_cores()
- Removed esp_startup_start_app_common() as app startup functions are now
already common to all ports.
- Added extra logs to "main_task" to help with user debugging
Note: Increased startup delay on "unity_task". The "unity_run_menu()" is non
blocking, thus if the main task or other startup tasks have not been freed
by the time "unity_run_menu()" is run, those tasks will be freed the next time
"unity_task" blocks. This could cause some tests to have a memory leak, thus
the "unity_task" startup delay has increased.
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).
This commit places some functions in port.c and port_common.c into flash by
default. These functions are mostly called once during startup, thus shouldn't
affect applications much when placed into flash instead of the default IRAM.
For RISC-V and Xtensa targets, in case a panic needs to happen when
Task WDT is triggered (ESP_TASK_WDT_PANIC), the interruptee's stack
is now used for printing the backtrace.
Abort after Task Watchdog is triggered can happen on APP CPU (second core).
The CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH allows some FreeRTOS functions to be placed
into flash, thus saving some IRAM. However, this feature was previously not supported for
SMP FreeRTOS.
This commit adds CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH support for SMP FreeRTOS. There
are now separate linker fragment files for IDF FreeRTOS and SMP FreeRTOS, named "linker.lf"
and "linker_smp.lf" respectively.
This commit updates the copied Xtensa port to support the new porting interfaces
of the FreeRTOS SMP kernel. These modifications are mainly contained in
- FreeRTOSConfig.h
- FreeRTOSConfig_smp.h
- portmacro.h
- port.c
Some porting interfaces have changed in FreeRTOS SMP. In order to allow building
with IDF, compatibility interfaces have been added.
1. Add conditions based on Kconfig options for functions which are
compiled based on those options.
2. Static allocation is always enabled, move corresponding functions
into the common list.
correct generation.py script to be silent when file: function is not in the object list (just ignore placement)
correct linker.lf to place task functions into flash if CONFIG_FREERTOS_TASK_FUNCTIONS_INTO_FLASH is active otherwise into IRAM
update kconfig option to place functions into IRAM
update linker file after tests
fix spi_device_polling_end crash when xTaskGetTickCount() in flash
disable "yield from lower priority task, other CPU" test case when placing rtos functions into flash
upadate ut app config freertos_flash
combine spi_flash driver and freertos ut configs into one file
remove TEST_EXCLUDE_COMPONENTS
ci: fix ut job
remove functions that are called from ISR funcs
add port module functions to place into Flash
place snapshot funcs into Flash when ESP_PANIC_HANDLER_IRAM is not set
ci: add job with tags UT_T1_GPIO,ESP32_IDF
`xQueueGenericCreateStatic` is placed into flash by the linker script to
reduce IRAM usage. This will also cause the `xRingbufferCreate` not
not callable when cache is disabled.