CodeWarrior 5.9, MPC5634, can't relocate function to special address in Flash

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

CodeWarrior 5.9, MPC5634, can't relocate function to special address in Flash

713 Views
yizhou
Contributor I

Dear:

My environment is CodeWarrior 5.9.0, MPC5634. 

I've taken the document AN4329 and AN4497 as the reference. like below:

code:

   #pragma section RX ".romsymbols" data_mode=far_abs
   __declspec(section ".romsymbols") void delay(int ms);
   void delay(int ms)
   {
      int ii,jj;
      if (ms<1) ms=1;
      for(ii=0;ii<ms;ii++)
      for(jj=0;jj<5500;jj++){}
   }

 

the lcf file is:

MEMORY
{
resetvector: org = 0x00000000, len = 0x00000008
init: org = 0x00000020, len = 0x00000FE0
exception_handlers: org = 0x00001000, len = 0x00001000
internal_flash: org = 0x00002000, len = 0x00007000
myrom: org = 0x00008000, len = 0x00001000

internal_ram: org = 0x40000000, len = 0x00014000
heap : org = 0x40014000, len = 0x00002000
stack : org = 0x40016000, len = 0x00001800

}

 

.rom_symbols :
{
__ROM_SYMBOLS = . ;
. = ALIGN (0x4);
*(.romsymbols)
. = ALIGN (0x4);
} > myrom

 

But I always got link warning : 

No linker command file input for section '.romsymbols' in file ....

overlap of the .__bam_bootdata section and .romsymbols section

 

 

Several options in the community are tried. but still failed.

Original Attachment has been moved to: OldCCP.zip

0 Kudos
2 Replies

488 Views
martin_kovar
NXP Employee
NXP Employee

Hello,

I did several changes in your project and now it works correct.

At first, I changed linker file and I created group for rom_symbols section. Second I changed name of section used in pragma in file delay.c.

Please see the example in the attachment and compare it with your original example.

If you have any other questions, please feel free to write me back.

Regards,

Martin

488 Views
yizhou
Contributor I

Hello Martin:

your comment is helpful. thanks a lot

Further question is:

how to place a group of global variables into specified RAM section?

I updated the LCF file like:

    internal_ram:          org = 0x40000000,   len = 0x00013000
 calcram:      org = 0x40013000,   len = 0x00001000

and add section:

 /*calbiration section*/
 .calc_symbols(NOLOAD) : {
   . = ALIGN(4);
   *(.calc_symbols)
   . = ALIGN(4);
 } > calcram

the global varible is declared as:

__attribute__ ((section(".calc_symbols"))) uint16_t  TaskTick;

but the CodeWarrior always reports an error:

section '.calc_symbols' must have an uninitialized data section for object 'TaskTick'

In fact, I prefer to use #pragma command to specify data section or code secton for some variables or functions.

keywords '__attribute__' and '__declspec' are not good, because it can be used only for one global variable.

I believe codeWarrior can support it, but how to use it? And where to find a helpful document on NXP website?

please see the attachment OldCCP.zip.

0 Kudos