Commit Graph

673 Commits

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