[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Maximum Object File Alignment

From: Robert Latham
Subject: [avr-gcc-list] Maximum Object File Alignment
Date: Tue, 19 Nov 2002 10:06:34 -0000

I am trying to create a global array in program memory (flash) to which I 
wish to write using spm.   The array needs to be aligned to the flash 
pages.   So I have a declaration as follows:

__attribute__ ((progmem, aligned(128)))
unsigned char gucArray[ARRAY_SIZE] =
<lots of bytes>

In response the compiler issues the warning:

"Warning: alignment of `gucArray' is greater than maximum object file 
alignment. Using 1."

Sadly it is being truthful, which means my code doesn't work.

For starters I worked my way all the way down to aligned(2), and still got 
the same warning.   Humpf!   Doing a search on Google on this message gave 
quite a few hits, mostly relating to things like compiling foo_bar_1_6 on 
a Vax.   A bit more relevant was a hit on a dodgy "how to write a [Linux] 
virus" site which suggested setting MAX_OFILE_ALIGNMENT and/or 
BIGGEST_ALIGNMENT, but that didn't have any effect.   More relevant and 
much less distasteful was the post from Bruce D. Lightner in the AVR1.org 
archives.   But for him it didn't matter, so understandably he didn't 
offer a solution.   I've tried a few wild guesses too, the publishing of 
which would make me look really dumb, but at least I feel a little less 
dumb now I know I'm not the only one :).

Can anyone tell me what I should be doing, please?

Bruce's post did suggest one way out - creating the array in assembler. 
  However, I can't find any *comprehensive* documentation of the gcc 
in-line assembler, so whilst I've figured out how to create in-line 
assembler functions, I've no idea how to create and reference (from C or 
in-line assembler functions) a global variable defined in assembler.   Can 
anyone point me in the right direction please?

Bruce says he was using avr-gcc 2.95.2 and thought maybe a later version 
contained the solution.   Well avr-gcc 3.0 running on NT4 doesn't appear 
to.   If at all possible I would like to stick with the version I'm using, 
as I'm nearly finished on this project and everything else is working.


Robert Latham (new to list),
avr-gcc-list at http://avr1.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]