I have developed 8051 software like following: void my_f(U8 t) { U8 i; U8 j; for (i=0;i<t;i++) for (j=0;j<10;j++) nop(); } void my_int (void) interrupt 2 { ....... my_f(1); ....... } I compile this code, there are no problem, but later i modified the my_f, to following void my_f(U8 t) { U8 i; U8 j; for (i=0;i<t;i++) nop(); } void my_int (void) interrupt 2 { ....... my_f(1); ....... } I recompile this code, there are warning as following: warning C280: 'j': unreferenced local variable *** WARNING L15: MULTIPLE CALL TO SEGMENT SEGMENT: ?PR?_MY_F_?MYCODE CALLER1: ?PR?_MY_INT?INTCODE CALLER2: ?C_C51STARTUP but there are only one place i use my_f, where is in my_int. can anyone figure out why the warning generated? I know just delete the unused variable j can solve the problem, but i want to know why. my software: uVision2 2.38a C51 7.06 BL51 5.03 A51 7.07 my setting: Large mode, no RTX, using Dalas DS80C323. Thanks.
but there are only one place i use my_f, where is in my_int. Looks like it's called from my_int and from main based on the code you posted. Jon
thanks for your reply. I think you refer to the warning message, but why this message not shown in first piece of code? this is the main thing confuse me. thanks
I think you refer to the warning message No. I refer to the code you originally posted. void my_f(U8 t) { U8 i; U8 j; for (i=0;i<t;i++) for (j=0;j<10;j++) nop(); } void my_int (void) interrupt 2 { ....... my_f(1); ....... } I compile this code, there are no problem, but later i modified the my_f, to following void my_f(U8 t) { U8 i; U8 j; for (i=0;i<t;i++) nop(); } void my_int (void) interrupt 2 { ....... my_f(1); ....... } Note the 2 lines in bold. It really doesn't matter anyway, because the linker warning is most likely correct. Jon
maybe I have not make myself clear, the two line you highlighted is the same line. in my code. i just duplicated them there. sorry for this confusing. how you figure out I call my_f in main based program? if you did not draw conclusion from the warning message. I also agree that this is not a serious problem, and solvable. what I am asking here is why. thanks.
See our support knowledgebase, for example: http://www.keil.com/support/docs/874.htm.
Thanks for your reply. I understand that,this warning means I must have call this function, in my interrupt and also my main code, but my problem is first I can not find any place else call it except in the interrupt second why the first piece of code do not give me warning so can you explain more specificly on why first piece of code do not generate warning but secode piece of code do. if you need more information on setting of my project, i can also post them. thanks.
so can you explain more specificly on why first piece of code do not generate warning but secode piece of code do. If you could actually post the code that has the problem that woud help. Posting bits and pieces with mistakes in them makes it impossible for anyone to help you. Perhaps, it's worth it to contact technical support. Jon
thanks Jon as the whole code will be 10 plus files so it will be impossible for me to post here. i will try to contact tech support, thanks for your help.