feat(heap): Add executable caps to IRAM region

This commit is contained in:
Dong Heng
2021-01-22 12:07:37 +08:00
parent b9b4d8d7da
commit 5d980e20f1
2 changed files with 2 additions and 1 deletions

View File

@ -31,6 +31,7 @@ extern "C" {
*/ */
#define HEAP_ALIGN(ptr) (((size_t)ptr + (HEAP_ALIGN_SIZE - 1)) & ~(HEAP_ALIGN_SIZE - 1)) #define HEAP_ALIGN(ptr) (((size_t)ptr + (HEAP_ALIGN_SIZE - 1)) & ~(HEAP_ALIGN_SIZE - 1))
#define MALLOC_CAP_EXEC (1 << 0) ///< Memory must be able to run executable code
#define MALLOC_CAP_32BIT (1 << 1) ///< Memory must allow for aligned 32-bit data accesses #define MALLOC_CAP_32BIT (1 << 1) ///< Memory must allow for aligned 32-bit data accesses
#define MALLOC_CAP_8BIT (1 << 2) ///< Memory must allow for 8-bit data accesses #define MALLOC_CAP_8BIT (1 << 2) ///< Memory must allow for 8-bit data accesses
#define MALLOC_CAP_DMA (1 << 3) ///< Memory must be able to accessed by DMA #define MALLOC_CAP_DMA (1 << 3) ///< Memory must be able to accessed by DMA

View File

@ -46,7 +46,7 @@ void heap_caps_init(void)
if (iram_size > HEAP_REGION_IRAM_MIN && iram_size < HEAP_REGION_IRAM_MAX) { if (iram_size > HEAP_REGION_IRAM_MIN && iram_size < HEAP_REGION_IRAM_MAX) {
g_heap_region[heap_region_num].start_addr = (uint8_t *)&_iram_end; g_heap_region[heap_region_num].start_addr = (uint8_t *)&_iram_end;
g_heap_region[heap_region_num].total_size = iram_size; g_heap_region[heap_region_num].total_size = iram_size;
g_heap_region[heap_region_num].caps = MALLOC_CAP_32BIT; g_heap_region[heap_region_num].caps = MALLOC_CAP_32BIT | MALLOC_CAP_EXEC;
heap_region_num++; heap_region_num++;
} }
#endif #endif