Commit Graph

1158 Commits

Author SHA1 Message Date
Konstantin Kondrashov
22b3041f1e feat(freertos): Runtime Counter support
Closes https://github.com/espressif/esp-idf/issues/13120
2024-05-28 12:07:13 +03:00
Darian Leung
89c22c63e6
refactor(freertos/idf): Add critical section requirements to function description
This commit adds a note regarding the critical section calling requires of some
internal functions.
2024-05-18 01:22:03 +08:00
Darian Leung
7c38b262fb
fix(freertos/idf): Add missing critical sections to vTaskSuspendAll()
vTaskSuspendAll() requires critical sections when building for SMP. Otherwise,
it is possible for a task to switch cores in between getting the core ID and
before incremented uxSchedulerSuspended.
2024-05-18 01:22:03 +08:00
Darian Leung
27e8db2ae9
fix(freertos): Fix vTaskList() parameter print order
xCoreID was previously printed as the last parameter priority to IDF v5.1, but
was changed to the third paramtere from v5.2 onwards. This commit restores the
correct ordering.

Closes https://github.com/espressif/esp-idf/issues/13675
2024-04-24 17:56:59 +08:00
Omar Chebib
70fc931dd2
fix(freertos): display tasks with no affinity as -1 during tracing
Closes https://github.com/espressif/esp-idf/issues/12858
2024-04-24 17:51:11 +08:00
Andy Lin
6bcf47386d fix(freertos): Fix broken portable macro portTRY_ENTER_CRITICAL_SAFE()
This commit fixes a bug where the portTRY_ENTER_CRITICAL_SAFE() for the
Xtensa and RISC-V FreeRTOS ports were broken as it did not correctly use
the timeout parameter.

Merges: https://github.com/espressif/esp-idf/pull/13022
2024-04-17 12:26:50 +02:00
Darian Leung
31883c9a64
feat(freertos): Add application task tag support
This commit enables support for application task tag.

- Added CONFIG_FREERTOS_USE_APPLICATION_TASK_TAG option
- Added basic unit test
2024-03-30 17:44:38 +08:00
Sudeep Mohanty
b32d47ab98 fix(freertos): Fixed an issue where accessing task lists could overrun memory
This commit fixes a potential issue of illegal memory access when
accessing the various task lists in FreeRTOS while fetching tasks using
the xTaskGetNext() function.
2024-03-20 08:57:02 +01:00
Sudeep Mohanty
bc310e088b fix(freertos): Updated dependency list for CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER option
This commit updates the dependency for
CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER to be dependent explicitly on
CONFIG_ESP_SYSTEM_PANIC_GDBSTUB or CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME
instead of CONFIG_ESP_GDBSTUB_ENABLED which caused FreeRTOS Task
Function Wrappers to be enabled even if the esp_gdbstub component was
part of the build.
2024-03-15 10:54:25 +01:00
Darian Leung
c15484ec58
change(freertos): Test tick and idle hooks in options test
Add CONFIG_FREERTOS_USE_TICK_HOOK and CONFIG_FREERTOS_USE_IDLE_HOOK to
sdkconfig.ci.freertos_options to ensure those options are tested.
2024-03-06 13:52:51 +08:00
Darian Leung
e4eaa28b82
fix(freertos/idf): Fix build error when CONFIG_FREERTOS_USE_TICK_HOOK is enabled
Closes https://github.com/espressif/esp-idf/issues/13297
2024-03-06 13:52:13 +08:00
Erhan Kurubas
054f33b386 feat(coredump): improve the probability of accessing healthy TCBs 2024-01-26 22:55:16 +08:00
Darian Leung
555bd367e1 change(xtensa): Deprecate ".../xtensa_context.h" include path
This commit deprecates the "freertos/xtensa_context.h" and "xtensa/xtensa_context.h"
include paths. Users should use "xtensa_context.h" instead.

- Replace legacy include paths
- Removed some unnecessary includes of "xtensa_api.h"
- Add warning to compatibility header
2023-12-05 18:04:52 +08:00
Darian Leung
c2e134b775 change(xtensa): Deprecate ".../xtensa_api.h" include path
This commit deprecates the "freertos/xtensa_api.h" and "xtensa/xtensa_api.h"
include paths. Users should use "xtensa_api.h" instead.

