Commit Graph

1018 Commits

Author SHA1 Message Date
Darian Leung
ad5044c5f6 freertos: Add task creation with caps functions
This commit adds the corresponding CreateWithCaps functions for tasks:

- xTaskCreatePinnedToCoreWithCaps()
- xTaskCreateWithCaps()
- vTaskDeleteWithCaps()

Documentation and migraiton guide have been updated accordingly.

Closes https://github.com/espressif/esp-idf/issues/11216
2023-05-10 17:55:49 +08:00
Marius Vikhammer
4a35536244 Merge branch 'feature/freertos_get_static_buffers_v5.1' into 'release/v5.1'
FreeRTOS: Add GetStaticBuffer and CreateWithCaps functions (v5.1)

See merge request espressif/esp-idf!23381
2023-05-10 17:53:26 +08:00
Sudeep Mohanty
ee18b19b8f freertos-idf: Fixed incorrect scheduler suspension check in xTaskRemoveFromEventList()
This commit fixes a bug in xTaskRemoveFromEvenetList() where in the
check for scheduler suspension did not account for nested suspensions.
Additionally, this commit updates all checks for scheduler
suspension to follow a uniform way.
2023-05-09 12:25:09 +02:00
laokaiyao
87328d594f esp32h4: checked all the corner stuffs of the removal 2023-04-26 18:53:12 +08:00
laokaiyao
954a6a2cff esp32h4: removed esp32h4 related codes 2023-04-26 18:53:12 +08:00
Darian Leung
46fe70fb46 freertos: Add unit tests for ...WithCaps() functions 2023-04-24 11:44:46 +08:00
Darian Leung
c5fe3ec05d freertos: Add wrapper functions to create objects with capabilities
This commit adds various ...WithCaps() functions to create FreeRTOS objects
with specific memory capabilities.
2023-04-24 11:44:46 +08:00
Darian Leung
3562cb8051 freertos: Add GetStaticBuffer functions
This commit adds the various ...GetStaticBuffer() functions from upstream
FreeRTOS. See https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/641 for more
details.
2023-04-24 11:44:46 +08:00
Darian Leung
7b41d6004a freertos: Fix idf_additions.h include order error
When building for CONFIG_FREERTOS_SMP, "idf_additions.h" was previously
implicitly included by "task.h" so that other ESP-IDF components still have
access to IDF API additions without needing to include "idf_additions.h"
directly.

However, some FreeRTOS headers (e.g., queue.h) will include task.h before
declaring any types (e.g., QueueHandle_t). Thus if any of those types are used
in idf_additions.h, we get a missing type error.

This commit moves the implicity include of idf_additions.h to FreeRTOS.h
2023-04-24 11:44:46 +08:00
Darian Leung
b042ed0495 freertos: Uncrustify idf_additions.h 2023-04-07 15:24:34 +08:00
Darian Leung
3d2e674326 freertos: Move private API additions to "freertos_idf_additions_priv.h"
Previously, some IDF FreeRTOS API additions that were meant to be private were
exposed through the same "idf_additions.h" header. This commit moves those
functions to a separate header included via
"esp_private/freertos_idf_additions_priv.h" so that they are not mistaken as
public API by users.

This commit also fixes some missing include and C++ guards in idf_additions.h
2023-04-07 15:24:34 +08:00
Darian Leung
0c21d59716 freertos: Move freertos_tasks_c_additions.h
freertos_tasks_c_additions.h is technically included as source file. This
commit removes the "private_include" directory of "freertos_tasks_c_additions.h"
and treats it as a source file of "esp_additions".
2023-04-07 15:24:34 +08:00
Sudeep Mohanty
7f6e9cf786 freertos-tests: Fixed failing CI test and added a new test case for vTaskSuspendAll() API
This commit fixes the failing test - Test vTaskSuspendAll allows
scheduling on other cores.
The commit also adds a new test to test the scenario where in an
unpinned task, when unblocked by an ISR can be scheduled on the core
which has the scheduler running.
2023-04-06 08:26:38 +02:00
Marius Vikhammer
bf8934002b freertos: re-enable "mutex released not by owner causes an assert" test in CI 2023-03-24 10:19:51 +08:00
Darian Leung
54deed0566 freertos: Uncrustify FreeRTOSConfig files 2023-03-22 16:32:29 +08:00
Darian Leung
6895e92fd2 freertos: Combine Amazon SMP FreeRTOS and IDF FreeRTOS config files
This commit merges the "FreeRTOSConfig_smp.h" file into the "FreeRTOSConfig.h".
The configurations for all FreeRTOS implementations are now stored in a single
file.
2023-03-22 16:32:29 +08:00
Darian Leung
63f318b85b freertos: Refactor FreeRTOSConfig_arch.h
This commit removes or adds some misplaced configs from the
FreeRTOSConfig_arch.h headers of each architecture.
2023-03-22 16:32:29 +08:00
Darian Leung
05bda6595d freertos: Move FreeRTOSConfig_arch.h
This commit moves the FreeRTOSConfig_arc.h to the "esp_additions" directory
so that they can also be used for SMP FreeRTOS builds.
2023-03-22 16:32:29 +08:00
Darian
bd87e61e6f Merge branch 'refactor/freertos_remove_xTaskRemoveFromUnorderedEventList_define' into 'master'
FreeRTOS: Remove xTaskRemoveFromUnorderedEventList compatibility define

