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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

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

1,356 次查看
007
Contributor II

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 =

{

   (U16)_Startup,

   APP_ROM_BEGIN_ADDR,

   APP_ROM_END_ADDR,

   APP_ROM_CS_ADDR,

}

 

Regards,

dp

标签 (1)
标记 (4)
0 项奖励
回复
2 回复数

1,176 次查看
implicit
Contributor II

You can force the linker into keeping unreferenced symbols around by explicitly declaring them in the ENTRIES section of the PRM linker script for the project.

E.g.

ENTRIES

      App_Rom_Info

END

0 项奖励
回复

1,176 次查看
007
Contributor II

Thank you, it works :-)

regards,

dp

0 项奖励
回复