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

How unaligned address is handled in arm cortex m4?

Hi, I am using arm cortex m4

I have following code:

main()
{
     fun1();
}
void fun1()
{
     uint8_t frame[256];
     fun2(frame);
}
void fun2(uint8_t *frame)
{
     uint32_t temp;
     temp = *(uint32_t *)(frame + 1);
     printf("%d", temp);
}

Will temp variable prints 32 bit value correctly?

I mean to ask, if address generated (frame + 1) is odd and not on 4 byte boundary then will it be able to load 32 bit value correctly on cortex m4?

I have read following ARM Information Center , it states that:

"The ARMv6 architecture introduced the first hardware support for unaligned accesses.  ARM11 and Cortex-A/R processors can deal with unaligned accesses in hardware, removing the need for software routines"

But what about cortex m4?

Is it same?

I think that arm v4T does not support this alignment and in such case we need to explicitly copy the data byte by byte?

Am I correct?

Please elaborate.

Thanks for reading mu question.

Also, thanks in advance for your answers.