Dan Knieper

MPC55xx, Compiler 4.3 build 154: Keeping sdata2 out of _rom_copy_info table

Discussion created by Dan Knieper on Feb 2, 2011
Latest reply on Feb 2, 2011 by stanish


I've worked through many steps to get short constants assigned to a specific section in ROM. The idea is to have a calibration table that can be flashed separately from a main application.  I have the complete ability to link those constants to the right address and separate the output hex files.  My last problem is that the addresses of that separate ROM section are still listed in the _rom_copy_info table, and therefore at startup, the function __init_data attempts to copy from application ROM to what it thinks is RAM, but is really ROM.  This of course causes problems.  I have also tried to eliminate this by using sdata2threshold 0 in the linker arguements.  I'm stuck unless I modify the __init_data function to filter the _rom_copy_info table, but I see this as only a last resort.


Here are some samples of my code / LCF:




#pragma section const_type sconst_type ".cal_data" ".cal_data"

__declspec (section ".cal_data"const uint8 DelayCal[4] = {1,2,3,4};




lcf file:



  . = ALIGN(32);

  .cal_data: {}

} > CAL_SECTION /* defined as address 0xC000 */


The MAP file correctly puts DelayCal at address 0xC000, and the function that uses that calibration uses the correct address as well.  As far as I can tell, the only problem is that the init code tries that unnecessary copy.


(MPC55xx family)