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

@@ -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