Reg: const variables in CW

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

Reg: const variables in CW

2,552件の閲覧回数
girichavana
Contributor II

Greetings to all,

 

  I am working with CodeWarrior for MCU Version: 10. I need the clarification tha where the const variables will be stored ? is it in Flash memory (Code area) ?

 

If so, can i redirect these variables to store in RAM by using prm file ??

 

Thanks and Regards

 

ラベル(1)
0 件の賞賛
返信
6 返答(返信)

2,165件の閲覧回数
CrasyCat
Specialist III

Hello

  Which MCU are you targeting (HC08, Coldfire, Kinetis, ...)?

  Answer to this question depends on the target you are using.

CrasyCat

0 件の賞賛
返信

2,165件の閲覧回数
girichavana
Contributor II

Hi,

My target is HC08 MCU

Thanks

0 件の賞賛
返信

2,165件の閲覧回数
CrasyCat
Specialist III

Hello

HC08 compiler places all constants per default in a section called ROM_VAR (or .rodata).

This section is placed in flash in the.prm file generated by the wizard.

If you wish to get your constants allocated in RAM, just place the section into a RAM memory area in the .prm file PLACEMENT block.

If you have defined your own constant section (using pragma CONST_SEG), just place this section in a RAM memory area in the .prm file PLACEMENT block.

If you decide to allocate your constants in RAM, make sure you are not building with option -D__ONLY_INIT_SP. Initialization values for your constants will need to be copied from ROM to RAM at startup so you need to execute the whole startup code.

I hope this helps.

CrasyCat

2,165件の閲覧回数
girichavana
Contributor II

Hello,

Can you explain, where the option D__ONLY_INIT_SP will be available to enable/disable ?

Thanks&Regards

Giri Chavana

0 件の賞賛
返信

2,165件の閲覧回数
CrasyCat
Specialist III

Hello

  • Click right on the project name in the CodeWarrior Project view
  • Select Properties. The Project Properties dialog is opened.
  • Switch to C/C++ Build > Settings > Tool Settings > S08 Compiler > Preprocessor page.
  • If the symbol __ONLY_INIT_SP is listed in the list box, remove it.

CrasyCat

2,165件の閲覧回数
girichavana
Contributor II

Helly Catherine Bezy,

     Thanks for the useful information.

0 件の賞賛
返信