Commit Graph

890 Commits

Author SHA1 Message Date
Alexey Lapshin
06ac8505b9 fix(xtensa): fix registers curruption on context switch
a6, a7 registers may be corrupted on multicore ESP chips while FreeRTOS
Kernel SMP context switch
2023-11-02 02:18:11 +00:00
Sudeep Mohanty
e53e0c553f 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-21 13:11:36 +02:00
Marius Vikhammer
1bdc5dedc1 Merge branch 'bugfix/freertos_vTaskSuspendAll_test_flakiness_v5.0' into 'release/v5.0'
FreeRTOS: Fix vTaskSuspendAll unit test flakiness (v5.0)

See merge request espressif/esp-idf!25609
2023-09-18 10:20:39 +08:00
Sudeep Mohanty
9fe0fa3455 feat(freertos): Added SBOM manifest file for SPDX file generation
This commit adds the SBOM manifest file for the FreeRTOS-Kernel to aid
SPDX file generation.
2023-09-08 12:56:04 +02:00
Darian Leung
715ff1e432 freertos: Fix vTaskSuspendAll unit test falkiness
This commit fixes falkey unit tests (due to memory leaks) by adding a short
delay at the end of the test to allow the idle task to free task memory.
2023-08-28 19:09:53 +08:00
Jiang Jiang Jian
7c91c8f78d Merge branch 'feature/freertos_iram_optimization_5.0' into 'release/v5.0'
freertos: Update linker fragment files to optimise IRAM utilisation (v5.0)

See merge request espressif/esp-idf!24222
2023-08-21 10:33:23 +08:00
Darian Leung
02ee20ff3a pytest: Expect "Calling app_main()" to indicate start of application
This commit updates variousf pytest scripts to expect
"main_task: Calling app_main()" instead of "cpu_start: Starting scheduler" as
indicator of the start of an application.
2023-06-23 10:35:56 +02:00
Darian Leung
9c3a13515c 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-06-23 09:20:18 +02:00
Darian Leung
4ac68a97d9 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-06-23 07:16:58 +02:00
Darian Leung
55644575db 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-06-22 17:20:48 +02:00
Darian Leung
68646e23ae freertos: Refactor port common functions
This commit refactors port_common.c so that it only contains implementation of
FreeRTOS port functions that are common to all FreeRTOS ports (i.e., on all
architectures and on all FreeRTOS implementations).
2023-06-22 17:20:35 +02:00
Darian Leung
feee3a3059 freertos: Refactor OS startup functions
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.
2023-06-22 17:17:18 +02:00
KonstantinKondrashov
2bdbcf12a9 freertos: Fix Systick stuck when systimer was not reset
Relates to OTA update for S3/C3 chips from IDF version 4.3 to v5.0 and above
2023-06-21 14:42:34 +00:00
liuning
6b5bc6304a rtc_sleep: workaround systimer stall issue during lightsleep on ESP32C3 2023-03-29 21:19:21 +08:00
Jiang Jiang Jian
b7ca4320bb Merge branch 'bugfix/atomic_gptimer_fsm_v5.0' into 'release/v5.0'
gptimer: fix race condition between start and stop (v5.0)

See merge request espressif/esp-idf!22712
2023-03-17 10:38:53 +08:00
Darian Leung
e0b1ccf6ce 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-15 16:12:24 +08:00
morris
c24222dcde 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-11 11:42:09 +08:00
Darian Leung
3623dc0fce 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-24 16:24:25 +08:00
Darian Leung
912c82fc5a freertos: Expand CONFIG_FREERTOS_SMP description
This commit adds more details to the CONFIG_FREERTOS_SMP option's description.
2023-02-15 20:16:55 +08:00
Ivan Grokhotkov
205ca920bf Merge branch 'contrib/github_pr_10199_v5.0' into 'release/v5.0'
Removed the 'configASSERT( xInheritanceOccurred == pdFALSE )' assertion from xQueueSemaphoreTake (GitHub PR)(v5.0)

See merge request espressif/esp-idf!21500
2022-12-21 19:56:13 +08:00
Zim Kalinowski
83e2cf1a68 Merge branch 'staging/riscv_wrapper_freertos_tasks_v5.0' into 'release/v5.0'
RISC-V: Create a wrapper around FreeRTOS Tasks to detect the ones returning (backport v5.0)

