Skip to content

Commit 9e9e60b

Browse files
ibirnbaumfabiobaltieri
authored andcommitted
arch: aarch32: fix z_mapped_start location for non-XIP operation
Move the z_mapped_start marker for non-XIP builds to the base RAM address. This has already been the marker's location when building for XIP. Prior to this change, z_mapped_start was located at the start of the text section for non-XIP builds. However, at least for the Cortex-A family of CPUs, the first section located at the RAM base address isn't the text section, but the single 4k page containing the exception vectors which are copied to either address 0 or the HIVECS address upon early boot. This resulted in this first 4k page at the bottom of RAM to be considered available for memory mappings via the MMU at run-time, followed by all the permanently mapped stuff, with available mappable memory only continuing behind z_mapped_end. A call at run-time requesting memory to be mapped via the MMU therefore always assigned the single 4k page containing the vectors data first, before continuing mapping physical memory behind z_mapped_end. For any map call requesting more than 4k, this resulted in a contiguous virtual memory address range mapped to non-contiguous physical memory. This behaviour has already been documented in zephyrproject-rtos#51024. This behaviour would also cause further problems in case of support for the Cortex-A's VBAR register, which has been proposed before, but eventually wasn't merged. Letting VBAR point to the RAM base where the 4k vectors page is located within the Zephyr image instead of copying the vectors to either 0 or the HIVECS address means that this page may under no circumstance be re-assigned for use as regular RAM mapped via the MMU. Signed-off-by: Immo Birnbaum <mail@birnbaum.immo>
1 parent 36997de commit 9e9e60b

File tree

1 file changed

+0
-5
lines changed
  • include/zephyr/arch/arm/aarch32/cortex_a_r/scripts

1 file changed

+0
-5
lines changed

include/zephyr/arch/arm/aarch32/cortex_a_r/scripts/linker.ld

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@ SECTIONS
138138
{
139139
. = ALIGN(_region_min_align);
140140
__text_region_start = .;
141-
#ifndef CONFIG_XIP
142-
z_mapped_start = .;
143-
#endif
144141

145142
#include <zephyr/linker/kobject-text.ld>
146143

@@ -252,9 +249,7 @@ SECTIONS
252249
*/
253250
. = ALIGN(_region_min_align);
254251
_image_ram_start = .;
255-
#ifdef CONFIG_XIP
256252
z_mapped_start = .;
257-
#endif
258253

259254
/* Located in generated directory. This file is populated by the
260255
* zephyr_linker_sources() Cmake function.

0 commit comments

Comments
 (0)