EmbDev.net

Forum: ARM programming with GCC/GNU tools uint8_t to uint32_t pointer cast with arm-none-eabi


Author: Pawel (Guest)
Posted on:

Rate this post
0 useful
not useful
I encountered another problem when I moved from arm-elf- to 
arm-none-eabi-
The following code:

uint8_t *Data;
uint8_t  Idx;

*((uint32_t *)(Data+(6+Idx)))

would not work anymore.
My intention was to fetch 4 bytes pointed by Data (plus 6+Idx)
and interpret them as a 32-bit unsigned integer. It worked with arm-elf 
but with arm-none-eabi only the lowest byte of the resulting 32-bit word 
was correct. Could anybody help ?

Pawel.

Author: Klaus Wachtler (mfgkw)
Posted on:

Rate this post
0 useful
not useful
Maybe your uint8_t is not aligned on a /4 divisable address as probably 
required for an uint32_t?

Author: Rolf Magnus (Guest)
Posted on:

Rate this post
0 useful
not useful
Is the 32-bit-word you're trying to read properly aligned?

Author: Pawel (Guest)
Posted on:

Rate this post
0 useful
not useful
Well, there is a 3/4 change that the data is not aligned. But how did it 
work with arm-elf and does not work with arm-none-eabi ?

Pawel.

Author: A. K. (prx)
Posted on:

Rate this post
0 useful
not useful
Different aligments.

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.