Commit Graph

908 Commits

Author SHA1 Message Date
Sudeep Mohanty
d050b2b63c freertos-smp: Disable CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER for FreeRTOS SMP
An explicit check of the mutex owner during a mutex release operation is
not necessary for FreeRTOS SMP as this is checked by default. Hence, the
corresponding Kconfig option is removed.
2022-10-26 09:02:55 +02:00
Zim Kalinowski
09587b84c2 freertos: final test cleanup 2022-10-25 17:41:29 +02:00
Darian Leung
96fce0c9c4 freertos: Fix/remove flakey tests after migration
This commit fixes/ignores flakey freertos unit tests after migrating them to
the test app:

- Added vTaskDelay() before teardown to prevent memory leaks
- Adjusted the "main" task's priority so that scheudling tasks would work
- pytest now only runs tests that are not ignored
- Reset tests are temporarily ignored. Will be enabled to dedicate reset tests.
- Some flakey tests are fixed by adjusting delays and stack sizes.
2022-10-23 20:02:14 +08:00
Darian Leung
c36e06c45c freertos: Add test app sdkconfig
This commit adds the sdkconfig files for the FreeRTOS test app. These
configurations were dervied from the various legacy unit test app's
config files that included the FreeRTOS component.

This commit tries to keep a 1 to 1 config parity with the legacy test app.
Meaning, if FreeRTOS test were run on a particular target with a particular
config, that config will be represented in one of the test app's
sdkconfig.ci.XXX files.

However, the following configurations were removed for FreeRTOS tests:

- The "freertos_flash" option was removed due to redudancy (already tested in
  freertos_options)
2022-10-23 20:02:14 +08:00
Darian Leung
a50a238c18 freertos: Tidy up test organization
Some tests were placed in the incorrect test groups (i.e., kernel, port,
performance etc). This commit fixes those placements.

The following redundant tests were also removed:

- "test_panic.c" as behavior is already covered in esp_system tests
2022-10-23 19:56:47 +08:00
Darian Leung
54d7a3bb66 freertos: Migrate misc tests to test app
This commit migrates the "misc" tests to the test app as a component.
2022-10-23 19:56:47 +08:00
Darian Leung
87c3cc57d1 freertos: Migrate performance tests to test app
This commit migrates the "performance" tests to the test app as a component.
2022-10-23 19:56:47 +08:00
Darian Leung
df9aa722af freertos: Migrate port tests to test app
This commit migrates the "port" tests to the test app as a component.
2022-10-23 19:56:47 +08:00
Darian Leung
df4bfeee5b freertos: Migrate kernel tests to test app
This commit renames the "integration" tests to "kernel" test and migrates them
to the test app as a component.
2022-10-23 19:56:47 +08:00
Darian Leung
60edaa4152 freertos: Add blank freertos test app
This commit adds a blank FreeRTOS test app in preparation for migrating of
FreeRTOS unit tests to the created test app.
2022-10-23 19:56:47 +08:00
Jakob Hasse
944576a0fa refactor(freertos): streamlined freertos CMakeLists.txt 2022-10-20 16:43:24 +02:00
Sudeep Mohanty
70070989f0 freertos: Enable configUSE_PORT_OPTIMISED_TASK_SELECTION for RISC-V targets
This commit enables the config option
configUSE_PORT_OPTIMISED_TASK_SELECTION on RISC-V targets for legacy
FreeRTOS (IDF-FreeRTOS).
2022-10-17 16:47:21 +02:00
Darian
54d286de67 Merge branch 'bugfix/freertos_fpu_isr_pins_task' into 'master'
FreeRTOS: Fix bug where FPU usage in ISR pins the interrupted task.

Closes IDF-6068

See merge request espressif/esp-idf!20573
2022-10-15 00:40:04 +08:00
Ivan Grokhotkov
989d9e831f Merge branch 'bugfix/replace_port_get_runtime_counter_usage' into 'master'
freertos, app_trace: use esp_cpu_get_cycle_count to get ccount

Closes IDF-4744

