2009-04-26 22:37:53 Aligning buffer fails
Gopal Karanam (INDIA)
Message: 73245
Hello,
I've to align DMA buffers to 32-byte boundary to avoid boundary issues with cache. I'm using the following attribute to align buffers
unsigned int buf1[BUF_SIZE] __attribute__ ((aligned(32)));
But the linker seems to ignore this and align the buffer only to a 4-byte boundary. Even aligned(16) didn't work. Is there any limitation in the linker with alignment?
Thanks,
Gopal
QuoteReplyEditDelete
2009-04-26 22:40:26 Re: Aligning buffer fails
Mike Frysinger (UNITED STATES)
Message: 73246
are you declaring the buffer on the stack or in the .data/.bss ? aligned attributes do not work for the stack but should work just fine for .data/.bss.
if you're writing the linker script yourself and arent just globbing sections, you need to set the ALIGN() yourself.
QuoteReplyEditDelete
2009-04-26 22:56:59 Re: Aligning buffer fails
Gopal Karanam (INDIA)
Message: 73247
Hi Mike,
I'm declaring the buffers in .bss (global). I'm not writing any linker script just using the simple Makefile described in the "Hello world" example on the Wiki.
- Gopal
QuoteReplyEditDelete
2009-04-26 23:11:18 Re: Aligning buffer fails
Gopal Karanam (INDIA)
Message: 73249
Here is a simple program to demonstrate the failure.
Compiled with the following command:
bfin-uclinux-gcc -DEMBED -D__uClinux__ -mcpu=bf548-0.1 -Wall -Wl,-elf2flt x.c -o x
x.c
QuoteReplyEditDelete
2009-04-26 23:14:11 Re: Aligning buffer fails
Gopal Karanam (INDIA)
Message: 73250
It works with FDPIC toolchain. It maybe an issue with the FLAT toolchain.
QuoteReplyEditDelete
2009-04-26 23:54:50 Re: Aligning buffer fails
Mike Frysinger (UNITED STATES)
Message: 73252
yes, that i can believe. the FLAT toolchain does a pass to "pack" things. i can reproduce your issue so i'll open a tracker item.
QuoteReplyEditDelete