AnsweredAssumed Answered

How to allocate a const table in ROM yet without used.

Question asked by dongpeng hou on Aug 8, 2014
Latest reply on Aug 11, 2014 by dongpeng hou

Hello Freescale,


I have a question as title. Here is my use case, on my S12G MCU flash, there are two parts, one is a CAN bootloader project allocated at 0xF000 section, the other is my Application project allocated at other sections. The application is downloaded through the CAN bootloader and a Host GUI tool. MCU reset vector points to the CAN bootloader startup, bootloader will check the App flash ROM valid or not after MCU power on or reset. The bootloader can know the App ROM start, end and checksum through a const table which is saved in App ROM area. The App ROM information table is defined in App project, but used in bootloader project.


I tested the S12 compiler, to allocate a const table in ROM, the table must be used in the C function, then it can be built into memory map. If it's not used, it will not be linked in. I tested #pragma INTO_ROM with -Cc option said as the S12 compiler manual, the const also can't be linked in.


I tested @address method as below, it can fix the problem, but when I define other const table behind it, the behind table will be overlapped with the fixed address table App_Rom_Info.


Do you have other method to resolve this problem?


#pragma CONST_SEG APP_ROM_ENTRY  /* App ROM information defined here.

                                                                * It is used for App flash validity check in bootloader*/


const T_APP_ROM_INFO App_Rom_Info @0xC000 =