Commit Graph

1144 Commits

Author SHA1 Message Date
Darian
fb8ff0e9fe Merge branch 'feature/freertos_add_valid_core_id_macro' into 'master'
feat(freertos/idf): Add taskVALID_CORE_ID() macro

See merge request espressif/esp-idf!27014
2023-11-15 20:51:55 +08:00
Darian Leung
c12da6b77d 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 11:53:26 +08:00
Sudeep Mohanty
bf237a2bd4 Merge branch 'feature/freertos_expose_list_integrity_check_option' into 'master'
feat(freertos): Exposed Kconfig option for configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES

Closes IDF-8366

See merge request espressif/esp-idf!26960
2023-11-14 21:27:19 +08:00
Sudeep Mohanty
ff6b0ed148 Merge branch 'task/freertos_deprecate_xtaskgetaffinity' into 'master'
change(freertos/idf): Deprecate some FreeRTOS IDF addition functions

Closes IDF-8164 and IDF-8163

See merge request espressif/esp-idf!26875
2023-11-13 20:23:49 +08:00
Sudeep Mohanty
289913daaf 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-10 09:23:51 +01:00
Sudeep Mohanty
d507a86285 feat(freertos): Exposed Kconfig option for configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES
This commit exposes the FreeRTOS List integrity check option
configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES via menuconfig.
2023-11-09 14:54:13 +01:00
Darian
c4eea80c07 Merge branch 'change/freertos_local_crit_section_macro' into 'master'
change(freertos/idf): Refactor thread safety convenience macros

Closes IDF-8161

See merge request espressif/esp-idf!26805
2023-11-08 10:29:22 +08:00
Sudeep Mohanty
ebeea3df60 Merge branch 'revert/freertos_same_priority_preemption_disabled' into 'master'
Revert "fix(freertos/idf): Add workaround for same priority preemption in xTaskIncrementTick()"

Closes IDF-8428

See merge request espressif/esp-idf!26732
2023-11-03 21:59:17 +08:00
Sudeep Mohanty
d38f100223 change(freertos/idf): Deprecate some FreeRTOS IDF addition functions
This commit deprecates xTaskGetAffinity(), xTaskGetCurrentTaskHandleForCPU()
and xTaskGetIdleTaskHandleForCPU() APIs for IDF-FreeRTOS kernel.
Instead, users are directed to use alternatives. All other
components in IDF using these functions have been updated accordingly.
2023-11-03 14:54:06 +01:00
Darian Leung
52a929521d 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-03 15:41:46 +08:00
Darian Leung
e2c8185f72 fix(freertos/idf): Fix xEventGroupGetBitsFromISR() critical section
Adds missing critical section to xEventGroupGetBitsFromISR() that is required
in dual-core SMP.
2023-11-03 15:41:39 +08:00
Sudeep Mohanty
0a0c7ef40f 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-01 12:32:06 +00:00
Sudeep Mohanty
3fb23c85b6 Revert "fix(freertos/idf): Add workaround for same priority preemption in xTaskIncrementTick()"
This reverts commit 6c6a6ad44a.
2023-11-01 12:31:37 +00:00
Darian
7baebd4ae3 Merge branch 'feature/add_run_time_counter_type_option' into 'master'
feat(freertos/idf): Add configRUN_TIME_COUNTER_TYPE option

Closes IDFGH-10757

See merge request espressif/esp-idf!26704
2023-11-01 17:07:11 +08:00
Darian Leung
b301f175c9 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-10-31 14:55:12 +08:00
Jakob Hasse
bd34fc41bb 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-10-30 18:09:17 +08: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
Darian Leung
9968a48c36 refactor(freertos/task_snapshot): Make task snapshot private
Task snapshot API were never intended to be called from user code. This commit
makes task snapshot a private API thus moves `#include "freertos/task_snapshot.h"`
to `#include "esp_private/freertos_debug.h"`.

Task snapshot related Kconfig options have also been hidden.

Note: Added 'freertos_common' mapping to ldgen mapping execptions lists due to
inlining of 'freertos_debug.h' functions.
2023-10-07 13:14:55 +08:00
KonstantinKondrashov
28b8a5d9b4 fix(esp_system): Fix mixing logs, remove early info logs for 2nd CPU
Fixes mixing logs when two cores use esp_rom_printf
2023-10-02 12:50:40 +00:00
Sudeep Mohanty
b8444c2234 Merge branch 'bugfix/fix_freertos_system_task_names' into 'master'
fix(freertos): Updated IDLE task names for each core to have the coreID as a suffix