- Replace legacy include paths
- Removed some unnecessary includes of "xtensa_api.h"
- Replaced some calls with "esp_cpu_..." equivalents
- Add warning to compatibility header
2023-12-05 18:04:52 +08:00
Darian Leung
913550f62c fix(freertos/idf): Fix invalid xCoreID arguments in single-core
IDF FreeRTOS v10.5.1 no longer accepts out of range xCoreID arguments in
"PinnedToCore" task creation functions when building for single-core. This
commit fixes those violations through ESP-IDF.
2023-12-04 15:03:58 +08:00
Darian Leung
ee0ee4887f change(freertos/idf): Remove xCoreID TCB member for single-core
This commit does the following:

- removes the xCoreID member from the TCB when building for single-core
- xCoreID is no longer hard set to 0 when calling "PinnedToCore" task creation
functions in single-core
- Tidy up or add missing xCoreID asserts for functions that take xCoreID as an
argument:
    - Functions that set/query a variable of a particular core will call
      taskVALID_CORE_ID() to ensure ) 0 <= xCoreID < configNUMBER_OF_CORES
    - Task creation functions that accept xCoreID also call taskVALID_CORE_ID()
      but also allow tskNO_AFFINITY.
- Fix TaskStatus_t
    - Remove xCoreID from TaskStatus_t if configTASKLIST_INCLUDE_COREID is not
      defined.
    - Set xCoreID to 0 when calling vTaskGetInfo() in single-core builds
2023-12-04 15:03:55 +08:00
Darian Leung
63fee6c23a refactor(freertos/idf): Refactor yield and affinity macros
This commit refactors the following macros so that calling them no longer
requires referencing pxTCB->xCoreID.

- taskIS_YIELD_REQUIRED()
- taskIS_YIELD_REQUIRED_USING_PRIORITY()
- taskIS_AFFINITY_COMPATIBLE()
2023-12-04 14:59:37 +08:00
Marius Vikhammer
3d591c57c0 Merge branch 'feature/add_run_time_counter_type_option_v5.2' into 'release/v5.2'
feat(freertos/idf): Add configRUN_TIME_COUNTER_TYPE option (v5.2)

See merge request espressif/esp-idf!26848
2023-11-17 11:25:37 +08:00
Jiang Jiang Jian
f8ee9b334c Merge branch 'bugfix/freertos_define_list_volatile_v5.2' into 'release/v5.2'
fix(freertos/idf): Define configLIST_VOLATILE for list elements (v5.2)

See merge request espressif/esp-idf!27096
2023-11-17 10:28:44 +08:00
Marius Vikhammer
681439b85a Merge branch 'change/freertos_local_crit_section_macro_v5.2' into 'release/v5.2'
change(freertos/idf): Refactor thread safety convenience macros (v5.2)

See merge request espressif/esp-idf!26997
2023-11-16 11:23:25 +08:00
Darian Leung
d0aa950fa6 feat(freertos/idf): Add configRUN_TIME_COUNTER_TYPE option
This commit adds a Kconfig option for configRUN_TIME_COUNTER_TYPE

Closes https://github.com/espressif/esp-idf/issues/11973
2023-11-16 10:16:00 +08:00
Darian Leung
7391b59f54 feat(freertos/idf): Add taskVALID_CORE_ID() macro
This commit adds a taskVALID_CORE_ID() macro, similar to the one offered in
Amazon SMP FreeRTOS.

- Various functions have been updated to use that macro
- Removed some unecessary static asserts of CONFIG_FREERTOS_NO_AFFINITY and
added casting.
- Uncrustify changes
2023-11-15 22:05:54 +08:00
Sudeep Mohanty
2c0cea641a fix(freertos/idf): Define configLIST_VOLATILE for list elements
It was noticed that when high level compiler optimizations are enabled,
the compiler optimizes some list manupulation code. This commit enables
the configLIST_VOLATILE for list elements to prevent the compiler from
optimizing out essential kernel code.
2023-11-15 10:04:33 +00:00
Marius Vikhammer
4d0d0f5d10 Merge branch 'revert/freertos_same_priority_preemption_disabled_v5.2' into 'release/v5.2'
Revert "fix(freertos/idf): Add workaround for same priority preemption in xTaskIncrementTick()" (v5.2)

See merge request espressif/esp-idf!26926
2023-11-14 15:35:05 +08:00
Marius Vikhammer
5e65545320 Merge branch 'feature/frertos_idle_task_name_suffix_v5.2' into 'release/v5.2'
fix(freertos/idf): Updated IDLE task names for each core to have the coreID as a suffix (v5.2)

See merge request espressif/esp-idf!26892
2023-11-14 15:33:54 +08:00
Darian Leung
a442a6b65c refactor(freertos/idf): Update thread safety convenience macros
This commit refactors some of the thread safety convenience macros by removing
some repeated definitions and keeping them all in "freertos_idf_additions_priv.h"
2023-11-08 14:53:28 +08:00
Darian Leung
1d9a155fd7 fix(freertos/idf): Fix xEventGroupGetBitsFromISR() critical section
Adds missing critical section to xEventGroupGetBitsFromISR() that is required
in dual-core SMP.
2023-11-08 14:53:28 +08:00
Jakob Hasse
8c7ee8482e fix(freertos): Fixed prvTaskCreateDynamicPinnedToCoreWithCaps
* The function was based on an outdated IDF/FreeRTOS
  combination which didn't always require zero-ing
  the TCB. This has been changed in the current
  IDF/FreeRTOS combination, leading to crashes.
  Unconditionally zero-ing the TCB fixes this problem.
2023-11-06 15:33:40 +08:00
Sudeep Mohanty
29cfa2d472 Revert "fix(freertos/idf): Add workaround for same priority preemption in xTaskIncrementTick()"
This reverts commit 6c6a6ad44a.
2023-11-03 15:00:24 +01:00
Sudeep Mohanty
33e0f11ef4 fix(freertos/idf): Updated IDLE task names for each core to have the coreID as a suffix
This commit updates the IDLE task names for each core by concatenating
the respective coreIDs to the task names.

Closes https://github.com/espressif/esp-idf/issues/12204
2023-11-02 16:38:16 +01:00
Jakob Hasse
228c40c2ac Merge branch 'feature/freertos_task_private_create_psram' into 'master'
feat(freertos): Added private task creation functions allocating stack in PSRAM

See merge request espressif/esp-idf!25404
2023-10-26 10:27:00 +08:00
Omar Chebib
a8b1475fe7 feat(riscv): implement coprocessors save area and FPU support
This commit mainly targets the ESP32-P4. It adds supports for coprocessors on
RISC-V based targets. The coprocessor save area, describing the used coprocessors
is stored at the end of the stack of each task (highest address) whereas each
coprocessor save area is allocated at the beginning of the task (lowest address).
The context of each coprocessor is saved lazily, by the task that want to use it.
2023-10-23 11:10:28 +08:00
Darian Leung
94b46599c3 change(freertos/idf): Update FreeRTOS documentation build
This commit does the following:

- Update doxygen comments in FreeRTOS headers to remove unsupported doxygen
labels and internal functions
- Fixed existing doxygen warnings in FreeRTOS headers
2023-10-21 04:39:17 +08:00
Darian Leung
fdfdfc6d9e change(freertos/idf): Temporarily disable "Test suspend-resume CPU works with xTimer'"
The test is flakey with the v10.5.1 kernel.
2023-10-21 04:39:16 +08:00
Darian Leung
0d846ffe26 fix(freertos/idf): Add missing vPortSetStackWatchpoint() call
This commit restores a missing call to vPortSetStackWatchpoint() in the
V10.5.1 kernel.
2023-10-21 04:39:16 +08:00
Darian Leung
6c6a6ad44a fix(freertos/idf): Add workaround for same priority preemption in xTaskIncrementTick()
This commit temporarily disables a bugfixed introduced by FreeRTOS v10.5.1 that
ensures timed out tasks will only preempt if their priority is higher than the
currently running task.

This bugfix has been temporarily reversed due to some compatibility issues with
some IDF tests.
2023-10-21 04:39:16 +08:00
Darian Leung
4d14717e77 fix(freertos/idf): Add work around vTaskResumeAll() compiler optimization
This commit adds a workaround for a compiler optimization issue in FreeRTOS
v10.5.1 in xTaskResumeAll() where pxTCB is only read once, even if in a loop.

A follow up ticket has been added to properly resolve this issue.
2023-10-21 04:39:16 +08:00
Darian Leung
0c15815c2b fix(freertos/idf): vTaskStepTick assertions in SMP
Fixes vTaskStepTick() assertions in SMP, where SMP uses critical sections
instead of scheduler suspension when handling tickless idling.
2023-10-21 04:39:16 +08:00
Darian Leung
ec1ba78b7c fix(freertos/idf): Fix utility function performance
This commit optimizes the following utility functions to achieve higher
overall system performance:

