Hi all

Problem from the other day:

Have large data area in the FLASH which is fully accesible and is retained 
between code donwloads with TI Flash Emul. tool and CSPY

Solution ( as pointed by Harry Lemmens):
(just a simplified example)

#define FLASH_ADDRESS 0xB400  // or elsewhere in flash where there is no code

unsigned char * NVdata_ptr = (unsigned char *)FLASH_ADDRESS;


const unsigned char FixedArray[512]=
{
    0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
    0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,......
};
........
        Flash_SegmentWrite( FixedArray, NVdata_ptr);

.........etc..etc.....( or similar....example FLASH access functions can be 
found in slaa103.pdf / zip at TI.com ) 

The NVdata_ptr can be manipulated at will and one can store large strucs / 
unions etc. Care must be taken with segment allignment, boundaries, code / 
table increase,....etc..etc....

When reloading the code with CSPY one should use "FET Options"->"Download 
Options" and select Retain Unchanged Memory  ( one can do this ONLY after first 
download.....).

That will keep whatever you put at B400 or elsewhere in main mem. between 
downloads !!!!!!!!!!!!!!!!

In the case you just need large tables which can be reloaded at startup:  

const unsigned char Table[4096]__attribute__ ((section (".ROMdata"))) = { data 
};

msp430-gcc FileName.c -mmcu=msp430x449 -Wl,--section-start -Wl, .ROMdata=0xB400 
-ggdb  -O2 -o FileName.elf
msp430-objdump -DS FileName.elf > FileName.lst
msp430-objcopy -O ihex FileName.elf  FileName.dhex    
(  *.d* is CSPY default file load name)

....etc..etc....and don't care about CSPY settings !

If you do just 
const unsigned char Table[4096]__attribute__ ((section (".ROMdata"))) ; 
without init and use "Retain Unchanged Memory  " the 4096 bytes from B400 will 
be zeroed instead of being retained at code reload.

This is all "obvious" and "simple" but I hope it can be of some help to some 
people !!!!!!!!!!!


Regards

Vladimir Voroncov
System/Software Engineer
Design2000 Pty. Ltd.
9-11 Rose Street PO Box 7020
Upper Ferntree Gully
Melbourne Victoria 3156
Australia

Phone: -61-(0)3-9758-5933
Fax:     -61-(0)3-9758-7279
Mobile: 0407-766-569
Email: vladi...@design2000.com.au

Reply via email to