We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
When I load my code into the dscope debugger I do not get a jump to my interrupt service routines in the vector table. I am using two interrupts (serial interrupt -4, timer interrupt -1) The code at location FF000b is FF000b cmod3 (0xff),r2 FF000d rr a FF000e mov r4,a I replaced with ejmp ?PR?Timer0_ISR It goes to the service request but the stack is not correct and the ISR does not return. I get something similar with my serial ISR. Why isn't the linker using the proper jump instruction, or am I doing something wrong?????.
I would like to add that half of my code Main is in processor space and other code is in external memory. ie FE0000-F7FFFF address space. Can the interrupts handle being called from this space and then find there way back home???? ISR is in FF:1000 space (on chip)
Did you write your code in C? How did you declare your interrupt service routines? Jon
Jon, The routines were all written in C and I have 2 ISR's void timer0_isr (void) interrupt 1 using 1 void serialIntr (void) interrupt 4 using 3 They were located in the 251 in the 251 internal address space by setting a segment in the linker setup. I wanted some of my code to be in the internal and some code to be in the external spaces. It appears that when I inline assemble a ljmp or ejmp to these ISR's that as long as I stay inthe internal memory they seem to go back and forth corectly (even though the call stack display shows the wrong return address.... but when I go out into external memory and get an interrupt I don't sequence correctly.. Any Ideas or suggestions... Thanks Jon
What step of the 251 chips are you using? Also, which device? Intel or Atmel WM? Jon
>I wanted some of my code to be in the >internal and some code to be in the external spaces. Which parts ? >It appears that when I inline assemble a ljmp or ejmp Why you need use inline assembling ? All JMP's to ISR's compiler can do automatically for you. I do the same work very simple: 1) Use memory models: XSMALL (for data) and HUGE (for code) 2) Check Options/C251 compiler/Object/ Interrupt vectors [X] Include in object Offset: 0 Keep in mind about Offset, if you need build for MON251 then place proper value (usually 0x4000) 3) To locate code/const/data/stack in preferreable areas use linker directives like this
; Here part of *.LIN file SE(?STACK(100H),& ; REBOOT vector for working program ?C_RESET(0xFF0000), ; Config bytes UCONFIG(0,1) ; from config01.c: ;unsigned char code config_bytes[2] = { 0xf1, 0xff }; ; ?CO?CONFIG01(0xFFFFF8)) & ; ------- TARGET MEMORY MAP --------- ; External devices (GLCD, KBD, ExtIO) ; occupy this region RE(01FC00H-01FFFFH) & ; Place reserved for 'const' tables CLASSES (HCONST (0FE0000H-0FE6FFFH), & ; Place for functions in regions FE,FF: ECODE (0FE7000H-0FFFFF7H)) &
Guys, I am just using the dscope simulator right now, however eventually I will run this code on a Temic TSC80251G1D. I don't have any code to set the config, is this done in a startup file. I don't really know about anything other than my own operational code. The reason I inline assembled the addresses into the vector table was that the jumps were not there. Some other stuff was. See my original post. My code seems to sequence correctly but interrupts have problems. Should I be setting the configuration register somehow or be using a different startup file. Since I don't have a copy of this file I don't know much about it. Thanks
I also went back to the compiler and told it to use source mode and save the PSW , and I rebuilt everything, interrups linker still says interrupt frame two bytes. However mode shows source mode.
corrected the interrupt frame size but now the simulator sometimes moves to the next instruction in my code after the interrupt even when the currently running instruction is a loop forever ie WHILE(1). When the simulator returns from the interrupt it sometimes does not execute this instruction and exits my loop. Then it crashes. Is there any way I can avoid this????
Jim, It sounds like the compiler is not generating interrupt vectors for you. Did you disable this option? What compiler and linker options have you specified? Can you show us an example of the program you are compiling? The only time I've seen the problems you are describing is when I set WAY TOO MANY compiler options. If you find that you are setting LOTS of compiler options, there's something wrong. Try building your project with only MODSRC for C251 and A251. Also, one last thought. Are you actually compiling any C files with the C compiler or are you using #pragma SRC for all of your C files? Jon
I set the compiler to save the PSW and put it into source mode (4 byte frame) instead of binary. Now when I load my program into the dscope it has the correct ljmp instructions to my ISR's. I created an endless while loop(while(1);) in one of my subroutines(external code space). When I run my code to this location it gets there fine, but when an interrupt occurs I vector to the ISR and return to the code however when I return I do not actually execute any instructions or stop at any breakpoints set. The trace shows that I just run through all of my instructions until execution stops. One other thing I noticed that the display of the call stack shows a different address than what should be when an interrupt occurs. It seems to be off by 1 byte. Does this mean anything the interrupt seems to come and go alright when it hits when I am in my main routine (located in the same code segment as the ISR) But the stack addressing anomally applies.
Are you using the simulator or the target monitor (MON251)? What versions of the debugger and C compiler are you using? Jon
My tools are: Keil 80251 C Compiler V2.X(DLL 1.31) using simulator dScope debugger dScope-251 / windows V1.51 Jim