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

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

[avr-gcc-list] Overlays


From: Ron Kreymborg
Subject: [avr-gcc-list] Overlays
Date: Sun, 29 Feb 2004 11:34:20 +1100

I am writing an overlay manager that will pull in overlays from an external
SPI eeprom. It will reside in the bootloader section. I appreciate that
others have done this by reprogramming the entire flash - but I want to see
if I can get the gcc overlay mechanism to work in an AVR.

My question concerns the OVERLAY linker script command. While I can get the
linker to perform what looks like the correct allocations, a quick look with
Studio4 shows it is not working. The simple test harness (on a atmega169)
flashes a LED at different rates depending on which overlay is running. The
main program looks like:

    while (1)
    {
        Overlay1Set(10);
        Overlay2Set(5);
    }

and the overlays are respectively:

//-----------------------------------------------------------
__attribute__ ((section (".text1"))) void Overlay1Set(int n)
{
    int i;
    Cycles = 250;
    for (i=0; i<n; i++)
    {
        Delay(Cycles);
        LED4_ON;
        Delay(Cycles);
        LED4_OFF;
    }
}

//-----------------------------------------------------------
__attribute__ ((section (".text2"))) void Overlay2Set(int n)
{
    int i;
    Cycles = 1000;
    for (i=0; i<n; i++)
    {
        Delay(Cycles);
        LED4_ON;
        Delay(Cycles);
        LED4_OFF;
    }
}

The Cycles variable is a global int, and Delay is a public function. Where I
am going wrong, I think, is in patching the avr5.x script. I added the
lines:

  OVERLAY 0x2000 : AT (0x3000)
  {
        .text1 { o1/*.o(.text)}
        .text2 { o2/*.o(.text)}
  }

after the normal .text section. Using the Weddington standard makefile, it
reports:

Main elf  :
section   size      addr
.data        0   8388864
.text      328         0
.text1      64      8192
.text2      64      8192
.bss         2   8388864
.noinit      0   8388866
.eeprom      0   8454144
.stab     2964         0
.stabstr  2191         0
Total     5613

which looks like what I would expect. Note that the bootloader code is not
present here - I'm just trying to get the overlays to link correctly. What
is not working is on entry in Studio4 the PC is at 0x1000, and pointing to
one of the overlays. The main program and other overlay seem to be not
available.

Can anyone see something I am doing wrong? Could the overlay description be
added to the makefile without requiring a scipt file change?

Ron


_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list


reply via email to

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