Commit Graph

1029 Commits

Author SHA1 Message Date
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
Jakob Hasse
8ebea6f689 bugfix (freertos): Changed minimal stack size to regard watchpoint usage 2021-12-07 10:42:05 +08:00
Sudeep Mohanty
40c1f3e06e freertos: update module handles to struct type
This commit updates the handles for the timer, task and event_group
modules to struct type. This matches upstream freertos source.

Signed-off-by: Sudeep Mohanty <sudeep.mohanty@espressif.com>
2021-12-06 08:37:06 +05:30
Simon
e9f3f56ba1 Merge branch 'refactor/delete_clk_header' into 'master'
cleanups: Delete some deprecated headers to make idf cleaner(clk.h esp_cache_err.h)

Closes IDF-4294

See merge request espressif/esp-idf!16012
2021-11-29 07:31:55 +00:00
Cao Sen Miao
eddc196081 esp_clk: refactor target/clk.h to private/esp_clk.h 2021-11-26 14:56:30 +08:00
lisekt84
b3e0c9213a freertos: Fix loss of precision in pdTICKS_TO_MS
Closes https://github.com/espressif/esp-idf/pull/7856
Closes https://github.com/espressif/esp-idf/issues/7853

[darian@espressif.com: Updated commit message]
Signed-off-by: Darian Leung <darian@espressif.com>
2021-11-25 21:55:39 +08:00
Mahavir Jain
140efc3857 Merge branch 'bugfix/scheduler_state_query_thread_safety' into 'master'
freertos: fix thread safety for checking scheduler state

Closes IDFGH-6041

See merge request espressif/esp-idf!16097
2021-11-25 07:31:33 +00:00
Darian Leung
289730820b freertos: Add missing INCLUDE_ configurations for some functions
This commit adds missing INCLUDE_ configurations to FreeRTOSConfig.h for
the following functions:

- xTaskAbortDelay()
- xTaskGetHandle()

Unit tests for these functions were also added.

Closes https://github.com/espressif/esp-idf/issues/7902
2021-11-25 00:04:07 +08:00
Mahavir Jain
5d40016ddb freertos: fix thread safety for checking scheduler state
This issue was earlier fixed in commit 79e74e5d5f
but during migration to newer FreeRTOS release, it got introduced again.

This commit fixes thread safety issues with configASSERT() calls
regarding the value of uxSchedulerSuspended. A false negative
occurs if a context switch to the opposite core occurs in between
the getting the core ID and the assesment.

Relevant https://github.com/espressif/esp-idf/issues/4230
Closes https://github.com/espressif/esp-idf/issues/7726
Closes IDFGH-6041
2021-11-24 14:34:40 +05:30
Darian Leung
9b3796d2f1 freertos: Add portTRY_ENTRY_CRITICAL() and deprecate legacy spinlock fucntions
Add TRY_ENTRY_CRITICAL() API to all for timeouts when entering critical sections.
The following port API were added:
- portTRY_ENTER_CRITICAL()
- portTRY_ENTER_CRITICAL_ISR()
- portTRY_ENTER_CRITICAL_SAFE()

Deprecated legacy spinlock API in favor of spinlock.h. The following API were deprecated:
- vPortCPUInitializeMutex()
- vPortCPUAcquireMutex()
- vPortCPUAcquireMutexTimeout()
- vPortCPUReleaseMutex()

Other Changes:
- Added portMUX_INITIALIZE() to replace vPortCPUInitializeMutex()
- The assembly of the critical section functions ends up being about 50 instructions longer,
  thus the spinlock test pass threshold had to be increased to account for the extra runtime.

Closes https://github.com/espressif/esp-idf/issues/5301
2021-11-22 13:28:39 +08:00
Roland Dobai
766aa57084 Build & config: Remove leftover files from the unsupported "make" build system 2021-11-11 15:32:36 +01:00
Omar Chebib
9d5923a13e IPC: Move ipc sources to esp_system
IPC shall be put back into esp_system as it is an 'OS additions'.
2021-11-11 10:30:01 +08:00
Zim Kalinowski
04d80db499 freertos: Move Espressif's specific esp_reent_init into collective ifdef 2021-11-10 10:55:05 +08:00
Omar Chebib
8376276b14 FreeRTOS: Fix xStreamBufferReset function always crashing
This function resets the spinlock given as a parameter after taking it
(when entering the critical section). This then results in a panic once
it tries to exit the same critical section.

