mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
feat(heap): move TLSF ROM patches and related files from esp_rom to heap
The TLSF ROM patch code (rom_patch_tlsf.c, rom_patch_multi_heap.c), their headers, and the per-target *.rom.heap.ld linker scripts are semantically owned by the heap component, not esp_rom. Move them accordingly: - components/esp_rom/patches/esp_rom_tlsf.c → components/heap/rom_patches/rom_patch_tlsf.c - components/esp_rom/patches/esp_rom_multi_heap.c → components/heap/rom_patches/rom_patch_multi_heap.c - components/esp_rom/include/esp_rom_tlsf.h → components/heap/rom_patches/include/rom_patch_tlsf.h - components/esp_rom/include/esp_rom_multi_heap.h → components/heap/rom_patches/include/rom_patch_multi_heap.h - components/esp_rom/<target>/ld/<target>.rom.heap.ld (×8) → components/heap/port/<target>/ld/<target>.rom.heap.ld Update heap/CMakeLists.txt to: - use target_linker_script() directly for *.rom.heap.ld - guard post-registration ROM patch setup with NOT BOOTLOADER_BUILD - drop stale CONFIG_HEAP_TLSF_CHECK_PATCH symbol reference - drop esp_rom_include_multi_heap_patch from TLSF_CHECK_PATCH guard Remove the corresponding entries from esp_rom/CMakeLists.txt.
This commit is contained in:
@@ -24,18 +24,6 @@ else()
|
||||
"patches/esp_rom_efuse.c"
|
||||
"patches/esp_rom_gpio.c")
|
||||
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
if(CONFIG_HEAP_TLSF_USE_ROM_IMPL AND CONFIG_ESP_ROM_TLSF_CHECK_PATCH)
|
||||
# This file shall be included in the build if TLSF in ROM is activated
|
||||
list(APPEND sources "patches/esp_rom_tlsf.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_HEAP_TLSF_USE_ROM_IMPL AND CONFIG_ESP_ROM_MULTI_HEAP_WALK_PATCH)
|
||||
# This file shall be included in the build if TLSF in ROM is activated
|
||||
list(APPEND sources "patches/esp_rom_multi_heap.c")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND private_required_comp soc hal esp_hal_uart)
|
||||
endif()
|
||||
|
||||
@@ -119,7 +107,6 @@ if(CONFIG_ESP_ROM_HAS_VERSION)
|
||||
endif()
|
||||
|
||||
if(ESP_TEE_BUILD)
|
||||
rom_linker_script("heap")
|
||||
if(CONFIG_LIBC_NEWLIB AND CONFIG_ESP_ROM_HAS_NEWLIB_NANO_FORMAT)
|
||||
rom_linker_script("newlib-nano")
|
||||
endif()
|
||||
@@ -347,22 +334,6 @@ else() # Regular app build
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CONFIG_HEAP_TLSF_USE_ROM_IMPL)
|
||||
# After registering the component, set the tlsf_set_rom_patches symbol as undefined
|
||||
# to force the linker to integrate the whole `esp_rom_tlsf.c` object file inside the
|
||||
# final binary. This is necessary because tlsf_set_rom_patches is a constructor, thus,
|
||||
# there as no explicit reference/call to it in IDF.
|
||||
if((CONFIG_ESP_ROM_TLSF_CHECK_PATCH OR CONFIG_HEAP_TLSF_CHECK_PATCH))
|
||||
target_link_libraries(${COMPONENT_LIB} PRIVATE "-u tlsf_set_rom_patches")
|
||||
endif()
|
||||
|
||||
if((CONFIG_ESP_ROM_TLSF_CHECK_PATCH OR CONFIG_ESP_ROM_MULTI_HEAP_WALK_PATCH))
|
||||
target_link_libraries(${COMPONENT_LIB} PRIVATE "-u esp_rom_include_multi_heap_patch")
|
||||
endif()
|
||||
|
||||
rom_linker_script("heap")
|
||||
endif()
|
||||
|
||||
if(CONFIG_SPI_FLASH_ROM_IMPL)
|
||||
# Older targets do not have a separate ld file for spiflash
|
||||
if(NOT target STREQUAL "esp32c3" AND NOT target STREQUAL "esp32s3" AND NOT target STREQUAL "esp32c2")
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include "esp_rom_tlsf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief TLSF ROM vtable stub table for esp32c2.
|
||||
*
|
||||
* This struct mirrors the TLSF function-pointer vtable stored in ROM.
|
||||
* Its layout MUST exactly match the ROM vtable for the target chip.
|
||||
* It is used by tlsf_set_rom_patches() to intercept TLSF calls.
|
||||
*/
|
||||
struct heap_tlsf_stub_table_t {
|
||||
tlsf_t (*tlsf_create)(void* mem);
|
||||
tlsf_t (*tlsf_create_with_pool)(void* mem, size_t bytes);
|
||||
pool_t (*tlsf_get_pool)(tlsf_t tlsf);
|
||||
pool_t (*tlsf_add_pool)(tlsf_t tlsf, void* mem, size_t bytes);
|
||||
void (*tlsf_remove_pool)(tlsf_t tlsf, pool_t pool);
|
||||
|
||||
void* (*tlsf_malloc)(tlsf_t tlsf, size_t size);
|
||||
void* (*tlsf_memalign)(tlsf_t tlsf, size_t align, size_t size);
|
||||
void* (*tlsf_memalign_offs)(tlsf_t tlsf, size_t align, size_t size, size_t offset);
|
||||
void* (*tlsf_realloc)(tlsf_t tlsf, void* ptr, size_t size);
|
||||
void (*tlsf_free)(tlsf_t tlsf, void* ptr);
|
||||
|
||||
size_t (*tlsf_block_size)(void* ptr);
|
||||
size_t (*tlsf_size)(void);
|
||||
size_t (*tlsf_align_size)(void);
|
||||
size_t (*tlsf_block_size_min)(void);
|
||||
size_t (*tlsf_block_size_max)(void);
|
||||
size_t (*tlsf_pool_overhead)(void);
|
||||
size_t (*tlsf_alloc_overhead)(void);
|
||||
|
||||
void (*tlsf_walk_pool)(pool_t pool, tlsf_walker walker, void* user);
|
||||
|
||||
int (*tlsf_check)(tlsf_t tlsf);
|
||||
int (*tlsf_check_pool)(pool_t pool);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
/***************************************
|
||||
Group heap
|
||||
***************************************/
|
||||
|
||||
/* Functions */
|
||||
PROVIDE( tlsf_create = 0x400002dc );
|
||||
PROVIDE( tlsf_create_with_pool = 0x400002e0 );
|
||||
PROVIDE( tlsf_get_pool = 0x400002e4 );
|
||||
PROVIDE( tlsf_add_pool = 0x400002e8 );
|
||||
PROVIDE( tlsf_remove_pool = 0x400002ec );
|
||||
PROVIDE( tlsf_malloc = 0x400002f0 );
|
||||
PROVIDE( tlsf_memalign = 0x400002f4 );
|
||||
PROVIDE( tlsf_memalign_offs = 0x400002f8 );
|
||||
PROVIDE( tlsf_realloc = 0x400002fc );
|
||||
PROVIDE( tlsf_free = 0x40000300 );
|
||||
PROVIDE( tlsf_block_size = 0x40000304 );
|
||||
PROVIDE( tlsf_size = 0x40000308 );
|
||||
PROVIDE( tlsf_align_size = 0x4000030c );
|
||||
PROVIDE( tlsf_block_size_min = 0x40000310 );
|
||||
PROVIDE( tlsf_block_size_max = 0x40000314 );
|
||||
PROVIDE( tlsf_pool_overhead = 0x40000318 );
|
||||
PROVIDE( tlsf_alloc_overhead = 0x4000031c );
|
||||
PROVIDE( tlsf_walk_pool = 0x40000320 );
|
||||
PROVIDE( tlsf_check = 0x40000324 );
|
||||
PROVIDE( tlsf_check_pool = 0x40000328 );
|
||||
PROVIDE( tlsf_poison_fill_pfunc_set = 0x4000032c );
|
||||
PROVIDE( multi_heap_get_block_address_impl = 0x40000330 );
|
||||
PROVIDE( multi_heap_get_allocated_size_impl = 0x40000334 );
|
||||
PROVIDE( multi_heap_register_impl = 0x40000338 );
|
||||
PROVIDE( multi_heap_set_lock = 0x4000033c );
|
||||
PROVIDE( multi_heap_os_funcs_init = 0x40000340 );
|
||||
PROVIDE( multi_heap_internal_lock = 0x40000344 );
|
||||
PROVIDE( multi_heap_internal_unlock = 0x40000348 );
|
||||
PROVIDE( multi_heap_get_first_block = 0x4000034c );
|
||||
PROVIDE( multi_heap_get_next_block = 0x40000350 );
|
||||
PROVIDE( multi_heap_is_free = 0x40000354 );
|
||||
PROVIDE( multi_heap_malloc_impl = 0x40000358 );
|
||||
PROVIDE( multi_heap_free_impl = 0x4000035c );
|
||||
PROVIDE( multi_heap_realloc_impl = 0x40000360 );
|
||||
PROVIDE( multi_heap_aligned_alloc_impl_offs = 0x40000364 );
|
||||
PROVIDE( multi_heap_aligned_alloc_impl = 0x40000368 );
|
||||
PROVIDE( multi_heap_check = 0x4000036c );
|
||||
PROVIDE( multi_heap_dump = 0x40000370 );
|
||||
PROVIDE( multi_heap_free_size_impl = 0x40000374 );
|
||||
PROVIDE( multi_heap_minimum_free_size_impl = 0x40000378 );
|
||||
PROVIDE( multi_heap_get_info_impl = 0x4000037c );
|
||||
/* Data (.data, .bss, .rodata) */
|
||||
PROVIDE( heap_tlsf_table_ptr = 0x3fcdffec );
|
||||
|
||||
/**
|
||||
* Multi heap function
|
||||
*/
|
||||
|
||||
PROVIDE (multi_heap_malloc = multi_heap_malloc_impl);
|
||||
PROVIDE (multi_heap_free = multi_heap_free_impl);
|
||||
PROVIDE (multi_heap_realloc = multi_heap_realloc_impl);
|
||||
PROVIDE (multi_heap_get_allocated_size = multi_heap_get_allocated_size_impl);
|
||||
PROVIDE (multi_heap_register = multi_heap_register_impl);
|
||||
PROVIDE (multi_heap_get_info = multi_heap_get_info_impl);
|
||||
PROVIDE (multi_heap_free_size = multi_heap_free_size_impl);
|
||||
PROVIDE (multi_heap_minimum_free_size = multi_heap_minimum_free_size_impl);
|
||||
PROVIDE (multi_heap_get_block_address = multi_heap_get_block_address_impl);
|
||||
PROVIDE (multi_heap_aligned_alloc = multi_heap_aligned_alloc_impl);
|
||||
PROVIDE (multi_heap_aligned_free = multi_heap_aligned_free_impl);
|
||||
PROVIDE (multi_heap_check = multi_heap_check);
|
||||
PROVIDE (multi_heap_set_lock = multi_heap_set_lock);
|
||||
PROVIDE (multi_heap_internal_lock = multi_heap_internal_lock);
|
||||
PROVIDE (multi_heap_internal_unlock = multi_heap_internal_unlock);
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include "esp_rom_tlsf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief TLSF ROM vtable stub table for esp32c5.
|
||||
*
|
||||
* This struct mirrors the TLSF function-pointer vtable stored in ROM.
|
||||
* Its layout MUST exactly match the ROM vtable for the target chip.
|
||||
* It is used by tlsf_set_rom_patches() to intercept TLSF calls.
|
||||
*/
|
||||
struct heap_tlsf_stub_table_t {
|
||||
tlsf_t (*tlsf_create)(void *mem, size_t max_bytes);
|
||||
tlsf_t (*tlsf_create_with_pool)(void *mem, size_t pool_bytes, size_t max_bytes);
|
||||
pool_t (*tlsf_get_pool)(tlsf_t tlsf);
|
||||
pool_t (*tlsf_add_pool)(tlsf_t tlsf, void *mem, size_t bytes);
|
||||
void (*tlsf_remove_pool)(tlsf_t tlsf, pool_t pool);
|
||||
|
||||
void *(*tlsf_malloc)(tlsf_t tlsf, size_t size);
|
||||
void *(*tlsf_memalign)(tlsf_t tlsf, size_t align, size_t size);
|
||||
void *(*tlsf_memalign_offs)(tlsf_t tlsf, size_t align, size_t size, size_t offset);
|
||||
void *(*tlsf_realloc)(tlsf_t tlsf, void *ptr, size_t size);
|
||||
void (*tlsf_free)(tlsf_t tlsf, void *ptr);
|
||||
|
||||
size_t (*tlsf_block_size)(void *ptr);
|
||||
size_t (*tlsf_size)(tlsf_t tlsf);
|
||||
size_t (*tlsf_align_size)(void);
|
||||
size_t (*tlsf_block_size_min)(void);
|
||||
size_t (*tlsf_block_size_max)(tlsf_t tlsf);
|
||||
size_t (*tlsf_pool_overhead)(void);
|
||||
size_t (*tlsf_alloc_overhead)(void);
|
||||
|
||||
void (*tlsf_walk_pool)(pool_t pool, tlsf_walker walker, void *user);
|
||||
|
||||
int (*tlsf_check)(tlsf_t tlsf);
|
||||
int (*tlsf_check_pool)(pool_t pool);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/* ROM function interface esp32c5.rom.heap.ld for esp32c5
|
||||
*
|
||||
*
|
||||
* Generated from ./target/esp32c5/interface-esp32c5.yml md5sum 4dfe6ccc311ca3575012c23e3753353c
|
||||
*
|
||||
* Compatible with ROM where ECO version equal or greater to 2.
|
||||
*
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
*/
|
||||
|
||||
/***************************************
|
||||
Group heap
|
||||
***************************************/
|
||||
|
||||
/* Functions */
|
||||
tlsf_create = 0x4000040c;
|
||||
tlsf_create_with_pool = 0x40000410;
|
||||
tlsf_get_pool = 0x40000414;
|
||||
tlsf_add_pool = 0x40000418;
|
||||
tlsf_remove_pool = 0x4000041c;
|
||||
tlsf_malloc = 0x40000420;
|
||||
tlsf_memalign = 0x40000424;
|
||||
tlsf_memalign_offs = 0x40000428;
|
||||
tlsf_realloc = 0x4000042c;
|
||||
tlsf_free = 0x40000430;
|
||||
tlsf_block_size = 0x40000434;
|
||||
tlsf_size = 0x40000438;
|
||||
tlsf_align_size = 0x4000043c;
|
||||
tlsf_block_size_min = 0x40000440;
|
||||
tlsf_block_size_max = 0x40000444;
|
||||
tlsf_pool_overhead = 0x40000448;
|
||||
tlsf_alloc_overhead = 0x4000044c;
|
||||
tlsf_walk_pool = 0x40000450;
|
||||
tlsf_check = 0x40000454;
|
||||
tlsf_check_pool = 0x40000458;
|
||||
tlsf_poison_fill_pfunc_set = 0x4000045c;
|
||||
tlsf_poison_check_pfunc_set = 0x40000460;
|
||||
multi_heap_get_block_address_impl = 0x40000464;
|
||||
multi_heap_get_allocated_size_impl = 0x40000468;
|
||||
multi_heap_register_impl = 0x4000046c;
|
||||
multi_heap_set_lock = 0x40000470;
|
||||
multi_heap_os_funcs_init = 0x40000474;
|
||||
multi_heap_internal_lock = 0x40000478;
|
||||
multi_heap_internal_unlock = 0x4000047c;
|
||||
multi_heap_get_first_block = 0x40000480;
|
||||
multi_heap_get_next_block = 0x40000484;
|
||||
multi_heap_is_free = 0x40000488;
|
||||
multi_heap_malloc_impl = 0x4000048c;
|
||||
multi_heap_free_impl = 0x40000490;
|
||||
multi_heap_realloc_impl = 0x40000494;
|
||||
multi_heap_aligned_alloc_impl_offs = 0x40000498;
|
||||
multi_heap_aligned_alloc_impl = 0x4000049c;
|
||||
multi_heap_check = 0x400004a0;
|
||||
multi_heap_dump = 0x400004a4;
|
||||
multi_heap_free_size_impl = 0x400004a8;
|
||||
multi_heap_minimum_free_size_impl = 0x400004ac;
|
||||
multi_heap_get_info_impl = 0x400004b0;
|
||||
/* Data (.data, .bss, .rodata) */
|
||||
heap_tlsf_table_ptr = 0x4085ffd8;
|
||||
|
||||
PROVIDE (multi_heap_malloc = multi_heap_malloc_impl);
|
||||
PROVIDE (multi_heap_free = multi_heap_free_impl);
|
||||
PROVIDE (multi_heap_realloc = multi_heap_realloc_impl);
|
||||
PROVIDE (multi_heap_get_allocated_size = multi_heap_get_allocated_size_impl);
|
||||
PROVIDE (multi_heap_register = multi_heap_register_impl);
|
||||
PROVIDE (multi_heap_get_info = multi_heap_get_info_impl);
|
||||
PROVIDE (multi_heap_free_size = multi_heap_free_size_impl);
|
||||
PROVIDE (multi_heap_minimum_free_size = multi_heap_minimum_free_size_impl);
|
||||
PROVIDE (multi_heap_get_block_address = multi_heap_get_block_address_impl);
|
||||
PROVIDE (multi_heap_aligned_alloc = multi_heap_aligned_alloc_impl);
|
||||
PROVIDE (multi_heap_aligned_free = multi_heap_aligned_free_impl);
|
||||
PROVIDE (multi_heap_check = multi_heap_check);
|
||||
PROVIDE (multi_heap_set_lock = multi_heap_set_lock);
|
||||
PROVIDE (multi_heap_os_funcs_init = multi_heap_mutex_init);
|
||||
PROVIDE (multi_heap_internal_lock = multi_heap_internal_lock);
|
||||
PROVIDE (multi_heap_internal_unlock = multi_heap_internal_unlock);
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include "esp_rom_tlsf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief TLSF ROM vtable stub table for esp32c6.
|
||||
*
|
||||
* This struct mirrors the TLSF function-pointer vtable stored in ROM.
|
||||
* Its layout MUST exactly match the ROM vtable for the target chip.
|
||||
* It is used by tlsf_set_rom_patches() to intercept TLSF calls.
|
||||
*/
|
||||
struct heap_tlsf_stub_table_t {
|
||||
tlsf_t (*tlsf_create)(void* mem);
|
||||
tlsf_t (*tlsf_create_with_pool)(void* mem, size_t bytes);
|
||||
pool_t (*tlsf_get_pool)(tlsf_t tlsf);
|
||||
pool_t (*tlsf_add_pool)(tlsf_t tlsf, void* mem, size_t bytes);
|
||||
void (*tlsf_remove_pool)(tlsf_t tlsf, pool_t pool);
|
||||
|
||||
void* (*tlsf_malloc)(tlsf_t tlsf, size_t size);
|
||||
void* (*tlsf_memalign)(tlsf_t tlsf, size_t align, size_t size);
|
||||
void* (*tlsf_memalign_offs)(tlsf_t tlsf, size_t align, size_t size, size_t offset);
|
||||
void* (*tlsf_realloc)(tlsf_t tlsf, void* ptr, size_t size);
|
||||
void (*tlsf_free)(tlsf_t tlsf, void* ptr);
|
||||
|
||||
size_t (*tlsf_block_size)(void* ptr);
|
||||
size_t (*tlsf_size)(void);
|
||||
size_t (*tlsf_align_size)(void);
|
||||
size_t (*tlsf_block_size_min)(void);
|
||||
size_t (*tlsf_block_size_max)(void);
|
||||
size_t (*tlsf_pool_overhead)(void);
|
||||
size_t (*tlsf_alloc_overhead)(void);
|
||||
|
||||
void (*tlsf_walk_pool)(pool_t pool, tlsf_walker walker, void* user);
|
||||
|
||||
int (*tlsf_check)(tlsf_t tlsf);
|
||||
int (*tlsf_check_pool)(pool_t pool);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/* ROM function interface esp32c6.rom.heap.ld for esp32c6
|
||||
*
|
||||
*
|
||||
* Generated from ./target/esp32c6/interface-esp32c6.yml md5sum 06c13e133e0743d09b87aba30d3e213b
|
||||
*
|
||||
* Compatible with ROM where ECO version equal or greater to 0.
|
||||
*
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
*/
|
||||
|
||||
/***************************************
|
||||
Group heap
|
||||
***************************************/
|
||||
|
||||
/* Functions */
|
||||
tlsf_create = 0x400003fc;
|
||||
tlsf_create_with_pool = 0x40000400;
|
||||
tlsf_get_pool = 0x40000404;
|
||||
tlsf_add_pool = 0x40000408;
|
||||
tlsf_remove_pool = 0x4000040c;
|
||||
tlsf_malloc = 0x40000410;
|
||||
tlsf_memalign = 0x40000414;
|
||||
tlsf_memalign_offs = 0x40000418;
|
||||
tlsf_realloc = 0x4000041c;
|
||||
tlsf_free = 0x40000420;
|
||||
tlsf_block_size = 0x40000424;
|
||||
tlsf_size = 0x40000428;
|
||||
tlsf_align_size = 0x4000042c;
|
||||
tlsf_block_size_min = 0x40000430;
|
||||
tlsf_block_size_max = 0x40000434;
|
||||
tlsf_pool_overhead = 0x40000438;
|
||||
tlsf_alloc_overhead = 0x4000043c;
|
||||
tlsf_walk_pool = 0x40000440;
|
||||
tlsf_check = 0x40000444;
|
||||
tlsf_poison_fill_pfunc_set = 0x4000044c;
|
||||
tlsf_poison_check_pfunc_set = 0x40000450;
|
||||
multi_heap_get_block_address_impl = 0x40000454;
|
||||
multi_heap_get_allocated_size_impl = 0x40000458;
|
||||
multi_heap_register_impl = 0x4000045c;
|
||||
multi_heap_set_lock = 0x40000460;
|
||||
multi_heap_mutex_init = 0x40000464;
|
||||
multi_heap_internal_lock = 0x40000468;
|
||||
multi_heap_internal_unlock = 0x4000046c;
|
||||
multi_heap_get_first_block = 0x40000470;
|
||||
multi_heap_get_next_block = 0x40000474;
|
||||
multi_heap_is_free = 0x40000478;
|
||||
multi_heap_malloc_impl = 0x4000047c;
|
||||
multi_heap_free_impl = 0x40000480;
|
||||
multi_heap_realloc_impl = 0x40000484;
|
||||
multi_heap_aligned_alloc_impl_offs = 0x40000488;
|
||||
multi_heap_aligned_alloc_impl = 0x4000048c;
|
||||
multi_heap_check = 0x40000490;
|
||||
multi_heap_dump = 0x40000494;
|
||||
multi_heap_free_size_impl = 0x40000498;
|
||||
multi_heap_minimum_free_size_impl = 0x4000049c;
|
||||
multi_heap_get_info_impl = 0x400004a0;
|
||||
/* Data (.data, .bss, .rodata) */
|
||||
heap_tlsf_table_ptr = 0x4087ffd8;
|
||||
|
||||
PROVIDE (multi_heap_malloc = multi_heap_malloc_impl);
|
||||
PROVIDE (multi_heap_free = multi_heap_free_impl);
|
||||
PROVIDE (multi_heap_realloc = multi_heap_realloc_impl);
|
||||
PROVIDE (multi_heap_get_allocated_size = multi_heap_get_allocated_size_impl);
|
||||
PROVIDE (multi_heap_register = multi_heap_register_impl);
|
||||
PROVIDE (multi_heap_get_info = multi_heap_get_info_impl);
|
||||
PROVIDE (multi_heap_free_size = multi_heap_free_size_impl);
|
||||
PROVIDE (multi_heap_minimum_free_size = multi_heap_minimum_free_size_impl);
|
||||
PROVIDE (multi_heap_get_block_address = multi_heap_get_block_address_impl);
|
||||
PROVIDE (multi_heap_aligned_alloc = multi_heap_aligned_alloc_impl);
|
||||
PROVIDE (multi_heap_aligned_free = multi_heap_aligned_free_impl);
|
||||
PROVIDE (multi_heap_check = multi_heap_check);
|
||||
PROVIDE (multi_heap_set_lock = multi_heap_set_lock);
|
||||
PROVIDE (multi_heap_os_funcs_init = multi_heap_mutex_init);
|
||||
PROVIDE (multi_heap_internal_lock = multi_heap_internal_lock);
|
||||
PROVIDE (multi_heap_internal_unlock = multi_heap_internal_unlock);
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include "esp_rom_tlsf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief TLSF ROM vtable stub table for esp32c61.
|
||||
*
|
||||
* This struct mirrors the TLSF function-pointer vtable stored in ROM.
|
||||
* Its layout MUST exactly match the ROM vtable for the target chip.
|
||||
* It is used by tlsf_set_rom_patches() to intercept TLSF calls.
|
||||
*/
|
||||
struct heap_tlsf_stub_table_t {
|
||||
tlsf_t (*tlsf_create)(void *mem, size_t max_bytes);
|
||||
tlsf_t (*tlsf_create_with_pool)(void *mem, size_t pool_bytes, size_t max_bytes);
|
||||
pool_t (*tlsf_get_pool)(tlsf_t tlsf);
|
||||
pool_t (*tlsf_add_pool)(tlsf_t tlsf, void *mem, size_t bytes);
|
||||
void (*tlsf_remove_pool)(tlsf_t tlsf, pool_t pool);
|
||||
|
||||
void *(*tlsf_malloc)(tlsf_t tlsf, size_t size);
|
||||
void *(*tlsf_memalign)(tlsf_t tlsf, size_t align, size_t size);
|
||||
void *(*tlsf_memalign_offs)(tlsf_t tlsf, size_t align, size_t size, size_t offset);
|
||||
void *(*tlsf_realloc)(tlsf_t tlsf, void *ptr, size_t size);
|
||||
void (*tlsf_free)(tlsf_t tlsf, void *ptr);
|
||||
|
||||
size_t (*tlsf_block_size)(void *ptr);
|
||||
size_t (*tlsf_size)(tlsf_t tlsf);
|
||||
size_t (*tlsf_align_size)(void);
|
||||
size_t (*tlsf_block_size_min)(void);
|
||||
size_t (*tlsf_block_size_max)(tlsf_t tlsf);
|
||||
size_t (*tlsf_pool_overhead)(void);
|
||||
size_t (*tlsf_alloc_overhead)(void);
|
||||
|
||||
void (*tlsf_walk_pool)(pool_t pool, tlsf_walker walker, void *user);
|
||||
|
||||
int (*tlsf_check)(tlsf_t tlsf);
|
||||
int (*tlsf_check_pool)(pool_t pool);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/* ROM function interface esp32c61.rom.heap.ld for esp32c61
|
||||
*
|
||||
*
|
||||
* Generated from ./target/esp32c6lite/interface-esp32c6lite.yml md5sum 27eb0efac0883ee622c22767242c9457
|
||||
*
|
||||
* Compatible with ROM where ECO version equal or greater to 0.
|
||||
*
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
*/
|
||||
|
||||
/***************************************
|
||||
Group heap
|
||||
***************************************/
|
||||
|
||||
/* Functions */
|
||||
tlsf_create = 0x4000040c;
|
||||
tlsf_create_with_pool = 0x40000410;
|
||||
tlsf_get_pool = 0x40000414;
|
||||
tlsf_add_pool = 0x40000418;
|
||||
tlsf_remove_pool = 0x4000041c;
|
||||
tlsf_malloc = 0x40000420;
|
||||
tlsf_memalign = 0x40000424;
|
||||
tlsf_memalign_offs = 0x40000428;
|
||||
tlsf_realloc = 0x4000042c;
|
||||
tlsf_free = 0x40000430;
|
||||
tlsf_block_size = 0x40000434;
|
||||
tlsf_size = 0x40000438;
|
||||
tlsf_align_size = 0x4000043c;
|
||||
tlsf_block_size_min = 0x40000440;
|
||||
tlsf_block_size_max = 0x40000444;
|
||||
tlsf_pool_overhead = 0x40000448;
|
||||
tlsf_alloc_overhead = 0x4000044c;
|
||||
tlsf_walk_pool = 0x40000450;
|
||||
tlsf_check = 0x40000454;
|
||||
tlsf_check_pool = 0x40000458;
|
||||
tlsf_poison_fill_pfunc_set = 0x4000045c;
|
||||
tlsf_poison_check_pfunc_set = 0x40000460;
|
||||
multi_heap_get_block_address_impl = 0x40000464;
|
||||
multi_heap_get_allocated_size_impl = 0x40000468;
|
||||
multi_heap_register_impl = 0x4000046c;
|
||||
multi_heap_set_lock = 0x40000470;
|
||||
multi_heap_os_funcs_init = 0x40000474;
|
||||
multi_heap_internal_lock = 0x40000478;
|
||||
multi_heap_internal_unlock = 0x4000047c;
|
||||
multi_heap_get_first_block = 0x40000480;
|
||||
multi_heap_get_next_block = 0x40000484;
|
||||
multi_heap_is_free = 0x40000488;
|
||||
multi_heap_malloc_impl = 0x4000048c;
|
||||
multi_heap_free_impl = 0x40000490;
|
||||
multi_heap_realloc_impl = 0x40000494;
|
||||
multi_heap_aligned_alloc_impl_offs = 0x40000498;
|
||||
multi_heap_aligned_alloc_impl = 0x4000049c;
|
||||
multi_heap_check = 0x400004a0;
|
||||
multi_heap_dump = 0x400004a4;
|
||||
multi_heap_free_size_impl = 0x400004a8;
|
||||
multi_heap_minimum_free_size_impl = 0x400004ac;
|
||||
multi_heap_get_info_impl = 0x400004b0;
|
||||
/* Data (.data, .bss, .rodata) */
|
||||
heap_tlsf_table_ptr = 0x4084ffd8;
|
||||
|
||||
PROVIDE (multi_heap_malloc = multi_heap_malloc_impl);
|
||||
PROVIDE (multi_heap_free = multi_heap_free_impl);
|
||||
PROVIDE (multi_heap_realloc = multi_heap_realloc_impl);
|
||||
PROVIDE (multi_heap_get_allocated_size = multi_heap_get_allocated_size_impl);
|
||||
PROVIDE (multi_heap_register = multi_heap_register_impl);
|
||||
PROVIDE (multi_heap_get_info = multi_heap_get_info_impl);
|
||||
PROVIDE (multi_heap_free_size = multi_heap_free_size_impl);
|
||||
PROVIDE (multi_heap_minimum_free_size = multi_heap_minimum_free_size_impl);
|
||||
PROVIDE (multi_heap_get_block_address = multi_heap_get_block_address_impl);
|
||||
PROVIDE (multi_heap_aligned_alloc = multi_heap_aligned_alloc_impl);
|
||||
PROVIDE (multi_heap_aligned_free = multi_heap_aligned_free_impl);
|
||||
PROVIDE (multi_heap_check = multi_heap_check);
|
||||
PROVIDE (multi_heap_set_lock = multi_heap_set_lock);
|
||||
PROVIDE (multi_heap_internal_lock = multi_heap_internal_lock);
|
||||
PROVIDE (multi_heap_internal_unlock = multi_heap_internal_unlock);
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include "esp_rom_tlsf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief TLSF ROM vtable stub table for esp32h2.
|
||||
*
|
||||
* This struct mirrors the TLSF function-pointer vtable stored in ROM.
|
||||
* Its layout MUST exactly match the ROM vtable for the target chip.
|
||||
* It is used by tlsf_set_rom_patches() to intercept TLSF calls.
|
||||
*/
|
||||
struct heap_tlsf_stub_table_t {
|
||||
tlsf_t (*tlsf_create)(void *mem, size_t max_bytes);
|
||||
tlsf_t (*tlsf_create_with_pool)(void *mem, size_t pool_bytes, size_t max_bytes);
|
||||
pool_t (*tlsf_get_pool)(tlsf_t tlsf);
|
||||
pool_t (*tlsf_add_pool)(tlsf_t tlsf, void *mem, size_t bytes);
|
||||
void (*tlsf_remove_pool)(tlsf_t tlsf, pool_t pool);
|
||||
|
||||
void *(*tlsf_malloc)(tlsf_t tlsf, size_t size);
|
||||
void *(*tlsf_memalign)(tlsf_t tlsf, size_t align, size_t size);
|
||||
void *(*tlsf_memalign_offs)(tlsf_t tlsf, size_t align, size_t size, size_t offset);
|
||||
void *(*tlsf_realloc)(tlsf_t tlsf, void *ptr, size_t size);
|
||||
void (*tlsf_free)(tlsf_t tlsf, void *ptr);
|
||||
|
||||
size_t (*tlsf_block_size)(void *ptr);
|
||||
size_t (*tlsf_size)(tlsf_t tlsf);
|
||||
size_t (*tlsf_align_size)(void);
|
||||
size_t (*tlsf_block_size_min)(void);
|
||||
/* NOTE: The ROM signature is tlsf_block_size_max(control_t *control), but
|
||||
* control_t is an internal TLSF type not exposed in any public header.
|
||||
* Since tlsf_t is typedef'd as void* (same as control_t), the ABI is
|
||||
* identical and we use tlsf_t here to keep this header self-contained. */
|
||||
size_t (*tlsf_block_size_max)(tlsf_t tlsf);
|
||||
size_t (*tlsf_pool_overhead)(void);
|
||||
size_t (*tlsf_alloc_overhead)(void);
|
||||
|
||||
void (*tlsf_walk_pool)(pool_t pool, tlsf_walker walker, void *user);
|
||||
|
||||
int (*tlsf_check)(tlsf_t tlsf);
|
||||
int (*tlsf_check_pool)(pool_t pool);
|
||||
|
||||
void *(*tlsf_malloc_addr)(tlsf_t tlsf, size_t size, void *address);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/* ROM function interface esp32h2.rom.heap.ld for esp32h2
|
||||
*
|
||||
*
|
||||
* Generated from ./target/esp32h2/interface-esp32h2.yml md5sum c0ad4e113e5b29bb9d799f10f03edbc1
|
||||
*
|
||||
* Compatible with ROM where ECO version equal or greater to 0.
|
||||
*
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
*/
|
||||
|
||||
/***************************************
|
||||
Group heap
|
||||
***************************************/
|
||||
|
||||
/* Functions */
|
||||
tlsf_create = 0x400003f4;
|
||||
tlsf_create_with_pool = 0x400003f8;
|
||||
tlsf_get_pool = 0x400003fc;
|
||||
tlsf_add_pool = 0x40000400;
|
||||
tlsf_remove_pool = 0x40000404;
|
||||
tlsf_malloc = 0x40000408;
|
||||
tlsf_memalign = 0x4000040c;
|
||||
tlsf_memalign_offs = 0x40000410;
|
||||
tlsf_realloc = 0x40000414;
|
||||
tlsf_free = 0x40000418;
|
||||
tlsf_block_size = 0x4000041c;
|
||||
tlsf_size = 0x40000420;
|
||||
tlsf_align_size = 0x40000424;
|
||||
tlsf_block_size_min = 0x40000428;
|
||||
tlsf_block_size_max = 0x4000042c;
|
||||
tlsf_pool_overhead = 0x40000430;
|
||||
tlsf_alloc_overhead = 0x40000434;
|
||||
tlsf_walk_pool = 0x40000438;
|
||||
tlsf_check = 0x4000043c;
|
||||
tlsf_poison_fill_pfunc_set = 0x40000444;
|
||||
tlsf_poison_check_pfunc_set = 0x40000448;
|
||||
multi_heap_get_block_address_impl = 0x4000044c;
|
||||
multi_heap_get_allocated_size_impl = 0x40000450;
|
||||
multi_heap_register_impl = 0x40000454;
|
||||
multi_heap_set_lock = 0x40000458;
|
||||
multi_heap_os_funcs_init = 0x4000045c;
|
||||
multi_heap_internal_lock = 0x40000460;
|
||||
multi_heap_internal_unlock = 0x40000464;
|
||||
multi_heap_get_first_block = 0x40000468;
|
||||
multi_heap_get_next_block = 0x4000046c;
|
||||
multi_heap_is_free = 0x40000470;
|
||||
multi_heap_malloc_impl = 0x40000474;
|
||||
multi_heap_free_impl = 0x40000478;
|
||||
multi_heap_realloc_impl = 0x4000047c;
|
||||
multi_heap_aligned_alloc_impl_offs = 0x40000480;
|
||||
multi_heap_aligned_alloc_impl = 0x40000484;
|
||||
multi_heap_check = 0x40000488;
|
||||
multi_heap_dump = 0x4000048c;
|
||||
multi_heap_free_size_impl = 0x40000490;
|
||||
multi_heap_minimum_free_size_impl = 0x40000494;
|
||||
multi_heap_get_info_impl = 0x40000498;
|
||||
/* Data (.data, .bss, .rodata) */
|
||||
heap_tlsf_table_ptr = 0x4084ffd8;
|
||||
|
||||
PROVIDE (multi_heap_malloc = multi_heap_malloc_impl);
|
||||
PROVIDE (multi_heap_free = multi_heap_free_impl);
|
||||
PROVIDE (multi_heap_realloc = multi_heap_realloc_impl);
|
||||
PROVIDE (multi_heap_get_allocated_size = multi_heap_get_allocated_size_impl);
|
||||
PROVIDE (multi_heap_register = multi_heap_register_impl);
|
||||
PROVIDE (multi_heap_get_info = multi_heap_get_info_impl);
|
||||
PROVIDE (multi_heap_free_size = multi_heap_free_size_impl);
|
||||
PROVIDE (multi_heap_minimum_free_size = multi_heap_minimum_free_size_impl);
|
||||
PROVIDE (multi_heap_get_block_address = multi_heap_get_block_address_impl);
|
||||
PROVIDE (multi_heap_aligned_alloc = multi_heap_aligned_alloc_impl);
|
||||
PROVIDE (multi_heap_aligned_free = multi_heap_aligned_free_impl);
|
||||
PROVIDE (multi_heap_check = multi_heap_check);
|
||||
PROVIDE (multi_heap_set_lock = multi_heap_set_lock);
|
||||
PROVIDE (multi_heap_os_funcs_init = multi_heap_mutex_init);
|
||||
PROVIDE (multi_heap_internal_lock = multi_heap_internal_lock);
|
||||
PROVIDE (multi_heap_internal_unlock = multi_heap_internal_unlock);
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include "esp_rom_tlsf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief TLSF ROM vtable stub table for esp32h21.
|
||||
*
|
||||
* This struct mirrors the TLSF function-pointer vtable stored in ROM.
|
||||
* Its layout MUST exactly match the ROM vtable for the target chip.
|
||||
* It is used by tlsf_set_rom_patches() to intercept TLSF calls.
|
||||
*/
|
||||
struct heap_tlsf_stub_table_t {
|
||||
tlsf_t (*tlsf_create)(void *mem, size_t max_bytes);
|
||||
tlsf_t (*tlsf_create_with_pool)(void *mem, size_t pool_bytes, size_t max_bytes);
|
||||
pool_t (*tlsf_get_pool)(tlsf_t tlsf);
|
||||
pool_t (*tlsf_add_pool)(tlsf_t tlsf, void *mem, size_t bytes);
|
||||
void (*tlsf_remove_pool)(tlsf_t tlsf, pool_t pool);
|
||||
|
||||
void *(*tlsf_malloc)(tlsf_t tlsf, size_t size);
|
||||
void *(*tlsf_memalign)(tlsf_t tlsf, size_t align, size_t size);
|
||||
void *(*tlsf_memalign_offs)(tlsf_t tlsf, size_t align, size_t size, size_t offset);
|
||||
void *(*tlsf_realloc)(tlsf_t tlsf, void *ptr, size_t size);
|
||||
void (*tlsf_free)(tlsf_t tlsf, void *ptr);
|
||||
|
||||
size_t (*tlsf_block_size)(void *ptr);
|
||||
size_t (*tlsf_size)(tlsf_t tlsf);
|
||||
size_t (*tlsf_align_size)(void);
|
||||
size_t (*tlsf_block_size_min)(void);
|
||||
/* NOTE: The ROM signature is tlsf_block_size_max(control_t *control), but
|
||||
* control_t is an internal TLSF type not exposed in any public header.
|
||||
* Since tlsf_t is typedef'd as void* (same as control_t), the ABI is
|
||||
* identical and we use tlsf_t here to keep this header self-contained. */
|
||||
size_t (*tlsf_block_size_max)(tlsf_t tlsf);
|
||||
size_t (*tlsf_pool_overhead)(void);
|
||||
size_t (*tlsf_alloc_overhead)(void);
|
||||
|
||||
void (*tlsf_walk_pool)(pool_t pool, tlsf_walker walker, void *user);
|
||||
|
||||
int (*tlsf_check)(tlsf_t tlsf);
|
||||
int (*tlsf_check_pool)(pool_t pool);
|
||||
|
||||
void *(*tlsf_malloc_addr)(tlsf_t tlsf, size_t size, void *address);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/* ROM function interface esp32h21.rom.heap.ld for esp32h21
|
||||
*
|
||||
*
|
||||
* Generated from ./target/esp32h21/interface-esp32h21.yml md5sum dee73289acb146ae14dd9544143527f0
|
||||
*
|
||||
* Compatible with ROM where ECO version equal or greater to 0.
|
||||
*
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
*/
|
||||
|
||||
/***************************************
|
||||
Group heap
|
||||
***************************************/
|
||||
|
||||
/* Functions */
|
||||
tlsf_create = 0x400003f4;
|
||||
tlsf_create_with_pool = 0x400003f8;
|
||||
tlsf_get_pool = 0x400003fc;
|
||||
tlsf_add_pool = 0x40000400;
|
||||
tlsf_remove_pool = 0x40000404;
|
||||
tlsf_malloc = 0x40000408;
|
||||
tlsf_memalign = 0x4000040c;
|
||||
tlsf_memalign_offs = 0x40000410;
|
||||
tlsf_malloc_addr = 0x40000414;
|
||||
tlsf_realloc = 0x40000418;
|
||||
tlsf_free = 0x4000041c;
|
||||
tlsf_block_size = 0x40000420;
|
||||
tlsf_size = 0x40000424;
|
||||
tlsf_pool_overhead = 0x40000428;
|
||||
tlsf_alloc_overhead = 0x4000042c;
|
||||
tlsf_walk_pool = 0x40000430;
|
||||
tlsf_check = 0x40000434;
|
||||
tlsf_check_pool = 0x40000438;
|
||||
tlsf_poison_fill_pfunc_set = 0x4000043c;
|
||||
tlsf_poison_check_pfunc_set = 0x40000440;
|
||||
multi_heap_get_block_address_impl = 0x40000444;
|
||||
multi_heap_get_allocated_size_impl = 0x40000448;
|
||||
multi_heap_register_impl = 0x4000044c;
|
||||
multi_heap_set_lock = 0x40000450;
|
||||
multi_heap_os_funcs_init = 0x40000454;
|
||||
multi_heap_internal_lock = 0x40000458;
|
||||
multi_heap_internal_unlock = 0x4000045c;
|
||||
multi_heap_get_first_block = 0x40000460;
|
||||
multi_heap_get_next_block = 0x40000464;
|
||||
multi_heap_is_free = 0x40000468;
|
||||
multi_heap_malloc_impl = 0x4000046c;
|
||||
multi_heap_free_impl = 0x40000470;
|
||||
multi_heap_realloc_impl = 0x40000474;
|
||||
multi_heap_aligned_alloc_impl_offs = 0x40000478;
|
||||
multi_heap_aligned_alloc_impl = 0x4000047c;
|
||||
multi_heap_check = 0x40000480;
|
||||
multi_heap_dump = 0x40000484;
|
||||
multi_heap_free_size_impl = 0x40000488;
|
||||
multi_heap_minimum_free_size_impl = 0x4000048c;
|
||||
multi_heap_get_info_impl = 0x40000490;
|
||||
/* Data (.data, .bss, .rodata) */
|
||||
heap_tlsf_table_ptr = 0x4084ffd8;
|
||||
|
||||
PROVIDE (multi_heap_malloc = multi_heap_malloc_impl);
|
||||
PROVIDE (multi_heap_free = multi_heap_free_impl);
|
||||
PROVIDE (multi_heap_realloc = multi_heap_realloc_impl);
|
||||
PROVIDE (multi_heap_get_allocated_size = multi_heap_get_allocated_size_impl);
|
||||
PROVIDE (multi_heap_register = multi_heap_register_impl);
|
||||
PROVIDE (multi_heap_get_info = multi_heap_get_info_impl);
|
||||
PROVIDE (multi_heap_free_size = multi_heap_free_size_impl);
|
||||
PROVIDE (multi_heap_minimum_free_size = multi_heap_minimum_free_size_impl);
|
||||
PROVIDE (multi_heap_get_block_address = multi_heap_get_block_address_impl);
|
||||
PROVIDE (multi_heap_aligned_alloc = multi_heap_aligned_alloc_impl);
|
||||
PROVIDE (multi_heap_aligned_free = multi_heap_aligned_free_impl);
|
||||
PROVIDE (multi_heap_check = multi_heap_check);
|
||||
PROVIDE (multi_heap_set_lock = multi_heap_set_lock);
|
||||
PROVIDE (multi_heap_os_funcs_init = multi_heap_mutex_init);
|
||||
PROVIDE (multi_heap_internal_lock = multi_heap_internal_lock);
|
||||
PROVIDE (multi_heap_internal_unlock = multi_heap_internal_unlock);
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include "esp_rom_tlsf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief TLSF ROM vtable stub table for esp32h4.
|
||||
*
|
||||
* This struct mirrors the TLSF function-pointer vtable stored in ROM.
|
||||
* Its layout MUST exactly match the ROM vtable for the target chip.
|
||||
* It is used by tlsf_set_rom_patches() to intercept TLSF calls.
|
||||
*/
|
||||
struct heap_tlsf_stub_table_t {
|
||||
tlsf_t (*tlsf_create)(void *mem, size_t max_bytes);
|
||||
tlsf_t (*tlsf_create_with_pool)(void *mem, size_t pool_bytes, size_t max_bytes);
|
||||
pool_t (*tlsf_get_pool)(tlsf_t tlsf);
|
||||
pool_t (*tlsf_add_pool)(tlsf_t tlsf, void *mem, size_t bytes);
|
||||
void (*tlsf_remove_pool)(tlsf_t tlsf, pool_t pool);
|
||||
|
||||
void *(*tlsf_malloc)(tlsf_t tlsf, size_t size);
|
||||
void *(*tlsf_memalign)(tlsf_t tlsf, size_t align, size_t size);
|
||||
void *(*tlsf_memalign_offs)(tlsf_t tlsf, size_t align, size_t size, size_t offset);
|
||||
void *(*tlsf_realloc)(tlsf_t tlsf, void *ptr, size_t size);
|
||||
void (*tlsf_free)(tlsf_t tlsf, void *ptr);
|
||||
|
||||
size_t (*tlsf_block_size)(void *ptr);
|
||||
size_t (*tlsf_size)(tlsf_t tlsf);
|
||||
size_t (*tlsf_align_size)(void);
|
||||
size_t (*tlsf_block_size_min)(void);
|
||||
/* NOTE: The ROM signature is tlsf_block_size_max(control_t *control), but
|
||||
* control_t is an internal TLSF type not exposed in any public header.
|
||||
* Since tlsf_t is typedef'd as void* (same as control_t), the ABI is
|
||||
* identical and we use tlsf_t here to keep this header self-contained. */
|
||||
size_t (*tlsf_block_size_max)(tlsf_t tlsf);
|
||||
size_t (*tlsf_pool_overhead)(void);
|
||||
size_t (*tlsf_alloc_overhead)(void);
|
||||
|
||||
void (*tlsf_walk_pool)(pool_t pool, tlsf_walker walker, void *user);
|
||||
|
||||
int (*tlsf_check)(tlsf_t tlsf);
|
||||
int (*tlsf_check_pool)(pool_t pool);
|
||||
|
||||
void *(*tlsf_malloc_addr)(tlsf_t tlsf, size_t size, void *address);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/* ROM function interface esp32h4.rom.heap.ld for esp32h4
|
||||
*
|
||||
*
|
||||
* Generated from ../../rom/target/esp32h4/interface-esp32h4.yml md5sum bb9ee317148d3c5b10610936a3675a65
|
||||
*
|
||||
* Compatible with ROM where ECO version equal or greater to 0.
|
||||
*
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
*/
|
||||
|
||||
/***************************************
|
||||
Group heap
|
||||
***************************************/
|
||||
|
||||
/* Functions */
|
||||
tlsf_create = 0x400003a8;
|
||||
tlsf_create_with_pool = 0x400003ac;
|
||||
tlsf_get_pool = 0x400003b0;
|
||||
tlsf_add_pool = 0x400003b4;
|
||||
tlsf_remove_pool = 0x400003b8;
|
||||
tlsf_malloc = 0x400003bc;
|
||||
tlsf_memalign = 0x400003c0;
|
||||
tlsf_memalign_offs = 0x400003c4;
|
||||
tlsf_malloc_addr = 0x400003c8;
|
||||
tlsf_realloc = 0x400003cc;
|
||||
tlsf_free = 0x400003d0;
|
||||
tlsf_block_size = 0x400003d4;
|
||||
tlsf_size = 0x400003d8;
|
||||
tlsf_pool_overhead = 0x400003dc;
|
||||
tlsf_alloc_overhead = 0x400003e0;
|
||||
tlsf_walk_pool = 0x400003e4;
|
||||
tlsf_check = 0x400003e8;
|
||||
tlsf_check_pool = 0x400003ec;
|
||||
tlsf_poison_fill_pfunc_set = 0x400003f0;
|
||||
tlsf_poison_check_pfunc_set = 0x400003f4;
|
||||
multi_heap_get_block_address_impl = 0x400003f8;
|
||||
multi_heap_get_allocated_size_impl = 0x400003fc;
|
||||
multi_heap_register_impl = 0x40000400;
|
||||
multi_heap_set_lock = 0x40000404;
|
||||
multi_heap_os_funcs_init = 0x40000408;
|
||||
multi_heap_internal_lock = 0x4000040c;
|
||||
multi_heap_internal_unlock = 0x40000410;
|
||||
multi_heap_get_first_block = 0x40000414;
|
||||
multi_heap_get_next_block = 0x40000418;
|
||||
multi_heap_is_free = 0x4000041c;
|
||||
multi_heap_malloc_impl = 0x40000420;
|
||||
multi_heap_free_impl = 0x40000424;
|
||||
multi_heap_realloc_impl = 0x40000428;
|
||||
multi_heap_aligned_alloc_impl_offs = 0x4000042c;
|
||||
multi_heap_aligned_alloc_impl = 0x40000430;
|
||||
multi_heap_check = 0x40000434;
|
||||
multi_heap_dump = 0x40000438;
|
||||
multi_heap_free_size_impl = 0x4000043c;
|
||||
multi_heap_minimum_free_size_impl = 0x40000440;
|
||||
multi_heap_get_info_impl = 0x40000444;
|
||||
/* Data (.data, .bss, .rodata) */
|
||||
heap_tlsf_table_ptr = 0x4085ffd4;
|
||||
|
||||
PROVIDE (multi_heap_malloc = multi_heap_malloc_impl);
|
||||
PROVIDE (multi_heap_free = multi_heap_free_impl);
|
||||
PROVIDE (multi_heap_realloc = multi_heap_realloc_impl);
|
||||
PROVIDE (multi_heap_get_allocated_size = multi_heap_get_allocated_size_impl);
|
||||
PROVIDE (multi_heap_register = multi_heap_register_impl);
|
||||
PROVIDE (multi_heap_get_info = multi_heap_get_info_impl);
|
||||
PROVIDE (multi_heap_free_size = multi_heap_free_size_impl);
|
||||
PROVIDE (multi_heap_minimum_free_size = multi_heap_minimum_free_size_impl);
|
||||
PROVIDE (multi_heap_get_block_address = multi_heap_get_block_address_impl);
|
||||
PROVIDE (multi_heap_aligned_alloc = multi_heap_aligned_alloc_impl);
|
||||
PROVIDE (multi_heap_aligned_free = multi_heap_aligned_free_impl);
|
||||
PROVIDE (multi_heap_check = multi_heap_check);
|
||||
PROVIDE (multi_heap_set_lock = multi_heap_set_lock);
|
||||
PROVIDE (multi_heap_os_funcs_init = multi_heap_mutex_init);
|
||||
PROVIDE (multi_heap_internal_lock = multi_heap_internal_lock);
|
||||
PROVIDE (multi_heap_internal_unlock = multi_heap_internal_unlock);
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include "esp_rom_tlsf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief TLSF ROM vtable stub table for esp32s31.
|
||||
*
|
||||
* This struct mirrors the TLSF function-pointer vtable stored in ROM.
|
||||
* Its layout MUST exactly match the ROM vtable for the target chip.
|
||||
* It is used by tlsf_set_rom_patches() to intercept TLSF calls.
|
||||
*/
|
||||
struct heap_tlsf_stub_table_t {
|
||||
tlsf_t (*tlsf_create)(void *mem, size_t max_bytes);
|
||||
tlsf_t (*tlsf_create_with_pool)(void *mem, size_t pool_bytes, size_t max_bytes);
|
||||
pool_t (*tlsf_get_pool)(tlsf_t tlsf);
|
||||
pool_t (*tlsf_add_pool)(tlsf_t tlsf, void *mem, size_t bytes);
|
||||
void (*tlsf_remove_pool)(tlsf_t tlsf, pool_t pool);
|
||||
|
||||
void *(*tlsf_malloc)(tlsf_t tlsf, size_t size);
|
||||
void *(*tlsf_memalign)(tlsf_t tlsf, size_t align, size_t size);
|
||||
void *(*tlsf_memalign_offs)(tlsf_t tlsf, size_t align, size_t size, size_t offset);
|
||||
void *(*tlsf_realloc)(tlsf_t tlsf, void *ptr, size_t size);
|
||||
void (*tlsf_free)(tlsf_t tlsf, void *ptr);
|
||||
|
||||
size_t (*tlsf_block_size)(void *ptr);
|
||||
size_t (*tlsf_size)(tlsf_t tlsf);
|
||||
size_t (*tlsf_align_size)(void);
|
||||
size_t (*tlsf_block_size_min)(void);
|
||||
/* NOTE: The ROM signature is tlsf_block_size_max(control_t *control), but
|
||||
* control_t is an internal TLSF type not exposed in any public header.
|
||||
* Since tlsf_t is typedef'd as void* (same as control_t), the ABI is
|
||||
* identical and we use tlsf_t here to keep this header self-contained. */
|
||||
size_t (*tlsf_block_size_max)(tlsf_t tlsf);
|
||||
size_t (*tlsf_pool_overhead)(void);
|
||||
size_t (*tlsf_alloc_overhead)(void);
|
||||
|
||||
void (*tlsf_walk_pool)(pool_t pool, tlsf_walker walker, void *user);
|
||||
|
||||
int (*tlsf_check)(tlsf_t tlsf);
|
||||
int (*tlsf_check_pool)(pool_t pool);
|
||||
|
||||
void *(*tlsf_malloc_addr)(tlsf_t tlsf, size_t size, void *address);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/* ROM function interface esp32s31.rom.heap.ld for esp32s31
|
||||
*
|
||||
*
|
||||
* Generated from ../../rom/target/esp32s31/interface-esp32s31.yml md5sum 0cb775308c66eebf0757e406021ad5be
|
||||
*
|
||||
* Compatible with ROM where ECO version equal or greater to 0.
|
||||
*
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
*/
|
||||
|
||||
/***************************************
|
||||
Group heap
|
||||
***************************************/
|
||||
|
||||
/* Functions */
|
||||
tlsf_create = 0x2f8003d0;
|
||||
tlsf_create_with_pool = 0x2f8003d4;
|
||||
tlsf_get_pool = 0x2f8003d8;
|
||||
tlsf_add_pool = 0x2f8003dc;
|
||||
tlsf_remove_pool = 0x2f8003e0;
|
||||
tlsf_malloc = 0x2f8003e4;
|
||||
tlsf_memalign = 0x2f8003e8;
|
||||
tlsf_memalign_offs = 0x2f8003ec;
|
||||
tlsf_malloc_addr = 0x2f8003f0;
|
||||
tlsf_realloc = 0x2f8003f4;
|
||||
tlsf_free = 0x2f8003f8;
|
||||
tlsf_block_size = 0x2f8003fc;
|
||||
tlsf_size = 0x2f800400;
|
||||
tlsf_pool_overhead = 0x2f800404;
|
||||
tlsf_alloc_overhead = 0x2f800408;
|
||||
tlsf_walk_pool = 0x2f80040c;
|
||||
tlsf_check = 0x2f800410;
|
||||
tlsf_check_pool = 0x2f800414;
|
||||
tlsf_poison_fill_pfunc_set = 0x2f800418;
|
||||
tlsf_poison_check_pfunc_set = 0x2f80041c;
|
||||
multi_heap_get_block_address_impl = 0x2f800420;
|
||||
multi_heap_get_allocated_size_impl = 0x2f800424;
|
||||
multi_heap_register_impl = 0x2f800428;
|
||||
multi_heap_set_lock = 0x2f80042c;
|
||||
multi_heap_os_funcs_init = 0x2f800430;
|
||||
multi_heap_internal_lock = 0x2f800434;
|
||||
multi_heap_internal_unlock = 0x2f800438;
|
||||
multi_heap_get_first_block = 0x2f80043c;
|
||||
multi_heap_get_next_block = 0x2f800440;
|
||||
multi_heap_is_free = 0x2f800444;
|
||||
multi_heap_malloc_impl = 0x2f800448;
|
||||
multi_heap_free_impl = 0x2f80044c;
|
||||
multi_heap_realloc_impl = 0x2f800450;
|
||||
multi_heap_aligned_alloc_impl_offs = 0x2f800454;
|
||||
multi_heap_aligned_alloc_impl = 0x2f800458;
|
||||
multi_heap_check = 0x2f80045c;
|
||||
multi_heap_dump = 0x2f800460;
|
||||
multi_heap_free_size_impl = 0x2f800464;
|
||||
multi_heap_minimum_free_size_impl = 0x2f800468;
|
||||
multi_heap_get_info_impl = 0x2f80046c;
|
||||
/* Data (.data, .bss, .rodata) */
|
||||
heap_tlsf_table_ptr = 0x2f07ffcc;
|
||||
|
||||
PROVIDE (multi_heap_malloc = multi_heap_malloc_impl);
|
||||
PROVIDE (multi_heap_free = multi_heap_free_impl);
|
||||
PROVIDE (multi_heap_realloc = multi_heap_realloc_impl);
|
||||
PROVIDE (multi_heap_get_allocated_size = multi_heap_get_allocated_size_impl);
|
||||
PROVIDE (multi_heap_register = multi_heap_register_impl);
|
||||
PROVIDE (multi_heap_get_info = multi_heap_get_info_impl);
|
||||
PROVIDE (multi_heap_free_size = multi_heap_free_size_impl);
|
||||
PROVIDE (multi_heap_minimum_free_size = multi_heap_minimum_free_size_impl);
|
||||
PROVIDE (multi_heap_get_block_address = multi_heap_get_block_address_impl);
|
||||
PROVIDE (multi_heap_aligned_alloc = multi_heap_aligned_alloc_impl);
|
||||
PROVIDE (multi_heap_aligned_free = multi_heap_aligned_free_impl);
|
||||
PROVIDE (multi_heap_check = multi_heap_check);
|
||||
PROVIDE (multi_heap_set_lock = multi_heap_set_lock);
|
||||
PROVIDE (multi_heap_os_funcs_init = multi_heap_mutex_init);
|
||||
PROVIDE (multi_heap_internal_lock = multi_heap_internal_lock);
|
||||
PROVIDE (multi_heap_internal_unlock = multi_heap_internal_unlock);
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @brief Opaque handle to a registered heap */
|
||||
typedef struct multi_heap_info *multi_heap_handle_t;
|
||||
|
||||
/**
|
||||
* @brief Callback called when walking the given heap blocks of memory
|
||||
*
|
||||
* @param block_ptr Pointer to the block data
|
||||
* @param block_size The size of the block
|
||||
* @param block_used Block status. 0: free, 1: allocated
|
||||
* @param user_data Opaque pointer to user defined data
|
||||
*
|
||||
* @return True if the walker is expected to continue the heap traversal
|
||||
* False if the walker is expected to stop the traversal of the heap
|
||||
*/
|
||||
typedef bool (*multi_heap_walker_cb_t)(void *block_ptr, size_t block_size, int block_used, void *user_data);
|
||||
|
||||
/**
|
||||
* @brief Call the tlsf_walk_pool function of the heap given as parameter with
|
||||
* the walker function passed as parameter
|
||||
*
|
||||
* @param heap The heap to traverse
|
||||
* @param walker_func The walker to trigger on each block of the heap
|
||||
* @param user_data Opaque pointer to user defined data
|
||||
*/
|
||||
void multi_heap_walk(multi_heap_handle_t heap, multi_heap_walker_cb_t walker_func, void *user_data);
|
||||
|
||||
/**
|
||||
* @brief Function walking through a given heap and returning the pointer to the
|
||||
* allocated block containing the pointer passed as parameter.
|
||||
*
|
||||
* @note The heap parameter must be valid and the pointer parameter must
|
||||
* belong to a block of allocated memory. The app will crash with an
|
||||
* assertion failure if at least one of the parameter is invalid.
|
||||
*
|
||||
* @param heap The heap to walk through
|
||||
* @param ptr The pointer to find the allocated block of
|
||||
* @return Pointer to the allocated block containing the pointer ptr
|
||||
*/
|
||||
void *multi_heap_find_containing_block_impl(multi_heap_handle_t heap, void *ptr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,123 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* tlsf_t: a TLSF structure. Can contain 1 to N pools. */
|
||||
/* pool_t: a block of memory that TLSF can manage. */
|
||||
typedef void* tlsf_t;
|
||||
typedef void* pool_t;
|
||||
|
||||
/* Create/destroy a memory pool. */
|
||||
#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2
|
||||
tlsf_t tlsf_create(void* mem);
|
||||
tlsf_t tlsf_create_with_pool(void* mem, size_t bytes);
|
||||
size_t tlsf_size(void);
|
||||
#else
|
||||
tlsf_t tlsf_create(void* mem, size_t max_bytes);
|
||||
tlsf_t tlsf_create_with_pool(void* mem, size_t pool_bytes, size_t max_bytes);
|
||||
size_t tlsf_size(tlsf_t tlsf);
|
||||
#endif
|
||||
|
||||
void tlsf_destroy(tlsf_t tlsf);
|
||||
pool_t tlsf_get_pool(tlsf_t tlsf);
|
||||
|
||||
/* Add/remove memory pools. */
|
||||
pool_t tlsf_add_pool(tlsf_t tlsf, void* mem, size_t bytes);
|
||||
void tlsf_remove_pool(tlsf_t tlsf, pool_t pool);
|
||||
|
||||
/* malloc/memalign/realloc/free replacements. */
|
||||
void* tlsf_malloc(tlsf_t tlsf, size_t size);
|
||||
void* tlsf_memalign(tlsf_t tlsf, size_t align, size_t size);
|
||||
void* tlsf_memalign_offs(tlsf_t tlsf, size_t align, size_t size, size_t offset);
|
||||
void* tlsf_realloc(tlsf_t tlsf, void* ptr, size_t size);
|
||||
void tlsf_free(tlsf_t tlsf, void* ptr);
|
||||
|
||||
/* Returns internal block size, not original request size */
|
||||
size_t tlsf_block_size(void* ptr);
|
||||
|
||||
/* Overheads/limits of internal structures. */
|
||||
size_t tlsf_pool_overhead(void);
|
||||
size_t tlsf_alloc_overhead(void);
|
||||
|
||||
#if ESP_TEE_BUILD
|
||||
/* NOTE: These declarations are only needed for the TEE build, since these
|
||||
* functions are (static inline) defined in tlsf_control_functions.h for
|
||||
* IDF builds.
|
||||
*/
|
||||
size_t tlsf_align_size(void);
|
||||
size_t tlsf_block_size_min(void);
|
||||
#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2
|
||||
size_t tlsf_block_size_max(void);
|
||||
#else
|
||||
size_t tlsf_block_size_max(tlsf_t tlsf);
|
||||
#endif
|
||||
size_t tlsf_fit_size(tlsf_t tlsf, size_t size);
|
||||
|
||||
/* NOTE: The consumer of this callback function (tlsf_walk_pool) is patched
|
||||
* in IDF builds to address issues in the ROM implementation. For TEE build,
|
||||
* the ROM declarations can be used directly, as heap integrity checking is not
|
||||
* supported.
|
||||
*/
|
||||
typedef void (*tlsf_walker)(void* ptr, size_t size, int used, void* user);
|
||||
#else
|
||||
typedef bool (*tlsf_walker)(void* ptr, size_t size, int used, void* user);
|
||||
#endif
|
||||
|
||||
/* Debugging. */
|
||||
void tlsf_walk_pool(pool_t pool, tlsf_walker walker, void* user);
|
||||
void tlsf_walk_pool_patched(pool_t pool, tlsf_walker walker, void* user);
|
||||
/* Returns nonzero if any internal consistency check fails. */
|
||||
int tlsf_check(tlsf_t tlsf);
|
||||
int tlsf_check_pool(pool_t pool);
|
||||
|
||||
/*!
|
||||
* Defines the function prototypes for multi_heap_internal_poison_fill_region
|
||||
* and multi_heap_internal_check_block_poisoning, these two function will
|
||||
* be registered to the ROM tlsf IMPL through the function tlsf_poison_fill_pfunc_set()
|
||||
* and tlsf_poison_check_pfunc_set() when the heap poisoning feature is enabled.
|
||||
*/
|
||||
typedef void (*poison_fill_pfunc_t)(void *start, size_t size, bool is_free);
|
||||
typedef bool (*poison_check_pfunc_t)(void *start, size_t size, bool is_free, bool print_errors);
|
||||
|
||||
/*!
|
||||
* @brief Set the function to call for filling memory region when
|
||||
* poisoning is configured.
|
||||
*
|
||||
* @note Please keep in mind that this function in ROM still accepts void*.
|
||||
*
|
||||
* @param pfunc The callback function to trigger for poisoning
|
||||
* a memory region.
|
||||
*/
|
||||
void tlsf_poison_fill_pfunc_set(poison_fill_pfunc_t pfunc);
|
||||
|
||||
/*!
|
||||
* @brief Set the function to call in tlsf_check for checking memory
|
||||
* region when poisoning is configured.
|
||||
*
|
||||
* @param pfunc The callback function to trigger for checking
|
||||
* the content of a memory region.
|
||||
*/
|
||||
void tlsf_poison_check_pfunc_set(poison_check_pfunc_t pfunc);
|
||||
|
||||
/*!
|
||||
* @brief Set the function to call in tlsf_walk_pool for checking memory
|
||||
* region when poisoning is configured.
|
||||
*
|
||||
* @param pfunc The callback function to trigger for checking
|
||||
* the content of a memory region.
|
||||
*/
|
||||
void tlsf_walk_pool_pfunc_set(poison_check_pfunc_t pfunc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,145 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is a patch for the multi_heap.c file stored in ROM
|
||||
* - added function multi_heap_walk
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_rom_multi_heap.h"
|
||||
#include "esp_rom_tlsf.h"
|
||||
|
||||
// Hook to force the linker to include this file
|
||||
void esp_rom_include_multi_heap_patch(void)
|
||||
{
|
||||
}
|
||||
|
||||
typedef struct multi_heap_info {
|
||||
void *lock;
|
||||
size_t free_bytes;
|
||||
size_t minimum_free_bytes;
|
||||
size_t pool_size;
|
||||
void* heap_data;
|
||||
} heap_t;
|
||||
|
||||
/* Declare helper functions that are not in public headers */
|
||||
extern pool_t tlsf_get_pool(tlsf_t tlsf);
|
||||
extern void multi_heap_internal_lock(multi_heap_handle_t heap);
|
||||
extern void multi_heap_internal_unlock(multi_heap_handle_t heap);
|
||||
|
||||
void multi_heap_walk(multi_heap_handle_t heap, multi_heap_walker_cb_t walker_func, void *user_data)
|
||||
{
|
||||
assert(heap != NULL);
|
||||
|
||||
multi_heap_internal_lock(heap);
|
||||
tlsf_walk_pool_patched(tlsf_get_pool(heap->heap_data), walker_func, user_data);
|
||||
multi_heap_internal_unlock(heap);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Structure used in multi_heap_find_containing_block to retain
|
||||
* information while walking a given heap to find the allocated block
|
||||
* containing the pointer ptr.
|
||||
*
|
||||
* @note The block_ptr gets filled with the pointer to the allocated block
|
||||
* containing the ptr.
|
||||
*/
|
||||
typedef struct containing_block_data {
|
||||
void *ptr; ///< Pointer to find the containing block of
|
||||
void *block_ptr; ///< Pointer to the containing block
|
||||
} containing_block_data_t;
|
||||
|
||||
|
||||
#if CONFIG_HEAP_POISONING_DISABLED
|
||||
void *multi_heap_find_containing_block(multi_heap_handle_t heap, void *ptr)
|
||||
__attribute__((alias("multi_heap_find_containing_block_impl")));
|
||||
#endif
|
||||
|
||||
typedef struct block_header_t
|
||||
{
|
||||
/* Points to the previous physical block. */
|
||||
struct block_header_t* prev_phys_block;
|
||||
|
||||
/* The size of this block, excluding the block header. */
|
||||
size_t size;
|
||||
|
||||
/* Next and previous free blocks. */
|
||||
struct block_header_t* next_free;
|
||||
struct block_header_t* prev_free;
|
||||
} block_header_t;
|
||||
|
||||
#define tlsf_cast(t, exp) ((t) (exp))
|
||||
#define block_header_free_bit (1UL << 0)
|
||||
#define block_header_prev_free_bit (1UL << 1)
|
||||
#define block_header_overhead (sizeof(size_t))
|
||||
#define block_start_offset (offsetof(block_header_t, size) + sizeof(size_t))
|
||||
|
||||
#if !defined (tlsf_assert)
|
||||
#define tlsf_assert assert
|
||||
#endif
|
||||
|
||||
static inline __attribute__((always_inline)) void* block_to_ptr(const block_header_t* block)
|
||||
{
|
||||
return tlsf_cast(void*,
|
||||
tlsf_cast(unsigned char*, block) + block_start_offset);
|
||||
}
|
||||
static size_t block_size(const block_header_t* block)
|
||||
{
|
||||
return block->size & ~(block_header_free_bit | block_header_prev_free_bit);
|
||||
}
|
||||
static block_header_t* offset_to_block(const void* ptr, size_t size)
|
||||
{
|
||||
return tlsf_cast(block_header_t*, tlsf_cast(ptrdiff_t, ptr) + size);
|
||||
}
|
||||
static int block_is_free(const block_header_t* block)
|
||||
{
|
||||
return tlsf_cast(int, block->size & block_header_free_bit);
|
||||
}
|
||||
static int block_is_last(const block_header_t* block)
|
||||
{
|
||||
return block_size(block) == 0;
|
||||
}
|
||||
static block_header_t* block_next(const block_header_t* block)
|
||||
{
|
||||
block_header_t* next = offset_to_block(block_to_ptr(block),
|
||||
block_size(block) - block_header_overhead);
|
||||
tlsf_assert(!block_is_last(block));
|
||||
return next;
|
||||
}
|
||||
|
||||
void* tlsf_find_containing_block(pool_t pool, void *ptr)
|
||||
{
|
||||
block_header_t* block = offset_to_block(pool, -(int)block_header_overhead);
|
||||
|
||||
while (block && !block_is_last(block))
|
||||
{
|
||||
if (!block_is_free(block)) {
|
||||
void *block_start = block_to_ptr(block);
|
||||
void *block_end = block_start + block_size(block);
|
||||
if (block_start <= ptr && block_end > ptr) {
|
||||
// we found the containing block, return
|
||||
return block_start;
|
||||
}
|
||||
}
|
||||
|
||||
block = block_next(block);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *multi_heap_find_containing_block_impl(multi_heap_handle_t heap, void *ptr)
|
||||
{
|
||||
void *block_ptr = tlsf_find_containing_block(tlsf_get_pool(heap->heap_data), ptr);
|
||||
assert(block_ptr);
|
||||
return block_ptr;
|
||||
}
|
||||
@@ -1,199 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is a patch for the tlsf implementation stored in ROM
|
||||
* - tlsf_check() now implements a call to a hook giving the user the possibility
|
||||
* to implement specific checks on the memory of every free blocks.
|
||||
* - The function tlsf_poison_check_pfunc_set() was added to allow the user to
|
||||
* register the hook function called in tlsf_check().
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "esp_rom_caps.h"
|
||||
#include "esp_rom_tlsf.h"
|
||||
#include "esp_rom_sys.h"
|
||||
|
||||
#include "tlsf_block_functions.h"
|
||||
#include "tlsf_control_functions.h"
|
||||
|
||||
/*
|
||||
* IMPORTANT!
|
||||
*
|
||||
* Several versions of the TLSF in ROM exist and can be divided in
|
||||
* 3 categories:
|
||||
* 1- Versions where tlsf_check and tlsf_walk_pool do not call
|
||||
* the poison check hook (oldest versions)
|
||||
* 2- Versions where tlsf_check does call the poison check hook,
|
||||
* but tlsf_walk_pool still doesn't (intermediate versions)
|
||||
* 3- Versions where both tlsf_check and tlsf_walk_pool call the
|
||||
* the poison check hook (latest versions)
|
||||
*
|
||||
* Category 3 does not require the patch defined in this file.
|
||||
*
|
||||
* Category 2 requires the patch but only for tlsf_walk_pool. In those
|
||||
* versions, a definition of tlsf_poison_check_pfunc_set is present in
|
||||
* the TLSF ROM which makes the definition in this file unnecessary since
|
||||
* the linker will keep the ROM definition. For this reason, tlsf_walk_pool_pfunc_set
|
||||
* is defined and called in multi_heap_poisoning.c to make sure that the poison check
|
||||
* hook also gets set in this file. The definition of tlsf_poison_check_pfunc_set could
|
||||
* be removed from this file if not for the needs of category 1.
|
||||
*
|
||||
* Category 1 versions of the ROM TLSF do not provide a definition of
|
||||
* tlsf_poison_check_pfunc_set, making the definition below necessary for
|
||||
* any application to compile and link properly. The added patch of tlsf_walk_pool
|
||||
* makes the patch of tlsf_check unnecessary in this file since tlsf_check was only
|
||||
* calling the poison check hook for free blocks while tlsf_walk_pool calls the poison
|
||||
* check hook for all blocks (free and used). For this reason, tlsf_poison_check_pfunc_set
|
||||
* is left empty.
|
||||
* */
|
||||
|
||||
static poison_check_pfunc_t s_walk_pool_check_region = NULL;
|
||||
|
||||
void tlsf_poison_check_pfunc_set(poison_check_pfunc_t pfunc)
|
||||
{
|
||||
}
|
||||
|
||||
void tlsf_walk_pool_pfunc_set(poison_check_pfunc_t pfunc)
|
||||
{
|
||||
s_walk_pool_check_region = pfunc;
|
||||
}
|
||||
|
||||
#define tlsf_insist_no_assert(x) { if (!(x)) { status--; } }
|
||||
|
||||
typedef struct integrity_t
|
||||
{
|
||||
int prev_status;
|
||||
int status;
|
||||
} integrity_t;
|
||||
|
||||
static bool integrity_walker(void* ptr, size_t size, int used, void* user)
|
||||
{
|
||||
block_header_t* block = block_from_ptr(ptr);
|
||||
integrity_t* integ = tlsf_cast(integrity_t*, user);
|
||||
const int this_prev_status = block_is_prev_free(block) ? 1 : 0;
|
||||
const int this_status = block_is_free(block) ? 1 : 0;
|
||||
const size_t this_block_size = block_size(block);
|
||||
|
||||
int status = 0;
|
||||
tlsf_insist_no_assert(integ->prev_status == this_prev_status && "prev status incorrect");
|
||||
tlsf_insist_no_assert(size == this_block_size && "block size incorrect");
|
||||
|
||||
if (s_walk_pool_check_region != NULL)
|
||||
{
|
||||
/* block_size(block) returns the size of the usable memory when the block is allocated.
|
||||
* As the block under test is free, we need to subtract to the block size the next_free
|
||||
* and prev_free fields of the block header as they are not a part of the usable memory
|
||||
* when the block is free. In addition, we also need to subtract the size of prev_phys_block
|
||||
* as this field is in fact part of the current free block and not part of the next (allocated)
|
||||
* block. Check the comments in block_split function for more details.
|
||||
*/
|
||||
const size_t actual_free_block_size = used ? this_block_size :
|
||||
this_block_size - offsetof(block_header_t, next_free)- block_header_overhead;
|
||||
|
||||
void* ptr_block = used ? (void*)block + block_start_offset :
|
||||
(void*)block + sizeof(block_header_t);
|
||||
|
||||
tlsf_insist_no_assert(s_walk_pool_check_region(ptr_block, actual_free_block_size, !used, true));
|
||||
}
|
||||
|
||||
integ->prev_status = this_status;
|
||||
integ->status += status;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool default_walker(void* ptr, size_t size, int used, void* user)
|
||||
{
|
||||
(void)user;
|
||||
printf("\t%p %s size: %x (%p)\n", ptr, used ? "used" : "free", (unsigned int)size, block_from_ptr(ptr));
|
||||
return true;
|
||||
}
|
||||
|
||||
static void tlsf_walk_pool_impl(pool_t pool, tlsf_walker walker, void* user)
|
||||
{
|
||||
tlsf_walker pool_walker = walker ? walker : default_walker;
|
||||
block_header_t* block =
|
||||
offset_to_block(pool, -(int)block_header_overhead);
|
||||
|
||||
bool ret_val = true;
|
||||
while (block && !block_is_last(block) && ret_val == true)
|
||||
{
|
||||
ret_val = pool_walker(
|
||||
block_to_ptr(block),
|
||||
block_size(block),
|
||||
!block_is_free(block),
|
||||
user);
|
||||
|
||||
if (ret_val == true) {
|
||||
block = block_next(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int tlsf_check_pool_impl(pool_t pool)
|
||||
{
|
||||
/* Check that the blocks are physically correct. */
|
||||
integrity_t integ = { 0, 0 };
|
||||
tlsf_walk_pool_impl(pool, integrity_walker, &integ);
|
||||
|
||||
return integ.status;
|
||||
}
|
||||
|
||||
#undef tlsf_insist_no_assert
|
||||
|
||||
/* Set up the TLSF ROM patches here */
|
||||
|
||||
/*
|
||||
* struct heap_tlsf_stub_table_t is defined in the per-target header.
|
||||
* Its layout exactly mirrors the TLSF vtable in ROM for the current target.
|
||||
* The header is produced by gen_esp_rom_heap_tlsf_stub_table.py from the
|
||||
* target's .rom.heap.ld file; run that script whenever the .ld file changes.
|
||||
*/
|
||||
#include "esp_rom_heap_tlsf_stub_table.h"
|
||||
|
||||
/* We need the original table from the ROM */
|
||||
extern struct heap_tlsf_stub_table_t* heap_tlsf_table_ptr;
|
||||
|
||||
/* We will copy the ROM table and modify the functions we patch */
|
||||
|
||||
struct heap_tlsf_stub_table_t heap_tlsf_patch_table_ptr;
|
||||
|
||||
/*!
|
||||
* @brief Setup the TLSF ROM patches.
|
||||
* This function must be called when setting up the heap. It will put in place the function patched
|
||||
* from the ROM implementation.
|
||||
* This function must not be defined as static, as it is marked as "undefined" in the linker flags
|
||||
* (to force the linker to integrate the functions of this file inside the final binary)
|
||||
*/
|
||||
void __attribute__((constructor)) tlsf_set_rom_patches(void)
|
||||
{
|
||||
/* Copy the ROM default table inside our table */
|
||||
memcpy(&heap_tlsf_patch_table_ptr, heap_tlsf_table_ptr, sizeof(struct heap_tlsf_stub_table_t));
|
||||
|
||||
/* Set the patched function here */
|
||||
heap_tlsf_patch_table_ptr.tlsf_check_pool = tlsf_check_pool_impl;
|
||||
heap_tlsf_patch_table_ptr.tlsf_walk_pool = tlsf_walk_pool_impl;
|
||||
|
||||
/* Set our table as the one to use in the ROM code */
|
||||
heap_tlsf_table_ptr = &heap_tlsf_patch_table_ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief Helper function to call the patched tlsf_walk_pool.
|
||||
* This is needed because the ROM's tlsf_walk_pool symbol cannot be overridden
|
||||
* on chips where it's a strong symbol (not using PROVIDE in linker script).
|
||||
* Other patch files can call this to access the patched version.
|
||||
*/
|
||||
void tlsf_walk_pool_patched(pool_t pool, tlsf_walker walker, void* user)
|
||||
{
|
||||
heap_tlsf_table_ptr->tlsf_walk_pool(pool, walker, user);
|
||||
}
|
||||
Reference in New Issue
Block a user