"improper fixup" linking error caused by load and store library routines?

Hi,

It seems as if the load and store library routines used by the C51 compiler (see http://www.keil.com/support/docs/1964.htm for a description of these routines) are the cause of an 'improper fixup' error I'm getting while linking. I'm using the ROM(SMALL) directive in conjunction with a customized linker command line:

CODE(?CO?StateTest(0x4005), ?PR?*) OVERLAY(* ! ?PR?_UPDATE?StateTest, * ! ?CO StateTest)

to link the following small program:
=============================================
#pragma ROM(SMALL)

unsigned int update(unsigned int arg0, unsigned int arg1);

typedef struct ProcessFragmentState {
unsigned int x;
unsigned char a;
} PFragState;

unsigned int code StateSize = sizeof(PFragState);

PFragState xdata * statePtr;

unsigned int update(unsigned int arg0, unsigned int arg1) {
(statePtr -> x) = (statePtr -> x) + 1;
return arg0 + arg1;
}

=============================================

Shouldn't the linker be able to figure out where to place the load and store routines such that they satisfy the ROM(SMALL) requirements? Is there a way around this?

Thanks,
Slarti

Parents
  • Here's the error I'm getting:

    ==========================================
    *** ERROR L121: IMPROPER FIXUP MODULE:
    D:\PROJECTS\PUSHPIN\CODE\VERSION3\TESTCODEV3\STATETEST\STATETEST.OBJ
    (STATETEST)
    >> SEGMENT: ?PR?_UPDATE?STATETEST
    OFFSET: 000AH
    ==========================================

    And here's the part of the listing file of interest:

    ===========================================

    ; FUNCTION _update (BEGIN)
    ; SOURCE LINE # 23
    ;---- Variable 'arg1' assigned to Register 'R4/R5' ----
    ;---- Variable 'arg0' assigned to Register 'R6/R7' ----
    ; SOURCE LINE # 24
    0000 850082 R MOV DPL,statePtr+01H
    0003 850083 R MOV DPH,statePtr
    0006 E4 CLR A
    0007 75F001 MOV B,#01H
    000A 1100 E ACALL ?C?IILDX
    ; SOURCE LINE # 25
    000C EF MOV A,R7
    000D 2D ADD A,R5
    000E FF MOV R7,A
    000F EE MOV A,R6
    0010 3C ADDC A,R4
    0011 FE MOV R6,A
    ; SOURCE LINE # 26
    0012 ?C0001:
    0012 22 RET
    ; FUNCTION _update (END)

    ============================================

    It's the ACALL to ?C?IILDX that seems to be causing the error.

    Cheers,
    Slarti

Reply Children
More questions in this forum