xTaskGetCurrentTaskHandle():
- Made into stand alone function instead of wrapper call to "ForCore" variant
- Replaced critical sections with disabling interrupts. Lack of lock contention
improves performance.

xTaskGetCurrentTaskHandleForCore():
- Removed unecessary critical sections

xTaskGetSchedulerState():
- Replaced critical sections with disabling interrupts. Lack of lock contention
improves performance.
2023-10-21 04:39:16 +08:00
Darian Leung
b13b9c1163 fix(freertos/idf/linux): Fix configMAX_PRIORITIES for linux port
Previously the linux port of FreeRTOS set configMAX_PRIORITIES to 7. However,
multiple linux POSIX simulator examples will call API that create tasks with
priortiies >= 7.

This commit fixes the configMAX_PRIORITIES and unifies all ports to have 25
priorities.
2023-10-21 04:39:16 +08:00
Darian Leung
5c0449a63a change(freertos/idf): Update single-core macros to prevent unused variable error
Various convenience macros in tasks.c will simply leave macro arguments unused
when built for single-core. This leads to an 'unused variable' warning.

This commit updates those macrso so that the unused arguments have a
'(void)' statement.
2023-10-21 04:39:16 +08:00
Darian Leung
82ad04e3ba change(freertos/idf): Update version number, licenses, and sbom to v10.5.1
Following the upgrade to FreeRTOS kernel v10.5.1, this commit updates the
version numbers, licenses, and SBOM files of FreeRTOS files to reflect v10.5.1.

Note:

- Updated licenses as v10.5.1 now uses SPDX format
- Removed CVE-2021-43997 as it was fixed post v10.4.5
2023-10-21 04:39:16 +08:00
Darian Leung
16ccb31d33 change(freertos/idf): Make v10.5.1 the default kernel
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.
2023-10-21 04:39:16 +08:00
Darian Leung
2025a77dd6 change(freertos/idf): Move v10.5.1 kernel files
This commit moves the v10.5.1 kernel files to the 'FreeRTOS-Kernel' directory.
2023-10-21 04:39:16 +08:00
Darian Leung
fe5a577198 change(freertos/idf): Remove v10.4.3 kernel files
This commit removes the v10.4.3 kernel files in prepartion for upgrading to
v10.5.1.

- Portable files still remain
- Added as a separate commit to preserve commit history
2023-10-21 04:39:16 +08:00
Jakob Hasse
8aba6a53e4 feat(freertos): Added private PSRAM stack task creation functions
* Added prvTaskCreateDynamicAffinitySetWithCaps
  and prvTaskCreateDynamicPinnedToCoreWithCaps
  which allocate the task's stack in PSRAM instead of
  internal RAM. These functions are only available if
  PSRAM is enabled.
2023-10-18 20:06:42 +08:00
Sudeep Mohanty
225ecfb6e2 Merge branch 'bugfix/interrupt_context_for_p4' into 'master'
fix(freertos): Fixed xPortCanYield to correctly determine ISR context on esp32p4

See merge request espressif/esp-idf!26161
2023-10-17 17:16:57 +08:00
Sudeep Mohanty
cf55ab899a fix(freertos): Fixed xPortCanYield to correctly determine ISR context on esp32p4
This commit fixes an issue where xPortCanYield() function may not be
able to detect an ISR context when HW interrupt nesting is active on
a CLIC interrupt controller such as on esp32p4.
2023-10-09 09:12:15 +02:00
Darian Leung
65d3931fab change(freertos/debug): Add API to get current TCB
This commit adds `pvTaskGetCurrentTCBForCore()` to get a void pointer to the
current TCB of a particular core. This removes the need to `extern `pxCurrentTCB`
in esp_gdbstub.
2023-10-07 18:55:47 +08:00
Darian Leung
2b357071f1 refactor(freertos/task_snapshot): Deprecate task_snapshot.h
This commit deprecates the `#include "freertos/task_snapshot.h" include path:

- Adds compatibility header with compile time warning
- Removes hints related to `task_snapshot.h`
- Adds entry to migration guide
2023-10-07 18:55:47 +08:00