See merge request espressif/esp-idf!20443
2022-10-13 21:40:07 +08:00
Darian Leung
423fb361e7 freertos: Enable FPU ISR core pinning test for IDF FreeRTOS 2022-10-12 22:45:56 +08:00
Darian Leung
9f7f964363 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-10-12 22:45:56 +08:00
Darian
96058c25ab Merge branch 'refactor/freertos_fpu_unit_tests' into 'master'
FreeRTOS: Refactor FPU unit tests

See merge request espressif/esp-idf!20526
2022-10-12 22:36:46 +08:00
Ivan Grokhotkov
7e2f261a58
freertos, app_trace, heap: use esp_cpu_get_cycle_count to get ccount
portGET_RUN_TIME_COUNTER_VALUE should only be used in the kernel.
2022-10-12 11:20:55 +02:00
Darian Leung
d69361779e freertos: Refactor FPU unit tests
This commit refactors the existing FPU unit tests as follows

- Rename them from coproc to FPU
- Reorganize test placement
- Make existing tests work on both IDF and SMP FreeRTOS
- Update test documentation
- Remove old "test_float_in_isr.c"
2022-10-12 16:29:13 +08:00
Darian Leung
7b1c0ef22c 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.
2022-10-11 14:24:39 +08:00
Darian Leung
2059fb885e freertos: Move FPU unit tests to correct directory
This commit moves the FPU unit tests to the correct directory so that they are
built by the unit tests app.
2022-10-11 14:03:28 +08:00
Darian Leung
fe0d4f2834 freertos: Refactor riscv port stack initialization code
This commit refactors the pxPortInitialiseStack() function of the riscv
FreeRTOS ports (both IDF and SMP FreeRTOS).

- Each stack area is now separated into their own functions
- Each function will individually
    - Push the stack pointer to allocate the stack area
    - Initiaze the allocated stack area
- Each stack area's size and usage is now clearly documented in code
2022-10-09 14:51:45 +08:00
Darian Leung
282f10d1bc freertos: Refactor xtensa port stack initialization code
This commit refactors the pxPortInitialiseStack() function of the xtensa
FreeRTOS ports (both IDF and SMP FreeRTOS).

- Each stack area is now separated into their own functions
- Each function will individually
    - Push the stack pointer to allocate the stack area
    - Initiaze the allocated stack area
- Each stack area's size and usage is now clearly documented in code
2022-10-09 14:48:30 +08:00
Jakob Hasse
bfbbd9d790 feat(freertos): Added FreeRTOS POSIX/Linux Simulator
* Added port layer from the FreeRTOS POSIX port, added
  additional port code for ESP-IDF.
* Created another hello world example using that POSIX
  port in tools/test_apps.
* Removed old linux app
2022-09-27 16:23:54 +02:00
Darian Leung
aaf7547665 freertos: Refactor vTaskDelay() and vTaskDelayUntil() unit tests
This commit refactors the existing vTaskDelayUntil() unit test according to
the FreeRTOS unit test guidelines, and adds a new vTaskDelay() unit test.
2022-09-22 11:27:29 +08:00
Darian Leung
193e30bbf7 freertos: Rename vTaskDelayUntil unit test file 2022-09-22 11:27:29 +08:00
Darian Leung
0d9d4f60df freertos: Add unit test utilities
This commit adds "freertos_test_utils.h/c" that contains utility functions
used in FreeRTOS unit tests.
2022-09-22 11:27:29 +08:00
Darian
9657e687e4 Merge branch 'feature/freertos_10.4.3_sync_various_functions' into 'master'
FreeRTOS: (Sync v10.4.3) Update various functions (Remerge)

See merge request espressif/esp-idf!20235
2022-09-21 16:04:06 +08:00
Darian Leung
c126b910b6 freertos: Expand CONFIG_FREERTOS_SMP description
This commit adds more details to the CONFIG_FREERTOS_SMP option's description.
2022-09-20 16:46:43 +08:00
Darian Leung
882515fcef freertos: Add priority scheduling unit tests
This commit adds a priority scheduling unit test to test that the scheduler
always schedules the highest priority ready state task. Single core and SMP
variants of the test are both added.
2022-09-20 16:46:43 +08:00
Darian Leung
188c21319d freertos: Add test reorganization README.md and portTestMacro.h
This commit adds a README.md containing guidelines on how to refactor the
FreeRTOS unit tests for upstreaming. A portTestMacro.h header was also added
which contains port implementation specific macros used by the test cases.
2022-09-20 16:46:43 +08:00
Darian Leung
7e49d67bad freertos: Move some port functions into flash by default
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.
2022-09-19 23:35:25 +08:00
Darian Leung
aa5d74410b freertos: Synchronize tasks.c functions (minor changes) to v10.4.3
This commit synchronizes multiple functions in tasks.c with upstream v10.4.3
that contain minor differences.

