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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

636件の閲覧回数
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 返答(返信)

456件の閲覧回数
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 件の賞賛

456件の閲覧回数
007
Contributor II

Thank you, it works :-)

regards,

dp

0 件の賞賛