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:
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
Hi,
Default value for CCR register should be 0x200, but after my reset, CCR has a value of 0x218. This makes CCR.UNALIGN_ TRP=1 and hence the problem. I think it is a manufacturing defect. Initially I thought that it was an SRAM problem. But I was using cached SRAM and I don't have any previous experience with cache, so I didn't look for it. And sorry for confusing the fault. It was a usage fault.
Thank you very much for your opinion. I'm grateful.
Regards
Saqib Ahmed
Hello Saqib,
thank you for your explanations.
I think it would be a manufacturing defect, too.
Best regards,
Yasuhiko Koumoto.