Commit Graph

1131 Commits

Author SHA1 Message Date
Darian Leung
5e5a40f7ac freertos: Add Amazon SMP FreeRTOS unit test configuration 2022-11-10 16:01:15 +08:00
Darian Leung
ae3383ddc5 freertos: Remove/restore queue locks for multi-core/single-core
This commit removes the updates the usage of queue locks in IDF FreeRTOS

Queue locks are present in Vanilla FreeRTOS to ensure that queue functions
behave deterministicly in critical sections (i.e., no walking linked lists
while interrupts are disabled). However, currently in IDF FreeRTOS...

- When configNUM_CORES > 1, IDF FreeRTOS drops the determinism requirement.
Thus, queue functions could be simplified if queue locks were not used at all
(and have a queue function do everything inside the same critical section).

- When configNUM_CORES == 1, the current queue implementation in IDF FreeRTOS
does not meet the determinism requirements, as critical sections are used
(instead of scheduler suspension) when locking/unlocking the queues.

There, this commit updates multiple queue functions so that

- When configNUM_CORES > 1
    - Queue locks are no longer used. All actions are done within the same
      critical section.
    - Affected queue functions now need 40% less CPU clock cycles when blocking
- When configNUM_CORES = 1
    - Queue locks are still used.
    - Vanilla behavior of suspending the scheduler is restored when locking
      the queue. Thus queue fucntions are now deterministic and have the same
      behavior as Vanilla FreeRTOS.
    - Affected queue functions now takes 36% more CPU clock cycles when
      blocking (due to the scheduler suspension/resumption).
2022-11-10 14:39:47 +08:00
Kevin (Lao Kaiyao)
5bed8fab49 Merge branch 'refactor/rename_h2_to_h4' into 'master'
esp32h2: renaming esp32h2 to esp32h4

Closes IDF-6098

See merge request espressif/esp-idf!20676
2022-11-09 19:19:43 +08:00
Alexey Gerenkov
dbc3409d6c Merge branch 'bugfix/fix_asm_xtensa_vectors' into 'master'
freertos: fix gnu asm extensions.

See merge request espressif/esp-idf!19167
2022-11-09 16:28:50 +08:00
Sudeep Mohanty
0744f4d5a5 freertos: Removed CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION kconfig option
This commit removes the unused FreeRTOS kconfig option
CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION.
2022-11-09 08:14:16 +01:00
laokaiyao
8677216576 esp32h2: renaming esp32h2 to esp32h4 2022-11-08 17:05:33 +08:00
Zim Kalinowski
98ff59b394 Merge branch 'bugfix/fix_stack_overflow_on_s3_with_freertos_smp' into 'master'
freertos-smp: Fixed stack overflow on esp32s3 with FreeRTOS SMP

Closes IDF-5509 and IDF-4982

See merge request espressif/esp-idf!20932
2022-11-08 03:36:49 +08:00
Zim Kalinowski
9da7deaa7c Merge branch 'task/update_freertos_smp_kernel_source' into 'master'
freertos-smp: Updated the FreeRTOS SMP kernel source to the latest commit

See merge request espressif/esp-idf!20911
2022-11-07 17:32:37 +08:00
Sudeep Mohanty
9bb8f0e38d freertos-smp: Fixed stack overflow on esp32s3 with FreeRTOS SMP
The following changes have been made in this commit:
1. configMINIMAL_STACK_SIZE is now defined as CONFIG_FREERTOS_IDLE_TASK_STACKSIZE.
2. Removed configIDLE_TASK_STACK_SIZE config as it was redundant.
3. Updates the order of allocating the TCB and stack memory to avoid the
   stack memory overriding the TCB memory when the stack grows downwards.
4. CONFIG_FREERTOS_IDLE_TASK_STACKSIZE is now incorporated into the
   FreeRTOSConfig_smp.h to configure the IDLE0 stack size.
2022-11-07 09:59:02 +01:00
Zim Kalinowski
b354b457c8 Merge branch 'feature/freertos_smp_enable_static_task_cleanup' into 'master'
freertos-smp: Enable static task cleanup

See merge request espressif/esp-idf!20870
2022-11-04 19:18:03 +08:00
Darian
7b90c608fa Merge branch 'bugfix/freertos_fix_flakey_delay_tests' into 'master'
FreeRTOS: Fix flakey vTaskDelayUntil() test

See merge request espressif/esp-idf!20931
2022-11-04 14:24:27 +08:00
Jakob Hasse
a995c83060 Merge branch 'feature/freertos_linux_target_add_features' into 'master'
freertos/linux: added event group and stream buffer

Closes IDF-6007

See merge request espressif/esp-idf!20878
2022-11-03 19:05:06 +08:00
Darian Leung
95cfd32871 freertos: Fix flakey task delay tests
This commit fixes flakey task delay tests when running on IDF FreeRTOS. IN IDF
FreeRTOS, core 1's tick interrupts could be up to (< 1 tick) out of phase from
core 0's tick interrupt, thus the measured delay time on core 1 could last 1
tick longer. This commit makes the test detla 2 ticks for IDF FreeRTOS.
2022-11-03 18:22:58 +08:00
Sudeep Mohanty
4bc6b9ed7e freertos-smp: Updated the FreeRTOS SMP kernel source to the latest commit
This commit updates the FreeRTOS SMP source to the latest upstream
source at commit 8128208bdee1f997f83cae631b861f36aeea9b1f
2022-11-03 08:01:44 +01:00
Darian
3c18cc482c Merge branch 'refactor/freertos_uncrustify_code_formatting' into 'master'
FreeRTOS: Uncrustify source code using upstream configuration

See merge request espressif/esp-idf!20722
2022-11-03 14:19:00 +08:00
Darian Leung
ef45a3df7f freertos: Uncrustify IDF FreeRTOS
This commit uncrustifies IDF FreeRTOS source files using the upstream provided
uncrustify.cfg files.
2022-11-02 19:49:40 +08:00
Darian Leung
4b2c8c591b freertos: Add uncrustiy config files for IDF FreeRTOS v10.4.3
This commit adds a copy of upstream vanilla FreeRTOS uncrustify.cfg files from
the following upstream commit:

89e4823a49

Note: "pp_indent_brace" is commented out as that was enabled after v10.4.3

Also also added a note in the ESP-IDF style guide aobut formatting FreeRTOS
source code using Uncrustify.
2022-11-02 19:42:19 +08:00
Sudeep Mohanty
defd6c4ec1 freertos-smp: Enable static task cleanup
This commit enables Static task cleanup feature for FreeRTOS SMP.
2022-11-02 11:24:07 +01:00
Sudeep Mohanty
b3755b751e pthread: Remove pthread TLS cleanup dependency on FreeRTOS Static Task Cleanup Hook
This commit removes the need to define the vTaskCleanupTCB hook in
pthread to cleanup the thread-specific data before a thread is deleted.
2022-11-02 09:52:28 +01:00
Darian Leung
40b96cf596 freertos: Refactor stream buffer spinlock initialization
This commit refactors the way stream buffers initialize their spinlock.

- "prvInitialiseNewStreamBuffer()" now initializes the stream buffer fields
  manually (instead of using memset()) to avoid resetting the spin lock
- Stream buffer creation functions now manually initialize the spinlock after
  the other fields are initialized using "prvInitialiseNewStreamBuffer()"

