mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
heap: use ROM implementation for heap tlsf on esp32c2
This commit is contained in:
parent
24f5fecef0
commit
068adfba70
@ -200,7 +200,7 @@ else() # Regular app build
|
|||||||
rom_linker_script("newlib-nano")
|
rom_linker_script("newlib-nano")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CONFIG_HEAP_ROM_IMPL)
|
if(CONFIG_HEAP_TLSF_USE_ROM_IMPL)
|
||||||
rom_linker_script("heap")
|
rom_linker_script("heap")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -34,3 +34,7 @@ config ESP_ROM_HAS_HAL_WDT
|
|||||||
config ESP_ROM_HAS_HAL_SYSTIMER
|
config ESP_ROM_HAS_HAL_SYSTIMER
|
||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
|
|
||||||
|
config ESP_ROM_HAS_HEAP_TLSF
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
@ -14,3 +14,4 @@
|
|||||||
#define ESP_ROM_HAS_RVFPLIB (1) // ROM has the rvfplib
|
#define ESP_ROM_HAS_RVFPLIB (1) // ROM has the rvfplib
|
||||||
#define ESP_ROM_HAS_HAL_WDT (1) // ROM has the implementation of Watchdog HAL driver
|
#define ESP_ROM_HAS_HAL_WDT (1) // ROM has the implementation of Watchdog HAL driver
|
||||||
#define ESP_ROM_HAS_HAL_SYSTIMER (1) // ROM has the implementation of Systimer HAL driver
|
#define ESP_ROM_HAS_HAL_SYSTIMER (1) // ROM has the implementation of Systimer HAL driver
|
||||||
|
#define ESP_ROM_HAS_HEAP_TLSF (1) // ROM has the implementation of the tlsf and multi-heap library
|
||||||
|
@ -3,7 +3,7 @@ set(srcs
|
|||||||
"heap_caps_init.c"
|
"heap_caps_init.c"
|
||||||
"multi_heap.c")
|
"multi_heap.c")
|
||||||
|
|
||||||
if(NOT CONFIG_HEAP_ROM_IMPL)
|
if(NOT CONFIG_HEAP_TLSF_USE_ROM_IMPL)
|
||||||
list(APPEND srcs "heap_tlsf.c")
|
list(APPEND srcs "heap_tlsf.c")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -71,14 +71,9 @@ menu "Heap memory debugging"
|
|||||||
help
|
help
|
||||||
When enabled, if a memory allocation operation fails it will cause a system abort.
|
When enabled, if a memory allocation operation fails it will cause a system abort.
|
||||||
|
|
||||||
config HEAP_HAS_ROM_IMPL
|
config HEAP_TLSF_USE_ROM_IMPL
|
||||||
bool
|
bool "Use ROM implementation of heap tlsf library"
|
||||||
depends on IDF_TARGET_ESP32C2
|
depends on ESP_ROM_HAS_HEAP_TLSF
|
||||||
default y if IDF_TARGET_ESP32C2
|
|
||||||
|
|
||||||
config HEAP_ROM_IMPL
|
|
||||||
bool "Use heap implementation in ROM"
|
|
||||||
depends on HEAP_HAS_ROM_IMPL
|
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
Enable this flag to use heap functions from ROM instead of ESP-IDF.
|
Enable this flag to use heap functions from ROM instead of ESP-IDF.
|
||||||
|
@ -49,7 +49,7 @@ void heap_caps_enable_nonos_stack_heaps(void)
|
|||||||
*/
|
*/
|
||||||
void heap_caps_init(void)
|
void heap_caps_init(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_HEAP_ROM_IMPL
|
#ifdef CONFIG_HEAP_TLSF_USE_ROM_IMPL
|
||||||
extern void multi_heap_in_rom_init(void);
|
extern void multi_heap_in_rom_init(void);
|
||||||
multi_heap_in_rom_init();
|
multi_heap_in_rom_init();
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[mapping:heap]
|
[mapping:heap]
|
||||||
archive: libheap.a
|
archive: libheap.a
|
||||||
entries:
|
entries:
|
||||||
if HEAP_HAS_ROM_IMPL = n || HEAP_ROM_IMPL = n:
|
if HEAP_TLSF_USE_ROM_IMPL = n:
|
||||||
heap_tlsf (noflash)
|
heap_tlsf (noflash)
|
||||||
multi_heap (noflash)
|
multi_heap (noflash)
|
||||||
if HEAP_POISONING_DISABLED = n:
|
if HEAP_POISONING_DISABLED = n:
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
/* Defines compile-time configuration macros */
|
/* Defines compile-time configuration macros */
|
||||||
#include "multi_heap_config.h"
|
#include "multi_heap_config.h"
|
||||||
|
|
||||||
#if (!defined MULTI_HEAP_POISONING) && (!defined CONFIG_HEAP_ROM_IMPL)
|
#if (!defined MULTI_HEAP_POISONING) && (!defined CONFIG_HEAP_TLSF_USE_ROM_IMPL)
|
||||||
/* if no heap poisoning, public API aliases directly to these implementations */
|
/* if no heap poisoning, public API aliases directly to these implementations */
|
||||||
void *multi_heap_malloc(multi_heap_handle_t heap, size_t size)
|
void *multi_heap_malloc(multi_heap_handle_t heap, size_t size)
|
||||||
__attribute__((alias("multi_heap_malloc_impl")));
|
__attribute__((alias("multi_heap_malloc_impl")));
|
||||||
@ -77,7 +77,7 @@ typedef struct multi_heap_info {
|
|||||||
tlsf_t heap_data;
|
tlsf_t heap_data;
|
||||||
} heap_t;
|
} heap_t;
|
||||||
|
|
||||||
#ifdef CONFIG_HEAP_ROM_IMPL
|
#ifdef CONFIG_HEAP_TLSF_USE_ROM_IMPL
|
||||||
|
|
||||||
void _multi_heap_lock(void *lock)
|
void _multi_heap_lock(void *lock)
|
||||||
{
|
{
|
||||||
@ -99,7 +99,7 @@ void multi_heap_in_rom_init(void)
|
|||||||
multi_heap_os_funcs_init(&multi_heap_os_funcs);
|
multi_heap_os_funcs_init(&multi_heap_os_funcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else //#ifndef CONFIG_HEAP_ROM_IMPL
|
#else //#ifndef CONFIG_HEAP_TLSF_USE_ROM_IMPL
|
||||||
|
|
||||||
/* Return true if this block is free. */
|
/* Return true if this block is free. */
|
||||||
static inline bool is_free(const block_header_t *block)
|
static inline bool is_free(const block_header_t *block)
|
||||||
|
@ -334,7 +334,7 @@ multi_heap_handle_t multi_heap_register(void *start, size_t size)
|
|||||||
memset(start, FREE_FILL_PATTERN, size);
|
memset(start, FREE_FILL_PATTERN, size);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_HEAP_ROM_IMPL
|
#ifdef CONFIG_HEAP_TLSF_USE_ROM_IMPL
|
||||||
tlsf_poison_fill_pfunc_set(multi_heap_internal_poison_fill_region);
|
tlsf_poison_fill_pfunc_set(multi_heap_internal_poison_fill_region);
|
||||||
#endif
|
#endif
|
||||||
return multi_heap_register_impl(start, size);
|
return multi_heap_register_impl(start, size);
|
||||||
|
@ -421,6 +421,14 @@ VFS
|
|||||||
:CONFIG_ESP_ROM_HAS_HAL_SYSTIMER: * Enabling :ref:`CONFIG_HAL_SYSTIMER_USE_ROM_IMPL` can reduce the IRAM usage and binary size by linking in the systimer HAL driver of ROM implementation.
|
:CONFIG_ESP_ROM_HAS_HAL_SYSTIMER: * Enabling :ref:`CONFIG_HAL_SYSTIMER_USE_ROM_IMPL` can reduce the IRAM usage and binary size by linking in the systimer HAL driver of ROM implementation.
|
||||||
:CONFIG_ESP_ROM_HAS_HAL_WDT: * Enabling :ref:`CONFIG_HAL_WDT_USE_ROM_IMPL` can reduce the IRAM usage and binary size by linking in the watchdog HAL driver of ROM implementation.
|
:CONFIG_ESP_ROM_HAS_HAL_WDT: * Enabling :ref:`CONFIG_HAL_WDT_USE_ROM_IMPL` can reduce the IRAM usage and binary size by linking in the watchdog HAL driver of ROM implementation.
|
||||||
|
|
||||||
|
.. only:: esp32c2
|
||||||
|
|
||||||
|
Heap
|
||||||
|
@@@@
|
||||||
|
|
||||||
|
.. list::
|
||||||
|
|
||||||
|
:CONFIG_ESP_ROM_HAS_HEAP_TLSF: * Enabling :ref:`CONFIG_HEAP_TLSF_USE_ROM_IMPL` can reduce the IRAM usage and binary size by linking in the TLSF library of ROM implementation.
|
||||||
|
|
||||||
Bootloader Size
|
Bootloader Size
|
||||||
---------------
|
---------------
|
||||||
|
Loading…
Reference in New Issue
Block a user