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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

1,005 Views
DKnieper
Contributor I

Hello,

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:

 

cal_file.c:

 

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

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

 

 

 

lcf file:

 

GROUP : {

  . = 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.

PLEASE HELP!

(MPC55xx family)

Thanks,

Dan

Labels (1)
0 Kudos
3 Replies

420 Views
CrasyCat
Specialist III

Hello

 

I assume you are attempting to get a standalone version of your application.

Am I right?

 

Did you generate a ROM image for your application?

If this is the case and if you have several ROM or Flash memory block in your .lcffile you need to use the LOAD modified in your .lcf file.

 

Attached Technical Note provides some advanced information of ROM image generation.

 

CrasyCat

0 Kudos

420 Views
DKnieper
Contributor I

Hi CrasyCat,

I have read the technical note before, and have no problem generating a ROM image for the application. The application should be *nearly* stand alone, as both the application and the calibration must be present for proper operation.  This is checked in the flash bootloader before the application is launched.  According to the MAP files and confirming the load from a debugger, everything is making it to the address I expect.  The _rom_copy_info table still contains the information to copy it.

Any further suggestions?

Dan

0 Kudos

420 Views
stanish
NXP Employee
NXP Employee

Hi DKneiper,

 

I'd suggest you to modify the .lcf file in order not to generate ROM image for your custom constant section:

 

GROUP :
{
  .cal_data  LOAD(0x0000C000) : {}
} > CAL_SECTION /* defined as address 0xC000 */

 

 

In this case ROM source and RAM destination adresses are same so copydown routine ignores copy.

 

Stanish

0 Kudos