Commit Graph

71 Commits

Author SHA1 Message Date
Sudeep Mohanty
0744f4d5a5 freertos: Removed CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION kconfig option
This commit removes the unused FreeRTOS kconfig option
CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION.
2022-11-09 08:14:16 +01: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
37e8f1f348 feat(freertos): added event group and stream buffer to linux target 2022-10-31 16:34:23 +01:00
Sudeep Mohanty
70070989f0 freertos: Enable configUSE_PORT_OPTIMISED_TASK_SELECTION for RISC-V targets
This commit enables the config option
configUSE_PORT_OPTIMISED_TASK_SELECTION on RISC-V targets for legacy
FreeRTOS (IDF-FreeRTOS).
2022-10-17 16:47:21 +02:00
Darian Leung
9f7f964363 freertos: Fix FPU ISR core pinning bug
This commit fixes a bug where if an unpinned task is interrupted by a level 1
ISR that users the FPU, the FPU usage will cause the interrupted task to
become pinned to the current core.

Note: This bug was already fixed in SMP FreeRTOS in commit
d69361779e. This commit simply backports the
fix to IDF FreeRTOS.
2022-10-12 22:45:56 +08:00
Darian Leung
fe0d4f2834 freertos: Refactor riscv port stack initialization code
This commit refactors the pxPortInitialiseStack() function of the riscv
FreeRTOS ports (both IDF and SMP FreeRTOS).

- Each stack area is now separated into their own functions
- Each function will individually
    - Push the stack pointer to allocate the stack area
    - Initiaze the allocated stack area
- Each stack area's size and usage is now clearly documented in code
2022-10-09 14:51:45 +08:00
Darian Leung
282f10d1bc freertos: Refactor xtensa port stack initialization code
This commit refactors the pxPortInitialiseStack() function of the xtensa
FreeRTOS ports (both IDF and SMP FreeRTOS).

- Each stack area is now separated into their own functions
- Each function will individually
    - Push the stack pointer to allocate the stack area
    - Initiaze the allocated stack area
- Each stack area's size and usage is now clearly documented in code
2022-10-09 14:48:30 +08: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
Darian Leung
aa5d74410b freertos: Synchronize tasks.c functions (minor changes) to v10.4.3
This commit synchronizes multiple functions in tasks.c with upstream v10.4.3
that contain minor differences.

The following functions have had their parameter names or code formatting
updated:

- xTaskCreateStaticPinnedToCore()
- xTaskCreatePinnedToCore()
- prvInitialiseNewTask()
- prvTaskIsTaskSuspended()
- vTaskStartScheduler()
- xTaskResumeAll()
- xTaskCheckForTimeOut()
- uxTaskResetEventItemValue()

The following functions have had their missing "xAlreadyYielded" restored

- xTaskDelayUntil()
- vTaskDelay()

The following functions have had their critical section/interrupt disdable
usage update

- vTaskSuspendAll()
- xTaskGetTickCountFromISR()
- xTaskGetApplicationTaskTagFromISR()
2022-09-19 21:30:52 +08:00
Darian Leung
abf0bc13e6 riscv: Fix esprv_intc_int_set_threshold() naming
This commit fixes the function declaration naming from esprv_intc_set_threshold()
to esprv_intc_int_set_threshold(), thus allowing the underlying ROM funciton to be
exposed via the header.
2022-09-16 16:45:43 +08:00
Darian Leung
0c97fbd5ba riscv: Remove redundant riscv_interrupts.h header
This commit removes the riscv_interrupts.h header is it has become redundant. The previously
exposed API has been handled as follows:

- "riscv_interrupt_enable()" and "riscv_interrupt_disable()" have been removed. These functions
  were declarations only and never had any implementation.
- "riscv_global_interrupts_enable()" and "riscv_global_interrupts_disable()" renamed to
  "rv_utils_intr_global_enable()" and "rv_utils_intr_global_disable()" respectively and now
  placed in rv_utils.h
2022-09-16 16:45:43 +08:00
Omar Chebib
53c7dd4efc WDT: implement interrupt wdt and task wdt for ESP32-C2
ESP32-C2 has a single group timer, thus it will use it for the interrupt watchdog,
which is more critical than the task watchdog. The latter is implement in
software thanks to the `esp_timer`component.
2022-09-15 14:37:59 +08:00
Ivan Grokhotkov
0332b8db07 Revert "Merge branch 'feature/freertos_10.4.3_sync_various_functions' into 'master'"
This reverts merge request !19761
2022-09-12 19:53:09 +08:00
Darian Leung
bb5e189d2b freertos: Synchronize tasks.c functions (minor changes) to v10.4.3
This commit synchronizes multiple functions in tasks.c with upstream v10.4.3
that contain minor differences.

The following functions have had their parameter names or code formatting
updated:

- xTaskCreateStaticPinnedToCore()
- xTaskCreatePinnedToCore()
- prvInitialiseNewTask()
- prvTaskIsTaskSuspended()
- vTaskStartScheduler()
- xTaskResumeAll()
- xTaskCheckForTimeOut()
- uxTaskResetEventItemValue()