Closes IDFGH-11021

See merge request espressif/esp-idf!25899
2023-09-21 18:33:24 +08:00
Zim Kalinowski
d9a9a4a17f Merge branch 'fix/test_app_trim_builds' into 'master'
fix(test_apps): Trim builds of component test apps

See merge request espressif/esp-idf!25789
2023-09-20 18:32:57 +08:00
Sudeep Mohanty
a76a1465b6 fix(freertos): 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 names.

Closes https://github.com/espressif/esp-idf/issues/12204
2023-09-20 10:31:08 +02:00
Darian Leung
b09462eae8 feat(freertos): Add beta support for FreeRTOS v10.5.1 kernel
This commit adds beta support for the FreeRTOS v10.5.1 kernel which can be
enabled by enabling the CONFIG_FREERTOS_USE_KERNEL_10_5_1 option.

The following changes have been made:

- Updated freertos/CMakeLists.txt to build v10.5.1 kernel with v10.4.3. ports
- Updated existing Xtensa and RISC-V ports to work with V10.5.1
- Modifications to other ESP-IDF components to work with v10.5.1
- Added some ESP-IDF specific tracing changes to v10.5.1 kernel
- Make CONFIG_FREERTOS_USE_KERNEL_10_5_1 a public option

Note: The beta release is missing some minor fixes, performance improvements,
and features. Using this beta release for production is not recommended.

Closes https://github.com/espressif/esp-idf/issues/7137
2023-09-18 21:32:14 +08:00
Darian Leung
49af70506a feat(freertos): Add SMP critical section changes to FreeRTOS v10.5.1
This commit adds the SMP critical section changes to the v10.5.1 kernel. These
changes are temporarily documented in the `idf_changes.md` document. This
commit...

- Adds granular spinlocks to each data group (e.g., kernel, queues, event_groups etc.)
- Updates critical section macros to use those spinlocks
- Add missing critical sections required in SMP
2023-09-18 18:32:55 +08:00
Darian Leung
db64e51e53 feat(freertos): Add SMP kernel changes to FreeRTOS v10.5.1
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.
2023-09-18 18:32:54 +08:00
Darian Leung
287bdc5e61 fix(test_apps): Trim builds of component test apps
Some component test apps do not use the "set(COMPONENTS main)" command in their
project level "CMakeLists.txt", thus leading to their builds pulling in all
ESP-IDF components.

This commit trims the build of multiple component test apps:

- Add "set(COMPONENTS main ...)" to project level "CMakeLists.txt"
- Add missing "PRIV_REQUIRES" in some "main" component "CMakeLists.txt"

Also removed repeated configuraiton options in legacy_i2c_driver/sdkconfig.ci.defaults
as they are already specified in legacy_i2c_driver/sdkconfig.defaults
2023-09-18 17:16:37 +08:00
Konstantin Kondrashov
cbdb799b6f feat(esp_timer): Support systimer for ESP32P4 2023-09-13 19:13:38 +08:00
Sudeep Mohanty
165955dec4 Merge branch 'feature/freertos_Kconfig_option_for_timer_task_name' into 'master'
feat(freertos): Added a Kconfig option for FreeRTOS Timer Service task name

See merge request espressif/esp-idf!25900
2023-09-12 16:41:48 +08:00
Konstantin Kondrashov
2557513fb5 Merge branch 'bugfix/esp32p4_usage_clic_int_thresh_reg' into 'master'
fix(freertos): Use INTERRUPT_CURRENT_CORE_INT_THRESH_REG for esp32p4

See merge request espressif/esp-idf!25840
2023-09-08 22:43:22 +08:00
Sudeep Mohanty
371ad531ee feat(freertos): Added a Kconfig option for FreeRTOS Timer Service task name
This commit adds a Kconfig option for setting a custom name for the
FreeRTOS Timer Service task.
2023-09-08 16:39:15 +02:00
Sudeep Mohanty
51846b497b Merge branch 'feature/freertos_add_sbom_file' into 'master'
feat(freertos): Added SBOM manifest file for SPDX file generation

Closes IDF-7979

See merge request espressif/esp-idf!25758
2023-09-08 18:21:46 +08:00