16-byte-aligned malloc()?

Rick Mann rmann@latencyzero.com
Fri Sep 7 02:07:00 GMT 2007


Hi. To make some of the hardware on the PXA320 happy, I need to  
allocate buffers on 16 byte boundaries (lower four bits of address  
should be zero. Does anyone have any suggestions on the best way to  
accomplish this?

In certain cases, I could probably have the linker script create  
sections (for example, I need to put a couple of frame buffers in  
external memory; I think the linker script is expressive enough to  
let me define a couple symbols with those addresses, and give me the  
added benefit of preventing BSS data from encroaching into those, but  
that's really a question for the GCC list).

In other cases, I need to declare static structures or malloc() space  
for them. They are much smaller (16 bytes), but still need to be 16  
byte-aligned.

Will I need to modify malloc() to do this?

TIA,
-- 
Rick



More information about the Newlib mailing list