Commit Graph

1023 Commits

Author SHA1 Message Date
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
Darian Leung
76d4c9f592 freertos: Refactor port_systick
This commit refactors port_systick.c so that all ports (RISC-V vs Xtensa) of
all FreeRTOS implementations (IDF vs Amazon SMP FreeRTOS) use the same set of
tick interrupt functions. Thus, these funcitons are now common:

- vPortSetupTimer() to setup the tick interrupt's timer
- xPortSysTickHandler() that is called on each tick interrupt
2023-04-28 23:03:00 +08:00
Darian Leung
cf595293af freertos: Move port_systick to common directory
This commit moves port_systick to a directory that ia accessible to both
IDF FreeRTOS and Amazon SMP FreeRTOS.
2023-04-28 23:03:00 +08: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
laokaiyao
49f16eefbb esp32h4: checked all the corner stuffs of the removal 2023-04-23 12:03:07 +00:00
laokaiyao
bf2a7b2df6 esp32h4: removed esp32h4 related codes 2023-04-23 12:03:07 +00: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
6587e75251 xtensa: Add bare metal port stub functions for G0 build test
This commit adds "bare metal stubs" xtensa_rtos.h glue layer to mimic a bare
metal OS port. The bare metal stubs don't access any components outside of the
G0 group.
2023-04-18 15:51:38 +08:00
Darian Leung
5fde889a3d xtensa: Remove OS agnostic files from Amazon SMP FreeRTOS port
The previous commit moved the OS agnostic files from the IDF FreeRTOS port to
the xtensa component, thus can be accessed by both IDF and Amazon SMP FreeRTOS.

This commit removes the redudant copies in the Amazon SMP FreeRTOS port.
2023-04-18 15:51:38 +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
fa4491a56b freertos: Add unit tests for ...WithCaps() functions 2023-04-12 12:00:53 +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
902d8f392d freertos: Fix idf_additions.h include order error
When building for CONFIG_FREERTOS_SMP, "idf_additions.h" was previously
implicitly included by "task.h" so that other ESP-IDF components still have
access to IDF API additions without needing to include "idf_additions.h"
directly.

However, some FreeRTOS headers (e.g., queue.h) will include task.h before
declaring any types (e.g., QueueHandle_t). Thus if any of those types are used
in idf_additions.h, we get a missing type error.

This commit moves the implicity include of idf_additions.h to FreeRTOS.h
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
Sudeep Mohanty
7f6e9cf786 freertos-tests: Fixed failing CI test and added a new test case for vTaskSuspendAll() API
This commit fixes the failing test - Test vTaskSuspendAll allows
scheduling on other cores.
The commit also adds a new test to test the scenario where in an
unpinned task, when unblocked by an ISR can be scheduled on the core
which has the scheduler running.
2023-04-06 08:26:38 +02:00
Marius Vikhammer
bf8934002b freertos: re-enable "mutex released not by owner causes an assert" test in CI 2023-03-24 10:19:51 +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
bd87e61e6f Merge branch 'refactor/freertos_remove_xTaskRemoveFromUnorderedEventList_define' into 'master'
FreeRTOS: Remove xTaskRemoveFromUnorderedEventList compatibility define

See merge request espressif/esp-idf!22813
2023-03-20 19:01:27 +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
Jiang Jiang Jian
3f3a2cf560 Merge branch 'bugfix/fix_systimer_stall_issue_in_lightsleep' into 'master'
rtc_sleep: workaround systimer stall issue during sleep on ESP32C3

See merge request espressif/esp-idf!22739
2023-03-17 14:16:36 +08:00
liuning
14ca81f03f rtc_sleep: workaround systimer stall issue during lightsleep on ESP32C3 2023-03-15 20:33:03 +08:00
Sudeep Mohanty
9b81e2b189 freertos: Schedule tasks unblocked by an ISR on a core with scheduler running if core affinity matches
FromISR APIs would put an unblocked task on the pending ready list if
the scheduler is suspended on the current core, irrespective of the
task's core affinity and the state of the scheduler on the other core.
This commit updates this behavior by allowing tasks to get scheduled on
a core which has the scheduler running as long as the task's core
affinity allows it.
2023-03-15 07:43:33 +00: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
morris
f8d68efcbf Merge branch 'bugfix/atomic_gptimer_fsm' into 'master'
gptimer: fix race condition between start and stop

See merge request espressif/esp-idf!22620
2023-03-11 09:40:17 +08:00
Darian
a8948eb130 Merge branch 'refactor/xtensa_default_vectors' into 'master'
Xtensa: Move default vectors back into xtensa_vectors.S

Closes IDF-7022

