This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

improper fixup (while using interrupt)

after linking my code I get:
*** ERROR L121: IMPROPER FIXUP
MODULE: prog_fsk.obj (PROG_FSK)
SEGMENT: ABSOLUTE

Everything was OK before untill the moment, when I changed one of my program functions to be ISR.

Here is it's source code:

void CallerId(void) interrupt 0 using 2 {
char c;
int timeout=0;
char i; //licznik petli


while(P3_2==0); //czeka az skonczy sie pierwszy dzwonek

P3_3=0; //przelaczenie CMX 612 w tryb odbioru danych FSK
P3_7=1;

c=_getkey();
while(c!=0x55) //czekamy na blok Chan Seize (ASCII 'U')
{
c=_getkey(); //czym rozni sie getkey od getchar????
timeout++;
if(timeout==10000)
//aktywowac przerwanie INT 1 tylko po co?????????
{dzwonek=0;
return; //nieudana transmisja danych
}
}
timeout=0;
while(c!=0x80) //czekamy na naglowek CLIP (call setup)
{
c=_getkey();
timeout++;
if(timeout==10000)
{ //aktywowac przerwanie INT 1 tylko po co?????????
dzwonek=0;
return; //nieudana transmisja danych
}
}

fsk_tab[0]=c; //"call setup"
c=_getkey();
fsk_tab[1]=c; //liczba bajtow wiadomosci (nie liczac pol "call setup" i "Message Lenght")

for(i=2;i<c+2;i++)
{
fsk_tab[i]=_getkey();
}

P3_3=1; //przelaczenie CMX 612 w tryb "Zero Power"
P3_7=0;
dzwonek=1;
}

and here memory map:

LINK MAP OF MODULE: prog_fsk (PROG_FSK)


TYPE BASE LENGTH RELOCATION SEGMENT NAME
-----------------------------------------------------

* * * * * * * D A T A M E M O R Y * * * * * * *
REG 0000H 0008H ABSOLUTE "REG BANK 0"
DATA 0008H 0006H UNIT _DATA_GROUP_
000EH 0002H *** GAP ***
REG 0010H 0008H ABSOLUTE "REG BANK 2"
DATA 0018H 0050H UNIT ?DT?PROG_FSK
IDATA 0068H 0001H UNIT ?STACK

* * * * * * * C O D E M E M O R Y * * * * * * *
CODE 0000H 0003H ABSOLUTE
CODE 0003H 0002H ABSOLUTE
0005H 07FBH *** GAP ***
CODE 0800H 00F6H UNIT ?C?LIB_CODE
CODE 08F6H 00D9H INBLOCK ?PR?MAIN?PROG_FSK
CODE 09CFH 00B4H INBLOCK ?PR?CALLERID?PROG_FSK
CODE 0A83H 008CH UNIT ?C_C51STARTUP
CODE 0B0FH 0086H INBLOCK ?PR?PRINTCLIP?PROG_FSK
CODE 0B95H 005CH INBLOCK ?PR?SAVECLIP?PROG_FSK
CODE 0BF1H 004DH INBLOCK ?PR?_PRINTWPIS?PROG_FSK
CODE 0C3EH 002DH INBLOCK ?PR?_CHECKSUM?PROG_FSK
CODE 0C6BH 001CH INBLOCK ?PR?_WRITE_DATA?PROG_FSK
CODE 0C87H 0014H INBLOCK ?PR?SERIAL_INIT?PROG_FSK
CODE 0C9BH 000FH INBLOCK ?PR?_WRITE_CMD?PROG_FSK
CODE 0CAAH 000EH INBLOCK ?PR?_WRITE_NIBBLE?PROG_FSK
CODE 0CB8H 000CH INBLOCK ?PR?LCD_INIT?PROG_FSK
CODE 0CC4H 000AH UNIT ?PR?_GETKEY?_GETKEY
CODE 0CCEH 0004H UNIT ?C_INITSEG

Thank you for help,
Wojtek


PS I'm using Keil Evaluation
Project settings:
-Device:

Parents
  • Oh, sorry. I didn't notice you were using the evaluation tools.

    The evaluation compiler starts program code at 0x0800. The interrupt service routine (at address 0x0003) is using a 2-byte JMP (AJMP) to jump to the ISR code (which is located above 0x0800 = 2K). This is what causes the fixup error.

    You're not going to be able to use the evaluation compiler to develop code for a 2K device using on-chip memory. This limitation is in place because the evaluation compiler is for evaluating the tools. If you're going to do full-up development, you need to purchase a license for the product.

    That limitation should be explained when you install the tools.

    Jon

Reply
  • Oh, sorry. I didn't notice you were using the evaluation tools.

    The evaluation compiler starts program code at 0x0800. The interrupt service routine (at address 0x0003) is using a 2-byte JMP (AJMP) to jump to the ISR code (which is located above 0x0800 = 2K). This is what causes the fixup error.

    You're not going to be able to use the evaluation compiler to develop code for a 2K device using on-chip memory. This limitation is in place because the evaluation compiler is for evaluating the tools. If you're going to do full-up development, you need to purchase a license for the product.

    That limitation should be explained when you install the tools.

    Jon

Children
  • I see. One thing is strange to me:
    why my code was compiled and linked without any errors after change my ISR(CallerId()) to normal function.

    Wojtek

  • It's not strange at all. If you look at the linker MAP file you posted:

    CODE 0000H 0003H ABSOLUTE
    CODE 0003H 0002H ABSOLUTE
    0005H 07FBH *** GAP ***
    CODE 0800H 00F6H UNIT ?C?LIB_CODE
    CODE 08F6H 00D9H INBLOCK ?PR?MAIN?PROG_FSK
    CODE 09CFH 00B4H INBLOCK ?PR?CALLERID?PROG_FSK
    CODE 0A83H 008CH UNIT ?C_C51STARTUP
    CODE 0B0FH 0086H INBLOCK ?PR?PRINTCLIP?PROG_FSK
    CODE 0B95H 005CH INBLOCK ?PR?SAVECLIP?PROG_FSK
    CODE 0BF1H 004DH INBLOCK ?PR?_PRINTWPIS?PROG_FSK
    CODE 0C3EH 002DH INBLOCK ?PR?_CHECKSUM?PROG_FSK
    CODE 0C6BH 001CH INBLOCK ?PR?_WRITE_DATA?PROG_FSK
    CODE 0C87H 0014H INBLOCK ?PR?SERIAL_INIT?PROG_FSK
    CODE 0C9BH 000FH INBLOCK ?PR?_WRITE_CMD?PROG_FSK
    CODE 0CAAH 000EH INBLOCK ?PR?_WRITE_NIBBLE?PROG_FSK
    CODE 0CB8H 000CH INBLOCK ?PR?LCD_INIT?PROG_FSK
    CODE 0CC4H 000AH UNIT ?PR?_GETKEY?_GETKEY
    CODE 0CCEH 0004H UNIT ?C_INITSEG
    

    You'll notice the following line:

    CODE 0000H 0003H ABSOLUTE

    This absolute segment is 3 bytes long. This indicates an LJMP instruction (AJMPs are only 2 bytes long). This is the LJMP that's generated for the startup code. Either you allowed the linker to include the default startup code or you didn't modify the LJMP in STARTUP.A51 to be an AJMP.

    The interrupt was C code compiled in ROM(SMALL) and the interrupt vector is only 2 bytes (an AJMP).

    CODE 0003H 0002H ABSOLUTE

    The remainder of the code is located from 0x800-0xFFF. If you changed the interrupt service routine to a function, it was included in this range and was called from another function in this range. And that would be OK - and generate no warnings or errors.

    Jon