variable optimized out

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

variable optimized out

ソリューションへジャンプ
3,873件の閲覧回数
AhmadTurkmani
Contributor II

hi,

im trying to read a led using the function Dio_ReadChannel. my code is written as shown below:

while (1)
{

Dio_WriteChannel(DioConf_DioChannel_myled, STD_HIGH);
TestDelay(5000000);
Dio_ReadChannel(DioConf_DioChannel_myled);
if ( Dio_ReadChannel(DioConf_DioChannel_myled) == true)
{
x = 1;

}
else
x=0;

im always getting x as an optimized out:

AhmadTurkmani_0-1692278093832.png

i want to see the value of my variable can anyone help me?

thank you.

0 件の賞賛
返信
1 解決策
3,809件の閲覧回数
VaneB
NXP TechSupport
NXP TechSupport

Hi @AhmadTurkmani 

Go to the project properties -> C/C++ Build -> Settings -> Optimization. 

VaneB_0-1692633933320.png

 

元の投稿で解決策を見る

3 返答(返信)
3,859件の閲覧回数
VaneB
NXP TechSupport
NXP TechSupport

Hi @AhmadTurkmani 

It means you compiled an optimization level different than the default, so the gcc optimizer found that some of your variables were redundant in some way that allowed them to be optimized away. Compile with optimization disabled if you want to see such variables (this is generally a good idea for debug builds in any case).

 

B.R.

VaneB

0 件の賞賛
返信
3,838件の閲覧回数
AhmadTurkmani
Contributor II
How can i disable optimization?
0 件の賞賛
返信
3,810件の閲覧回数
VaneB
NXP TechSupport
NXP TechSupport

Hi @AhmadTurkmani 

Go to the project properties -> C/C++ Build -> Settings -> Optimization. 

VaneB_0-1692633933320.png