From 391dd7b9ad845694b25662d4aa46df2d8e8cf66c Mon Sep 17 00:00:00 2001 From: Alexey Gerenkov Date: Tue, 10 Sep 2024 18:52:09 +0300 Subject: [PATCH] fix(build): Fix declaration of linker labels for ROM reserved regions It looks like as a part of optimization for inlined functions like 'mmu_ll_vaddr_to_laddr' Clang aligns constant value used for bitwise AND operation with the pointer to external symbol passed to the function as parameter. That led to assertion failures because boundaries can be unaligned to 4 bytes. --- components/esp_mm/esp_mmu_map.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/esp_mm/esp_mmu_map.c b/components/esp_mm/esp_mmu_map.c index c2b8be1beb..4b63136055 100644 --- a/components/esp_mm/esp_mmu_map.c +++ b/components/esp_mm/esp_mmu_map.c @@ -134,8 +134,8 @@ static void s_reserve_irom_region(mem_region_t *hw_mem_regions, int region_nums) * - Now IBUS addresses (between `_instruction_reserved_start` and `_instruction_reserved_end`) are consecutive on all chips, * we strongly rely on this to calculate the .text length */ - extern int _instruction_reserved_start; - extern int _instruction_reserved_end; + extern char _instruction_reserved_start; + extern char _instruction_reserved_end; size_t irom_len_to_reserve = (uint32_t)&_instruction_reserved_end - (uint32_t)&_instruction_reserved_start; assert((mmu_ll_vaddr_to_laddr((uint32_t)&_instruction_reserved_end) - mmu_ll_vaddr_to_laddr((uint32_t)&_instruction_reserved_start)) == irom_len_to_reserve); @@ -162,8 +162,8 @@ static void s_reserve_drom_region(mem_region_t *hw_mem_regions, int region_nums) /** * Similarly, we follow the way how 1st bootloader load flash .rodata: */ - extern int _rodata_reserved_start; - extern int _rodata_reserved_end; + extern char _rodata_reserved_start; + extern char _rodata_reserved_end; size_t drom_len_to_reserve = (uint32_t)&_rodata_reserved_end - (uint32_t)&_rodata_reserved_start; assert((mmu_ll_vaddr_to_laddr((uint32_t)&_rodata_reserved_end) - mmu_ll_vaddr_to_laddr((uint32_t)&_rodata_reserved_start)) == drom_len_to_reserve);