Also added comments to event group spinlock initializtion.
2022-11-02 14:56:46 +08:00
Song Ruo Jing
2557e24a28 ci: Enable esp32c6 example, test_apps, and unit tests CI build stage 2022-11-01 11:23:21 +08:00
Jakob Hasse
37e8f1f348 feat(freertos): added event group and stream buffer to linux target 2022-10-31 16:34:23 +01:00
Andrei Safronov
847462a578 freertos: fix gnu asm extensions.
The llvm asm pasrser doesn't support some gnu asm extensions,
like using "&" with macro arguments. So, replace such code with
code which could be compiled by llvm.
2022-10-27 00:27:50 +03:00
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
Alexey Gerenkov
e5085db5f0 sysview: Adds FreeRTOS SMP port 2022-08-25 13:08:19 +03:00
Marius Vikhammer
38d30548d4 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-24 18:43:28 +08:00
Darian Leung
77f6e8daca freertos: Synchronize prvAddCurrentTaskToDelayedList() to v10.4.3
This commit synchronizes prvAddCurrentTaskToDelayedList() with upstream
v10.4.3. Multi-core modifications are then reapplied to the function.
2022-08-24 16:03:10 +08:00
Darian Leung
fdbf892124 freertos: Synchronize xTaskRemoveFrom...EventList() functions to v10.4.3
This commit synchronizes the following xTaskRemoveFrom...EventList() with
upstream v10.4.3. Multi-core modifications are then reapplied to the
functions.

The functions updated are:

- xTaskRemoveFromEventList()
- vTaskRemoveFromUnorderedEventList()

The following multi-core macros have been removed as they are no longer
required.

- tskCAN_RUN_HERE()
- taskYIELD_OTHER_CORE()
2022-08-24 16:03:10 +08:00
Darian Leung
fb960f42b3 freertos: Synchronize vTaskPlaceOnEventList...() functions to v10.4.3
This commit synchronizes the following vTaskPlaceOnEventList...() with
upstream v10.4.3.

The functions updated are:

- vTaskPlaceOnEventList()
- vTaskPlaceOnUnorderedEventList()
- vTaskPlaceOnEventListRestricted()

The traceTASK_DELAY_UNTIL() macro has also been updated.
2022-08-24 16:03:10 +08:00
Darian Leung
27c0120c18 freertos: Synchronize prvAddNewTaskToReadyList() to v10.4.3
This commit synchronizes prvAddNewTaskToReadyList() with upstream v10.4.3.
Multi-core modifications are then reapplied to the function.
2022-08-24 16:03:10 +08:00
Darian Leung
e22e7dd670 freertos: Revert critical section macro
This commit reverts the previous "taskENTER_CRTIICAL();" so that the argument
is now provided for better code readability. The names of the spinlocks have
also been updated.
2022-08-12 16:17:45 +08:00
Darian Leung
287ab7566b freertos: Use check yielding macros
This commit updates various FreeRTOS functions to call the newly added
prvCheckForYield() and prvCheckForYieldUsingPriority() when checking for
yielding. This allows the source code to match upstream more closely.
2022-08-11 16:02:48 +08:00
Darian Leung
0fd305da2d freertos: Add new macro to check for yielding
When a FreeRTOS function unblocks a task, that function will check whether
the unblocked task requires a yield to be called. This is currently done by
having each function individually check if the unblocked task has a higher
priority than the both cores, and yielding the appropriate core.

This commit adds the macros list below to abstract away the yielding checking
procedure. This will allow the code to match upstream more closely.

- prvCheckForYield()
- prvCheckForYieldUsingPriority()
2022-08-11 16:02:48 +08:00
Darian Leung
5804d2b6a7 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-10 16:54:25 +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
Darian
0570c5db1a Merge branch 'bugfix/freertos_xTaskIncrementTick' into 'master'
freertos: Fix xTaskIncrementTick() and xTaskResumeAll()

Closes IDF-4698 and IDF-4705

See merge request espressif/esp-idf!17204
2022-07-21 08:14:30 +08:00
Darian Leung
38d974aca0 freertos: Update scheduler suspension unit tests
This commit updates unit tests for vTaskSuspendAll()/xTaskResumeAll().
2022-07-20 11:32:10 +08:00
Darian Leung
ac38f9aaf1 freertos: Rename scheduler suspension test file 2022-07-20 11:32:10 +08:00
Darian Leung
db26ff2503 freertos: Fix vTaskSuspendAll() and xTaskResumeAll()
This commit fixes vTaskSuspendAll() and xTaskResumeAll() in the following ways.

- For vTaskSuspendAll()
    - Sync function source code with upstream single core version
    - Clearly mark IDF additions
- For xTaskResumeAll()
    - Sync function source code with upstream single core version
    - Clearly mark IDF additions
    - Fix bug where cores other than core 0 were allowed to unwind pended ticks
2022-07-20 11:32:10 +08:00
Darian Leung
5971253971 freertos: Fix vTaskStepTick() and xTaskCatchUpTicks()
This commit fixes the following issues:

- Clearly mark IDF additions in vTaskStepTick() and xTaskCatchUpTicks()
- Add back vTaskSuspendAll()/xTaskResumeAll() to xTaskCatchUpTicks(). Scheduler
  suspension and resumption is required to unwind the pended ticks.
2022-07-20 11:32:10 +08:00
Darian Leung
7a4e1fee99 freertos: Fix xTaskIncrementTick()
Previously, xTaskIncrementTick() would always trigger a yield (i.e., return pdTRUE)
when called on core 1. This would mean core 1 would call vTaskSwitchContext() on
every tick, leading to uneccesary CPU overhead.

This commit fixes xTaskIncrementTick() in the following ways:

- Clearly mark IDF additions in xTaskIncrementTick()
- Moved esp_vApplicationTickHook() to be called direclty in xPortSysTickHandler() in order to
  simplify xTaskIncrementTick().
- Only core 0 calls xTaskIncrementTick() in order to simplify the function's logic. Core 0 is
  solely responsible for managing xTickCount and xPendedTicks
- All other cores call xTaskIncrementTickOtherCores() instead which is a simplified version of
  xTaskIncrementTick() and handles the following:
    - Check if core 0 has unblocked a higher priority task to run
    - Check if the current core requires time slicing
    - Call vApplicationTickHook()
2022-07-20 11:31:50 +08:00
Sudeep Mohanty
5e1437deb8 freertos: Fixed a bug where xTimerIsTimerActive incorrectly returns pdTRUE from callback
This commit fixes the following:
- Fixes a bug wherein the timer status is active for oneshot timers that
expire before they are started.
- Callback calls for periodic timers where made before the timers were
auto-reloaded.
- Timer expiry trace was being set after the timer callback is called.

Closes https://github.com/espressif/esp-idf/issues/8014
2022-07-19 10:42:09 +02:00
Omar Chebib
e5c83211a7 Merge branch 'bugfix/interrupt_stack_bss' into 'master'
System: move interrupt stack to .bss instead of .data section

Closes IDFGH-7635

See merge request espressif/esp-idf!18697
2022-07-12 13:44:07 +08:00
Jakob Hasse
0adb313441 bugfix (freertos): removed unused variable in tasks.c 2022-07-11 18:18:09 +08:00
Omar Chebib
bac62cfac8 System: move interrupt stack to .bss instead of .data section
The interrupt stack for Xtensa targets is now declared in C, automatically moving it to .bss section instead of .data section.

* Closes https://github.com/espressif/esp-idf/issues/9188
2022-07-11 17:49:21 +08:00
Alexey Lapshin
7e5a7921fe freertos: fix inlining for xtensa port 2022-07-07 09:04:51 +00:00
Marius Vikhammer
f78d13398e Merge branch 'bugfix/enable_freertos_tests_c2' into 'master'
freertos: re-enable tests disabled for C2

Closes IDF-5140