* Closes https://github.com/espressif/esp-idf/issues/7725
2021-11-09 14:04:02 +08:00
Cao Sen Miao
09487761cf ESP8684: add freertos, hal, esp_system support 2021-11-06 17:33:44 +08:00
Darian Leung
8babb3bca6 freertos: Fix SMP round robin scheduling
The previous SMP freertos round robin would skip over tasks when
time slicing. This commit implements a Best Effort Round Robin
where selected tasks are put to the back of the list, thus
makes the time slicing more fair.

- Documentation has been updated accordingly.
- Tidy up vTaskSwitchContext() to match v10.4.3 more
- Increased esp_ipc task stack size to avoid overflow

Closes https://github.com/espressif/esp-idf/issues/7256
2021-11-02 14:00:14 +08:00
Sudeep Mohanty
4846222102 freertos: update freertos folder structure to match upstream
The following changes have been made:
1. All FreeRTOS kernel source files are now placed in the
   freertos/FreeRTOS-Kernel folder to match with the upstream folder structure.
2. All kernel include files are now placed in freertos/FreeRTOS-Kernel/include.
3. All port files are now placed in freertos/FreeRTOS-Kernel/portable.
4. All additions/customizations are placed in freertos/esp_additions.
5. All other miscellaneous files (README, License files etc.) are moved to
   freertos/FreeRTOS-Kernel folder to match with the upstream.
6. Updated esp-cryptoauthlib to latest commit to resolve FreeRTOS
   include dependencies.

Signed-off-by: Sudeep Mohanty <sudeep.mohanty@espressif.com>
2021-10-29 12:05:13 +08:00
Jakob Hasse
7efb01846f [cxx]: simple spi master class
* spi cxx unit test (CATCH-based, on host)
* added portmacro.h to driver mocking
* added simple testing app to write/read SPI,
  using an MPU9250
2021-10-25 14:56:59 +08:00
Darian
e5f5eb3cbb Merge branch 'refactor/freertos_deprecate_critical_nested_macros' into 'master'
freertos: Deprecate critical nested macros

Closes IDF-4036

See merge request espressif/esp-idf!15539
2021-10-23 07:42:15 +00:00
Darian
1591c4eb33 Merge branch 'feature/freertos_static_allocation_task_memory_callbacks' into 'master'
freertos: Add memory hooks for static IDLE and Timer tasks

Closes IDF-2243 and IDFGH-5804

See merge request espressif/esp-idf!15545
2021-10-23 07:20:30 +00:00
Darian Leung
0df4e80b97 freertos: Fix prvTaskIsTaskSuspended check
This commit fixes prvTaskIsTaskSuspended(). Both pending ready lists
should be checked to confirm that is truly suspended.

Closes https://github.com/espressif/esp-idf/issues/7564
2021-10-22 13:17:29 +08:00
Darian Leung
d6f2fa4bab freertos: Remove critical nested macros
This commit removes the following critical nested macros as follows:

- portENTER_CRITICAL_NESTED()
- portEXIT_CRITICAL_NESTED()

They are replaced with portSET_INTERRUPT_MASK_FROM_ISR() and
portCLEAR_INTERRUPT_MASK_FROM_ISR() which are the proper FreeRTOS interfaces.

Created a portmacro_deprecated.h for each port to contain deprecated API
that were originally from portmacro.h
2021-10-22 13:17:20 +08:00
Darian Leung
359a3d396d freertos: Add memory hooks for static IDLE and Timer tasks
This commit adds the following hook functions to obtain memory
for the IDLE and Timer Daemon tasks when configSUPPORT_STATIC_ALLOCATION
is enabled:

- vApplicationGetIdleTaskMemory()
- vApplicationGetTimerTaskMemory()

Currently, both functions simply allocate from the same memory as
regular tasks (i.e., internal memory for both the stack and TCB)

