[Top][All Lists]

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

[avr-gcc-list] atmega128 & external SRAM problem

From: Frank Siegemund
Subject: [avr-gcc-list] atmega128 & external SRAM problem
Date: Mon, 14 Oct 2002 23:39:38 +0200


I have downloaded the latest version of gcc and avr-lib and 
still cannot access external SRAM on my platform (atmega128 + 
60K external SRAM).

Here is what I did:
- downloaded and installed binutils 2.13
- downloaded latest snapshot CVS version of gcc:
avr-gcc -v
gcc version 3.3 20021007 (experimental)
- downloaded and installed todays CVS version of avr-libc

I enabled the SRE bit of MCUCR according to the faq in init1:

void my_init (void) __attribute__ ((naked)) \
    __attribute__ ((section (".init1")));

void my_init (void)
    sbi(MCUCR, SRE); 

and put -Wl,-Tdata,0x801100 to my LDFLAGS:

LDFLAGS = -v -g -Wl,-Tdata,0x801100 -mmcu=$(AVRARCH)

(AVRARCH = atmega128)

However, when I run a small test program, it just reboots after 
a short time indicating that the additional SRAM cannot be accessed.

Here is the test program:

#include <avr/io.h>
#include "uart1.h"

void my_init (void) __attribute__ ((naked)) \
    __attribute__ ((section (".init1")));

void my_init (void)
    sbi(MCUCR, SRE); 

int main (void) {

        unsigned short bla[3000], i, j;
        // just a busy wait to see when the program reboots
        for (i = 0; i < 3000; i++)
                for (j = 0; j < 200; j++)
        for (i = 0; i < 3000; i++) {                            
                bla[i] = i;
                debug_out_hex((u8*)&bla[i], 2);         
        for (i = 0; i < 3000; i++) 
                debug_out_hex((u8*)&bla[i], 2);
        return 0;       

Does anyone have any idea of how to solve the problem? Could it be 
that I have to set other variables? The stack should be automatically 
initialized to 0x10FF, right? I also tried it with modified linker 

Any ideas?

Thank you!

Kind regards,


avr-gcc-list at http://avr1.org

reply via email to

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