The following functions have had their parameter names or code formatting
updated:

- xTaskCreateStaticPinnedToCore()
- xTaskCreatePinnedToCore()
- prvInitialiseNewTask()
- prvTaskIsTaskSuspended()
- vTaskStartScheduler()
- xTaskResumeAll()
- xTaskCheckForTimeOut()
- uxTaskResetEventItemValue()

The following functions have had their missing "xAlreadyYielded" restored

- xTaskDelayUntil()
- vTaskDelay()

The following functions have had their critical section/interrupt disdable
usage update

- vTaskSuspendAll()
- xTaskGetTickCountFromISR()
- xTaskGetApplicationTaskTagFromISR()
2022-09-19 21:30:52 +08:00
Darian Leung
5742c194e1 freertos: Synchronize tasks.c functions (major changes) to v10.4.3
This commit synchronizes multiple functions that contain major differences with
upstream v10.4.3. Multi-core modifications are then reapplied to the function.

Vanilla code uses "pxTCB == pxCurrentTCB" to check whether a task is currently
running. This commit adds the following macros instead.

- taskIS_CURRENTLY_RUNNING()
- taskIS_CURRENTLY_RUNNING_ON_CORE()

The following functions have been updated to use those macros instead.

- eTaskGetState()
- vTaskPrioritySet()
- vTaskResume()

The following functions have been synchronized with upstream v10.4.3.
Multi-core modifications are then reapplied.

- vTaskSuspend()
- vTaskDelete()
- prvGetExpectedIdleTime()
2022-09-19 21:30:47 +08:00
Darian Leung
15d8fc0722 freertos: Restore xAlreadyYielded usage in event_groups
This commit restores xAlreadyYielded in various event_group functions to
synchronize with upstream v10.4.3.
2022-09-19 21:30:43 +08:00
Darian Leung
5352ba06fa freertos: Synchronize xStreamBufferSend() to v10.4.3
This commit synchronizes xStreamBufferSend() with upstream v10.4.3.
2022-09-19 21:30:38 +08:00
Darian Leung
77f2eba57e freeRTOS: Synchronize queue functions to v10.4.3
This commit synchronizes multiple functions in queue.c with upstream v10.4.3.
Multi-core modifications are then reapplied to these functions. The following
functions were modified:

prvNotifyQueueSetContainer()
xQueueGenericCreateStatic()
xQueueGenericCreate()
xQueueGetMutexHolder()
xQueueCreateCountingSemaphoreStatic()
xQueueCreateCountingSemaphore()
xQueueGenericSend()
xQueueGenericSendFromISR()
xQueueReceiveFromISR()
uxQueueMessagesWaiting()
prvUnlockQueue()
prvIsQueueFull()
xQueueAddToSet()
xQueueRemoveFromSet()
prvNotifyQueueSetContainer()

Note: The SEGGER_SYSVIEW traceQUEUE_SEND() macro was updated as the
      xCopyPosition argument is no longer available in scenarios where the
      macro is called.
2022-09-19 21:30:32 +08:00
Darian Leung
abf0bc13e6 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-16 16:45:43 +08:00
Darian Leung
0c97fbd5ba 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-16 16:45:43 +08:00
Omar Chebib
53c7dd4efc 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-09-15 14:37:59 +08:00
Ivan Grokhotkov
0332b8db07 Revert "Merge branch 'feature/freertos_10.4.3_sync_various_functions' into 'master'"
This reverts merge request !19761
2022-09-12 19:53:09 +08:00
Darian Leung
bb5e189d2b freertos: Synchronize tasks.c functions (minor changes) to v10.4.3
This commit synchronizes multiple functions in tasks.c with upstream v10.4.3
that contain minor differences.

