Commit Graph

720 Commits

Author SHA1 Message Date
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
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