Shortly, what I need is to place one section after another. An issue though that sections should be in different virtual address spaces.
Detailed: There are two pieces of code. One section (boot) works with MMU disabled and should be linked so that virtual and physical addresses be the same. Another section works while MMU enabled (app) and virtual address is offseted from physical.
Physically both sections should be placed one after another.
That is a part of a linker script I'm struggling with
MEMORY {
DDR_MEMORY : ORIGIN = 0x00002000, LENGTH = 0xFFFFFF
APP_VMA : ORIGIN = 0xFF002000, LENGTH = 0xFFFFFF
BOOT_LMA : ORIGIN = 0x00002000, LENGTH = 0xFFFFFF
}
SECTIONS
{
.boot : {
*(.startup)
} >BOOT_LMA AT>DDR_MEMORY
.app : {
*(.text)
*(.text*)
} >APP_VMA AT>DDR_MEMORY
}
Result is: Lets say 'startup' code is 0x5C bytes. So boot section is linked as 0x2000 - 0x205C virtual and physical.
App code should be behind boot section and I want it to be placed at 0xFF002060 (virtual) and 0x2060 (physical). But APP_VMA I get is 0xFF002000 (no 0x60 offset) with physical location being 0x2060 (that's as expected).
So the question is how to add an offset to APP_VMA so to get virtual address matching a physical (eg. 0xFF002060)?
Thanks.
PS: I'm using a clang linker, but pretty much sure that this is applicable for a gcc as well.