This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Load Alignment Exception with Arm Compiler 6.13

I am working on a low level trusted bootloader (written in C) running on an ARM Cortex-A53 at EL3.  The MMU is not setup and the bootloader is running out of ROM.  We are linking in the CC712 TEE-SBROM library, and running into alignment exceptions when performing a load.  Prior to Arm compiler 6.13, I was able to force strict alignment using the -mno-unaligned-access.  The Alignment Data Abort Exception has returned with the 6.13.   More specifically, the exception happens when trying to initialize a local function variable:

char header[] = CC_SB_CERT_UTIL_PEM_HEADER; // value of pem header ends with "0x0a" == line feed
char footer[] = CC_SB_CERT_UTIL_PEM_FOOTER; // value of pem footer ends with "0x0a" == line feed


The constant string is stored at a 16-bit aligned address. When it tries to load the address, it generates an alignment exception.

Here's a snippet of the assembly:

# the address assigned (2-byte aligned)
EL3:0x000000000000E640 : ADRP     x8,{pc}+0x5000 ; 0x13640
EL3:0x000000000000E644 : ADD      x8,x8,#0x50a

# * * *
# the load command
EL3:0x000000000000E668 : LDR      x12,[x8,#0]


Using ARM Compiler 6.12, the beginning of the string is placed on a 64-bit boundary. Any suggestions on how to do this on 6.13?

here are the compiler flags:

--target=aarch64-arm-none-eabi -mcpu=cortex-a53 -DARM_V8A -D__A53__ -D__64_BIT__ -DNO_MMU -c -DLITTLE__ENDIAN -DHASLONGLONG -Wall -Werror -Wno-self-assign -mno-unaligned-access -m -D__arm64__ -O0 -DDEBUG -g3 



And the Exception:

ESR_EL3: 96000021  FAR_EL3: 1334a, Stack Ptr = 34077024 
Parents
  • You are correct that -mno-unaligned-access will not force alignment of data, just that it will not generate such accesses (for example, by doing 4xbyte access rather than a single word load).

    I'm not familiar (at all!) with the CC712Tee code... are you able to debug which variable is causing the unaligned access, and from there compare its location in the 6.12 and 6.13 build?

    Aside, FYI, we have recently released Arm Compiler 6.14.

Reply
  • You are correct that -mno-unaligned-access will not force alignment of data, just that it will not generate such accesses (for example, by doing 4xbyte access rather than a single word load).

    I'm not familiar (at all!) with the CC712Tee code... are you able to debug which variable is causing the unaligned access, and from there compare its location in the 6.12 and 6.13 build?

    Aside, FYI, we have recently released Arm Compiler 6.14.

Children
No data