The following functions have had their parameter names or code formatting
updated:

- xTaskCreateStaticPinnedToCore()
- xTaskCreatePinnedToCore()
- prvInitialiseNewTask()
- prvTaskIsTaskSuspended()
- vTaskStartScheduler()
- xTaskResumeAll()
- xTaskCheckForTimeOut()
- uxTaskResetEventItemValue()

The following functions have had their missing "xAlreadyYielded" restored

- xTaskDelayUntil()
- vTaskDelay()

The following functions have had their critical section/interrupt disdable
usage update

- vTaskSuspendAll()
- xTaskGetTickCountFromISR()
- xTaskGetApplicationTaskTagFromISR()
2022-09-07 23:34:52 +08:00
Darian Leung
d382a2c952 freertos: Synchronize tasks.c functions (major changes) to v10.4.3
This commit synchronizes multiple functions that contain major differences with
upstream v10.4.3. Multi-core modifications are then reapplied to the function.

Vanilla code uses "pxTCB == pxCurrentTCB" to check whether a task is currently
running. This commit adds the following macros instead.

- taskIS_CURRENTLY_RUNNING()
- taskIS_CURRENTLY_RUNNING_ON_CORE()

The following functions have been updated to use those macros instead.

- eTaskGetState()
- vTaskPrioritySet()
- vTaskResume()

The following functions have been synchronized with upstream v10.4.3.
Multi-core modifications are then reapplied.

- vTaskSuspend()
- vTaskDelete()
- prvGetExpectedIdleTime()
2022-09-07 23:34:52 +08:00
Darian Leung
9b5392e8e8 freertos: Restore xAlreadyYielded usage in event_groups
This commit restores xAlreadyYielded in various event_group functions to
synchronize with upstream v10.4.3.
2022-09-07 23:34:52 +08:00
Darian Leung
c6b054693b freertos: Synchronize xStreamBufferSend() to v10.4.3
This commit synchronizes xStreamBufferSend() with upstream v10.4.3.
2022-09-07 23:34:52 +08:00
Darian Leung
48e03e4cbd freeRTOS: Synchronize queue functions to v10.4.3
This commit synchronizes multiple functions in queue.c with upstream v10.4.3.
Multi-core modifications are then reapplied to these functions. The following
functions were modified:

prvNotifyQueueSetContainer()
xQueueGenericCreateStatic()
xQueueGenericCreate()
xQueueGetMutexHolder()
xQueueCreateCountingSemaphoreStatic()
xQueueCreateCountingSemaphore()
xQueueGenericSend()
xQueueGenericSendFromISR()
xQueueReceiveFromISR()
uxQueueMessagesWaiting()
prvUnlockQueue()
prvIsQueueFull()
xQueueAddToSet()
xQueueRemoveFromSet()
prvNotifyQueueSetContainer()

Note: The SEGGER_SYSVIEW traceQUEUE_SEND() macro was updated as the
      xCopyPosition argument is no longer available in scenarios where the
      macro is called.
2022-09-07 23:34:52 +08:00
wuzhenghui
c5d8e94898 freertos, ulp: Fix header inclusion to be compatible with new esp32c6 target 2022-09-06 09:13:20 +00:00
KonstantinKondrashov
aea2fe0816 freertos: Adds new APIs to set/get and restore base priority
Closes https://github.com/espressif/esp-idf/issues/7580
2022-09-01 07:07:08 +00:00
Roland Dobai
1a006cb718 Merge branch 'feature/freertos_smp_sysview' into 'master'
sysview: Adds FreeRTOS SMP port

Closes IDF-4995

See merge request espressif/esp-idf!18615
2022-08-29 23:09:42 +08:00
Marius Vikhammer
e219510c9d Merge branch 'bugfix/freertos_org_inc_path' into 'master'
freertos: fixed ORIG_INCLUDE_PATH cmake property having the wrong path

Closes IDF-4464

See merge request espressif/esp-idf!19757
2022-08-26 11:42:29 +08:00