Closes https://github.com/espressif/esp-idf/issues/7511
2021-10-22 12:21:15 +08:00
morris
e2275b1f63 gptimer: clean up hal and ll for driver-ng 2021-10-20 18:40:08 +08:00
Zim Kalinowski
53f47ab2fa Merge branch 'feature/add-conditional-section-tags-in-freertos-source-files' into 'master'
freertos: added doxygen section tags for conditional documentation

Closes IDF-3871 and IDF-3872

See merge request espressif/esp-idf!15442
2021-10-11 08:46:32 +00:00
Zim Kalinowski
2c4d8ee6fa Merge branch 'feature/freertos-upgrade-rename-processors-to-cores' into 'master'
freertos: Introduce configNUM_CORES

Closes IDF-4119

See merge request espressif/esp-idf!15375
2021-10-11 06:03:41 +00:00
Sudeep Mohanty
52050ed883 freertos: added doxygen section tags for conditional documentation
Added DOC_EXCLUDE_SECTION section tag to conditionally remove sections
from FreeRTOS source files which we don't want in IDF API docs.
Added DOC_SINGLE_GROUP section tag to enable a flat document for
FreeRTOS and removing groups.
With these conditional tags, we can upstream FreeRTOS files without
affecting the upstream documentation.

Signed-off-by: Sudeep Mohanty <sudeep.mohanty@espressif.com>
2021-10-11 09:24:41 +05:30
Zim Kalinowski
4b8f96c73f resolve conflicts 2021-10-04 09:02:12 +08:00
Zim Kalinowski
d98b3948b8 Merge remote-tracking branch 'origin/master' into feature/github-5838 2021-10-04 08:38:39 +08:00
Zim Kalinowski
11329a0ce5 rename processors to cores
(cherry picked from commit a0d3afcac63bb62516daa3abd316091a1601c08c)
2021-10-01 21:23:17 +08:00
Zim Kalinowski
6590cc7616 freertos: upgrade to 10.4.3 - rename xaskRemoveFromUnorderedEventList
(cherry picked from commit e91586b57e19a3776c7c675f62c0afeebd19c294)
2021-10-01 13:28:42 +08:00
Darian Leung
e194113964 freertos: Tidy up port files
- port.c and portmacro.h contents are now logically grouped
- Doxygen API descriptions added
- Added refactor todo markers
- Removed portmacro_priv.h. Contents now in portmacro.h
- Formatted files
2021-09-24 18:14:33 +08:00
Zim Kalinowski
d37ed3e05b freertos: upgrade to 10.4.3 - try to add portDONT_DISCARD 2021-09-22 09:11:44 +08:00
Sudeep Mohanty
7eb75428d5 Merge branch 'feature/freertos-upgrade-to-10.4.3-FreeRTOSConfig.h-location-update' into 'master'
freertos: updated the location of FreeRTOSConfig.h

Closes IDF-3721

See merge request espressif/esp-idf!15119
2021-09-15 07:11:12 +00:00
Zim Kalinowski
da65a010a3 fixed invalid taskEXIT_CRITICAL 2021-09-14 15:03:46 +08:00
Sudeep Mohanty
0912df611f freertos: updated the location of FreeRTOSConfig.h
Moved FreeRTOSConfig.h from include/freertos to include/esp_additions/freertos.
Updated FreeRTOS.h file to include FreeRTOSConfig.h without the
freertos/ prefix to match with the upstream file.
Renamed architecture specific FreeRTOSConfig.h files to FreeRTOSConfig_arch.h

Signed-off-by: Sudeep Mohanty <sudeep.mohanty@espressif.com>
2021-09-14 08:46:01 +05:30
Zim Kalinowski
fa56351261 Merge branch 'feature/freertos-upgrade-to-10.4.3-extras' into 'master'
freertos: upgrade to 10.4.3 -- extras from SMP base

See merge request espressif/esp-idf!15144
2021-09-13 03:44:18 +00:00
Zim Kalinowski
59f6087b55 Merge branch 'feature/freertos-upgrade-to-10.4.3-reconcile-traces' into 'master'
freertos: upgrade to 10.4.3 - reconcile traces

See merge request espressif/esp-idf!15104
2021-09-10 10:18:20 +00:00
Bao Hong De
7fc071e133 Merge branch 'feature/high_level_interrupt_in_bluetooth' into 'master'
Bluetooth: High level interrupt in bluetooth

