Rename MODULE_TEXT to TEXT_HEAP as the latter is more generic.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
parent
79e9347551
commit
af5e0c620f
36 changed files with 118 additions and 123 deletions
10
arch/Kconfig
10
arch/Kconfig
|
@ -259,7 +259,7 @@ config ARCH_NEED_ADDRENV_MAPPING
|
|||
bool
|
||||
default n
|
||||
|
||||
config ARCH_HAVE_MODULE_TEXT
|
||||
config ARCH_HAVE_TEXT_HEAP
|
||||
bool "Special memory region for dynamic code loading"
|
||||
default n
|
||||
|
||||
|
@ -371,12 +371,12 @@ config ARCH_USE_MPU
|
|||
is enabled by other, platform-specific logic. In those cases, this
|
||||
selection will always be forced.
|
||||
|
||||
config ARCH_USE_MODULE_TEXT
|
||||
bool "Enable module text allocator"
|
||||
config ARCH_USE_TEXT_HEAP
|
||||
bool "Enable separate text heap for dynamic code loading"
|
||||
default n
|
||||
depends on ARCH_HAVE_MODULE_TEXT
|
||||
depends on ARCH_HAVE_TEXT_HEAP
|
||||
---help---
|
||||
This option enable architecture-sepecific memory allocator
|
||||
This option enables architecture-sepecific memory allocator
|
||||
for dynamic code loading. For example, ESP32 has a separate memory
|
||||
regions for instruction and data and the memory region used for
|
||||
usual malloc doesn't work for instruction.
|
||||
|
|
|
@ -456,7 +456,7 @@ config ARCH_CHIP_CXD56XX
|
|||
select ARCH_HAVE_FPU
|
||||
select ARCH_HAVE_HEAPCHECK
|
||||
select ARCH_HAVE_MULTICPU
|
||||
select ARCH_HAVE_MODULE_TEXT
|
||||
select ARCH_HAVE_TEXT_HEAP
|
||||
select ARCH_HAVE_SDIO if MMCSD
|
||||
select ARCH_HAVE_MATH_H
|
||||
---help---
|
||||
|
|
|
@ -1344,7 +1344,7 @@ endif
|
|||
config CXD56_USE_SYSBUS
|
||||
bool "Use the system bus for the data section"
|
||||
default y
|
||||
select ARCH_USE_MODULE_TEXT if ELF
|
||||
select ARCH_USE_TEXT_HEAP if ELF
|
||||
---help---
|
||||
To make ldrex/strex work correctly, this option must be enabled
|
||||
endmenu
|
||||
|
|
|
@ -97,8 +97,8 @@ CHIP_CSRCS += cxd56_testset.c
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_USE_MODULE_TEXT), y)
|
||||
CHIP_CSRCS += cxd56_modtext.c
|
||||
ifeq ($(CONFIG_ARCH_USE_TEXT_HEAP), y)
|
||||
CHIP_CSRCS += cxd56_textheap.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_CXD56_UART0),y)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* arch/arm/src/cxd56xx/cxd56_modtext.c
|
||||
* arch/arm/src/cxd56xx/cxd56_textheap.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
|
@ -44,18 +44,18 @@
|
|||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_module_text_init()
|
||||
* Name: up_textheap_init()
|
||||
****************************************************************************/
|
||||
|
||||
void up_module_text_init()
|
||||
void up_textheap_init()
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_module_text_memalign()
|
||||
* Name: up_textheap_memalign()
|
||||
****************************************************************************/
|
||||
|
||||
FAR void *up_module_text_memalign(size_t align, size_t size)
|
||||
FAR void *up_textheap_memalign(size_t align, size_t size)
|
||||
{
|
||||
FAR void *ret;
|
||||
ret = (FAR void *)kmm_malloc(size);
|
||||
|
@ -80,10 +80,10 @@ FAR void *up_module_text_memalign(size_t align, size_t size)
|
|||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_module_text_free()
|
||||
* Name: up_textheap_free()
|
||||
****************************************************************************/
|
||||
|
||||
void up_module_text_free(FAR void *p)
|
||||
void up_textheap_free(FAR void *p)
|
||||
{
|
||||
#ifdef CONFIG_CXD56_USE_SYSBUS
|
||||
if (p)
|
|
@ -50,7 +50,7 @@ config ARCH_CHIP_ESP32C3
|
|||
select LIBC_ARCH_MEMCCMP
|
||||
select LIBC_ARCH_MEMMOVE
|
||||
select LIBC_ARCH_MEMSET
|
||||
select ARCH_HAVE_MODULE_TEXT
|
||||
select ARCH_HAVE_TEXT_HEAP
|
||||
---help---
|
||||
Espressif ESP32-C3 (RV32IMC).
|
||||
|
||||
|
|
|
@ -156,8 +156,8 @@ CHIP_CSRCS += esp32c3_efuse_table.c
|
|||
CHIP_CSRCS += esp32c3_efuse_lowerhalf.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_USE_MODULE_TEXT),y)
|
||||
CHIP_CSRCS += esp32c3_modtext.c
|
||||
ifeq ($(CONFIG_ARCH_USE_TEXT_HEAP),y)
|
||||
CHIP_CSRCS += esp32c3_textheap.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RTC_DRIVER),y)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* arch/risc-v/src/esp32c3/esp32c3_modtext.c
|
||||
* arch/risc-v/src/esp32c3/esp32c3_textheap.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
|
@ -50,10 +50,10 @@
|
|||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_module_text_init()
|
||||
* Name: up_textheap_init()
|
||||
****************************************************************************/
|
||||
|
||||
void up_module_text_init()
|
||||
void up_textheap_init()
|
||||
{
|
||||
#ifdef CONFIG_ESP32C3_RTC_HEAP
|
||||
/* Initialize the RTC heap */
|
||||
|
@ -63,14 +63,14 @@ void up_module_text_init()
|
|||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_module_text_memalign()
|
||||
* Name: up_textheap_memalign()
|
||||
*
|
||||
* Description:
|
||||
* Allocate memory for module text with the specified alignment.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR void *up_module_text_memalign(size_t align, size_t size)
|
||||
FAR void *up_textheap_memalign(size_t align, size_t size)
|
||||
{
|
||||
FAR void *ret = NULL;
|
||||
|
||||
|
@ -99,14 +99,14 @@ FAR void *up_module_text_memalign(size_t align, size_t size)
|
|||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_module_text_free()
|
||||
* Name: up_textheap_free()
|
||||
*
|
||||
* Description:
|
||||
* Free memory for module text.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_module_text_free(FAR void *p)
|
||||
void up_textheap_free(FAR void *p)
|
||||
{
|
||||
if (p)
|
||||
{
|
|
@ -454,7 +454,7 @@ void up_allocate_heap(void **heap_start, size_t *heap_size)
|
|||
|
||||
/* We make the entire heap executable here to keep
|
||||
* the sim simpler. If it turns out to be a problem, the
|
||||
* ARCH_HAVE_MODULE_TEXT mechanism can be an alternative.
|
||||
* ARCH_HAVE_TEXT_HEAP mechanism can be an alternative.
|
||||
*/
|
||||
|
||||
uint8_t *sim_heap = host_alloc_heap(SIM_HEAP_SIZE);
|
||||
|
|
|
@ -14,7 +14,7 @@ config ARCH_CHIP_ESP32
|
|||
select ARCH_FAMILY_LX6
|
||||
select XTENSA_HAVE_INTERRUPTS
|
||||
select ARCH_HAVE_MULTICPU
|
||||
select ARCH_HAVE_MODULE_TEXT
|
||||
select ARCH_HAVE_TEXT_HEAP
|
||||
select ARCH_HAVE_SDRAM
|
||||
select ARCH_HAVE_RESET
|
||||
select ARCH_TOOLCHAIN_GNU
|
||||
|
@ -41,7 +41,7 @@ config ARCH_CHIP_ESP32S2
|
|||
bool "Espressif ESP32-S2"
|
||||
select ARCH_FAMILY_LX7
|
||||
select XTENSA_HAVE_INTERRUPTS
|
||||
select ARCH_HAVE_MODULE_TEXT
|
||||
select ARCH_HAVE_TEXT_HEAP
|
||||
select ARCH_HAVE_SDRAM
|
||||
select ARCH_HAVE_RESET
|
||||
select ARCH_TOOLCHAIN_GNU
|
||||
|
|
|
@ -180,8 +180,8 @@ CHIP_CSRCS += esp32_wdt_lowerhalf.c
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_USE_MODULE_TEXT),y)
|
||||
CHIP_CSRCS += esp32_modtext.c
|
||||
ifeq ($(CONFIG_ARCH_USE_TEXT_HEAP),y)
|
||||
CHIP_CSRCS += esp32_textheap.c
|
||||
CMN_ASRCS += xtensa_loadstore.S
|
||||
endif
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32/esp32_modtext.c
|
||||
* arch/xtensa/src/esp32/esp32_textheap.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
|
@ -34,63 +34,63 @@
|
|||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
extern uint32_t _smodtext;
|
||||
extern uint32_t _emodtext;
|
||||
extern uint32_t _stextheap;
|
||||
extern uint32_t _etextheap;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
struct mm_heap_s g_module_text;
|
||||
struct mm_heap_s g_textheap;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_module_text_init
|
||||
* Name: up_textheap_init
|
||||
*
|
||||
* Description:
|
||||
* Initialize the module text allocator
|
||||
* Initialize the text heap.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_module_text_init()
|
||||
void up_textheap_init()
|
||||
{
|
||||
mm_initialize(&g_module_text, &_smodtext, &_emodtext - &_smodtext);
|
||||
mm_initialize(&g_textheap, &_stextheap, &_etextheap - &_stextheap);
|
||||
|
||||
#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MEMINFO)
|
||||
static struct procfs_meminfo_entry_s g_modtext_procfs;
|
||||
static struct procfs_meminfo_entry_s g_textheap_procfs;
|
||||
|
||||
g_modtext_procfs.name = "modtext";
|
||||
g_modtext_procfs.mallinfo = (void *)mm_mallinfo;
|
||||
g_modtext_procfs.user_data = &g_module_text;
|
||||
procfs_register_meminfo(&g_modtext_procfs);
|
||||
g_textheap_procfs.name = "textheap";
|
||||
g_textheap_procfs.mallinfo = (void *)mm_mallinfo;
|
||||
g_textheap_procfs.user_data = &g_textheap;
|
||||
procfs_register_meminfo(&g_textheap_procfs);
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_module_text_memalign
|
||||
* Name: up_textheap_memalign
|
||||
*
|
||||
* Description:
|
||||
* Allocate memory for module text with the specified alignment.
|
||||
* Allocate memory from the text heap with the specified alignment.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR void *up_module_text_memalign(size_t align, size_t size)
|
||||
FAR void *up_textheap_memalign(size_t align, size_t size)
|
||||
{
|
||||
return mm_memalign(&g_module_text, align, size);
|
||||
return mm_memalign(&g_textheap, align, size);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_module_text_free
|
||||
* Name: up_textheap_free
|
||||
*
|
||||
* Description:
|
||||
* Free memory for module text.
|
||||
* Free memory from the text heap.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_module_text_free(FAR void *p)
|
||||
void up_textheap_free(FAR void *p)
|
||||
{
|
||||
return mm_free(&g_module_text, p);
|
||||
return mm_free(&g_textheap, p);
|
||||
}
|
|
@ -38,9 +38,9 @@
|
|||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_USE_MODULE_TEXT
|
||||
extern uint32_t _smodtext;
|
||||
extern uint32_t _emodtext;
|
||||
#ifdef CONFIG_ARCH_USE_TEXT_HEAP
|
||||
extern uint32_t _stextheap;
|
||||
extern uint32_t _etextheap;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -51,7 +51,7 @@ extern uint32_t _emodtext;
|
|||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_USE_MODULE_TEXT
|
||||
#ifdef CONFIG_ARCH_USE_TEXT_HEAP
|
||||
#ifdef CONFIG_ENDIAN_BIG
|
||||
#error not implemented
|
||||
#endif
|
||||
|
@ -323,7 +323,7 @@ static void advance_pc(uint32_t *regs, int diff)
|
|||
|
||||
uint32_t *xtensa_user(int exccause, uint32_t *regs)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_USE_MODULE_TEXT
|
||||
#ifdef CONFIG_ARCH_USE_TEXT_HEAP
|
||||
/* Emulate byte access for module text.
|
||||
*
|
||||
* ESP32 only allows word-aligned accesses to the instruction memory
|
||||
|
@ -338,8 +338,8 @@ uint32_t *xtensa_user(int exccause, uint32_t *regs)
|
|||
*/
|
||||
|
||||
if (exccause == XCHAL_EXCCAUSE_LOAD_STORE_ERROR &&
|
||||
(uintptr_t)&_smodtext <= regs[REG_EXCVADDR] &&
|
||||
(uintptr_t)&_emodtext > regs[REG_EXCVADDR])
|
||||
(uintptr_t)&_stextheap <= regs[REG_EXCVADDR] &&
|
||||
(uintptr_t)&_etextheap > regs[REG_EXCVADDR])
|
||||
{
|
||||
uint8_t *pc = (uint8_t *)regs[REG_PC];
|
||||
uint8_t imm8;
|
||||
|
|
|
@ -79,8 +79,3 @@ ifeq ($(CONFIG_ESP32S2_UART),y)
|
|||
CMN_CSRCS += esp32s2_serial.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_USE_MODULE_TEXT),y)
|
||||
CHIP_CSRCS += esp32s2_modtext.c
|
||||
CMN_ASRCS += xtensa_loadstore.S
|
||||
endif
|
||||
|
||||
|
|
|
@ -38,9 +38,9 @@
|
|||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_USE_MODULE_TEXT
|
||||
extern uint32_t _smodtext;
|
||||
extern uint32_t _emodtext;
|
||||
#ifdef CONFIG_ARCH_USE_TEXT_HEAP
|
||||
extern uint32_t _stextheap;
|
||||
extern uint32_t _etextheap;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -51,7 +51,7 @@ extern uint32_t _emodtext;
|
|||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_USE_MODULE_TEXT
|
||||
#ifdef CONFIG_ARCH_USE_TEXT_HEAP
|
||||
#ifdef CONFIG_ENDIAN_BIG
|
||||
#error not implemented
|
||||
#endif
|
||||
|
@ -293,7 +293,7 @@ static void advance_pc(uint32_t *regs, int diff)
|
|||
|
||||
uint32_t *xtensa_user(int exccause, uint32_t *regs)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_USE_MODULE_TEXT
|
||||
#ifdef CONFIG_ARCH_USE_TEXT_HEAP
|
||||
/* Emulate byte access for module text.
|
||||
*
|
||||
* ESP32S2 only allows word-aligned accesses to the instruction memory
|
||||
|
@ -308,8 +308,8 @@ uint32_t *xtensa_user(int exccause, uint32_t *regs)
|
|||
*/
|
||||
|
||||
if (exccause == XCHAL_EXCCAUSE_LOAD_STORE_ERROR &&
|
||||
(uintptr_t)&_smodtext <= regs[REG_EXCVADDR] &&
|
||||
(uintptr_t)&_emodtext > regs[REG_EXCVADDR])
|
||||
(uintptr_t)&_stextheap <= regs[REG_EXCVADDR] &&
|
||||
(uintptr_t)&_etextheap > regs[REG_EXCVADDR])
|
||||
{
|
||||
uint8_t *pc = (uint8_t *)regs[REG_PC];
|
||||
uint8_t imm8;
|
||||
|
|
|
@ -166,8 +166,8 @@ int unload_module(FAR struct binary_s *binp)
|
|||
if (binp->alloc[i])
|
||||
{
|
||||
binfo("Freeing alloc[%d]: %p\n", i, binp->alloc[i]);
|
||||
#if defined(CONFIG_ARCH_USE_MODULE_TEXT)
|
||||
up_module_text_free((FAR void *)binp->alloc[i]);
|
||||
#if defined(CONFIG_ARCH_USE_TEXT_HEAP)
|
||||
up_textheap_free((FAR void *)binp->alloc[i]);
|
||||
#else
|
||||
kumm_free((FAR void *)binp->alloc[i]);
|
||||
#endif
|
||||
|
|
|
@ -117,10 +117,10 @@ int elf_addrenv_alloc(FAR struct elf_loadinfo_s *loadinfo, size_t textsize,
|
|||
#else
|
||||
/* Allocate memory to hold the ELF image */
|
||||
|
||||
#if defined(CONFIG_ARCH_USE_MODULE_TEXT)
|
||||
#if defined(CONFIG_ARCH_USE_TEXT_HEAP)
|
||||
loadinfo->textalloc = (uintptr_t)
|
||||
up_module_text_memalign(loadinfo->textalign,
|
||||
textsize);
|
||||
up_textheap_memalign(loadinfo->textalign,
|
||||
textsize);
|
||||
#else
|
||||
loadinfo->textalloc = (uintptr_t)kumm_malloc(textsize + datasize);
|
||||
#endif
|
||||
|
@ -130,7 +130,7 @@ int elf_addrenv_alloc(FAR struct elf_loadinfo_s *loadinfo, size_t textsize,
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_ARCH_USE_MODULE_TEXT)
|
||||
#if defined(CONFIG_ARCH_USE_TEXT_HEAP)
|
||||
loadinfo->dataalloc = (uintptr_t)kumm_malloc(datasize);
|
||||
|
||||
if (0 != datasize && !loadinfo->dataalloc)
|
||||
|
@ -177,10 +177,10 @@ void elf_addrenv_free(FAR struct elf_loadinfo_s *loadinfo)
|
|||
}
|
||||
#else
|
||||
|
||||
#if defined(CONFIG_ARCH_USE_MODULE_TEXT)
|
||||
#if defined(CONFIG_ARCH_USE_TEXT_HEAP)
|
||||
if (loadinfo->textalloc != 0)
|
||||
{
|
||||
up_module_text_free((FAR void *)loadinfo->textalloc);
|
||||
up_textheap_free((FAR void *)loadinfo->textalloc);
|
||||
}
|
||||
|
||||
if (loadinfo->dataalloc != 0)
|
||||
|
|
|
@ -15,7 +15,7 @@ CONFIG_ARCH_CHIP_ESP32C3WROOM02=y
|
|||
CONFIG_ARCH_INTERRUPTSTACK=8192
|
||||
CONFIG_ARCH_RISCV=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH_USE_MODULE_TEXT=y
|
||||
CONFIG_ARCH_USE_TEXT_HEAP=y
|
||||
CONFIG_BOARDCTL_ROMDISK=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=15000
|
||||
CONFIG_BUILTIN=y
|
||||
|
|
|
@ -16,7 +16,7 @@ CONFIG_ARCH_CHIP="esp32"
|
|||
CONFIG_ARCH_CHIP_ESP32=y
|
||||
CONFIG_ARCH_CHIP_ESP32WROVER=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH_USE_MODULE_TEXT=y
|
||||
CONFIG_ARCH_USE_TEXT_HEAP=y
|
||||
CONFIG_ARCH_XTENSA=y
|
||||
CONFIG_BOARDCTL_ROMDISK=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||
|
|
|
@ -78,6 +78,6 @@ MEMORY
|
|||
|
||||
_eheap = 0x40000000 - CONFIG_ESP32_TRACEMEM_RESERVE_DRAM;
|
||||
|
||||
/* Module text area ends at top of dram0_0_seg */
|
||||
/* Text heap ends at top of dram0_0_seg */
|
||||
|
||||
_emodtext = 0x400a0000;
|
||||
_etextheap = 0x400a0000;
|
||||
|
|
|
@ -63,10 +63,10 @@ SECTIONS
|
|||
*(.phyiram .phyiram.*)
|
||||
_iram_text_end = ABSOLUTE(.);
|
||||
|
||||
/* Module text area starts at the end of iram0_0_seg */
|
||||
/* Text heap starts at the end of iram0_0_seg */
|
||||
|
||||
. = ALIGN (4);
|
||||
_smodtext = ABSOLUTE(.);
|
||||
_stextheap = ABSOLUTE(.);
|
||||
} > iram0_0_seg
|
||||
|
||||
/* Shared RAM */
|
||||
|
|
|
@ -70,10 +70,10 @@ SECTIONS
|
|||
_text_end = ABSOLUTE(.);
|
||||
_etext = .;
|
||||
|
||||
/* Module text area starts at the end of iram0_0_seg */
|
||||
/* Text heap starts at the end of iram0_0_seg */
|
||||
|
||||
. = ALIGN (4);
|
||||
_smodtext = ABSOLUTE(.);
|
||||
_stextheap = ABSOLUTE(.);
|
||||
} > iram0_0_seg
|
||||
|
||||
/* Shared RAM */
|
||||
|
|
|
@ -78,6 +78,6 @@ MEMORY
|
|||
|
||||
_eheap = 0x40000000 - CONFIG_ESP32_TRACEMEM_RESERVE_DRAM;
|
||||
|
||||
/* Module text area ends at top of dram0_0_seg */
|
||||
/* Text heap ends at top of dram0_0_seg */
|
||||
|
||||
_emodtext = 0x400a0000;
|
||||
_etextheap = 0x400a0000;
|
||||
|
|
|
@ -66,10 +66,10 @@ SECTIONS
|
|||
*(.phyiram .phyiram.*)
|
||||
_iram_text_end = ABSOLUTE(.);
|
||||
|
||||
/* Module text area starts at the end of iram0_0_seg */
|
||||
/* Text heap starts at the end of iram0_0_seg */
|
||||
|
||||
. = ALIGN (4);
|
||||
_smodtext = ABSOLUTE(.);
|
||||
_stextheap = ABSOLUTE(.);
|
||||
} > iram0_0_seg
|
||||
|
||||
/* Shared RAM */
|
||||
|
|
|
@ -70,10 +70,10 @@ SECTIONS
|
|||
_text_end = ABSOLUTE(.);
|
||||
_etext = .;
|
||||
|
||||
/* Module text area starts at the end of iram0_0_seg */
|
||||
/* Text heap starts at the end of iram0_0_seg */
|
||||
|
||||
. = ALIGN (4);
|
||||
_smodtext = ABSOLUTE(.);
|
||||
_stextheap = ABSOLUTE(.);
|
||||
} > iram0_0_seg
|
||||
|
||||
/* Shared RAM */
|
||||
|
|
|
@ -78,6 +78,6 @@ MEMORY
|
|||
|
||||
_eheap = 0x40000000 - CONFIG_ESP32_TRACEMEM_RESERVE_DRAM;
|
||||
|
||||
/* Module text area ends at top of dram0_0_seg */
|
||||
/* Text heap ends at top of dram0_0_seg */
|
||||
|
||||
_emodtext = 0x400a0000;
|
||||
_etextheap = 0x400a0000;
|
||||
|
|
|
@ -66,10 +66,10 @@ SECTIONS
|
|||
*(.phyiram .phyiram.*)
|
||||
_iram_text_end = ABSOLUTE(.);
|
||||
|
||||
/* Module text area starts at the end of iram0_0_seg */
|
||||
/* Text heap starts at the end of iram0_0_seg */
|
||||
|
||||
. = ALIGN (4);
|
||||
_smodtext = ABSOLUTE(.);
|
||||
_stextheap = ABSOLUTE(.);
|
||||
} > iram0_0_seg
|
||||
|
||||
/* Shared RAM */
|
||||
|
|
|
@ -70,10 +70,10 @@ SECTIONS
|
|||
_text_end = ABSOLUTE(.);
|
||||
_etext = .;
|
||||
|
||||
/* Module text area starts at the end of iram0_0_seg */
|
||||
/* Text heap starts at the end of iram0_0_seg */
|
||||
|
||||
. = ALIGN (4);
|
||||
_smodtext = ABSOLUTE(.);
|
||||
_stextheap = ABSOLUTE(.);
|
||||
} > iram0_0_seg
|
||||
|
||||
/* Shared RAM */
|
||||
|
|
|
@ -754,39 +754,39 @@ uintptr_t pgalloc(uintptr_t brkaddr, unsigned int npages);
|
|||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_module_text_init
|
||||
* Name: up_textheap_init
|
||||
*
|
||||
* Description:
|
||||
* Initialize the module text allocator
|
||||
* Initialize the text heap.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_USE_MODULE_TEXT)
|
||||
void up_module_text_init(void);
|
||||
#if defined(CONFIG_ARCH_USE_TEXT_HEAP)
|
||||
void up_textheap_init(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_module_text_memalign
|
||||
* Name: up_textheap_memalign
|
||||
*
|
||||
* Description:
|
||||
* Allocate memory for module text with the specified alignment.
|
||||
* Allocate memory from the text heap with the specified alignment.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_USE_MODULE_TEXT)
|
||||
FAR void *up_module_text_memalign(size_t align, size_t size);
|
||||
#if defined(CONFIG_ARCH_USE_TEXT_HEAP)
|
||||
FAR void *up_textheap_memalign(size_t align, size_t size);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_module_text_free
|
||||
* Name: up_textheap_free
|
||||
*
|
||||
* Description:
|
||||
* Free memory for module text.
|
||||
* Free memory from the text heap.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_USE_MODULE_TEXT)
|
||||
void up_module_text_free(FAR void *p);
|
||||
#if defined(CONFIG_ARCH_USE_TEXT_HEAP)
|
||||
void up_textheap_free(FAR void *p);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -95,7 +95,7 @@ struct elf_loadinfo_s
|
|||
uintptr_t textalloc; /* .text memory allocated when ELF file was loaded */
|
||||
uintptr_t dataalloc; /* .bss/.data memory allocated when ELF file was loaded */
|
||||
size_t textsize; /* Size of the ELF .text memory allocation */
|
||||
#ifdef CONFIG_ARCH_USE_MODULE_TEXT
|
||||
#ifdef CONFIG_ARCH_USE_TEXT_HEAP
|
||||
size_t textalign; /* Necessary alignment of .text */
|
||||
#endif
|
||||
size_t datasize; /* Size of the ELF .bss/.data memory allocation */
|
||||
|
|
|
@ -7,7 +7,7 @@ config LIBC_MODLIB
|
|||
bool
|
||||
default n
|
||||
select LIBC_ARCH_ELF
|
||||
select ARCH_USE_MODULE_TEXT if ARCH_HAVE_MODULE_TEXT
|
||||
select ARCH_USE_TEXT_HEAP if ARCH_HAVE_TEXT_HEAP
|
||||
|
||||
menu "Module library configuration"
|
||||
depends on LIBC_MODLIB
|
||||
|
|
|
@ -265,10 +265,10 @@ int modlib_load(FAR struct mod_loadinfo_s *loadinfo)
|
|||
|
||||
if (loadinfo->textsize > 0)
|
||||
{
|
||||
#if defined(CONFIG_ARCH_USE_MODULE_TEXT)
|
||||
#if defined(CONFIG_ARCH_USE_TEXT_HEAP)
|
||||
loadinfo->textalloc = (uintptr_t)
|
||||
up_module_text_memalign(loadinfo->textalign,
|
||||
loadinfo->textsize);
|
||||
up_textheap_memalign(loadinfo->textalign,
|
||||
loadinfo->textsize);
|
||||
#else
|
||||
loadinfo->textalloc = (uintptr_t)lib_memalign(loadinfo->textalign,
|
||||
loadinfo->textsize);
|
||||
|
|
|
@ -60,8 +60,8 @@ int modlib_unload(struct mod_loadinfo_s *loadinfo)
|
|||
|
||||
if (loadinfo->textalloc != 0)
|
||||
{
|
||||
#if defined(CONFIG_ARCH_USE_MODULE_TEXT)
|
||||
up_module_text_free((FAR void *)loadinfo->textalloc);
|
||||
#if defined(CONFIG_ARCH_USE_TEXT_HEAP)
|
||||
up_textheap_free((FAR void *)loadinfo->textalloc);
|
||||
#else
|
||||
lib_free((FAR void *)loadinfo->textalloc);
|
||||
#endif
|
||||
|
|
|
@ -1545,7 +1545,7 @@ config MODULE
|
|||
bool "Enable loadable OS modules"
|
||||
default n
|
||||
select LIBC_MODLIB
|
||||
select ARCH_USE_MODULE_TEXT if ARCH_HAVE_MODULE_TEXT
|
||||
select ARCH_USE_TEXT_HEAP if ARCH_HAVE_TEXT_HEAP
|
||||
---help---
|
||||
Enable support for loadable OS modules. Default: n
|
||||
|
||||
|
|
|
@ -572,8 +572,8 @@ void nx_start(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARCH_USE_MODULE_TEXT
|
||||
up_module_text_init();
|
||||
#ifdef CONFIG_ARCH_USE_TEXT_HEAP
|
||||
up_textheap_init();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MM_IOB
|
||||
|
|
|
@ -120,8 +120,8 @@ int rmmod(FAR void *handle)
|
|||
* and nullify so that the memory cannot be freed again
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_ARCH_USE_MODULE_TEXT)
|
||||
up_module_text_free((FAR void *)modp->textalloc);
|
||||
#if defined(CONFIG_ARCH_USE_TEXT_HEAP)
|
||||
up_textheap_free((FAR void *)modp->textalloc);
|
||||
#else
|
||||
kmm_free((FAR void *)modp->textalloc);
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue