Fixup overflow in InitDelay, type 1 at offset 0xA

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Fixup overflow in InitDelay, type 1 at offset 0xA

7,090 Views
tranvkhoa
Contributor I
Dear all
 
Basing on Motorola LINKit driver's sample project, I added some functions for CAN functionality and compiled successfully, but when linking the error below occured:
 
"Fixup overflow in InitDelay, type 1 at offset 0xA".
 
Notice that InitDelay is a function of original project, not added function.
 
I don't know how to handle this error and it's getting me stuck for a long time.
If anybody knows about this, please tell me.
 
Thanks in advance.
 
Below is the project's prm file and the function InitDelay
 
/*PRM file*/
 
LINK master.abs
NAMES
   ansi.lib
  /* other object files to link are passed from the IDF with the linker -Add option */
END
SECTIONS
    LIN_ZRAM    = READ_WRITE 0x0040 TO 0x00FF;          /* zero page */
    LIN_RAM     = READ_WRITE 0x0100 TO 0x03BF;          /* program data */
    LIN_STACK   = READ_WRITE 0x03C0 TO 0x043F;          /* stack */
    LIN_ROM     = READ_ONLY  0x8000 TO 0xFDFF;          /* program code & constants */
    LIN_VECTORS = READ_ONLY  0xFFD0 TO 0xFFFF;          /* interrupt vectors (use your vector.obj) */
END
PLACEMENT
    ZeroSeg, _DATA_ZEROPAGE INTO LIN_ZRAM;
    DEFAULT_ROM, ROM_VAR    INTO LIN_ROM;
    DEFAULT_RAM             INTO LIN_RAM;
    SSTACK                  INTO LIN_STACK;
    VECTORS_DATA            INTO LIN_VECTORS;
END
STACKSIZE 0x001F
ENTRIES
 _vectab
END
INIT  _Startup /* contains line replacing default _PRESTART */
MAPFILE ON
 
/*End Prm file*/
 
/*InitDelay function */
/*****************************************************************************
 * Function:        Delay
 *
 * Description:     Initialise RTI for use in Delay() function
 *
 *
 * Returns:         none
 *
 * Notes:   busfreq indicates the bus operating frequency in KHz
 *
 *
 *****************************************************************************/
void InitDelay(unsigned int busfreq)
{
 switch (busfreq)
 {
  case 8000:  TBCR = 0x16;
     break;
  default: break;
 }
}
Labels (1)
0 Kudos
8 Replies

723 Views
CrasyCat
Specialist III
Hello
The message ""Fixup overflow in InitDelay, type 1 at offset 0xA" indicates that you are trying to access a variable allocated outside of the direct page with a 8-bit address.
 
Please check carefully the definition and declaration of the variable TBCR.
The definition and declaration are probably not compatible.
 
Make sure to use the same pragma for variable definition and declaration.
 
CrasyCat
0 Kudos

723 Views
tranvkhoa
Contributor I

Dear Crasycat

TBCR is declared in Motorola's HC908GZ60.h like this:

/*** TBCR - Timebase Control Register; 0x0000001C ***/
typedef union {
  byte Byte;
  struct {
    byte             :1;
    byte TBON        :1;                                       /* Timebase Enabled */
    byte TBIE        :1;                                       /* Timebase Interrupt Enable */
    byte TACK        :1;                                       /* Timebase ACKnowledge */
    byte TBR0        :1;                                       /* Timebase Rate Selection Bit 0 */
    byte TBR1        :1;                                       /* Timebase Rate Selection Bit 1 */
    byte TBR2        :1;                                       /* Timebase Rate Selection Bit2 */
    byte TBIF        :1;                                       /* Timebase Interrupt Flag */
  } Bits;
  struct {
    byte         :1;
    byte         :1;
    byte         :1;
    byte         :1;
    byte grpTBR  :3;
    byte         :1;
  } MergedBits;
} TBCRSTR;
extern volatile TBCRSTR _TBCR @0x0000001C;
//#define TBCR                            _TBCR.Byte
#define TBCR_TBON                       _TBCR.Bits.TBON
#define TBCR_TBIE                       _TBCR.Bits.TBIE
#define TBCR_TACK                       _TBCR.Bits.TACK
#define TBCR_TBR0                       _TBCR.Bits.TBR0
#define TBCR_TBR1                       _TBCR.Bits.TBR1
#define TBCR_TBR2                       _TBCR.Bits.TBR2
#define TBCR_TBIF                       _TBCR.Bits.TBIF
#define TBCR_TBR                        _TBCR.MergedBits.grpTBR

#define TBCR_TBON_MASK                  2
#define TBCR_TBIE_MASK                  4
#define TBCR_TACK_MASK                  8
#define TBCR_TBR0_MASK                  16
#define TBCR_TBR1_MASK                  32
#define TBCR_TBR2_MASK                  64
#define TBCR_TBIF_MASK                  128
#define TBCR_TBR_MASK                   112
#define TBCR_TBR_BITNUM                 4

0 Kudos

723 Views
tranvkhoa
Contributor I
I just include Motorola's header file and use it without declaring TBCR in my code.
0 Kudos

