Sebastian Paul

Initialisation of Variable in seperated segment

Discussion created by Sebastian Paul on Jan 20, 2012
Latest reply on Jan 23, 2012 by Sebastian Paul

Hi,

 

i'm writing a bootloader, and therefor i need to put few variable initialisations into the seperated bootloader segment (not in standard COPYDOWN section!). How can i do this?

 

The bootloader segment is defined in *.prm file like this

SEGMENTS...BOOTLOADER        =  READ_ONLY    0xD600 TO 0xF9FF;...ENDPLACEMENT...BOOT INTO BOOTLOADER;...END

The bootloader code is located in a Boot.c file, and this file starts with

//beginning of Boot.c
#pragma CODE_SEG BOOT

unsigned long my_var = 0x11;

void MyFunc(void)
{
...
}

 In the *.map file i can see that the functions in this Boot.c are located in BOOT segment, but my_var is still in the standard COPYDOWN segment. How can i put my_var initial value in BOOT?

Outcomes