[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] external memory on atmega128l
From: |
Geir Tore Olsen |
Subject: |
RE: [avr-gcc-list] external memory on atmega128l |
Date: |
Sun, 8 Dec 2002 11:32:25 +0100 |
Hi There!
I see from your example that you enable the external ram in the main file.
That is way too late. You need to enable the external ram in .init1 section
(i think it's the .init1 section, not 100% sure tho), I.E before the
initialization code that copies data from the flash into the .data section
and before the .bss section is zeroed out. There should be documented at:
http://savannah.nongnu.org/download/avr-libc/doc/avr-libc-user-manual/
Check out the Related pages, Memory sections
Best Regards gtoo
-----Original Message-----
From: address@hidden [mailto:address@hidden
Behalf Of Jan Beutel
Sent: Friday, December 06, 2002 11:47 AM
To: AVR-GCC Mailing List
Cc: Urs Frey; Oliver Kasten
Subject: [avr-gcc-list] external memory on atmega128l
hello,
we are using avr-gcc (GCC) 3.3 20020905 with atmega128l and amic
lp62s2048x-70llt external memory.
we are experiencing problems with the external memory access. these
problems seem to increase when options such as -fno-inline-funcions
-Wall and -O6 are used.
if someone who has been using external meory successfully could give us
some hints we would be very glad.
jb
here's an example without waitstates...
#include <avr/io.h>
#include <avr/iom128.h>
#define BUF_ADDR 0x1100
#define BUF_SIZE 0xFFFF - BUF_ADDR
int main( void )
{
s32 i;
volatile u8 *xbuffer;
//disable interrupts
cli();
sbi (MCUCR, SRE); //enable xsram at the very beginning
// to be able to place .bss and .data there
cbi (XMCRB, XMBK); //bus-keeper
cbi(XMCRA, SRW11);
cbi(MCUCR, SRW10);
sbi(DDRF, 7);
cbi(PORTF, 7);
xbuffer = (u8 *) BUF_ADDR;
while (1){
for (i=0; i<BUF_SIZE; i++){
xbuffer[i]=0xFF;
if (xbuffer[i]!=0xFF){
sbi(PORTF, 7);
cbi(PORTF, 7);
}
xbuffer[i]=0x00;
if (xbuffer[i]!=0x00){
sbi(PORTF, 7);
cbi(PORTF, 7);
}
}
}
return 0;
}
--
Jan Beutel address@hidden
Computer Engineering and Networks Laboratory, ETZ G63
ETH Zurich +41 1 632 70 32 Phone
Gloriastrasse 35 +41 1 632 10 35 Fax
CH 8092 Zurich/Switzerland http://www.tik.ee.ethz.ch/~beutel
avr-gcc-list at http://avr1.org
avr-gcc-list at http://avr1.org