See merge request espressif/esp-idf!21202
2022-12-20 16:34:13 +08:00
timoxd7
39cadc7e46 Queue Send fix
Fixes rare deadlock on heavy loaded multicore-systems.
2022-12-20 08:30:53 +00:00
Zim Kalinowski
313edcd8a5 Merge branch 'bugfix/freertos_fpu_isr_pins_task_v5.0' into 'release/v5.0'
FreeRTOS: Fix bug where FPU usage in ISR pins the interrupted task (v5.0)

See merge request espressif/esp-idf!20626
2022-12-07 05:02:01 +08:00
Marius Vikhammer
7add623e73 freertos: add missing header include for esp_chip_info.h to port.c
Closes https://github.com/espressif/esp-idf/issues/10310
2022-12-06 12:17:17 +08:00
Darian Leung
ad9884463c freertos: Backport FPU tests from master to v5.0
This commit combines and backports the FPU unit tests updates of the following
commits:

423fb361e7
d69361779e
2022-12-06 00:03:50 +08:00
Darian Leung
13b8a8f2af freertos: Fix FPU ISR core pinning bug
This commit fixes a bug where if an unpinned task is interrupted by a level 1
ISR that users the FPU, the FPU usage will cause the interrupted task to
become pinned to the current core.

Note: This bug was already fixed in SMP FreeRTOS in commit
d69361779e. This commit simply backports the
fix to IDF FreeRTOS.
2022-12-06 00:03:50 +08:00
Zim Kalinowski
759f7ec13d Merge branch 'feature/add_int_task_wdt_esp32c2_v5.0' into 'release/v5.0'
WDT: implement interrupt wdt and task wdt for ESP32-C2 (backport v5.0)

See merge request espressif/esp-idf!20980
2022-12-05 16:38:35 +08:00
Zim Kalinowski
6536aee5cc Merge branch 'bugfix/xtensa_freertos_16B_aligned_v5.0' into 'release/v5.0'
FreeRTOS: Make the default stack alignment 16 for Xtensa (backport v5.0)

See merge request espressif/esp-idf!21078
2022-12-05 16:38:25 +08:00
Marius Vikhammer
2d826ddf3a Merge branch 'bugfix/add_missing_ifdef_to_static_structs_v5.0' into 'release/v5.0'
freertos: Add missing ESP_PLATFORM preprocessor directive for FreeRTOS static data structs (v5.0)

See merge request espressif/esp-idf!20743
2022-12-05 15:28:24 +08:00
Omar Chebib
8731d281f1 FreeRTOS: Make the default stack alignment 16 for Xtensa 2022-12-02 11:17:38 +00:00
Roland Dobai
17ad259e8e Merge branch 'feature/freertos_smp_sysview_v5.0' into 'release/v5.0'
sysview: Adds FreeRTOS SMP port (v5.0)

See merge request espressif/esp-idf!20015
2022-12-02 19:07:14 +08:00
Omar Chebib
b675bb2a4d WDT: implement interrupt wdt and task wdt for ESP32-C2
ESP32-C2 has a single group timer, thus it will use it for the interrupt watchdog,
which is more critical than the task watchdog. The latter is implement in
software thanks to the `esp_timer`component.
2022-12-01 10:45:35 +00:00
Omar Chebib
a4b2aa8a57 RISC-V: fix PC not saved when using backtrace 2022-11-23 15:49:42 +08:00
Omar Chebib
96346c1eed RISC-V: Create a wrapper around FreeRTOS Tasks to detect the ones returning 2022-11-23 15:44:44 +08:00
Sudeep Mohanty
fae252244b freertos: Add missing ESP_PLATFORM preprocessor directive for FreeRTOS static data structs (v5.0)
This commit adds the missing ESP_PLATFORM preprocessor directive to
static data structures to wrap the extra variable added for SMP locks.

Closes https://github.com/espressif/esp-idf/issues/9785
2022-10-21 14:15:16 +02:00
Darian Leung
ebc57e14f6 riscv: Fix esprv_intc_int_set_threshold() naming
This commit fixes the function declaration naming from esprv_intc_set_threshold()
to esprv_intc_int_set_threshold(), thus allowing the underlying ROM funciton to be
exposed via the header.
2022-09-19 14:19:41 +08:00
Darian Leung
0c8ac295c5 riscv: Remove redundant riscv_interrupts.h header
This commit removes the riscv_interrupts.h header is it has become redundant. The previously
exposed API has been handled as follows:

