Hello, I have variables initialized at the global level in my .c file but they are never being initialized. When I watch in d-scope and INIT.a51 is executing: ?C_START: MOV DPTR,#?C_INITSEG LOOP: WATCHDOG CLR A MOV R6,#1 MOVC A,@A+DPTR JZ INITEND <------Here!!!!!!!!!! INC DPTR MOV R7,A ANL A,#3FH JNB ACC.5,NOBIG the code jumps right to INITEND because the MOVC instruction puts zero into the accumulator, even though I've initalized global variables with values. Anyone see the problem? Thanks, Bob
Is it possible that all your files are from assembly sources (or C translated to assembly sources)? In which case just add a dummy C file to your project.
Thanks Jon, The myFile.obj is object from myFile.c Basically the issue is if I list INIT.obj before STARTUP.obj in the linker list, the startup code does not get jumped to. If STARTUP.obj is linked before INIT.obj, everything runs fine.
Yep, This is documented in the following knowledgebase article: http://www.keil.com/support/docs/787.htm Jon
Jon, Thanks for the diligence in helping me, I appreciate it. Honestly, I looked through the knowledgebase and didn't find this. I don't know how I missed it. I'll try the proposed solution and hopefully, it works. Thanks again, Bob
What about the STARTUP.A51 module. Should it also be placed at the end of the linker parameters?
I ran into a problem where I had my c relocatable as the first parameter , and startup.obj as the second. When it was in this configuration, the reset vector was not listed as the first instruction in the .hex file. Putting startup .obj as the first parameter corrected this. Just my experience, hope it helps.