See merge request espressif/esp-idf!22813
2023-03-20 19:01:27 +08:00
Darian Leung
4f8c6c6277 freertos: Remove xTaskRemoveFromUnorderedEventList compatibility define
xTaskRemoveFromUnorderedEventList is a scheduler internal function, thus will
never be called by users. Therefore, the compatbility define is not necessary.
2023-03-17 20:15:13 +08:00
Jiang Jiang Jian
3f3a2cf560 Merge branch 'bugfix/fix_systimer_stall_issue_in_lightsleep' into 'master'
rtc_sleep: workaround systimer stall issue during sleep on ESP32C3

See merge request espressif/esp-idf!22739
2023-03-17 14:16:36 +08:00
liuning
14ca81f03f rtc_sleep: workaround systimer stall issue during lightsleep on ESP32C3 2023-03-15 20:33:03 +08:00
Sudeep Mohanty
9b81e2b189 freertos: Schedule tasks unblocked by an ISR on a core with scheduler running if core affinity matches
FromISR APIs would put an unblocked task on the pending ready list if
the scheduler is suspended on the current core, irrespective of the
task's core affinity and the state of the scheduler on the other core.
This commit updates this behavior by allowing tasks to get scheduled on
a core which has the scheduler running as long as the task's core
affinity allows it.
2023-03-15 07:43:33 +00:00
Darian Leung
e5559d7903 freertos: Fix flakey task snapshot tests
The task snapshot tests use esp_cpu_stall() to stall the other CPU before
manually walking the task lists. However, it is possible that the other CPU
was also accessing the task lists when esp_cpu_stall() is called, leading to
flakey tests

This commit fixes the test by using a 2-way handshake instead of
esp_cpu_stall().
2023-03-14 16:51:25 +08:00
morris
f8d68efcbf Merge branch 'bugfix/atomic_gptimer_fsm' into 'master'
gptimer: fix race condition between start and stop

See merge request espressif/esp-idf!22620
2023-03-11 09:40:17 +08:00
Darian
a8948eb130 Merge branch 'refactor/xtensa_default_vectors' into 'master'
Xtensa: Move default vectors back into xtensa_vectors.S

Closes IDF-7022

See merge request espressif/esp-idf!20512
2023-03-11 01:00:48 +08:00
morris
2d52334e5d gptimer: fix race condition between start and stop
Added state transition in gptimer_start/stop functions.
So that it's not possible to make a stopped timer continue to run
because of race condition.
2023-03-10 23:27:29 +08:00
Darian Leung
29ec3fbacf xtensa: Move default vectors back into xtensa_vectors.S
The default implementation of some xtensa vectors were previously moved to
"xtensa_vector_defaults.S" as weak functions so that they could be overriden.

This commit moves these default vectors back into "xtensa_vectors.S" in
preparation for further refactoring of the xtensa component.
2023-03-10 13:59:01 +08:00
Zim Kalinowski
44df8624ed Merge branch 'bugfix/freertos-fix-ignored-warnings' into 'master'
freertos: fix and re-enable no-format warnings

Closes IDF-6798

See merge request espressif/esp-idf!22638
2023-03-10 13:58:45 +08:00
Darian
77ca79a5e9 Merge branch 'refactor/freertos_check_scheduler_suspend_asserts' into 'master'
FreeRTOS(IDF): Refactor configASSERTs for scheduler suspension

Closes IDF-5889

See merge request espressif/esp-idf!22576
2023-03-09 20:19:57 +08:00
Zim Kalinowski
70ba19b806 freertos: fix and re-enable no-format warnings 2023-03-09 12:43:11 +01:00
Darian Leung
353b25410a freertos: Refactor configASSERTs for scheduler suspension
This commit adds a common macro for the differing configASSERT() calls that
check if the scheduler is suspended outside a critical section. This macro
allows vanilla behavior to be restored for single core builds. Also added
comments explaining why xTaskGetSchedulerState() is called instead when
building for SMP.
2023-03-07 18:12:15 +08:00
Darian Leung
e21ab0332b freertos(IDF): Refactor port heap functions
Vanilla FreeRTOS expects applications to use one of the heap implementations
provided by FreeRTOS (i.e., heap_x.c), where functions such as pvPortMalloc()
and vPortFree() are defined in the heap implementation.