- "riscv_interrupt_enable()" and "riscv_interrupt_disable()" have been removed. These functions
  were declarations only and never had any implementation.
- "riscv_global_interrupts_enable()" and "riscv_global_interrupts_disable()" renamed to
  "rv_utils_intr_global_enable()" and "rv_utils_intr_global_disable()" respectively and now
  placed in rv_utils.h
2022-09-19 14:19:11 +08:00
Jiang Jiang Jian
3f9b12d62a Merge branch 'bugfix/clobbering_freertos_base_priority_v5.0' into 'release/v5.0'
spi_flash: fix issue linked with raising of task priority while priority is already raised (v5.0)

See merge request espressif/esp-idf!20011
2022-09-14 13:47:55 +08:00
KonstantinKondrashov
0147bd6b0d freertos: Adds new APIs to set/get and restore base priority
Closes https://github.com/espressif/esp-idf/issues/7580
2022-09-07 21:16:00 +08:00
Alexey Gerenkov
5b601cd67f sysview: Adds FreeRTOS SMP port 2022-09-07 13:47:26 +03:00
Marius Vikhammer
7f4fa696e1 freertos: fixed ORIG_INCLUDE_PATH cmake property having the wrong path
FreeRTOS include path was changed, but ORIG_INCLUDE_PATH wasn't updated to reflect this.
2022-08-31 10:26:50 +08:00
Darian Leung
a02a84d8a5 freertos: Fix flakey event group unit tests
The event group unit tests would previously use a single call bit (the
"BIT_CALL" macro) to unblock all the test tasks. However, if one or more tasks
were delayed in calling xEventGroupWaitBits(), the other tasks would clear the
test bits, leading to the test deadlocking.

This commit updates the bits used so that each task gets their own CALL and
RESPONSE bits.
2022-08-12 16:48:18 +08:00
Ivan Grokhotkov
401c10ecfb build system: re-add -Wno-format as private flag for some components 2022-08-03 16:42:47 +04:00
Omar Chebib
e25cda2c40 Task WDT: Interuptee task stack is now used for backtracing, regardless of the CPU core
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).
2022-08-02 12:41:14 +08:00
Guillaume Souchere
8357fc728f Merge branch 'bugfix/update-doc-freertos-task-header' into 'master'
freertos: Update the documentation of the ulBitsToClearOnEntry parameter

Closes IDFGH-5468

See merge request espressif/esp-idf!19277
2022-08-01 13:07:45 +08:00
Omar Chebib
692891e773 FreeRTOS: Modifying a timeout is now protected on multi-core configuration 2022-07-29 11:56:06 +08:00
Guillaume Souchere
421a408b42 freertos: Update the docuementation of the ulBitsToClearOnEntry parameter in xTaskGenericNotifyWait() function.
Closes https://github.com/espressif/esp-idf/issues/7207

The description of how the xTaskGenericNotifyWait parameter is handled in the
xTaskGenericNotifyWait() function was inaccurate.

In this commit, the description was updated to match the implementation of xTaskGenericNotifyWait().
2022-07-28 10:30:41 +02:00
morris
d94432fea8 systimer: refactor hal to accomodate more xtal choices 2022-07-25 16:08:52 +08:00
Guillaume Souchere
6005cc9163 hal: Deprecate interrupt_controller_hal.h, cpu_hal.h and cpu_ll.h interfaces
This commit marks all functions in interrupt_controller_hal.h, cpu_ll.h and cpu_hal.h as deprecated.
Users should use functions from esp_cpu.h instead.
2022-07-22 00:06:06 +08:00
Darian Leung
781d06af73 esp_hw_support: Remove compare_set.h API
This function removes the following legacy atomic CAS functions:

From compare_set.h (file removed):
- compare_and_set_native()
- compare_and_set_extram()

From portmacro.h
- uxPortCompareSet()
- uxPortCompareSetExtram()

Users should call esp_cpu_compare_and_set() instead as this function hides the details
of atomic CAS on internal and external RAM addresses.

Due to the removal of compare_set.h, some missing header includes are also fixed in this commit.
2022-07-22 00:06:06 +08:00