Skip to content

Conversation

@kokas-a
Copy link

@kokas-a kokas-a commented Sep 29, 2022

Add some debug variables to linker script.

Signed-off-by: Nikolay Agishev [email protected]

Add some debug variables to linker script.

Signed-off-by: Nikolay Agishev <[email protected]>
@kokas-a
Copy link
Author

kokas-a commented Sep 29, 2022

Hi colleagues,

I've created this pull request to start discussion about probably issue with current linker script (zephyr/include/zephyr/arch/arc/v2/linker.ld).

The point is while building non-XIP image "ROMable" and "RAMable" regions overlaps because of incorrect alignment.
In couple with assignment of MPU regions this cause system fault.

Linker script declares ROMable region firts and than RAMable region. At the end of tne ROMable region MPU_ALIGN macro is used.
And as it's supposed RAMbale region must be aligned with MPU border.

There is example below "samples/userspace/hello_world_user/" that shows addresses linker variables (obtain via "readelf -s").
This variables are sorted regarding their location in linker script (from top to bottom).

   8040a18c     0 NOTYPE  GLOBAL DEFAULT    7 __rodata_region_end
   80410000     0 NOTYPE  GLOBAL DEFAULT    8 __rom_region_end
   80410000     0 NOTYPE  GLOBAL DEFAULT    8 __ram_reg_start
   8040b940     0 NOTYPE  GLOBAL DEFAULT    9 z_user_stacks_start
   8040d800     0 NOTYPE  GLOBAL DEFAULT    9 z_user_stacks_end  
   8040a18c     0 NOTYPE  GLOBAL DEFAULT    8 __pre_bss
   8040a800     0 NOTYPE  GLOBAL DEFAULT    8 __bss_start

Here " _rom_region_end" and "_ram_reg_start" are aligned with MPU_ALIGN. But next values "z_user* " are misaligned as well as " __pre_bss".
Moreover "noinit" section (which holds z_user_stack) and "bss" sectioin overlaps ROMable region.

So here I'd like to ask for advice how to make correct alignment for regions.
This pull request refer to previous one (#46775)

Build command: west -v build -b qemu_arc_hs samples/userspace/hello_world_user/ with non-XIP.
zephyr.tar.gz

@kokas-a kokas-a closed this Sep 30, 2022
@kokas-a kokas-a deleted the arc_qemu_xip_draft_pr branch September 30, 2022 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant