Arm Community
Site
Search
User
Site
Search
User
Support forums
Arm Development Studio forum
Alignment of variables for Cortex-M0
Locked
Locked
Replies
2 replies
Subscribers
119 subscribers
Views
5519 views
Users
0 members are here
Options
Share
More actions
Related
How was your experience today?
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
Alignment of variables for Cortex-M0
Alistair Lowe
over 12 years ago
Note: This was originally posted on 12th October 2012 at
http://forums.arm.com
[font=verdana, sans-serif][size=2]Hi guys,[/size][/font]
[font=verdana, sans-serif][size=2]I'm currently working with a Cortex-M0 (using armcc), which is incapable of unaligned reads.[/size][/font]
[font=verdana, sans-serif][size=2]I have a byte array which is storing a received packet in a certain protocol, the first lot of information to come in is 1 byte, followed by two 16-bit half-words.[/size][/font]
[font=verdana, sans-serif][size=2]This is leading to misalignment and preventing me from performing any direct casting/pointer access to these values; I can't space the data out as it's being placed in the array by DMA.[/size][/font]
[font=verdana, sans-serif][size=2]I know with a structure it can be packed, however I've had no such luck with pointers and access to my array.[/size][/font]
[font=verdana, sans-serif][size=2]Is it possible to ask the compiler to align the start of my byte array on the edge of a word (3 bytes), so that the rest of my data is aligned? And if so how?[/size][/font]
[font=verdana, sans-serif][size=2]Any other suggestions?[/size][/font]
[font=verdana, sans-serif][size=2]Many thanks for any help and advice.[/size][/font]
0
Quote