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

Cortex M4 Unaligned access with STR single word access

Hi there,

I am getting a hard fault for accessing an unaligned memory address with STR single word access on a cortex M4 processor (Infineon XMC4500 F100k1024). Cortex M4 manual says that:

Unaligned support is only available for load/store singles (LDR, STR). Load/store double already supports word aligned accesses, but does not permit other unaligned accesses, and generates a fault if this is attempted. 

What could be the possible reason of this fault?

My code is as follows. It throws an exception at STR.

     PRESERVE8
     THUMB
Stack EQU 0x00000100

     AREA STACK,NOINIT,READWRITE,ALIGN=3
             
StackMem SPACE Stack

     AREA RESET,DATA ,READONLY
     EXPORT __Vectors
             
__Vectors
     DCD StackMem + Stack
     DCD Reset_Handler
     ALIGN

     AREA |.text|,CODE,READONLY, ALIGN=2

ENTRY
     EXPORT Reset_Handler     
Reset_Handler

     MOV R5 , #0x3c94
         MOVT R5 , #0x2000
     MOV R4 , #0x123
         STR R4 , [R5]
         
STOP
     B STOP
     END
    
    





0