See merge request espressif/esp-idf!11156
2021-09-10 09:50:39 +00:00
Zim Kalinowski
f3b3c1697c added vApplication... prototypes to tasks.h 2021-09-10 09:37:01 +08:00
baohongde
006a10b050 components/doc: Update doc about high-level interrupt
some bugfix.
2021-09-09 20:40:09 +08:00
Zim Kalinowski
5f522cd6f3 freertos: upgrade to 10.4.3 -- extras 2021-09-09 11:54:47 +08:00
baohongde
e2fb413329 components/bt: add config option to choose Bluetooth intterupt level. 2021-09-09 11:29:17 +08:00
baohongde
8a4696d25a components/os: Fix live lock int bt isr using ocd multicore debug
components/os: Fix live lock in bt isr immediately
2021-09-09 11:29:08 +08:00
baohongde
d1db2df316 components/bt: High level interrupt in bluetooth
components/os: Move ETS_T1_WDT_INUM, ETS_CACHEERR_INUM and ETS_DPORT_INUM to l5 interrupt

components/os: high level interrupt(5)

components/os: hli_api: meta queue: fix out of bounds access, check for overflow

components/os: hli: don't spill registers, instead save them to a separate region

Level 4 interrupt has a chance of preempting a window overflow or underflow exception.
Therefore it is not possible to use standard context save functions,
as the SP on entry to Level 4 interrupt may be invalid (e.g. in WindowUnderflow4).

Instead, mask window overflows and save the entire general purpose register file,
plus some of the special registers.
Then clear WindowStart, allowing the C handler to execute without spilling the old windows.
On exit from the interrupt handler, do everything in reverse.

components/bt: using high level interrupt in lc

components/os: Add DRAM_ATTR to avoid feature `Allow .bss segment placed in external memory`

components/bt: optimize code structure

components/os: Modify the BT assert process to adapt to coredump and HLI

components/os: Disable exception mode after saving special registers

To store some registers first, avoid stuck due to live lock after disabling exception mode

components/os: using dport instead of AHB in BT to fix live lock

components/bt: Fix hli queue send error

components/bt: Fix CI fail

# Conflicts:
#	components/bt/CMakeLists.txt
#	components/bt/component.mk
#	components/bt/controller/bt.c
#	components/bt/controller/lib
#	components/esp_common/src/int_wdt.c
#	components/esp_system/port/soc/esp32/dport_panic_highint_hdl.S
#	components/soc/esp32/include/soc/soc.h
2021-09-09 11:29:06 +08:00
Zim Kalinowski
538911e9ee reconcile traces 2021-09-07 15:57:50 +08:00
Sudeep Mohanty
3b40d77584 freertos: move esp_compiler.h include from FreeRTOS.h
Moved the inclusion of esp_compiler.h from FreeRTOS.h to
the app specific FreeRTOSConfig.h where the unlikely()
macro is used. This change is in alignment with the upstream
FreeRTOS.h file.

Signed-off-by: Sudeep Mohanty <sudeep.mohanty@espressif.com>
2021-09-07 13:12:04 +05:30
Sudeep Mohanty
1a19014d3d Merge branch 'feature/move-esp-macros-from-freetos-upstream-files' into 'master'
freertos: remove xSemaphoreAltTake/Give macros from semphr.h

Closes IDF-3814

See merge request espressif/esp-idf!15088
2021-09-07 04:45:18 +00:00
Zim Kalinowski
8f06bf6e44 freertos: upgrade to 10.4.3 - missing code layout changes
(cherry picked from commit 46477d85bb43aafac688747ad0c4090030410e3a)
2021-09-07 10:31:26 +08:00
Sudeep Mohanty
46d54990d8 freertos: remove xSemaphoreAltTake/Give macros from upstream files
xSemaphoreAltTake and xSemaphoreAltGive are Espressif defined macros and
are not being used. The respective definitions, xQueueAltGenericReceive
and xQueueAltGenericSend are also not part of current FreeRTOS source
(v10.4.3). Hence, removed xSemaphoreAltTake and xSemaphoreAltGive
definitions to align with upstream code.

