Commit Graph

48 Commits

Author SHA1 Message Date
David Cermak
a41d360842 freertos/linux: Fix use after scope exit in select() wrap 2023-05-15 10:28:54 +02:00
Darian Leung
66499f17a5 freertos: Refactor component structure
This commit refactors the "freertos" component's structure as follows:

- "FreeRTOSConfig.h" related files moved to "./config" directory
- Refactored CMakeLists.txt file in preparation for v10.5.1 upgrade
    - Grouped list appends based on component organization
    - Removed some unecessarily public "include_dirs"
- Removed FreeRTOS-openocd.c
    - uxTopUsedPriority has been added back to tasks.c since v10.4.2
    - Thus the workaround in FreeRTOS-openocd.c is no longer needed and can
      be removed.
2023-05-08 18:40:03 +08:00
David Cermak
b2af4d9689 lwip/linux: Add lwip support for networking component under linux
linux/lwip: Wrap some IO posix functions
* to workaourd the FreeRTOS EINTR issue (when building without lwip)
* to correctly choose the sub-system based on fd (when building with
lwip) -- passing control to either linux/system or to lwip
This commit also addapts tapio-if to provide DHCP client by default and
configurable settings for static IP
2023-05-05 05:03:39 +00:00
Jakob Hasse
550ecbe37a feat(freertos): added POSIX/Linux simulator port to FreeRTOS SMP
* Added a POSIX/Linux simulator that is compatible with the Amazon
  FreeRTOS SMP API. Note that the simulator itself is still
  single core, like the IDF FreeRTOS POSIX/Linux simulator.
2023-04-25 13:58:57 +08:00
Darian Leung
948010dc0b freertos: Add task creation with caps functions
This commit adds the corresponding CreateWithCaps functions for tasks:

- xTaskCreatePinnedToCoreWithCaps()
- xTaskCreateWithCaps()
- vTaskDeleteWithCaps()

Documentation and migraiton guide have been updated accordingly.

Closes https://github.com/espressif/esp-idf/issues/11216
2023-04-21 15:43:08 +08:00
Darian Leung
b2c074bb70 xtensa: Move Xtensa RTOS porting layer files to xtensa component
When porting an RTOS to the Xtensa architecture, there are a few files that
are common to all Xtensa RTOS ports. These files form the Xtensa RTOS porting
layer (e.g., "xtensa_vectors.S", "xtensa_context.S"). An Xtensa RTOS port is
expected to provide an RTOS specific "xtensa_rtos.h" header to interface with
the Xtensa RTOS porting layer.

Previously, the Xtensa RTOS porting layer files were placed in the FreeRTOS
component. This commit does the following:

1. Moves the Xtensa RTOS porting layer files from the `freertos` component to
the `xtensa` component. The following files were moved:

    - xtensa_asm_utils.h
    - xtensa_context.S
    - xtensa_loadstore_handler.S
    - xtensa_vectors.S

2. Refactored xtensa component include paths to separate Xtensa RTOS porting
layer headers.

- Xtensa HAL headers included via `#include <xtensa/...h>`
- Xtensa RTOS porting layer headers included via `#include <...h>`

Note: The xtensa files in the Amazon SMP FreeRTOS port are not moved/deleted in
this commit to ensure the moved files retain a clean diff history.
2023-04-18 15:28:05 +08:00
Darian Leung
4e7cd2e706 freertos: Add wrapper functions to create objects with capabilities
This commit adds various ...WithCaps() functions to create FreeRTOS objects
with specific memory capabilities.
2023-04-12 12:00:53 +08:00
Darian Leung
478e041ce5 freertos: Add GetStaticBuffer functions
This commit adds the various ...GetStaticBuffer() functions from upstream
FreeRTOS. See https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/641 for more
details.
2023-04-12 11:45:06 +08:00
Darian Leung
b042ed0495 freertos: Uncrustify idf_additions.h 2023-04-07 15:24:34 +08:00
Darian Leung
3d2e674326 freertos: Move private API additions to "freertos_idf_additions_priv.h"
Previously, some IDF FreeRTOS API additions that were meant to be private were
exposed through the same "idf_additions.h" header. This commit moves those
functions to a separate header included via
"esp_private/freertos_idf_additions_priv.h" so that they are not mistaken as
public API by users.

This commit also fixes some missing include and C++ guards in idf_additions.h
2023-04-07 15:24:34 +08:00
Darian Leung
0c21d59716 freertos: Move freertos_tasks_c_additions.h
freertos_tasks_c_additions.h is technically included as source file. This
commit removes the "private_include" directory of "freertos_tasks_c_additions.h"
and treats it as a source file of "esp_additions".
2023-04-07 15:24:34 +08:00
Darian Leung
54deed0566 freertos: Uncrustify FreeRTOSConfig files 2023-03-22 16:32:29 +08:00
Darian Leung
6895e92fd2 freertos: Combine Amazon SMP FreeRTOS and IDF FreeRTOS config files
This commit merges the "FreeRTOSConfig_smp.h" file into the "FreeRTOSConfig.h".
The configurations for all FreeRTOS implementations are now stored in a single
file.
2023-03-22 16:32:29 +08:00
Darian Leung
63f318b85b freertos: Refactor FreeRTOSConfig_arch.h
This commit removes or adds some misplaced configs from the
FreeRTOSConfig_arch.h headers of each architecture.
2023-03-22 16:32:29 +08:00
Darian Leung
05bda6595d freertos: Move FreeRTOSConfig_arch.h
This commit moves the FreeRTOSConfig_arc.h to the "esp_additions" directory
so that they can also be used for SMP FreeRTOS builds.
2023-03-22 16:32:29 +08:00
Darian Leung
4f8c6c6277 freertos: Remove xTaskRemoveFromUnorderedEventList compatibility define
xTaskRemoveFromUnorderedEventList is a scheduler internal function, thus will
never be called by users. Therefore, the compatbility define is not necessary.
2023-03-17 20:15:13 +08:00
Darian Leung
e5559d7903 freertos: Fix flakey task snapshot tests
The task snapshot tests use esp_cpu_stall() to stall the other CPU before
manually walking the task lists. However, it is possible that the other CPU
was also accessing the task lists when esp_cpu_stall() is called, leading to
flakey tests

This commit fixes the test by using a 2-way handshake instead of
esp_cpu_stall().
2023-03-14 16:51:25 +08:00
Darian Leung
321254a776 freertos(SMP): Update SMP FreeRTOS linker fragment file
This commit updates the linker fragment file for Amazon SMP FreeRTOS.

- Linker fragment file's formatting was updated
- Placement rules of functions is now clearly specified inside the linker
  fragment file.
- Some extra functions are now placed in flash in accordance to the new
  placement rules.
2023-02-01 15:15:51 +08:00
Jakob Hasse
83afda922b style(freertos/linux): improved docs and coding style 2022-12-29 12:05:15 +08:00
Darian Leung
c318c89453 freertos(IDF): Remove dependency on portUSING_MPU_WRAPPERS
This commit removes the dependency on portUSING_MPU_WRAPPERS on the Xtensa port
of IDF FreeRTOS. This dependency was added due to a hack implemented in the
upstream port that required the usage of the "xMPUSettings" member of the TCB.
The "xMPUSettings" would be used as a pointer to the task's coprocessor save
area on the stack, even though FreeRTOS MPU support was not available.

The hack has now been removed, and the CPSA pointer is now calculated using
a combination of constant offsets values and the pxEndOfStack member of the
TCB.

Note: This impelemtation was copied from the Xtensa port of Amazon SMP FreeRTOS.
2022-12-23 15:29:17 +08:00
Jakob Hasse
73d9d83a2f feat(freertos): make num of task notifications configurable
Closes https://github.com/espressif/esp-idf/issues/9349
2022-11-15 09:36:42 +01:00
Darian Leung
915787249a freertos(IDF): Provide default value to configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS
This commit updates how configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS is defined
by default it to 0 if not defined elsewhere. Dependent code now check for
"configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1" instead.
2022-11-10 18:37:42 +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
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
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
Jakob Hasse
37e8f1f348 feat(freertos): added event group and stream buffer to linux target 2022-10-31 16:34:23 +01: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
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
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
Marius Vikhammer
15684fb5a0 Freertos SMP: fix wrong no affinity value in kconfig 2022-05-24 09:16:43 +08:00
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
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
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 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
Erhan Kurubas
c5f5c84f67 freertos_additions: add debug params table for openocd 2022-03-11 11:33:08 +01: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
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
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
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
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
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
Jakob Hasse
8ebea6f689 bugfix (freertos): Changed minimal stack size to regard watchpoint usage 2021-12-07 10:42:05 +08: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
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
Zim Kalinowski
11329a0ce5 rename processors to cores
(cherry picked from commit a0d3afcac63bb62516daa3abd316091a1601c08c)
2021-10-01 21:23:17 +08:00
Omar Chebib
83c9e1b223 freertos: take tasks snapshot out of tasks.c source code 2021-08-16 10:29:36 +08:00