The following functions have had their missing "xAlreadyYielded" restored

- xTaskDelayUntil()
- vTaskDelay()

The following functions have had their critical section/interrupt disdable
usage update

- vTaskSuspendAll()
- xTaskGetTickCountFromISR()
- xTaskGetApplicationTaskTagFromISR()
2022-09-07 23:34:52 +08:00
wuzhenghui
c5d8e94898 freertos, ulp: Fix header inclusion to be compatible with new esp32c6 target 2022-09-06 09:13:20 +00:00
morris
d94432fea8 systimer: refactor hal to accomodate more xtal choices 2022-07-25 16:08:52 +08:00
Guillaume Souchere
6005cc9163 hal: Deprecate interrupt_controller_hal.h, cpu_hal.h and cpu_ll.h interfaces
This commit marks all functions in interrupt_controller_hal.h, cpu_ll.h and cpu_hal.h as deprecated.
Users should use functions from esp_cpu.h instead.
2022-07-22 00:06:06 +08:00
Darian Leung
781d06af73 esp_hw_support: Remove compare_set.h API
This function removes the following legacy atomic CAS functions:

From compare_set.h (file removed):
- compare_and_set_native()
- compare_and_set_extram()

From portmacro.h
- uxPortCompareSet()
- uxPortCompareSetExtram()

Users should call esp_cpu_compare_and_set() instead as this function hides the details
of atomic CAS on internal and external RAM addresses.

Due to the removal of compare_set.h, some missing header includes are also fixed in this commit.
2022-07-22 00:06:06 +08:00
Darian Leung
7a4e1fee99 freertos: Fix xTaskIncrementTick()
Previously, xTaskIncrementTick() would always trigger a yield (i.e., return pdTRUE)
when called on core 1. This would mean core 1 would call vTaskSwitchContext() on
every tick, leading to uneccesary CPU overhead.

This commit fixes xTaskIncrementTick() in the following ways:

- Clearly mark IDF additions in xTaskIncrementTick()
- Moved esp_vApplicationTickHook() to be called direclty in xPortSysTickHandler() in order to
  simplify xTaskIncrementTick().
- Only core 0 calls xTaskIncrementTick() in order to simplify the function's logic. Core 0 is
  solely responsible for managing xTickCount and xPendedTicks
- All other cores call xTaskIncrementTickOtherCores() instead which is a simplified version of
  xTaskIncrementTick() and handles the following:
    - Check if core 0 has unblocked a higher priority task to run
    - Check if the current core requires time slicing
    - Call vApplicationTickHook()
2022-07-20 11:31:50 +08:00
Omar Chebib
e5c83211a7 Merge branch 'bugfix/interrupt_stack_bss' into 'master'
System: move interrupt stack to .bss instead of .data section

Closes IDFGH-7635

See merge request espressif/esp-idf!18697
2022-07-12 13:44:07 +08:00
Omar Chebib
bac62cfac8 System: move interrupt stack to .bss instead of .data section
The interrupt stack for Xtensa targets is now declared in C, automatically moving it to .bss section instead of .data section.

* Closes https://github.com/espressif/esp-idf/issues/9188
2022-07-11 17:49:21 +08:00
Alexey Lapshin
7e5a7921fe freertos: fix inlining for xtensa port 2022-07-07 09:04:51 +00:00
Mahavir Jain
311822da25 freertos: Fix issue with bootup failure in ESP_MAIN_TASK_AFFINITY_CPU1 config
Idle tick hook that indicates completion of scheduler init must be launched
on other core than the one where main task runs. Earlier it was assumed that
main task shall always run on PRO cpu but that behavior can be changed with
ESP_MAIN_TASK_AFFINITY_CPU1 and hence this fix.

Closes https://github.com/espressif/esp-idf/issues/9247
Closes IDFGH-7705
2022-07-01 05:40:46 +00:00
Darian Leung
434287fc8b freertos: Xtensa FreeRTOS saves threadptr in solicited stack frame
The Xtensa FreeRTOS port does not save the threadptr register when
doing a voluntary yield. This can result in a crash when multiple
tasks used the threadptr register and call "taskYIELD()".

This commit adds the threadptr register to the solicited stack frame.
2022-06-15 20:20:41 +08:00
Armando (Dou Yiwen)
0b80546f8e Merge branch 'feature/new_esp_psram_component' into 'master'
esp_psram: new esp psram component

Closes IDF-4318, IDF-4382, IDF-4841, and IDFGH-7192

See merge request espressif/esp-idf!18050
2022-06-15 19:16:56 +08:00
Darian
e213e66ba3 Merge branch 'refactor/esp_hw_support_cpu' into 'master'
esp_hw_support: Add new esp_cpu.h abstraction

Closes IDF-4769