Signed-off-by: Sudeep Mohanty <sudeep.mohanty@espressif.com>
2021-09-06 15:55:23 +05:30
Zim Kalinowski
ef75b5a188 Merge branch 'feature/zim-freertos-upgrade-missing-files-etc' into 'master'
freertos: upgrade to 10.4.3 - missing files from upstream

See merge request espressif/esp-idf!15061
2021-09-06 06:40:04 +00:00
Zim Kalinowski
3f2f6d0cf5 freertos: upgrade to 10.4.3 - missing files from upstream 2021-09-06 14:39:48 +08:00
Zim Kalinowski
cbb087ae9c Merge branch 'zim-marking-vtasksuspendall' into 'master'
freertos: clearly marking vTaskSuspendAll and a few other small cleanups

See merge request espressif/esp-idf!15048
2021-09-06 06:01:28 +00:00
Zim Kalinowski
61ac7c3368 freertos: upgrade - indexed notifications 2021-09-06 12:46:14 +08:00
Zim Kalinowski
b7dbd3ffc1 Merge branch 'zim-xtaskdelayuntil-and-a-few-minor' into 'master'
freertos: upgrade to 10.4.3 - xTaskDelayUntil change and a few minor changes

See merge request espressif/esp-idf!15011
2021-09-02 10:01:16 +00:00
Zim Kalinowski
704a092550 freertos: upgrade to 10.4.3 - xTaskDelayUntil change and a few minor changes 2021-09-02 18:01:08 +08:00
Zim Kalinowski
07bd686471 marking vTaskSuspendAll and a few other small cleanups
(cherry picked from commit dc61510249fe441189ea1ca557deb9f003bbd374)
2021-09-02 15:20:19 +08:00
Zim Kalinowski
701c4fb2e3 upgrade freertos version and history 2021-09-02 11:02:34 +08:00
Omar Chebib
92cf321677 freertos: add kconfig options for task snapshot functions
Task snapshots is required by other modules that don't use gdbstub
or core dump. Add a Kconfig option to manage these possibilities.
2021-09-01 15:13:48 +08:00
Zim Kalinowski
268eace13a Merge branch 'zim-some-esp-platform-markers' into 'master'
freertos: several ESP specific things clearly marked

See merge request espressif/esp-idf!14995
2021-08-31 02:33:00 +00:00
Zim Kalinowski
4bad316700 freertos: several ESP specific things clearly marked 2021-08-31 10:32:54 +08:00
Zim Kalinowski
29ae014fd6 remaining <pre> to @code changes 2021-08-30 15:13:27 +08:00
Zim Kalinowski
39046c5e3e Merge branch 'zim-reduce-esp-specific-code' into 'master'
freertos: Reduce ESP specific code

See merge request espressif/esp-idf!14969
2021-08-30 06:45:36 +00:00
Zim Kalinowski
5f2a66a8a5 freertos: Reduce ESP specific code 2021-08-30 14:45:31 +08:00
Zim Kalinowski
b843eb61a7 Merge branch 'zim-cherrypicked-coroutine' into 'master'
freertos: upgrade to 10.4.3 - vCoRoutineSchedule fix

See merge request espressif/esp-idf!14942
2021-08-30 04:46:28 +00:00
Zim Kalinowski
0583bda9c7 Merge branch 'zim-fix-defines-in-doc' into 'master'
freertos: fix defines in documentation

See merge request espressif/esp-idf!14987
2021-08-30 03:36:20 +00:00
Zim Kalinowski
41c0e44185 freertos: Upgrade to 10.4.3 - timers
(cherry picked from commit c22a4c355603318a16adb3b898943744d9b826a5)
2021-08-30 10:10:29 +08:00
Zim Kalinowski
13360ab126 fix defines in doc 2021-08-29 21:02:33 +08:00
sU8U7SfkcwTJVH7PjaVmej7D
91a40044f5 [freertos] Silence sign-conversion warning 2021-08-26 12:36:46 +02:00
Zim Kalinowski
a8c7db62be freertos: cherrypicked code layout changes from freertos upgrade branch 2021-08-26 13:45:51 +08:00
Zim Kalinowski
12bf160f3d vCoRoutineScheduleFix
(cherry picked from commit 1edbd44db107225b7bc6342a7da5680cc12ad22f)
2021-08-25 15:59:00 +08:00
Zim Kalinowski
ff56848a0e revert dependency
integrating changes from upstream
2021-08-17 16:10:45 +08:00
Omar Chebib
32067f9b6b Merge branch 'feature/freertos_snapshot_extraction' into 'master'
freertos: take tasks snapshot out of tasks.c source code

