The compiler is generating the following sub-routine call: 019C DA000000 CALLS SEG (WriteString),WriteString I am translating this to be an Inter-Segment Subroutine Call, where the compiler is passing the dummy address DA000000 to the linker. In other places, it calls the same routine as follows: 070E DA000000 R CALLS SEG (WriteString),WriteString Notice, that here it is inserting the relocatable R I believe I need. Any ideas what I may be doing wrong? Thanks in advance. Jt
Is this actually causing you a problem, or is it just an observation? Could it be that one is in the same module as the definition of WriteString, but the others are in different modules? (therefore, they see it as an extern)
Thanks Andrew. Both subroutine calls are in the same module and I have declared the function at the beginning of the module. However, the call without the R is located before the procedure, and the call with the R is located after. If I move the subroutine with the first call after the WriteString() subroutine, the subroutine call will include the R in the list file and everything works fine. If I have declared the subroutines, why should it matter what order the subroutines are coded in the program? Another observation which may or may not be related: if I declare WriteString() as a static, it will also work properly and the R is included (of course, this solution is not acceptable because I won't be able to call the routine from other modules).
Did you prototype the function at the beginning of the file? If not try that and see if the relocatable reference is included. Jon
Thank you Jon. Yes, I did prototype. When I said Both subroutine calls are in the same module and I have declared the function at the beginning of the module in my previous message, I should have said Both subroutine calls are in the same module and I have prototyped all the functions at the beginning of the module
As Andrew asked, is this actually causing you a problem? Is it possible that it's just an error in the listing but the generated code is correct? - Mike
I do know the subroutine works when the relocatable reference is there, and it does not work when it is not there. Doesn't the reference tell the linker that the address needs to be updated when it is linked? How could it work if the reference isn't there? It just seems odd to me that I can get the relocation reference simply by putting the routines in a different order. Shouldn't the routines be mapped by the function prototypes at the top of the program? Thereby it shouldn't matter what order the functions are written, should it?
If it is what it seems it is, then you should send the description of the problem and the project verifying it to Keil Support. Before you do that check once again that the generated code contains the error, that is, check the disassembly listing after linking (in the simulator's disassembly window.) Regards, - Mike