using .init1 section with gcc

Sep 25, 2003 1 Replies

Hello.



I am using avr-gcc 3.0.2. I know its quite old, but switching to a newer WinAVR-Version is a bit of work, because of all the depracated header and so on.. and I am under pressure because of the deadline...



My Problem: I am working on an ATMega103 with 8K external RAM installed. I want to enable the RAM-Interface with:



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



void init_xram (void) { sbi(MCUCR, SRE); // this enables the external RAM interface }



But the linker ist bugging me with that answer:



secion .init1 [00009314 -> 00009323] overlaps section .data [00009314



-> 0000a19f]



How could this happen?



Is it ok, to place the function xram_init in the .c-file where the main() is?



I have already posted this in the avrfreaks.net forum, but no one has an idea for a solution. If anyone knows a possible reason, please answer me. I have to fix this as soon as posible...



Thanks in advance.


The problem lies in the linker script. It seems that it's not prepared to handle the section (.init1).

Another thing is that your start-up code is very probably also not prepared to handle the section very early in the start-up, as you seem to like it be.

IMHO, the easiest way is to edit the start-up module to include the sbi instruction, if you're not willing to go the safer path of upgrading your toolset.

HTH

Tauno Voipio tauno voipio @ iki fi

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required