However, ESP-IDF already provides its own heap implementation
(i.e., esp_heap_caps.h). Thus, the pvPortMallc()/vPortFree() functions were
previously overriden by macro to call esp_heap functions directly.

This commit refactors the FreeRTOS port's heap as such:

- Added a heap_idf.c that implements all of the heap related functions required
  by FreeRTOS source
- All dynamic memory allocated by FreeRTOS is from internal memory. Thus, the
  FreeRTOS heap is the internal memory subset of the ESP-IDF heap.
- Removed some old macros to reduce diff from upstream source code.
2023-03-06 16:00:29 +08:00
Darian Leung
c97523ae0a freertos: Fix stream buffer send-receive test
The stream buffer send-receive test preivously contained the following bugs:

- "sender" task would send 101 bytes instead of 100
- The main task would return before "sender" task sends its 101st item. Thus
  the sender task would cause memory corruption when accessing "tc" structure
  allocated on the main task's stack

This commit fixes and simplifies the stream buffer test.
2023-02-23 12:52:28 +08:00
Alexey Lapshin
25cb9b3f0e Merge branch 'fix/freertos-clang-riscv-port' into 'master'
freertos: riscv: implement vPortTaskWrapper with asm only

Closes IDF-6347

See merge request espressif/esp-idf!22199
2023-02-22 05:52:15 +08:00
Alexey Lapshin
d1214aef8c freertos: riscv: fix vPortTaskWrapper for clang 2023-02-20 13:09:42 +08:00
Cao Sen Miao
fd3e0b0b18 esp32h2(ci): enable target test 2023-02-15 10:20:43 +08:00
Marius Vikhammer
25abc7f6d8 ci: update idf-core related tests for C6 2023-02-13 13:01:57 +08:00
Darian Leung
903ac5dff9 freertos(IDF): Update IDF FreeRTOS linker fragment file
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.
2023-02-01 15:15:51 +08:00
Darian Leung
321254a776 freertos(SMP): Update SMP FreeRTOS linker fragment file
This commit updates the linker fragment file for Amazon SMP 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.
2023-02-01 15:15:51 +08:00
Darian Leung
0574e63e6f 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.
2023-02-01 15:09:46 +08:00
Jakob Hasse
9991862a10 fix(linux): fix build errors and warnings, remove ignore file 2023-01-18 09:24:28 +08:00
Cao Sen Miao
94120b82c2 esp32h2: add build test 2023-01-17 10:29:04 +08:00
morris
f7c3d791a2 Merge branch 'feature/systimer_support_esp32h2' into 'master'
systimer: assign counter and alarm in esp_hw_support

Closes IDF-6484, IDF-5323, and IDF-6230

See merge request espressif/esp-idf!21984
2023-01-12 11:01:17 +08:00
morris
6c1d98d556 systimer: assign counter and alarm in esp_hw_support 2023-01-10 17:05:49 +08:00
Jakob Hasse
83afda922b style(freertos/linux): improved docs and coding style 2022-12-29 12:05:15 +08:00
Darian Leung
92bbf85350 freertos: Fix clang-tidy warning on pxPortInitialiseStack() 2022-12-23 15:29:17 +08:00
Darian Leung
82f28a3e09 freertos: Update FPU unit tests to run for multiple iterations
This commit updates the FreeRTOS port FPU unit tests so that they run for
multiple iterations, thus checking that a task's FPU context is properly
cleaned up on deletion.
2022-12-23 15:29:17 +08:00
Darian Leung
45badf864f freertos(IDF): Allow cross-core freeing of task memory when deleting tasks
Previously, IDF FreeRTOS would restrict the clean up of task memory (done by
vTaskDelete() or the Idle task) to only tasks pinned to the current core or
unpinned tasks. This was due to the need to clear the task's coprocessor
ownership on the other core (i.e., "_xt_coproc_owner_sa"). But this restriction
can be lifted by simply protecting access of "_xt_coproc_owner_sa" with a
spinlock.

This commit implements a "_xt_coproc_owner_sa_lock" to protect the access of
"_xt_coproc_owner_sa", thus vTaskDelete() and prvDeleteTCB() can now delete
tasks pinned to the other core so long as that task is not currently running.

Note: This fix was copied from the Xtensa port of Amazon SMP FreeRTOS
2022-12-23 15:29:17 +08:00
Darian Leung
c318c89453 freertos(IDF): Remove dependency on portUSING_MPU_WRAPPERS
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.
2022-12-23 15:29:17 +08:00