Closes IDF-3334

See merge request espressif/esp-idf!14675
2021-08-16 11:04:51 +00:00
Omar Chebib
83c9e1b223 freertos: take tasks snapshot out of tasks.c source code 2021-08-16 10:29:36 +08:00
KonstantinKondrashov
263c10cee1 freertos: Fix settings of systimer for SysTicks in case Unicore
systimer was stopped because the option SYSTIMER_TIMER_UNIT1_CORE1_STALL_EN is set by default 1, it blocks counting.
For Unicore should be:
SYSTIMER_TIMER_UNIT1_CORE0_STALL_EN  1
SYSTIMER_TIMER_UNIT1_CORE1_STALL_EN  0
2021-08-12 12:30:52 +05:00
Zim Kalinowski
afc77dbc5a freertos: Sync safe changes from Amazon SMP branch 2021-08-10 05:13:43 +08:00
Jakob Hasse
c9984faaef [mocks]: freertos mock
[esp_event]: added preliminary host-based tests
2021-08-06 17:08:21 +08:00
Sachin Parekh
6582f7070e Update tests for assert and abort
- Place panic_abort in IRAM
- Added abort, assert test case in case of cache disabled
- Expect assert instead of abort in a freertos_mutex test
2021-08-05 11:09:22 +05:30
Zim Kalinowski
1fd56e0b87 Merge branch 'feature/systimer_generate_rtos_tick' into 'master'
freertos(esp32s3): SysTick uses systimer

Closes IDF-2613

See merge request espressif/esp-idf!12246
2021-08-04 12:33:52 +00:00
Konstantin Kondrashov
29f581fc70 freertos(esp32s3): SysTick uses systimer 2021-08-04 20:33:44 +08:00
Mahavir Jain
77900888f7 Merge branch 'bugfix/uninitialized_tasknumber' into 'master'
fix(FreeRTOS): Initialize uxTaskNumber at task initialization

Closes IDFGH-1815

See merge request espressif/esp-idf!14620
2021-08-04 12:12:08 +00:00
Konstantin Kondrashov
4972605b16 esp_common: Add API for IPC to run small pieces of code on the other CPU, in the context of the level 4 interrupt 2021-08-03 14:35:29 +08:00
Gautier Seidel
5a5e710225 fix(FreeRTOS): Initialize uxTaskNumber at task initialization
Signed-off-by: Laukik Hase <laukik.hase@espressif.com>

Closes https://github.com/espressif/esp-idf/pull/4025
2021-08-03 10:42:09 +05:30
Craig Kewley
99e2f970c3 doc: freertos: fix function name typo
Closes https://github.com/espressif/esp-idf/pull/7265
Closes IDFGH-5539
2021-07-28 19:04:15 +08:00
Konstantin Kondrashov
9c870b74bb Merge branch 'bugfix/freertos_ut_suspend' into 'master'
freertos: Increases delta for UT - Test suspend-resume CPU. The number of...

Closes IDFCI-688

See merge request espressif/esp-idf!14403
2021-07-21 06:07:34 +00:00
Ivan Grokhotkov
c28612cd2b Merge branch 'bugfix/freertos_coproc_save_area_alignment' into 'master'
freertos: Apply upstream stack masking fix for xtensa/port.c (Github PR)

Closes IDFGH-5549

See merge request espressif/esp-idf!14379
2021-07-20 09:00:04 +00:00
KonstantinKondrashov
84e5f52a26 freertos: Increases delta for UT - Test suspend-resume CPU. The number of tick_hook should be the same for both CPUs 2021-07-16 18:26:02 +05:00
Renz Bagaporo
7c22cccb9c esp32: cleanup build script 2021-07-16 20:14:27 +08:00
Axel Lin
6c2aa59b51 freertos: Apply upstream stack masking fix for xtensa/port.c
Link: 6a5784598a (diff-cfa9a8b71a9665b5610f59bd2f56cb81b3ee73beaa6cac3fc965884069588d47)
Signed-off-by: Axel Lin <axel.lin@gmail.com>

