AnsweredAssumed Answered

How to reference an absolute address defined in PRM file by a symbol for S12 MCU?

Question asked by dongpeng hou on Sep 8, 2014
Latest reply on Sep 10, 2014 by Edward Karpicz

Hello Freescale,

 

I have a question as title. Here is my case, in S12 PRM file, a flash section is allocated at 0xC000 area, and in code, I want to do a flash checksum checking using the address.  I think the compiler can use a symbol in C code to refer or extern to the absolute address in PRM file, in stead of re-define this address in C code. I see TI MCU compiler has this usage,  an address symbol can be defined in its memory control file, and it can be used in C.

 

In following example, how to reference ROM_C000_Start, ROM_C000_End and Rom_Cs_Word?

 

project.prm:

 

SEGMENTS

... ...

ROM_CS          = READ_ONLY     0xC000 TO   0xC001;

ROM_C000       = READ_ONLY     0xC002 TO   0xEFFF;

... ...

END

 

PLACEMENT

... ...

APP_ROM     INTO      ROM_C000

... ...

END

 

 

C code:

void Startup (void)

{

     U16 cs;

     cs = Checksum_CheckAreaWordAdd (ROM_C000_Start, ROM_C000_End);

     if (cs != *(U16 *) Rom_Cs_Word)

     {    

          for(;;);

     }

     ... ...

}

 

Regards,

dp

Outcomes