See merge request espressif/esp-idf!17091
2022-06-14 21:11:30 +08:00
Armando
cdad8a02fe esp_psram: remove g_spiram_ok 2022-06-14 15:44:27 +08:00
Armando
38e5043ae8 esp_psram: new psram component 2022-06-14 15:44:27 +08:00
Darian Leung
a8a3756b38 hal: Route CPU and Interrupt Controller HAL/LL to esp_cpu calls
This commit makes changes to cpu_ll.h, cpu_hal.h, and interrupt_controller_hal.h:

- Moved to esp_hw_support in order to be deprecated in the future
- HAL/LL API now route their calls to esp_cpu.h functions instead

Also updated soc_hal.h as follows:

- Removed __SOC_HAL_..._OTHER_CORES() macros as they dependend on cpu_hal.h
- Made soc_hal.h and soc_ll.h interfaces always inline, and removed soc_hal.c.

This commit also updates the XCHAL_ERRATUM_572 workaround by

- Removing it's HAL function and invoking the workaround it directly the bootloader
- Added missing workaround for the ESP32-S3
2022-06-14 14:40:03 +08:00
Mahavir Jain
4e4d0a5011 Merge branch 'bugfix/psram_startup_crash' into 'master'
psram: Fix startup crash when `CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=0`

Closes IDFGH-6938

See merge request espressif/esp-idf!17543
2022-06-14 14:36:47 +08:00
Laukik Hase
914b0de764
freertos: Indicate completed initialization for APP CPU with idle task hook
Co-authored-by: Mahavir Jain <mahavir@espressif.com>
2022-06-13 17:17:42 +05:30
Sudeep Mohanty
12e2312aaa freertos: FreeRTOS SMP RISC-V port cleanup and enable esp32c3 in KConfig
This commit does general cleanup of the risc-v port files and restricts
FreeRTOS SMP config option to only esp32 and esp32c3.
2022-06-13 13:39:16 +02:00
KonstantinKondrashov
ac4c7d99fe dport: Move DPORT workaround to G0 2022-05-31 13:44:18 +08:00
Darian Leung
7dc6fd9ff6 esp_system: Make interrupt WDT private API
This commit makes the interrupt WDT API private. To use the API,
IDF components should now '#include "esp_private/esp_int_wdt.h"'
2022-05-18 20:12:25 +08:00
Darian Leung
5953bca376 esp_system: Add arbitrary user feature to TWDT
This commit moidifies the TWDT as follows:

- Adds a feature to allows subscribing arbitrary users to the TWDT
- Changes esp_task_wdt_init() API to accept configuration structure
- Changes esp_task_wdt_init() and esp_task_wdt_deinit() to subscribe/unsubscribe
  idle tasks of various cores.
- Adds support for SMP FreeRTOS idle tasks
- Updates startup code TWDT initialization
- Updates API documentation
2022-05-13 18:01:28 +08:00
Mahavir Jain
588a65759c
freertos: fix allocation order for stack and TCB per portSTACK_GROWTH
This is as per FreeRTOS recommendation and allows to protect task TCB
in case task stack has overflowed.
2022-05-09 15:45:38 +05:30
Ivan Grokhotkov
b0544b9745
esp_timer: only add as a public dependency to FreeRTOS if necessary
esp_timer will be added as a dependency to freertos only if
CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER is enabled.
Other components are updated to add esp_timer as public or private
dependency, as needed.
This removes esp_timer from the default list of public dependencies.
2022-04-25 18:39:59 +02: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
Armando
c4bcf1117c esp_hw_support: move soc_memory_types.h helper functions into esp_hw_support 2022-04-08 11:46:10 +08:00
Sudeep Mohanty
129e613f15 freertos: remove portmacro_deprtecated.h file
This commit removes the portmacro_deprecated.h file and the deprecated
APIs contained in it. Alternate APIs to use are noted in the migration
guide.
2022-04-05 04:38:35 +00:00
Anton Maklakov
68e5d9d585 Remove IRAM_ATTR from any function declarations
IRAM_ATTR expands to a unique section attribute. Applying it to both
declaration and definition results in a section conflict.
2022-03-22 09:58:50 +00:00
Ivan Grokhotkov
2f9d47c708 Merge branch 'feature/gdbstub_rt_multicore' into 'master'
Extension for GDBstub runtime component (multicore, breakpoints, steps etc...)

See merge request espressif/esp-idf!13896
2022-03-17 19:59:29 +08:00
Darian Leung
94c2467dd6 esp_common: Rename esp_macro.h to esp_macros.h 2022-03-10 21:22:35 +08:00
Vladimir Chistyakov
216703c0ef esp_macro: Fix CHOOSE_MACRO_VA_ARG() for C++20
Closes https://github.com/espressif/esp-idf/pull/8372
Closes https://github.com/espressif/esp-idf/issues/8371

[darian@espressif.com: Updated macro description and commit message]
Signed-off-by: Darian Leung <darian@espressif.com>
2022-03-08 20:21:26 +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
Dmitry
a8c3fe56c8 This commit add to GDBstup:
1. Multicore suupor
2. Stepping
3. Console output
4. Update example + readme
5. Jumps
2022-03-01 19:49:24 +03: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