See merge request espressif/esp-idf!18885
2022-07-07 14:14:46 +08:00
Marius Vikhammer
457e31a715 freertos: re-enable tests disabled for C2 2022-07-06 12:15:04 +08:00
Darian Leung
a0ab1c2acd freertos: Fix stack and TCB allocation order in SMP FreeRTOS
This commit fixes the allocation order of task stacks and TCBs in
order to reduce the chance of a stack overflow overwriting a TCB.
2022-07-05 14:27:44 +08:00
Mahavir Jain
a269a704af Merge branch 'bugfix/main_task_on_cpu1_startup_failure' into 'master'
freertos: Fix issue with bootup failure in ESP_MAIN_TASK_AFFINITY_CPU1 config

Closes IDFGH-7705

See merge request espressif/esp-idf!18755
2022-07-04 14:54:14 +08:00
Darian
c9e7a799ee Merge branch 'bugfix/freertos_event_group_unblock_race_condition' into 'master'
FreeRTOS: Fix event group task list race condition

See merge request espressif/esp-idf!18727
2022-07-01 14:14:45 +08:00
Mahavir Jain
311822da25 freertos: Fix issue with bootup failure in ESP_MAIN_TASK_AFFINITY_CPU1 config
Idle tick hook that indicates completion of scheduler init must be launched
on other core than the one where main task runs. Earlier it was assumed that
main task shall always run on PRO cpu but that behavior can be changed with
ESP_MAIN_TASK_AFFINITY_CPU1 and hence this fix.

Closes https://github.com/espressif/esp-idf/issues/9247
Closes IDFGH-7705
2022-07-01 05:40:46 +00:00
Darian Leung
0cf1fd3a5a freertos: Add multi-core OS startup race condition workaround
FreeRTOS uses a single "xSchedulerRunning" variable to tack whether the
scheduler has started, and this variable is set to "pdTRUE" by core 0
via calling vTaskStartScheduler().

However, with SMP FreeRTOS, there is a race condition where core 0 has
already started the scheduler and another core has not called xPortStartScheduler()
yet and calls some FreeRTOS API. Thus the resultant FreeRTOS API can
cause errors as it thinks the scheduler has started.

