(Answer) (Category) ImageCraft Products FAQ-O-Matic : (Category) ICCAVR V6 - and - ICC7 for AVR :
How do I instruct the compiler NOT to initialize some of my char variables at startup?
there are two parts (we will try to make it easier later):

- Put the vars in your own area. In C, do

 #pragma data:uninit_vars
 char a, b, c;
 #pragma data:data

You can refer to them as normal extern in other files.


- ask the linker to put uninit_vars area after the "data" area. To do this, you need to modify the startup file (see Help under "Startup File"), you should see something like

         .area data
 __data_start::
         .area bss
 __bss_start::

somewhere in the middle of the file. Change it to:

         .area data
 __data_start::
        .area uninit_vars
 __uninit_vars_start::
         .area bss
 __bss_start::


Now compile startup as mentioned and all should be well. You can double check the address allocation by doing Help->"View Map File" under the IDE to make sure the addresses are expected.


richard@imagecraft.com

[Append to This Answer]
Previous: (Answer) How do I put a constant at a specific address using ICCAVR?
Next: (Answer) I write a simple program for the Mega128 (or Mega64), and it doesn't work!
This document is: http://www.dragonsgate.net/cgi-bin/FAQ/fom?file=200
[Search] [Appearance]
This is a Faq-O-Matic 2.721.
This FAQ administered by Richard Man