mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Remove default behaviour of FREERTOS_HEAP. (#807)
To build a complete static application (configSUPPORT_DYNAMIC_ALLOCATION set to 0) an ugly workaround is necessary, because when FREERTOS_HEAP is not set, heap 4 is automatically selected in the current CMake. Co-authored-by: kar-rahul-aws <118818625+kar-rahul-aws@users.noreply.github.com> Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
This commit is contained in:
parent
7562ebc6e1
commit
9f4a0e308b
|
@ -8,10 +8,12 @@ cmake_minimum_required(VERSION 3.15)
|
||||||
#
|
#
|
||||||
# DEPRECATED: FREERTOS_CONFIG_FILE_DIRECTORY - but still supported if no freertos_config defined for now.
|
# DEPRECATED: FREERTOS_CONFIG_FILE_DIRECTORY - but still supported if no freertos_config defined for now.
|
||||||
# May be removed at some point in the future.
|
# May be removed at some point in the future.
|
||||||
|
#
|
||||||
# User can choose which heap implementation to use (either the implementations
|
# User can choose which heap implementation to use (either the implementations
|
||||||
# included with FreeRTOS [1..5] or a custom implementation ) by providing the
|
# included with FreeRTOS [1..5] or a custom implementation) by providing the
|
||||||
# option FREERTOS_HEAP. If the option is not set, the cmake will default to
|
# option FREERTOS_HEAP. When dynamic allocation is used, the user must specify a
|
||||||
# using heap_4.c.
|
# heap implementation. If the option is not set, the cmake will use no heap
|
||||||
|
# implementation (e.g. when only static allocation is used).
|
||||||
|
|
||||||
# `freertos_config` target defines the path to FreeRTOSConfig.h and optionally other freertos based config files
|
# `freertos_config` target defines the path to FreeRTOSConfig.h and optionally other freertos based config files
|
||||||
if(NOT TARGET freertos_config )
|
if(NOT TARGET freertos_config )
|
||||||
|
@ -37,9 +39,6 @@ if(NOT TARGET freertos_config )
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Heap number or absolute path to custom heap implementation provided by user
|
|
||||||
set(FREERTOS_HEAP "4" CACHE STRING "FreeRTOS heap model number. 1 .. 5. Or absolute path to custom heap source file")
|
|
||||||
|
|
||||||
# FreeRTOS port option
|
# FreeRTOS port option
|
||||||
if(NOT FREERTOS_PORT)
|
if(NOT FREERTOS_PORT)
|
||||||
message(WARNING " FREERTOS_PORT is not set. Please specify it from top-level CMake file (example):\n"
|
message(WARNING " FREERTOS_PORT is not set. Please specify it from top-level CMake file (example):\n"
|
||||||
|
@ -285,10 +284,15 @@ target_sources(freertos_kernel PRIVATE
|
||||||
stream_buffer.c
|
stream_buffer.c
|
||||||
tasks.c
|
tasks.c
|
||||||
timers.c
|
timers.c
|
||||||
|
)
|
||||||
|
|
||||||
|
if (DEFINED FREERTOS_HEAP )
|
||||||
|
# User specified a heap implementation add heap implementation to freertos_kernel.
|
||||||
|
target_sources(freertos_kernel PRIVATE
|
||||||
# If FREERTOS_HEAP is digit between 1 .. 5 - it is heap number, otherwise - it is path to custom heap source file
|
# If FREERTOS_HEAP is digit between 1 .. 5 - it is heap number, otherwise - it is path to custom heap source file
|
||||||
$<IF:$<BOOL:$<FILTER:${FREERTOS_HEAP},EXCLUDE,^[1-5]$>>,${FREERTOS_HEAP},portable/MemMang/heap_${FREERTOS_HEAP}.c>
|
$<IF:$<BOOL:$<FILTER:${FREERTOS_HEAP},EXCLUDE,^[1-5]$>>,${FREERTOS_HEAP},portable/MemMang/heap_${FREERTOS_HEAP}.c>
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
target_link_libraries(freertos_kernel
|
target_link_libraries(freertos_kernel
|
||||||
|
|
Loading…
Reference in a new issue