723 Views
tranvkhoa
Contributor I
I commented the definition of TBCR in Motorola's header file, then define in my code like this:
#define    TBCR     IOBYTE(0x001C)       /* TBCR */
 
Then the error does not occur anymore, but I don't know why :smileyhappy:
 
 
0 Kudos

723 Views
CrasyCat
Specialist III

Hello

In fact you need to also add the register definition file (HC908GZ60.c) in your project and link it to the project.

Here you were using a variable, which was declared but not defined ....

CrasyCat

0 Kudos

723 Views
tranvkhoa
Contributor I

Dear Crasy,

Thanks for your reply. I added the source file into project, however now I get another link error, but I don't know if it has the relation with the above problem. Could you please help?

"Segment LIN_VECTORS (0xFFD0) and .absSeg113 (0xFFFF) overlap"

In the auto-generated master.map, I found this:

.abs_section_ffff                  1   N/I     0xFFFF     0xFFFF   .absSeg113

How do I adjust to solve the conflict?

Below is the declaration of LIN vectors in vector.c

#define LIN_VECTF (void *const)
void *const _vectab[] =
#endif  /* defined(COSMIC08)  */

#if defined(HC08GZ60)

/***************************************************************************/
/*      HC08GZ60                                                           */
/***************************************************************************/

{
    LIN_VECTF Dummy_ISR,                          /* 0xFFD0   ADC               */
    LIN_VECTF Dummy_ISR,                          /* 0xFFD2   IRQ2/Keypad       */
    LIN_VECTF Int_CAN_Transmit,               /* 0xFFD4   SCI transmit      */
    LIN_VECTF Int_CAN_Receive,               /* 0xFFD6   SCI receive       */
    LIN_VECTF Dummy_ISR,                /* 0xFFD8   SCI error         */
    LIN_VECTF Dummy_ISR,                          /* 0xFFDA   MSCAN Wakeup      */
    LIN_VECTF RTI_ISR,                       /* 0xFFDC   MSCAN Error       */
    LIN_VECTF Dummy_ISR,                          /* 0xFFDE   MSCAN Receive     */   
    LIN_VECTF Dummy_ISR,                          /* 0xFFE0   MSCAN Transmit    */   
#if defined(MASTER)                          /* (used for Master node only)*/
    LIN_VECTF LIN_ISR_SCI_Transmit,          /* 0xFFE2   SCI transmit      */
#endif /* defined(MASTER) */                 
#if defined(SLAVE)                                            
    LIN_VECTF Dummy_ISR,                          /* 0xFFE2   SCI transmit      */
#endif /* defined(SLAVE) */
    LIN_VECTF LIN_ISR_SCI_Receive,           /* 0xFFE4   SCI receive       */
    LIN_VECTF LIN_ISR_SCI_Error,             /* 0xFFE6   SCI error         */
    LIN_VECTF Dummy_ISR,                          /* 0xFFE8   TIMER B channel 1 */
    LIN_VECTF Dummy_ISR,                          /* 0xFFEA   TIMER B channel 0 */
    LIN_VECTF Dummy_ISR,                          /* 0xFFEC   TIMER A overflow  */
    LIN_VECTF Dummy_ISR,                          /* 0xFFEE   TIMER A channel 3 */
    LIN_VECTF Dummy_ISR,                          /* 0xFFF0   TIMER A channel 2 */
    LIN_VECTF Dummy_ISR,                          /* 0xFFF2   TIMER A channel 1 */
    LIN_VECTF Dummy_ISR,                          /* 0xFFF4   TIMER A channel 0 */
#if defined(MASTER)                          /* (used for Master node only)*/
    LIN_VECTF LIN_ISR_Timer0,                /* 0xFFF6   TIMER A channel 0 */
#endif /* defined(MASTER) */                 
#if defined(SLAVE)                                            
    LIN_VECTF Dummy_ISR,                          /* 0xFFF6   TIMER A channel 0 */
#endif /* defined(SLAVE) */
    LIN_VECTF Dummy_ISR,                          /* 0xFFF8   PLL               */
    LIN_VECTF Dummy_ISR,                          /* 0xFFFA   IRQ1              */
    LIN_VECTF Dummy_ISR,                          /* 0xFFFC   SWI               */
    LIN_VECTF Node_Startup                   /* 0xFFFE   RESET             */
};

Thanks,

Khoa

0 Kudos

723 Views
CrasyCat
Specialist III
Hello
  This message is telling you that two object are allocated at address 0xFFFF.
  This is the Reset Vector and the register COPCTL.
 
  In order to avoid that message, add following option to your linker command line:
  -WmsgSd1100 -WmsgSd1912
 
  This will disable both messages L1100 and L1912.
 
Note that these messages are disabled per default when you create a project using the wizard.
I hope this helps.
 
CrasyCat
0 Kudos

723 Views
tranvkhoa
Contributor I

Dear CrasyCat,

Thank you very much for your answer. I followed your suggestion and it works well now :smileyhappy:

Best regards,

Khoa

0 Kudos