avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] Extended SRAM access


From: Marek Michalkiewicz
Subject: Re: [avr-gcc-list] Extended SRAM access
Date: Tue, 2 Jul 2002 15:56:31 +0200 (CEST)

> I am using the new win32 avrgcc release. My embedded web server has 32k 
> external SRAM. I am trying to access it. In the avr-gcc list archives dated 
> september 2001 I found out that I have to modify the avrmega103.x file and 
> the linker flag in the makefile. The changes that I made are: 

The method of early initialization (MCUCR, WDTCR or anything else) is
different (and more flexible) in the current version.  Basically, write
a small assembler file which looks like this:

/* xram.S begin */

#include <io.h>

        .section .init1,"ax",@progbits

        ldi r16,_BV(SRE) | _BV(SRW)
        out _SFR_IO_ADDR(MCUCR),r16

/* xram.S end */

Assemble it, link the resulting xram.o with other files in your program,
and this piece of code will be inserted in initialization code, which is
run right after reset.  See the new linker script (avr3.x - BTW, the
old ones are still provided in the new binutils for compatibility with
the old GCC, but they should be removed from the binary distribution)
for comments about the new .initN sections (which one to use, etc.).

The advantage of this method is that you can insert any initialization
code you want (just remember that this is very early startup - no stack
and no __zero_reg__ yet), and no program memory space is wasted if this
feature is not used.

There should be no need to modify linker scripts anymore, except for
some very special cases.  It is best to leave __stack at its default
value (end of internal SRAM - faster, and required on some devices
like ATmega161 because of errata), and add -Wl,-Tdata,0x801100 to start
the data section above the stack.

All this should be documented somewhere...

Marek

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



reply via email to

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