Commit Graph

670 Commits

Author SHA1 Message Date
Jiang Jiang Jian
fe5ee1041c Merge branch 'bugfix/minimal_stacksize_watchpoint_aware_4.4' into 'release/v4.4'
[freertos]: Changed minimal stack size to regard watchpoint usage (backport v4.4)

See merge request espressif/esp-idf!16303
2021-12-08 10:28:05 +00:00
Jiang Jiang Jian
67fcfc2e02 Merge branch 'feature/freertos_try_enter_critical_v4.4' into 'release/v4.4'
freertos: Add portTRY_ENTRY_CRITICAL() and deprecate legacy spinlock fucntions (v4.4)

See merge request espressif/esp-idf!16040
2021-12-08 10:10:17 +00:00
Jakob Hasse
32077601c4 bugfix (freertos): Changed minimal stack size to regard watchpoint usage 2021-12-08 11:29:09 +08:00
Jiang Jiang Jian
6affb3da3c Merge branch 'bugfix/scheduler_state_query_thread_safety_v4.4' into 'release/v4.4'
freertos: fix thread safety for checking scheduler state (v4.4)

See merge request espressif/esp-idf!16126
2021-12-06 04:02:53 +00:00
Omar Chebib
581f1c4550 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-29 15:31:30 +08:00
Mahavir Jain
41906a8d31 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-25 15:43:07 +05:30
Darian Leung
c5efb55d43 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 18:42:10 +08:00
Darian Leung
466c42c3c1 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-11 16:16:11 +08:00
Darian Leung
7e725751e4 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-11-10 18:34:32 +08:00
Darian
423b6697ac Merge branch 'bugfix/freertos_prvTaskIsTaskSuspended_v4.4' into 'release/v4.4'
freertos: Fix prvTaskIsTaskSuspended check (v4.4)

See merge request espressif/esp-idf!15612
2021-11-04 10:26:54 +00:00
Darian Leung
5ac3b05cbe 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-11-02 14:54:01 +08:00
Darian Leung
efad5e56ae 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-11-02 14:51:17 +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