Merges https://github.com/espressif/esp-idf/pull/7274
2021-07-15 11:55:41 +02:00
Jakob Hasse
f6031d469b [cxx]: No ##__VA_ARGS__ in public header files
* ##__VA_ARGS__ is replaced by __VA_OPT__(,)
  and __VA_ARGS if C++20 is used.
* Affected header files are: esp_log.h,
  portmacro.h and esp_check.h

* Closes https://github.com/espressif/esp-idf/pull/6692
2021-07-15 17:05:57 +08:00
Vladimir Chistyakov
1d74652b5e Fix portGET_ARGUMENT_COUNT macro
portGET_ARGUMENT_COUNT uses a GCC extension ##__VA_ARGS__. It forces
the user to compile the code with GNU extensions enabled instead of ISO
language standard. The suggested change is to replace ##__VA_ARGS__ with
__VA_OPT__(,) __VA_ARGS__ which is supported by the current version of
GCC used in ESP-IDF for both C and C++ ISO standards.

This fix would enable ESP-IDF users to compile their code with ISO C++20
standard in future releases.

Signed-off-by: Jakob Hasse <jakob.hasse@espressif.com>
2021-07-15 17:01:31 +08:00
Shu Chen
ee23a489b9 esp32h2: code clean up 2021-07-01 19:53:50 +08:00
Shu Chen
6fce2930d0 esp32h2: enable more components to support esp32h2
Involved components:
 * app_trace
 * esp-tls
 * esp_adc_cal
 * esp_pm
 * esp_serial_slave_link
 * esp_timer
 * freertos
 * idf_test
 * log
 * mbedtls
 * newlib
 * perfmon
 * spi_flash
 * spiffs
 * ulp
 * unity
 * vfs
2021-07-01 19:53:11 +08:00
Angus Gratton
a413cbd784 Merge branch 'feature/esp_timer_with_skip_unhandled_events_does_not_wake_up' into 'master'
esp_timer: A timer with skip_unhandled_events won't wake up in light sleep mode

See merge request espressif/esp-idf!13219
2021-06-29 08:10:51 +00:00
Ivan Grokhotkov
d7928bf1db Merge branch 'feature/esp32c3_apptrace' into 'master'
apptrace: refactoring & esp32c3 support

See merge request espressif/esp-idf!11702
2021-06-28 06:00:24 +00:00
Alexey Gerenkov
20fd09728f apptrace: Adds ESP32-C3 support 2021-06-24 13:16:14 +03:00
Alexey Gerenkov
821869d98d apptrace: Refactors apptrace for better support various tracing HW 2021-06-24 13:16:13 +03:00
Fu Hanxi
cb46558c30 ci: update performance test key to db compatible format 2021-06-21 14:17:45 +08:00
KonstantinKondrashov
f9ad16bb66 esp_timer: Timers with skip_unhandled_events option won't wake up system from light sleep 2021-06-19 12:45:17 +08:00
Angus Gratton
dc6b950257 doc: Add performance guides for execuion speed, binary size, RAM usage
Closes https://github.com/espressif/esp-idf/issues/7007
Closes https://github.com/espressif/esp-idf/issues/6715
Closes https://github.com/espressif/esp-idf/issues/3781
Closes https://github.com/espressif/esp-idf/issues/2566
2021-06-03 13:55:34 +10:00
Ivan Grokhotkov
38d902f544 Merge branch 'feature/gdbstubs_rt' into 'master'
Extension of GDBStub component for handling GDB by serial port at runtime.

See merge request espressif/esp-idf!10312
2021-05-18 17:14:51 +00:00
Omar Chebib
dda7001c25 freertos: revert minimum stack size from 2304 to 1536 2021-05-14 11:12:28 +08:00
Dmitry
00a7ecb5a3 Code cleanup. Bugfix after rebase with master. Formating. 2021-05-13 15:03:40 +03:00