SP debug info incorrect

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

SP debug info incorrect

ソリューションへジャンプ
3,070件の閲覧回数
Seitec
Contributor III
Hello I have this code:


int n = 0;
void interrupt 38 receive_can(void){

unsigned char count;

Rx_Table[n].DLC=(CAN0RXDLR & 0x0F); /*prijata delka*/

for(count = 0; count < Rx_Table[n].DLC; count++){
Rx_Table[n].Data[count] = *(&CAN0RXDSR0 + count); /*kopirovani dat*/
}

CAN0RFLG = 0x01; /*nastaveni RXF dalsi zprava muze byt prijata*/
n++;
}

/******************************************************/
but if I would like debug there is warming SP debug info incorrect...
But if I arrange code (where int n = 0; is inside the function):
/*****************************************************/
void interrupt 38 receive_can(void){

unsigned char count;
int n = 0;

Rx_Table[n].DLC=(CAN0RXDLR & 0x0F); /*prijata delka*/

for(count = 0; count < Rx_Table[n].DLC; count++){
Rx_Table[n].Data[count] = *(&CAN0RXDSR0 + count); /*kopirovani dat*/
}

CAN0RFLG = 0x01; /*nastaveni RXF dalsi zprava muze byt prijata*/
n++;
}

It work properly without warmings but I need "n" as global. Is it mistake if I have "n" as global? Can I Switching off this optimization? Or I have mistake in code?

Thank you very much.
ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,375件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee
To switch off the optimization, use -onf.

Daniel

元の投稿で解決策を見る

0 件の賞賛
返信
5 返答(返信)
1,375件の閲覧回数
Lundin
Senior Contributor IV
I'm sure you know that "n" must be volatile if it is global. Otherwise you are introducing subtle but critical bugs in your program.
0 件の賞賛
返信
1,375件の閲覧回数
Seitec
Contributor III
yes sorry, i forgot on it Thank you very much.
0 件の賞賛
返信
1,376件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee
To switch off the optimization, use -onf.

Daniel
0 件の賞賛
返信
1,375件の閲覧回数
Seitec
Contributor III
Thank you. where I can write this -onf please?
0 件の賞賛
返信
1,375件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee
In the "Command line arguments" field in the "Compiler for HC??" preferences of the project Settings.

Daniel
0 件の賞賛
返信