Disabling optimization in certain areas

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

Disabling optimization in certain areas

ソリューションへジャンプ
2,028件の閲覧回数
Luigi
Contributor III
Hi all,
 
I am using CW for the 9S08AW32 processor.  I want copyright information to be part of the executable code as data.  So, I have an array of characters for copyright information declared as "const char Copyright[] = { "Copyright 2008 ... All rights reserved." };  The problem comes in when the compiler wants to optimize Copyright out since it is not used.  So, to get around the problem, I have a statement in main, "errorcode = Copyright[0];".  My question: is there a way to tell the compiler to NOT optimize out the Copyright variable without using the assignment I made above?  Thanks.
 
Lou
 
ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
682件の閲覧回数
Navidad
Contributor III
You can tell the linker to consider your object as "root" when building the dependency information. Add the following snippet to your .prm file to do that:

DEPENDENCY
  ROOT Copyright END
END

Alternatively, you can add an "ENTRIES" block to your .prm file:

ENTRIES
  Copyright
END



元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
683件の閲覧回数
Navidad
Contributor III
You can tell the linker to consider your object as "root" when building the dependency information. Add the following snippet to your .prm file to do that:

DEPENDENCY
  ROOT Copyright END
END

Alternatively, you can add an "ENTRIES" block to your .prm file:

ENTRIES
  Copyright
END



0 件の賞賛
返信
682件の閲覧回数
Luigi
Contributor III
Thanks!  I will give those a try.  I know it's no big deal to just leave the assignment statement in there, but I thought there must be a cleaner way of doing it.  Appreciated.
 
Lou
 
0 件の賞賛
返信