This commit adds a temporary workaround (by having each core maintain their
own "xSchedulerRunning" variable.
2022-06-30 20:24:53 +08:00
Darian Leung
16e739a09e freertos: Fix flakey event group unit test
The "FreeRTOS Event Groups" main task will only wait a single tick for the created
tasks to set their response bits. This short delay may not be sufficent if the tick
frequency is high.

This commit updates the test so that

- the main task waits indefinitely for all the response bits to be set.
- created tasks are cleand up by the main task
2022-06-30 20:19:39 +08:00
Darian Leung
1625a3aae2 freertos: Fix event group task list race condition
FreeRTOS synchronization primitives (e.g., queues, eventgroups) use various event lists (i.e., task lists) to track what
tasks are blocked on a current primitive. Usually these event lists are accessed via one of the event lists functions
(such as vTask[PlaceOn|RemoveFrom]UnorderedEventList()), which in turn ensure that the global task list spinlock
(xTaskQueueMutex) is taken when accessing these lists.

However, some functions in event_groups.c manually traverse their event lists. Thus if a tick interrupt occurs on
another core during traversal and that tick interrupt unblocks a task on the event list being traversed, the event list
will be corrupted.

This commit modifies the following event_groups.c functions so that they take the global task list lock before
traversing their event list.

- xEventGroupSetBits()
- vEventGroupDelete()
2022-06-30 20:12:26 +08:00
Darian
26ca7cbaed Merge branch 'feature/update_smp_freertos_porting_notes' into 'master'
freertos: Update SMP FreeRTOS porting notes

See merge request espressif/esp-idf!18632
2022-06-24 13:33:44 +08:00
Darian
7ea4b9d408 Merge branch 'feature/freertos_smp_reduce_iram_usage' into 'master'
FreeRTOS: Move some SMP FreeRTOS functions to flash

See merge request espressif/esp-idf!18581
2022-06-24 06:29:54 +08:00
Sudeep Mohanty
e3e2ac979a freertos-smp: update FreeRTOS SMP kernel
This commit updates the FreeRTOS SMP kernel to commit id 2eff03708
from the upstream smp branch, which is the latest as on date.
2022-06-23 11:56:20 +00:00
Darian Leung
733021ebf8 freertos: Move some SMP FreeRTOS functions to flash
The CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH allows some FreeRTOS functions to be placed
into flash, thus saving some IRAM. However, this feature was previously not supported for
SMP FreeRTOS.

This commit adds CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH support for SMP FreeRTOS. There
are now separate linker fragment files for IDF FreeRTOS and SMP FreeRTOS, named "linker.lf"
and "linker_smp.lf" respectively.
2022-06-23 16:00:46 +08:00
Darian Leung
fa45adee3c freertos: Update SMP FreeRTOS porting notes 2022-06-22 20:20:12 +08:00
Sudeep Mohanty
ac5cfa78bf Merge branch 'bugfix/freertos_smp_fix_test_preemtion' into 'master'
freertos-smp: Fix test_preemtion yield time threshold for FreeRTOS SMP

Closes IDF-5254

See merge request espressif/esp-idf!18577
2022-06-18 05:04:05 +08:00
Sudeep Mohanty
648f4d3a9f freertos-smp: Fix test_preemtion yield time threshold for FreeRTOS SMP
This commit adjusts the test_preemtion yield time threshold to pass when
FreeRTOS SMP is enabled.
2022-06-17 16:03:34 +02:00
Darian Leung
97cf44cbe0 freertos: Fix SMP FreeRTOS TSLP deletion callback tests
The TLSP deletion callback feature is not compatible with the CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP
option. However, the "freertos_options" unit test configuration will enable that option.

This commit disables all CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP related features when compiling with
SMP FreeRTOS.
2022-06-17 21:57:11 +08:00
Sudeep Mohanty
c5d6f97331 freertos-smp: Fix build test errors for esp32s2 and esp32s3
This commit fixes build test errors for esp32s2 and esp32s3 with
FreeRTOS SMP enabled.
2022-06-17 09:21:46 +02:00
Sudeep Mohanty
55f1eca248 freertos-smp: Fix build test errors for esp32c3
This commit fixes build test failures for esp32c3.
2022-06-17 09:18:46 +02:00
Sudeep Mohanty
7726f343e8 freertos-smp: Update prvYieldCore() to fix compile warning
prvYieldCore() leads to an array-out-of-bounds error when compiled with
-Os optimization and configNUM_CORES = 1. This commit avoids this
compile warning by compiling out the part of code which is unnecessary
when configNUM_CORES is 1.
2022-06-17 09:11:02 +02:00
Darian Leung
434287fc8b freertos: Xtensa FreeRTOS saves threadptr in solicited stack frame
The Xtensa FreeRTOS port does not save the threadptr register when
doing a voluntary yield. This can result in a crash when multiple
tasks used the threadptr register and call "taskYIELD()".

This commit adds the threadptr register to the solicited stack frame.
2022-06-15 20:20:41 +08:00
Armando (Dou Yiwen)
0b80546f8e Merge branch 'feature/new_esp_psram_component' into 'master'
esp_psram: new esp psram component

Closes IDF-4318, IDF-4382, IDF-4841, and IDFGH-7192

See merge request espressif/esp-idf!18050
2022-06-15 19:16:56 +08:00
Zim Kalinowski
e55ca17fb6 Merge branch 'feature/enable_freertos_smp_on_c2_and_h2' into 'master'
freertos-smp: enable FreeRTOS SMP for all targets

Closes IDF-5233

See merge request espressif/esp-idf!18506
2022-06-15 18:55:11 +08:00
Darian
e213e66ba3 Merge branch 'refactor/esp_hw_support_cpu' into 'master'
esp_hw_support: Add new esp_cpu.h abstraction

Closes IDF-4769

See merge request espressif/esp-idf!17091
2022-06-14 21:11:30 +08:00
Sudeep Mohanty
472729a513 freertos-smp: enable FreeRTOS SMP for all targets
This commit enables FreeRTOS SMP for esp32s2, esp32s3, esp32c2 and
esp32h2.
2022-06-14 13:53:30 +02:00
Armando
cdad8a02fe esp_psram: remove g_spiram_ok 2022-06-14 15:44:27 +08:00
Armando
38e5043ae8 esp_psram: new psram component 2022-06-14 15:44:27 +08:00
Darian Leung
a8a3756b38 hal: Route CPU and Interrupt Controller HAL/LL to esp_cpu calls
This commit makes changes to cpu_ll.h, cpu_hal.h, and interrupt_controller_hal.h:

- Moved to esp_hw_support in order to be deprecated in the future
- HAL/LL API now route their calls to esp_cpu.h functions instead

Also updated soc_hal.h as follows:

- Removed __SOC_HAL_..._OTHER_CORES() macros as they dependend on cpu_hal.h
- Made soc_hal.h and soc_ll.h interfaces always inline, and removed soc_hal.c.

This commit also updates the XCHAL_ERRATUM_572 workaround by

- Removing it's HAL function and invoking the workaround it directly the bootloader
- Added missing workaround for the ESP32-S3
2022-06-14 14:40:03 +08:00
Mahavir Jain
4e4d0a5011 Merge branch 'bugfix/psram_startup_crash' into 'master'
psram: Fix startup crash when `CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=0`

Closes IDFGH-6938

See merge request espressif/esp-idf!17543
2022-06-14 14:36:47 +08:00
Sudeep Mohanty
302c548bb0 Merge branch 'feature/freertos_smp_enable_riscv_port' into 'master'
freertos-smp: add support for RISC-V targets on FreeRTOS SMP

See merge request espressif/esp-idf!18128
2022-06-14 04:17:54 +08:00
Laukik Hase
914b0de764
freertos: Indicate completed initialization for APP CPU with idle task hook
Co-authored-by: Mahavir Jain <mahavir@espressif.com>
2022-06-13 17:17:42 +05:30
Sudeep Mohanty
12e2312aaa freertos: FreeRTOS SMP RISC-V port cleanup and enable esp32c3 in KConfig
This commit does general cleanup of the risc-v port files and restricts
FreeRTOS SMP config option to only esp32 and esp32c3.
2022-06-13 13:39:16 +02:00
Darian Leung
71eef9a9b0 freertos: Fix SMP RISC-V Port IDF Style critical sections
Previously the RV port was routing IDF style critical section API to call FreeRTOS style critical section API.
For example, a call to "portENTER_CRITICAL(mux)" would eventually call `vTaskEnterCritical()" via the following call flow:
- portENTER_CRITICAL(mux)
- vPortEnterCritical()
- portSET_INTERRUPT_MASK_FROM_ISR()
- vTaskEnterCritical()

This commit fixes the IDF style critical section by making sure that they are completely orthogonal to FreeRTOS critical sections
2022-06-13 13:34:21 +02:00
Sudeep Mohanty
8fd953c627 freertos-smp: add support for RISC-V targets oon FreeRTOS SMP
TBD: Initial commit. Enables risc-v port.
2022-06-13 13:34:21 +02:00
Sudeep Mohanty
9a53a4abf1 freertos: refactor yield tests for freertos
This commit refactors the yield test scenarios for a more deterministic
prediction of the kernel's yielding behavior.
2022-06-13 10:57:55 +02:00
Marius Vikhammer
08c4984773 Merge branch 'bugfix/s3_psram_spinlock' into 'master'
spinlock: fixed spinlocks not working on S3 if placed in PSRAM

Closes IDF-5169, IDFGH-7560, and IDF-5007

See merge request espressif/esp-idf!18425
2022-06-09 13:02:18 +08:00
Anton Maklakov
763deaea3c freertos, tests: increase stack size for a test 2022-06-08 16:45:31 +07:00
Marius Vikhammer
486316f222 spinlock: fixed spinlocks not working on S3 if placed in PSRAM
The compare and set instruction (S32C1I) cannot be used when
lock is not in internal memory.

Closes https://github.com/espressif/esp-idf/issues/9120
2022-06-08 14:31:16 +08:00
Darian Leung
3c6185788f freertos: Fix GCC 11 SMP FreeRTOS build errors
This commit fixes the following build errors in SMP FreeRTOS when building with GCC 11:

- "-Wattributes" warning due to conflicting attributes on xPortInterruptedFromISRContext()
- "-Wtype-limits" warning due to taskVALID_CORE_ID() not casting xCoreID
2022-06-07 16:33:22 +08:00
Darian Leung
593fbe0b23 freertos: Disable scheduler suspension tests for SMP FreeRTOS
The behavior of vTaskSuspendAll() has changed in SMP FreeRTOS. This commit
disables scheduler suspension related unit tests for SMP FreeRTOS.

The tests will be updated in IDF-5201
2022-06-06 12:15:44 +08:00
morris
aa3ddbc3c6 Merge branch 'test/enable_c2_target_tests' into 'master'
ci: enable target tests for ESP32-C2

Closes IDF-4989

See merge request espressif/esp-idf!18182
2022-06-03 16:41:24 +08:00
Darian Leung
d8eb55d83b freertos: Add newlib dynamic reentrancy support
SMP FreeRTOS adds support for dynamic reentrancy in the following commit:
34b8e24d7c

This commit does the following:

- Pulls in the upstream changes
- Move __getreent() to "freertos_tasks_c_additions.h"
- Add the required configNEWLIB_REENTRANT_IS_DYNAMIC to SMP FreeRTOS port
2022-06-02 15:42:02 +08:00
Michael (XIAO Xufeng)
6a8aed12ee ci: partially enable ut tests for esp32c2
Disabled test cases are tracked in:

 IDF-4465, IDF-5045, IDF-5057, IDF-5058, IDF-5059, IDF-5060, IDF-5061, IDF-5131

- test_fatfs: IDF-5136

- test_pm: IDF-5053

- test_cache_mmu: IDF-5138

- test_partitions: IDF-5137

- test_vfs: IDF-5139

- test_freertos: IDF-5140

- test_wpa_supplicant: IDF-5046

- test_mbedtls: IDF-5141

- test_pthread: IDF-5142

- test_protocomm: IDF-5143

- test_lightsleep: IDF-5053

- test_taskwdt: IDF-5055

- test_tcp_transport: IDF-5144

- test_app_update: IDF-5145

- test_timer: IDF-5052

- test_spi: IDF-5146

- test_rtc_clk: IDF-5060

- test_heap: IDF-5167

ci: fixed issues for tests of libgcc, ets_timer, newlib

test_pm: support on C2
2022-06-02 14:23:35 +08:00
Konstantin Kondrashov
b824f68b35 Merge branch 'feature/move_dport_workaround_to_g0' into 'master'
dport_access: Move DPORT workaround to G0

Closes IDF-2177

See merge request espressif/esp-idf!17961
2022-06-01 12:11:12 +08:00
KonstantinKondrashov
ac4c7d99fe dport: Move DPORT workaround to G0 2022-05-31 13:44:18 +08:00
Sudeep Mohanty
7476e197ad freertos: fix test_preemtion test
Increased the yield count threshold to work for both SMP FreeRTOS and
IDF FreeRTOS.
2022-05-30 13:19:26 +05:30
Darian
1ec59e6982 Merge branch 'bugfix/update_eTaskGetState_unit_test' into 'master'
FreeRTOS: Refactor eTaskGetState() test for FreeRTOS SMP

Closes IDF-5073

See merge request espressif/esp-idf!18228
2022-05-30 11:44:51 +08:00
Darian Leung
49256fe5c9 freertos: Refactor TLSP deletion callback test
- Add a new test case for SMP FreeRTOS
- Old test case is preserved. To be removed in the future
2022-05-28 21:36:39 +08:00
Darian Leung
64469affcd freertos: Fix TLSP deletion callback log
Currently, portCLEAN_UP_TCB() is called in a critical section. This commit updates
vPortTLSPointersDelCb() to use an EARLY log to prevent a crash.
2022-05-28 21:36:39 +08:00
Darian Leung
ef6afa1324 freertos: Refactor eTaskGetState() unit test
This commit refactors the eTaskGetState() unit test to work on FreeRTOS SMP
2022-05-28 21:36:23 +08:00
Marius Vikhammer
15684fb5a0 Freertos SMP: fix wrong no affinity value in kconfig 2022-05-24 09:16:43 +08:00
Darian
4afd048abf Merge branch 'bugfix/freertos_smp_queue_sets_thread_safety' into 'master'
FreeRTOS: Fix queue set tests for SMP FreeRTOS

See merge request espressif/esp-idf!18169
2022-05-21 05:02:19 +08:00
Darian Leung
56d45f9999 freertos: Fix queue set tests for SMP FreeRTOS
The "Test Queue sets thread safety" tests relied on IDF FreeRTOS specific
scheduling behavior, thus resulting in the test getting stuck when running
with SMP FreeRTOS.

This commit updates and refactors the tests to work on both IDF and SMP FreeRTOS.
2022-05-19 16:28:10 +08:00
Darian Leung
9b5601b7c7 freertos: Fix SMP FreeRTOS interrupt watchdog feeding
This commit fixes how SMP FreeRTOS feeds the INT WDT. Previously, the
port used vApplicationTickHook(). Now, all cores will feed the INT WDT
in xPortSysTickHandler().
2022-05-18 20:12:25 +08:00
Darian Leung
7dc6fd9ff6 esp_system: Make interrupt WDT private API
This commit makes the interrupt WDT API private. To use the API,
IDF components should now '#include "esp_private/esp_int_wdt.h"'
2022-05-18 20:12:25 +08:00
Darian Leung
5953bca376 esp_system: Add arbitrary user feature to TWDT
This commit moidifies the TWDT as follows:

- Adds a feature to allows subscribing arbitrary users to the TWDT
- Changes esp_task_wdt_init() API to accept configuration structure
- Changes esp_task_wdt_init() and esp_task_wdt_deinit() to subscribe/unsubscribe
  idle tasks of various cores.
- Adds support for SMP FreeRTOS idle tasks
- Updates startup code TWDT initialization
- Updates API documentation
2022-05-13 18:01:28 +08:00
Sudeep Mohanty
1f47466664 Merge branch 'test/ignore_freertos_yield_tests' into 'master'
freertos: ignore freertos yield test failures

See merge request espressif/esp-idf!18078
2022-05-13 11:45:15 +08:00
Darian
8dae294ab6 Merge branch 'refactor/freertos_kconfig_options' into 'master'
Freertos: Refactor Kconfig options

See merge request espressif/esp-idf!18043
2022-05-12 21:47:18 +08:00
Sudeep Mohanty
ffae594e8b freertos: ignore freertos yield test failures
This commit updates the freertos yield tests to be ignored by the CI
during failures.
2022-05-12 13:57:02 +05:30
Marius Vikhammer
c8617fe965 docs: fix all doxygen warnings
Doxygen warnings would previously not result in a failed pipeline.
Fixed this as well as all current warnings.
2022-05-12 14:50:03 +08:00
Darian Leung
aa028f018f freertos: Refactor Kconfig options
This commit refactors FreeRTOS Kconfig options as follows:

- Grouped them into Kernel and Port submenus
- Renamed Kernel option promppts to match upstream names
- Simplified some option descriptions
- Added "Todo" markers related to SMP support
2022-05-12 11:53:16 +08:00
Mahavir Jain
dec3db6913 Merge branch 'bugfix/freertos_stack_tcb_alloc_order' into 'master'
freertos: fix allocation order for stack and TCB per portSTACK_GROWTH

See merge request espressif/esp-idf!18042
2022-05-11 18:09:49 +08:00
Sudeep Mohanty
f6be878b6c Merge branch 'feature/freertos_smp_single_core_build' into 'master'
freertos: Enable FreeRTOS SMP unicore build

See merge request espressif/esp-idf!18020
2022-05-10 19:52:39 +08:00
Mahavir Jain
318f723042
freertos: extend snapshot test to check return status of vTaskGetSnapshot 2022-05-10 14:19:17 +05:30
Mahavir Jain
5b817038a0
freertos: add return value to API vTaskGetSnapshot
`vTaskGetSnapshot` is being used in coredump module to collect diagnostic information.
It is possible that input arguments are invalid and `assert` in this situation is not
correct.

This commit modifies API signature to return pdTRUE in case of success, and pdFALSE
otherwise. Caller can verify return value and then take appropriate decision.
2022-05-10 11:39:50 +05:30
Mahavir Jain
588a65759c
freertos: fix allocation order for stack and TCB per portSTACK_GROWTH
This is as per FreeRTOS recommendation and allows to protect task TCB
in case task stack has overflowed.
2022-05-09 15:45:38 +05:30
Sudeep Mohanty
aa60118944 freertos: Enable FreeRTOS SMP unicore build
This commit enables unicore build with the FreeRTOS SMP kernel.
2022-05-09 09:44:44 +05:30
Sudeep Mohanty
3ea1c8bf96 freertos: add freertos unit test to verify yielding behavior of the kernel
This commit adds a unit test to verify the task yielding behavior of the
FreeRTOS SMP kernel.
2022-05-09 03:48:07 +00:00
Sudeep Mohanty
6fba3fc645 Merge branch 'refactor/refactor-freertos-tls-del-cb' into 'master'
freertos-smp: refactor thread local storage pointers deletion callbacks

Closes IDF-3330

See merge request espressif/esp-idf!17972
2022-05-09 11:45:27 +08:00
morris
e7295c3577 gptimer: added enable/disable functions 2022-05-06 18:18:39 +08:00
Sudeep Mohanty
283f569a03 freertos-smp: refactor thread local storage pointers deletion callbacks
This commit updates how the TLS pointers deletion callbacks are called
during task deletion in the FreeRTOS SMP kernel. The callbacks are now
routed through the portCLEAN_UP_TCB() macro. This commit also adds a
new kconfig option CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS to control
the enablement of the TLSP deletion callbacks.
2022-05-06 09:25:25 +05:30
Darian Leung
efdedaf726 freertos: Move IDF API additions to seperate files
This commit moves the IDF API additions from task.h/task.c to seperate header/source files.

- Declarations moved to "idf_additions.h"
- Definitions moved to "freertos_task_c_additions.h"

The API descriptions have also been updated.
2022-04-27 20:31:39 +08:00
Ivan Grokhotkov
b0544b9745
esp_timer: only add as a public dependency to FreeRTOS if necessary
esp_timer will be added as a dependency to freertos only if
CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER is enabled.
Other components are updated to add esp_timer as public or private
dependency, as needed.
This removes esp_timer from the default list of public dependencies.
2022-04-25 18:39:59 +02:00
Ivan Grokhotkov
708e99497b
global: add dependency on esp_timer component and include esp_timer.h
Some components were including esp_timer.h without declaring a
dependency on esp_timer component. This used to work due to a
transitive public dependency on esp_timer from freertos component.
Add explicit dependencies where needed.
Also some source files were using esp_timer functions without
including the header file. This used to work because esp_timer.h was
included from freertos port header file. This commit adds esp_timer.h
includes where needed.
2022-04-25 18:39:23 +02:00
Marius Vikhammer
45c1d1cba2 Merge branch 'feature/move_target_kconfig_2' into 'master'
system: move kconfig options out of target component

See merge request espressif/esp-idf!17321
2022-04-24 13:29:43 +08:00
Sudeep Mohanty
2b507c33aa Merge branch 'feature/freertos-smp-task-deletion-coproc-cleanup' into 'master'
freertos-smp: Task Deletion Coproc context save area cleanup

Closes IDF-3332

See merge request espressif/esp-idf!17628
2022-04-22 11:51:31 +08:00
Zim Kalinowski
dad8b50876 freertos: move test files to appropriate subfolders 2022-04-21 07:55:34 +00:00
Sudeep Mohanty
44ee07ef23 freertos-smp: Task Deletion Coproc context save area cleanup
This commit adds FPU and other Co-processor context save area cleanup in
the task TCB for the FreeRTOS SMP kernel.
2022-04-21 13:09:03 +05:30
Marius Vikhammer
d2872095f9 soc: moved kconfig options out of the target component.
Moved the following kconfig options out of the target component:
 * CONFIG_ESP*_DEFAULT_CPU_FREQ* -> esp_system
 * ESP*_REV_MIN -> esp_hw_support
 * ESP*_TIME_SYSCALL -> newlib
 * ESP*_RTC_* -> esp_hw_support

Where applicable these target specific konfig names were merged into
a single common config, e.g;
CONFIG_ESP*_DEFAULT_CPU_FREQ -> CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ
2022-04-21 12:09:43 +08:00
Darian
fc9c6a6cfb Merge branch 'feature/freertos_smp_port_local_storage' into 'master'
freertos: Disable portUSING_MPU_WRAPPERS

Closes IDF-4563

See merge request espressif/esp-idf!17409
2022-04-19 19:52:29 +08:00
morris
373d9b3dbc Merge branch 'feature/default_clk_for_gptimer' into 'master'
clk_tree: added default clock source for peripherals (GPTimer, RMT, LCD, TempSensor)

Closes IDF-4894

See merge request espressif/esp-idf!17759
2022-04-19 18:02:40 +08:00
Darian Leung
839476b461 freertos: Add SMP FreeRTOS coprocessor unit tests 2022-04-19 13:35:30 +08:00
Darian Leung
8c92d0b2af freertos: Disable portUSING_MPU_WRAPPERS in FreeRTOS SMP Xtensa port
This commit disables portUSING_MPU_WRAPPERS for the FreeRTOS SMP xtensa port.
This was previously enabled due to the need to keep a CPSA (coprocessor save
area pointer) in the TCB. The CPSA pointer is now calculated at run time.
2022-04-19 13:35:30 +08:00
Darian Leung
79cecf05b3 freertos: Fix main task affinity in SMP FreeRTOS 2022-04-18 15:50:47 +08:00
morris
f32a89826c clk_tree: added default clock source for peripheral 2022-04-14 15:44:56 +08:00
Armando (Dou Yiwen)
5e8db9669d Merge branch 'refactor/move_soc_memory_types_helper_functions_to_esp_hw_support' into 'master'
hw_support: move soc_memory_types.h helper functions into esp_hw_support (G1)

Closes IDF-4858

See merge request espressif/esp-idf!17657
2022-04-10 19:10:33 +08:00
Darian
59202fe43e Merge branch 'bugfix/freertos_smp_cmakelist' into 'master'
freertos: Fix CMakeLists.txt to include esp_additions/private_include

See merge request espressif/esp-idf!17715
2022-04-08 21:35:44 +08:00
Darian Leung
7ea0106b3f freertos: Fix CMakeLists.txt to include esp_additions/private_include 2022-04-08 17:23:52 +08:00
Armando
c4bcf1117c esp_hw_support: move soc_memory_types.h helper functions into esp_hw_support 2022-04-08 11:46:10 +08:00
Sudeep Mohanty
f2d355992b Merge branch 'refactor/remove-portmacro-deprecated-apis' into 'master'
freertos: remove portmacro_deprtecated.h file

Closes IDF-4746

See merge request espressif/esp-idf!17661
2022-04-07 14:36:25 +08:00
Darian
7554194bf1 Merge branch 'feature/freertos_smp_port_idle_hooks' into 'master'
freertos: Update idle hooks for SMP

Closes IDF-3337

See merge request espressif/esp-idf!17407
2022-04-06 08:24:04 +08:00
Sudeep Mohanty
129e613f15 freertos: remove portmacro_deprtecated.h file
This commit removes the portmacro_deprecated.h file and the deprecated
APIs contained in it. Alternate APIs to use are noted in the migration
guide.
2022-04-05 04:38:35 +00:00
Darian Leung
e6d43ab56f freertos: Update SMP idle hooks
This commit updates the usage of idle hooks in SMP FreeRTOS as follows:

- IDF style idle hooks are now called from vApplicationMinimalIdleHook()
- If the user provdies their own vApplicationMinimalIdleHook(), it can be
  wrapped using -Wl,--wrap if CONFIG_FREERTOS_USE_MINIMAL_IDLE_HOOK is
  enabled.
- SMP port no longer uses vApplicationIdleHook() as it's only called from
  the prvIdleTask() and not every prvMinimalIdleTask()
2022-04-01 22:08:45 +08:00
Darian Leung
8c88c6f68f freertos: Update task snapshot unit tests
This commit updates the task snapshot unit tests as follows:

- Both uxTaskGetSnapshotAll() and vTaskGetSnapshot() are now both tested
- Test cases are now dependent on CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT
2022-04-01 22:01:16 +08:00
Darian Leung
80f0c64c2a freertos: Update task snapshot
This commit updates task snapshot as follows:

- Refactored implementation to increase readability
- Implementation moved into freertos_tasks_c_additions.h
- freertos_tasks_c_additions.h made a private header
- Support SMP FreeRTOS
- Removed configENABLE_TASK_SNAPSHOT option. CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT
  is direclty used instead.
2022-04-01 22:01:16 +08:00
Ivan Grokhotkov
c70a69b1dd Merge branch 'bugfix/remove_ref_non_ex_options' into 'master'
config: removed references to non-existing kconfig options

See merge request espressif/esp-idf!17495
2022-03-25 18:02:54 +08:00
morris
b40f05ddda Merge branch 'bugfix/freertos_smp_type_warning' into 'master'
freertos: Fix SMP build warning in xTaskCreateStaticPinnedToCore

See merge request espressif/esp-idf!17548
2022-03-23 16:19:03 +08:00
Darian Leung
63d15957d2 freertos: Fix SMP build warning in xTaskCreateStaticPinnedToCore 2022-03-22 23:51:43 +08:00
Anton Maklakov
68e5d9d585 Remove IRAM_ATTR from any function declarations
IRAM_ATTR expands to a unique section attribute. Applying it to both
declaration and definition results in a section conflict.
2022-03-22 09:58:50 +00:00
Darian Leung
199df492b7 freertos: Update task creation pinned to core functions
This commit updates the "xTaskCreate...PinnedToCore()" functions to
call the "xTaskCreate...AffinitySet()" equivalent functions.
2022-03-21 11:37:21 +08:00
Darian Leung
6a38499172 freertos: Add task creation with affinity functions to FreeRTOS SMP
This commit syncs adds task creation with affinity functions to
FreeRTOS SMP by syncing with upstrea commit
a97741a08d
2022-03-21 11:09:24 +08:00
Ivan Grokhotkov
2f9d47c708 Merge branch 'feature/gdbstub_rt_multicore' into 'master'
Extension for GDBstub runtime component (multicore, breakpoints, steps etc...)

See merge request espressif/esp-idf!13896
2022-03-17 19:59:29 +08:00
Marius Vikhammer
0fbae992dd config: removed references to non-existing kconfig options 2022-03-15 18:32:22 +08:00
Erhan Kurubas
c5f5c84f67 freertos_additions: add debug params table for openocd 2022-03-11 11:33:08 +01:00
Darian Leung
94c2467dd6 esp_common: Rename esp_macro.h to esp_macros.h 2022-03-10 21:22:35 +08:00
Vladimir Chistyakov
216703c0ef esp_macro: Fix CHOOSE_MACRO_VA_ARG() for C++20
Closes https://github.com/espressif/esp-idf/pull/8372
Closes https://github.com/espressif/esp-idf/issues/8371

[darian@espressif.com: Updated macro description and commit message]
Signed-off-by: Darian Leung <darian@espressif.com>
2022-03-08 20:21:26 +08:00
Darian Leung
c2f2b1e228 freertos: Add SMP FreeRTOS porting notes
This commit adds some notes about the SMP FreeRTOS port
2022-03-08 14:59:18 +08:00
Darian Leung
27f5c90e2e freertos: Fix usage of vTaskSuspendAll()/xTaskResumeAll()
IDF FreeRTOS uses vTaskSuspendAll()/xTaskResumeAll() to stop preemption
on a particular core. However, those functions behave differently in FreeRTOS SMP.
This commit replaces all calls of vTaskSuspendAll()/xTaskResumeAll() with
vTaskPreemptionDisable()/vTaskPreemptionEnable() when compiling with SMP FreeRTOS.
2022-03-08 14:59:18 +08:00
Darian Leung
883da858b0 freertos: Fix various build errors
This commit fixes various build errors in IDF (and tests) when compiling
with SMP FreeRTOS:

- Updated usage of xTaskGetIdleTaskHandle()
- Disable sysview tracing macros
- Update some task snapshot functions
- Disabled test_freertos_hooks.c test as vApplicationIdleHook() and
  vApplicationTickHook() are used.
2022-03-08 14:59:18 +08:00
Darian Leung
9da5d7c40a freertos: Add changes to FreeRTOS SMP sources
This commit adds the necessary changes to the FreeRTOS SMP source and
and header files so that it can be compatible with ESP-IDF.
2022-03-08 14:59:18 +08:00
Darian Leung
37c270b337 freertos: Update Xtensa port files to support FreeRTOS SMP
This commit updates the copied Xtensa port to support the new porting interfaces
of the FreeRTOS SMP kernel. These modifications are mainly contained in

- FreeRTOSConfig.h
- FreeRTOSConfig_smp.h
- portmacro.h
- port.c

Some porting interfaces have changed in FreeRTOS SMP. In order to allow building
with IDF, compatibility interfaces have been added.
2022-03-08 14:59:18 +08:00
Darian Leung
163ddc3818 freertos: Update components CMakeLists.txt and Add SMP Kconfig option
This commit does the following:

- Add a Kconfig option to select between the IDF FreeRTOS kernel and the
  FreeRTOS SMP kernel.
- Updates the freertos component's CMakeLists.txt so that FreeRTOS SMP
  files are now built based the the new configuration option.

This commit WILL NOT compile. The port files for FreeRTOS SMP still need to
be updated.
2022-03-08 14:59:18 +08:00
Darian Leung
89dd2fe7f5 freertos: Copy IDF xtensa port files
This commit copies over ESP-IDF Xtensa portable files to the
FreeRTOS-Kernel-SMP directory. No changes were made, this commit
only copies the portable source files.

Notes:
- This commit WILL NOT compile
- Some SPDX header dates were updated to pass pre-commit check
2022-03-08 14:59:18 +08:00
Darian Leung
2d1afaf35b freertos: Add FreeRTOS SMP upstream files
This commit copies over the sources files from
https://github.com/FreeRTOS/FreeRTOS-Kernel/tree/smp based on the
commit 4832377117b4198db43009f2b548497d9cdbf8da

The FreeRTOS SMP sources are added to components/freertos/FreeRTOS-Kernel-SMP

Notes:
- This commit WILL NOT compile correctly. It simply copies over sources files
- copyright_ignore.txt entries added so that we can avoid using SPDX headers
- Portable files are not added yet
2022-03-08 14:58:57 +08:00
Sudeep Mohanty
a9fda54d39 esp_hw_support/esp_system: Re-evaluate header inclusions and include directories
This commit updates the visibility of various header files and cleans up
some unnecessary inclusions. Also, this commit removes certain header
include paths which were maintained for backward compatibility.
2022-03-07 11:18:08 +05:30
Marius Vikhammer
bb88338118 system: move kconfig options out of target component
Moved the following kconfig options out of the target component:
 * ESP32_X_BROWNOUT_* -> esp_system
 * ESP32_X_DEBUG_OCDAWARE -> esp_system
 * APP_NO_BLOBS -> build type (main kconfig)
2022-03-02 01:22:26 +00:00
Dmitry
a8c3fe56c8 This commit add to GDBstup:
1. Multicore suupor
2. Stepping
3. Console output
4. Update example + readme
5. Jumps
2022-03-01 19:49:24 +03:00
Alexey Gerenkov
dea45a9d72 riscv: Use semihosting to set breakpoint and watchpoint when running under debugger 2022-02-24 08:55:40 +00:00
Alexey Gerenkov
088e940528 riscv: Fixes GDB backtrace end function to point to prvTaskExitError 2022-02-24 08:55:40 +00:00
Marius Vikhammer
06d8a5bf33 Merge branch 'bugfix/inline_intrmask_from_isr' into 'master'
freertos: always inline xPortSetInterruptMaskFromISR and vPortClearInterruptMaskFromISR

Closes IDFGH-6669

See merge request espressif/esp-idf!16970
2022-02-23 01:05:40 +00:00
Darian Leung
5f5daaa420 freertos: Remove legacy hooks
This commit refactors the legacy hooks as follows:

- Removed CONFIG_FREERTOS_LEGACY_HOOKS
- FreeRTOS hooks are now enabled via:
    - CONFIG_FREERTOS_USE_IDLE_HOOK
    - CONFIG_FREERTOS_USE_TICK_HOOK
- Update IDF hooks documentation
2022-02-18 19:56:35 +08:00
Jakob Hasse
d5e1362e14 bugfix (freertos): added stdint.h to linux portmacro header 2022-02-16 16:51:22 +08:00
Darian Leung
2cebfcf885 freertos: Refactor configuration files
This commit refactors the FreeRTOS configuration headers as follows:

- Layout is now similar to FreeRTOSConfig.h found in other upstream demos
- Separate out Vanilla FreeRTOS configurations and ESP-IDF additions
- Move/remove some irrelevant/unused macros and configurations
2022-02-10 21:23:46 +08:00
Darian Leung
57fd78f5ba freertos: Remove legacy data types
This commit removes the usage of all legacy FreeRTOS data types that
are exposed via configENABLE_BACKWARD_COMPATIBILITY. Legacy types can
still be used by enabling CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY.
2022-02-09 23:05:45 +08:00
morris
ef00bd59dc esp_rom: extract int matrix route and cpu ticks getter 2022-02-09 13:52:20 +08:00
Darian
a00117cb7f Merge branch 'refactor/freertos_macro_selection' into 'master'
freertos: Add CHOOSE_MACRO_VA_ARG selector

See merge request espressif/esp-idf!16904
2022-02-08 06:48:14 +00:00
Darian Leung
c5fd79547a freertos: Add CHOOSE_MACRO_VA_ARG selector
This commit adds a CHOOSE_MACRO_VA_ARG() selector to allow selection between two
versions of a macro based on the number of arguments. This replaces the previous
portGET_ARGUMENT_COUNT() selector.

- portYIELD_FROM_ISR() now uses CHOOSE_MACRO_VA_ARG()
- portYIELD_FROM_ISR(arg) version added to risc-v port
- Old vPortEvaluateYieldFromISR() and portGET_ARGUMENT_COUNT removed
2022-02-07 20:01:11 +08:00
Marius Vikhammer
0fc8ede204 freertos: add pm_trace header include 2022-02-07 17:44:33 +08:00
Marius Vikhammer
8220b2bb34 freertos: always inline xPortSetInterruptMaskFromISR and vPortClearInterruptMaskFromISR
These were called from IRAM context where the caller expect them to be inlined
and accessible when cache is disabled. This was not the case when compiled with -O0.

Closes https://github.com/espressif/esp-idf/issues/8301
2022-02-07 11:32:45 +08:00
Darian Leung
1c60d6a895 freertos: Add SPDX license identifiers and update xtensa port files
This commit does the following:

- Adds SPDX license identifiers to FreeRTOS sources. Remove those FreeRTOS sources from
  the copyright ignore list.
- Update xtensa port files to match FreeRTOS v10.4.3. Added SPDX license identifiers
  to the port files.
- Fixed some improperly licensed files
- Removed portbenchmark.h from RISC-V port
2022-02-03 17:08:14 +08:00
Darian Leung
3336b057d6 xtensa: Move saving of a0 register to match upstream
Upstream xtensa exception handling will save PS, PC, and a0 registers
together when saving a minimal context. This commit ppdates the xtensa
exception handling to match upstream behavior.
2022-02-03 17:08:14 +08:00
laokaiyao
cf049e15ed esp8684: rename target to esp32c2 2022-01-19 11:08:57 +08:00
morris
705788a13f unit_tests: replace legacy timer group with gptimer 2022-01-07 14:59:09 +08:00
Marius Vikhammer
7255497146 freertos: remove FREERTOS_ASSERT option
Freertos asserts are now configured the same way as all other asserts in IDF,
i.e. by configuring COMPILER_OPTIMIZATION_ASSERTION_LEVEL.
2022-01-07 09:16:48 +08:00
morris
869bed1bb5 soc: don't expose unstable soc header files in public api 2022-01-06 23:10:22 +08:00
Sudeep Mohanty
e22b4007d3 esp_hw_support: Removed deprecated CPU util functions
The following files were deleted:
- components/esp_hw_support/include/soc/cpu.h
- components/soc/esp32s3/include/soc/cpu.h

The following functions are deprecated:
- get_sp()

The following functions declared in soc/cpu.h are now moved to esp_cpu.h:
- esp_cpu_configure_region_protection()

The following functions declared in soc/cpu.h are now moved to components/xtensa/include/esp_cpu_utils.h:
- esp_cpu_process_stack_pc()

All files with soc/cpu.h inclusion are updated to include esp_cpu.h instead.

Signed-off-by: Sudeep Mohanty <sudeep.mohanty@espressif.com>
2021-12-28 16:58:37 +05:30
Harshit Malpani
2c84db95d2 freertos: fix build warnings with -Wsign-conversion CFLAG
Closes https://github.com/espressif/esp-idf/issues/4946
2021-12-27 13:31:34 +05:30
Ivan Grokhotkov
2dd6b66375 Merge branch 'contrib/github_pr_8107' into 'master'
Fix GDB backtraces in optimized builds (GitHub PR)

Closes IDFGH-6444

See merge request espressif/esp-idf!16436
2021-12-24 11:47:34 +00:00
Ivan Grokhotkov
a13fcc00db Merge branch 'bugfix/freertos_appcpu_int_disable' into 'master'
freertos: ensure interrupts are disabled before enabling tick timer

See merge request espressif/esp-idf!16460
2021-12-24 11:45:07 +00:00
Omar Chebib
fcd11ba125 FreeRTOS: Remove task_snapshot inclusion from task.h
Remove ESP's addition of task_snapshot.h from task.h. This line was
added previously for backward compatibility. For IDF v5.0, this can
be removed.
2021-12-21 07:10:22 +00:00
Ivan Grokhotkov
5d32e80ea7 freertos: ensure interrupts are disabled before enabling tick timer
xPortStartScheduler calls vPortSetupTimer -> _frxt_tick_timer_init,
which enables tick timer interrupt and sets up the first timeout.
From that point on, the interrupt can fire. If the interrupt happens
while _frxt_dispatch is running, the scheduler will enter an infinite
loop. This is because _frxt_dispatch isn't supposed to be preemptable,
and the tick interrupt will overwrite some of the registers used by
_frxt_dispatch.
Note that this situation doesn't practically occur on the real
hardware, where the execution of vPortSetupTimer and _frxt_dispatch
happens quickly enough. However it can be reproduced on an emulator
if the tick period is set to 1ms.

Add an explicit call to portDISABLE_INTERRUPTS in xPortStartScheduler
to guarantee that _frxt_dispatch doesn't run with interrupts enabled.
This is similar to the esprv_intc_int_set_threshold(1); call in
RISC-V version of port.c.
2021-12-20 17:25:56 +01:00
Dániel Buga
a02d1e35ee Allow enabling task function wrappers in more cases 2021-12-17 11:17:21 +01:00
Ivan Grokhotkov
5b3b5f006f Merge branch 'feature/cmake_weak_deps_helper' into 'master'
cmake: add idf_component_optional_requires utility function, simplify some component dependencies

Closes IDF-3086

See merge request espressif/esp-idf!16373
2021-12-16 13:46:45 +00:00
Sudeep Mohanty
07bfc09d0c Merge branch 'task/remove-portmacro.h-from-task.h' into 'master'
freertos: remove portmacro.h inclusion from task.h

Closes IDF-3793

See merge request espressif/esp-idf!16307
2021-12-15 11:17:51 +00:00
Ivan Grokhotkov
8df306ab60 freertos,esp_system: make dependencies on some components optional
Dependencies on gdbstub, espcoredump, app_trace will only be added
if these components are present in the build.
2021-12-13 18:39:49 +01:00
Cao Sen Miao
e81841318f CI: Enable ESP8684 build stage CI on master 2021-12-13 19:18:47 +08:00
Sudeep Mohanty
ee9a102841 freertos: remove portmacro.h inclusion from task.h
This commit removes the portmacro.h include from task.h as portmacro.h
gets pulled in via FreeRTOS.h. This aligns with upstream FreeRTOS code.

Signed-off-by: Sudeep Mohanty <sudeep.mohanty@espressif.com>
2021-12-13 14:33:37 +05:30
Jakob Hasse
2e1c7d876c Merge branch 'bugfix/minimal_stacksize_watchpoint_aware' into 'master'
[freertos]: Changed minimal stack size to regard watchpoint usage

See merge request espressif/esp-idf!16269
2021-12-08 02:57:11 +00:00