Hello,
We are working on a CM33 device and developing a code for the Secure World.
We are using Arm v6.19 Compiler, and our scatter file is like this
LR_IROM1 0x0C010100 0xFF00 { ; load region size_region
...
}
We need to leave 0x100 bytes before the image to add a metadata as post-build step.
We need to align a variable with 512
uint8_t globalBuffer[512] __attribute(align(512));But when we align any symbol, we are getting the following error.\Objects\OSTests_S1.axf: Error: L6244E: Load region LR_IROM1 address (0x0c010100) not aligned on a 512 byte boundary.
uint8_t globalBuffer[512] __attribute(align(512));
.\Objects\OSTests_S1.axf: Error: L6244E: Load region LR_IROM1 address (0x0c010100) not aligned on a 512 byte boundary.
If we align with 256, there is no problem as LR_IROM1 offset aligned with 256.
The same code is used by different architectures, so we need to keep the alignment as is.
But it does not make sense, why a variable alignment affects the image alignment.
And there is no documentation (seems empty) about this error
Any idea?
Thanks
I've not built up an explicit test case, but I expect that the array is the first (only?) thing you are placing in this section. You could place an empty section before it for your metadata, something like this.
LR_IROM1 0x0C010100 0xFF00 { ; load region size_region METADATA +0 EMPTY 0x100{} ARRAY +0 0xFE00{ array.o (+ZI) } }
Does this work?
Hi @ronans,
Thank you for the details.
Let me give a bit more about our scatter file. We have a section to collect all RO, called ER_IROM1 inside the LR_IROM1.
LR_IROM1 0x0C010100 0xFF00 { ER_IROM1 0x0C010100 0xFF00 { *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) }
LR_IROM1 0x0C010100 0xFF00 {
ER_IROM1 0x0C010100 0xFF00 {
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
RW_IRAM1 0x30008000 0x00002000 { ; RW data .ANY (+RW +ZI) *(STACK) }}
RW_IRAM1 0x30008000 0x00002000 { ; RW data
.ANY (+RW +ZI)
*(STACK)
Yes, we tried to add a section for 0x100 size for metadata just before the ER_IROM1 section, (And we set the LR_IROM offset to 0x0C010000 from 0x0C010100 to include the Metadata)
but then we started to get the same error for ER_IROM1, not for LR_IROM.
But still does not make sense, why a variable alignment is related to the Code section?
As the online documentation is empty, where to get the a full documentation about the linker behaviour.
PS: I can be wrong but we did not have this error before, we have a new setup with the latest MDK 3.28. I am wondering does it come from the toolchain?
Hi Murak,
I've built a test case, and I can replicate the issue. I will discuss with colleagues internally.
Ronan