See merge request espressif/esp-idf!20512
2023-03-11 01:00:48 +08:00
morris
2d52334e5d gptimer: fix race condition between start and stop
Added state transition in gptimer_start/stop functions.
So that it's not possible to make a stopped timer continue to run
because of race condition.
2023-03-10 23:27:29 +08:00
Darian Leung
29ec3fbacf xtensa: Move default vectors back into xtensa_vectors.S
The default implementation of some xtensa vectors were previously moved to
"xtensa_vector_defaults.S" as weak functions so that they could be overriden.

This commit moves these default vectors back into "xtensa_vectors.S" in
preparation for further refactoring of the xtensa component.
2023-03-10 13:59:01 +08:00
Zim Kalinowski
44df8624ed Merge branch 'bugfix/freertos-fix-ignored-warnings' into 'master'
freertos: fix and re-enable no-format warnings

Closes IDF-6798

See merge request espressif/esp-idf!22638
2023-03-10 13:58:45 +08:00
Darian
77ca79a5e9 Merge branch 'refactor/freertos_check_scheduler_suspend_asserts' into 'master'
FreeRTOS(IDF): Refactor configASSERTs for scheduler suspension

Closes IDF-5889

See merge request espressif/esp-idf!22576
2023-03-09 20:19:57 +08:00
Zim Kalinowski
70ba19b806 freertos: fix and re-enable no-format warnings 2023-03-09 12:43:11 +01:00
Darian Leung
353b25410a freertos: Refactor configASSERTs for scheduler suspension
This commit adds a common macro for the differing configASSERT() calls that
check if the scheduler is suspended outside a critical section. This macro
allows vanilla behavior to be restored for single core builds. Also added
comments explaining why xTaskGetSchedulerState() is called instead when
building for SMP.
2023-03-07 18:12:15 +08:00
Darian Leung
e21ab0332b freertos(IDF): Refactor port heap functions
Vanilla FreeRTOS expects applications to use one of the heap implementations
provided by FreeRTOS (i.e., heap_x.c), where functions such as pvPortMalloc()
and vPortFree() are defined in the heap implementation.

However, ESP-IDF already provides its own heap implementation
(i.e., esp_heap_caps.h). Thus, the pvPortMallc()/vPortFree() functions were
previously overriden by macro to call esp_heap functions directly.

This commit refactors the FreeRTOS port's heap as such:

- Added a heap_idf.c that implements all of the heap related functions required
  by FreeRTOS source
- All dynamic memory allocated by FreeRTOS is from internal memory. Thus, the
  FreeRTOS heap is the internal memory subset of the ESP-IDF heap.
- Removed some old macros to reduce diff from upstream source code.
2023-03-06 16:00:29 +08:00
Darian Leung
c97523ae0a freertos: Fix stream buffer send-receive test
The stream buffer send-receive test preivously contained the following bugs:

- "sender" task would send 101 bytes instead of 100
- The main task would return before "sender" task sends its 101st item. Thus
  the sender task would cause memory corruption when accessing "tc" structure
  allocated on the main task's stack

This commit fixes and simplifies the stream buffer test.
2023-02-23 12:52:28 +08:00
Alexey Lapshin
25cb9b3f0e Merge branch 'fix/freertos-clang-riscv-port' into 'master'
freertos: riscv: implement vPortTaskWrapper with asm only

Closes IDF-6347

See merge request espressif/esp-idf!22199
2023-02-22 05:52:15 +08:00
Alexey Lapshin
d1214aef8c freertos: riscv: fix vPortTaskWrapper for clang 2023-02-20 13:09:42 +08:00
Cao Sen Miao
fd3e0b0b18 esp32h2(ci): enable target test 2023-02-15 10:20:43 +08:00
Marius Vikhammer
25abc7f6d8 ci: update idf-core related tests for C6 2023-02-13 13:01:57 +08:00
Darian Leung
903ac5dff9 freertos(IDF): Update IDF FreeRTOS linker fragment file
This commit updates the linker fragment file for IDF 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
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
Darian Leung
0574e63e6f freertos: Add linker fragments for common functions
This commit adds a separate linker fragment file "linker_common.lf" for the
functions in "port_common.c". The placement rules are now clearly specified
inside the linker fragment file.
2023-02-01 15:09:46 +08:00
Jakob Hasse
9991862a10 fix(linux): fix build errors and warnings, remove ignore file 2023-01-18 09:24:28 +08:00
Cao Sen Miao
94120b82c2 esp32h2: add build test 2023-01-17 10:29:04 +08:00
morris
f7c3d791a2 Merge branch 'feature/systimer_support_esp32h2' into 'master'
systimer: assign counter and alarm in esp_hw_support

Closes IDF-6484, IDF-5323, and IDF-6230

See merge request espressif/esp-idf!21984
2023-01-12 11:01:17 +08:00
morris
6c1d98d556 systimer: assign counter and alarm in esp_hw_support 2023-01-10 17:05:49 +08:00