[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Problem with array on the stack
From: |
Cory Cross |
Subject: |
[avr-gcc-list] Problem with array on the stack |
Date: |
Mon, 06 Sep 2010 15:47:03 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.19) Gecko/20081204 Iceape/1.1.14 (Debian-1.1.14-1) |
Hi all,
I had an array on the stack clobber a global array like so:
uint16_t clobberee[3] = {0xFFFF,0xFFFF,0xFFFF};
volatile uint8_t stuff[9][7];
void process(uint8_t num) {
uint8_t i,j;
for(i=0;i<num;++i){
uint8_t clobberer[7];
for(j=0;j<7;++j)
clobberer[j] = stuff[0][j];
}
}
When I made "clobberer" a global, everything worked fine. But with it on
the stack there, the assembly loaded "0x0100" as the base address. When
made a global, it used the global address and everything worked fine.
I'm using the flags -mmcu=atmega168 -I. -gstabs -Os -Wall
-Wstrict-prototypes -fpack-struct -fshort-enums -std=gnu99 -save-temps
-ffunction-sections -ffreestanding
If this is not my fault, I will try and come up with the simplist
program demonstrating the problem.
Thanks,
Cory
- [avr-gcc-list] Problem with array on the stack,
Cory Cross <=