[FL-1609] Redirected malloc, calloc, realloc and free functions from newlib to freertos heap. (#604)
* Core: newlib-nano heap management functions replaced with freertos functions * Core: replace newlib heap management functions for firmware only, not for bootloader * Core, Linker: automatically determine available heap size at linking. Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
		@@ -2,6 +2,7 @@ PROJECT_ROOT	= $(abspath $(dir $(abspath $(firstword $(MAKEFILE_LIST))))..)
 | 
			
		||||
PROJECT			= firmware
 | 
			
		||||
 | 
			
		||||
include 		$(PROJECT_ROOT)/make/base.mk
 | 
			
		||||
include 		$(PROJECT_ROOT)/make/freertos-heap.mk
 | 
			
		||||
include			$(PROJECT_ROOT)/assets/assets.mk
 | 
			
		||||
include			$(PROJECT_ROOT)/core/core.mk
 | 
			
		||||
include 		$(PROJECT_ROOT)/applications/applications.mk
 | 
			
		||||
 
 | 
			
		||||
@@ -69,7 +69,8 @@
 | 
			
		||||
#define configTICK_RATE_HZ                       ((TickType_t)1024)
 | 
			
		||||
#define configMAX_PRIORITIES                     ( 56 )
 | 
			
		||||
#define configMINIMAL_STACK_SIZE                 ((uint16_t)128)
 | 
			
		||||
#define configTOTAL_HEAP_SIZE                    ((size_t)131072)
 | 
			
		||||
/* Heap size determined automatically by linker */
 | 
			
		||||
// #define configTOTAL_HEAP_SIZE                    ((size_t)0)
 | 
			
		||||
#define configMAX_TASK_NAME_LEN                  ( 16 )
 | 
			
		||||
#define configGENERATE_RUN_TIME_STATS            0
 | 
			
		||||
#define configUSE_TRACE_FACILITY                 1
 | 
			
		||||
 
 | 
			
		||||
@@ -161,9 +161,9 @@ SECTIONS
 | 
			
		||||
  ._user_heap_stack :
 | 
			
		||||
  {
 | 
			
		||||
    . = ALIGN(8);
 | 
			
		||||
    PROVIDE ( end = . );
 | 
			
		||||
    PROVIDE ( _end = . );
 | 
			
		||||
    . = . + _Min_Heap_Size;
 | 
			
		||||
    __heap_start__ = .;
 | 
			
		||||
    . = ORIGIN(RAM1) + LENGTH(RAM1) - _Min_Stack_Size;
 | 
			
		||||
    __heap_end__ = .;
 | 
			
		||||
    . = . + _Min_Stack_Size;
 | 
			
		||||
    . = ALIGN(8);
 | 
			
		||||
  } >RAM1
 | 
			
		||||
 
 | 
			
		||||
@@ -161,9 +161,9 @@ SECTIONS
 | 
			
		||||
  ._user_heap_stack :
 | 
			
		||||
  {
 | 
			
		||||
    . = ALIGN(8);
 | 
			
		||||
    PROVIDE ( end = . );
 | 
			
		||||
    PROVIDE ( _end = . );
 | 
			
		||||
    . = . + _Min_Heap_Size;
 | 
			
		||||
    __heap_start__ = .;
 | 
			
		||||
    . = ORIGIN(RAM1) + LENGTH(RAM1) - _Min_Stack_Size;
 | 
			
		||||
    __heap_end__ = .;
 | 
			
		||||
    . = . + _Min_Stack_Size;
 | 
			
		||||
    . = ALIGN(8);
 | 
			
		||||
  } >RAM1
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user