freertos: always enable static allocation

to use it for newlib locks
This commit is contained in:
Ivan Grokhotkov 2020-10-27 19:46:48 +01:00
parent 286f06b274
commit 7f3b16a99d
17 changed files with 7 additions and 58 deletions

View File

@ -76,11 +76,6 @@ menu "Driver configurations"
config TWAI_ISR_IN_IRAM
bool "Place TWAI ISR function into IRAM"
default n
select FREERTOS_SUPPORT_STATIC_ALLOCATION
# We need to enable FREERTOS_SUPPORT_STATIC_ALLOCATION because the
# TWAI driver requires the use of FreeRTOS Queues and Semaphores from
# the driver ISR. These Queues and Semaphores need to be placed in
# DRAM thus FreeRTOS static allocation API is required.
help
Place the TWAI ISR in to IRAM. This will allow the ISR to avoid
cache misses, and also be able to run whilst the cache is disabled

View File

@ -64,8 +64,6 @@ typedef enum {
* buffer where this struct is of the exact size required to store a ring
* buffer's control data structure.
*
* @note The CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION option must be enabled for
* this structure to be available.
*/
#if ( configSUPPORT_STATIC_ALLOCATION == 1)
typedef struct xSTATIC_RINGBUFFER {
@ -117,9 +115,6 @@ RingbufHandle_t xRingbufferCreateNoSplit(size_t xItemSize, size_t xItemNum);
* @param[in] pxStaticRingbuffer Pointed to a struct of type StaticRingbuffer_t
* which will be used to hold the ring buffer's data structure
*
* @note The CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION option must be enabled
* for this to be available
*
* @note xBufferSize of no-split/allow-split buffers MUST be 32-bit aligned.
*
* @return A handle to the created ring buffer

View File

@ -290,7 +290,6 @@ TEST_CASE_MULTIPLE_STAGES("can set sleep wake stub", "[deepsleep][reset=DEEPSLEE
#if CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP
#if CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION
/* Version of prepare_wake_stub() that sets up the deep sleep call while running
from RTC memory as stack, with a high frequency timer also writing RTC FAST
@ -346,7 +345,6 @@ TEST_CASE_MULTIPLE_STAGES("can set sleep wake stub from stack in RTC RAM", "[dee
prepare_wake_stub_from_rtc,
check_wake_stub);
#endif // CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION
#endif // CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP
TEST_CASE("wake up using ext0 (13 high)", "[deepsleep][ignore]")

View File

@ -205,36 +205,14 @@ menu "FreeRTOS"
For most uses, the default of 16 is OK.
config FREERTOS_SUPPORT_STATIC_ALLOCATION
bool "Enable FreeRTOS static allocation API"
default n
help
FreeRTOS gives the application writer the ability to instead provide the memory
themselves, allowing the following objects to optionally be created without any
memory being allocated dynamically:
- Tasks
- Software Timers (Daemon task is still dynamic. See documentation)
- Queues
- Event Groups
- Binary Semaphores
- Counting Semaphores
- Recursive Semaphores
- Mutexes
Whether it is preferable to use static or dynamic memory allocation is dependent on
the application, and the preference of the application writer. Both methods have pros
and cons, and both methods can be used within the same RTOS application.
Creating RTOS objects using statically allocated RAM has the benefit of providing the application writer
with more control: RTOS objects can be placed at specific memory locations. The maximum RAM footprint can
be determined at link time, rather than run time. The application writer does not need to concern
themselves with graceful handling of memory allocation failures. It allows the RTOS to be used in
applications that simply don't allow any dynamic memory allocation (although FreeRTOS includes allocation
schemes that can overcome most objections).
# Always enabled.
# Kconfig option preserved for compatibility with code
# which checked for CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION.
bool
default y
config FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP
bool "Enable static task clean up hook"
depends on FREERTOS_SUPPORT_STATIC_ALLOCATION
default n
help
Enable this option to make FreeRTOS call the static task clean up hook when a task is deleted.

View File

@ -239,7 +239,7 @@
kept at 1. */
#define configKERNEL_INTERRUPT_PRIORITY 1
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#define configSUPPORT_STATIC_ALLOCATION CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION
#define configSUPPORT_STATIC_ALLOCATION 1
#ifndef __ASSEMBLER__
#if CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP

View File

@ -291,7 +291,7 @@ int xt_clock_freq(void) __attribute__((deprecated));
#define configUSE_NEWLIB_REENTRANT 1
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#define configSUPPORT_STATIC_ALLOCATION CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION
#define configSUPPORT_STATIC_ALLOCATION 1
#ifndef __ASSEMBLER__
#if CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP

View File

@ -1,7 +1,6 @@
# sdkconfig replacement configurations for deprecated options formatted as
# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION
CONFIG_SUPPORT_STATIC_ALLOCATION CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION
CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP
CONFIG_TIMER_TASK_PRIORITY CONFIG_FREERTOS_TIMER_TASK_PRIORITY
CONFIG_TIMER_TASK_STACK_DEPTH CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH

View File

@ -29,7 +29,6 @@
#include "unity.h"
#include "test_utils.h"
#ifdef CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION
/* ---------------------Test 1: Backported Timer functions-----------------------
* Test xTimerCreateStatic(), vTimerSetTimerId(), xTimerGetPeriod(), xTimerGetExpiryTime()
*
@ -201,7 +200,6 @@ TEST_CASE("Test FreeRTOS backported eventgroup functions", "[freertos]")
//Cleanup static event
vEventGroupDelete(eg_handle);
}
#endif
/* --------Test backported thread local storage pointer and deletion cb feature----------
* vTaskSetThreadLocalStoragePointerAndDelCallback()

View File

@ -69,7 +69,6 @@ TEST_CASE("Recurring FreeRTOS timers", "[freertos]")
TEST_ASSERT( xTimerDelete(recurring, 1) );
}
#ifdef CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION
TEST_CASE("Static timer creation", "[freertos]")
{
StaticTimer_t static_timer;
@ -84,4 +83,3 @@ TEST_CASE("Static timer creation", "[freertos]")
TEST_ASSERT_NOT_NULL(created_timer);
}
#endif

View File

@ -104,7 +104,6 @@ menu "SPI Flash driver"
# The bus lock on SPI1 is meaningless when the legacy implementation is used, or the SPI
# driver does not support SPI1.
depends on !SPI_FLASH_USE_LEGACY_IMPL && !IDF_TARGET_ESP32S2
select FREERTOS_SUPPORT_STATIC_ALLOCATION
help
Each SPI bus needs a lock for arbitration among devices. This allows multiple
devices on a same bus, but may reduce the speed of esp_flash driver access to the

View File

@ -4,7 +4,6 @@ menu "TinyUSB"
bool "Enable TinyUSB driver"
default n
depends on IDF_TARGET_ESP32S2
select FREERTOS_SUPPORT_STATIC_ALLOCATION
select FREERTOS_USE_AUTHENTIC_INCLUDE_PATHS
help
Adds support for TinyUSB

View File

@ -438,9 +438,6 @@ ESP-IDF FreeRTOS configurations, see :doc:`FreeRTOS <../api-reference/kconfig>`
will be modified. For more details regarding the effects of running ESP-IDF FreeRTOS
on a single core, search for occurences of ``CONFIG_FREERTOS_UNICORE`` in the ESP-IDF components.
:ref:`CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION` will enable the
functionality of :cpp:func:`xTaskCreateStaticPinnedToCore` in ESP-IDF FreeRTOS
:ref:`CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION` will trigger a halt in
particular functions in ESP-IDF FreeRTOS which have not been fully tested
in an SMP context.

View File

@ -412,9 +412,6 @@ The :cpp:func:`xRingbufferCreateStatic` can be used to create ring buffers with
The manner in which these blocks are allocated will depend on the users requirements (e.g. all blocks being statically declared, or dynamically allocated with specific capabilities such as external RAM).
.. note::
The :ref:`CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION` option must be enabled in `menuconfig` for statically allocated ring buffers to be available.
.. note::
When deleting a ring buffer created via :cpp:func:`xRingbufferCreateStatic`,
the function :cpp:func:`vRingbufferDelete` will not free any of the memory blocks. This must be done manually by the user after :cpp:func:`vRingbufferDelete` is called.

View File

@ -14,7 +14,6 @@ CONFIG_BLE_MESH_PB_GATT=y
CONFIG_BLE_MESH_CFG_CLI=y
CONFIG_FREERTOS_UNICORE=y
CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y
CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY=y
CONFIG_BLE_MESH_MEM_ALLOC_MODE_IRAM_8BIT=y
CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC=y

View File

@ -12,7 +12,6 @@ CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y
CONFIG_FREERTOS_INTERRUPT_BACKTRACE=n
CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE=y
CONFIG_FREERTOS_LEGACY_HOOKS=y
CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y
CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP=y
CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=10
CONFIG_FREERTOS_USE_TRACE_FACILITY=y

View File

@ -12,7 +12,6 @@ CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y
CONFIG_FREERTOS_INTERRUPT_BACKTRACE=n
CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE=y
CONFIG_FREERTOS_LEGACY_HOOKS=y
CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y
CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP=y
CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=10
CONFIG_FREERTOS_USE_TRACE_FACILITY=y

View File

@ -17,7 +17,6 @@ CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS=y
CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=7
CONFIG_COMPILER_STACK_CHECK_MODE_STRONG=y
CONFIG_COMPILER_STACK_CHECK=y
CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y
CONFIG_ESP_TIMER_PROFILING=y
CONFIG_ADC_DISABLE_DAC=n
CONFIG_COMPILER_WARN_WRITE_STRINGS=y