From: Greg L. <gl4...@ea...> - 2000-11-14 19:21:39
|
I've just started using SDCC and have run across sever problems. My project is based on the Dallas Semiconductor 80C390. I'm using the 2.2.1 release of the compiler running on Windows 2K installed just last week with the current CYGWIN support. The first is a warning: filename.c(125):warning *** initializer different levels of indirections filename.c(125):warning *** initializer different levels of indirections I get both lines a they appear above. I created the structure to contain initialization data for the CAN controllers on the 80C390: struct _CAN_init { unsigned char ctrlreg; unsigned char ctlregadr[16]; struct _CANctrl xdata *CANctrl; unsigned char bprv; unsigned char tseg1; unsigned char tseg2; unsigned char sjw; unsigned char msmpl; unsigned char idmask[4]; unsigned char idmask15[4]; struct _MsgCtr_init { unsigned char msgctr; unsigned char format; unsigned char idreg[4]; } MsgCtr_init[MSG_CNTRS_USED]; }; In my source code I initialize an instance of an array of this structure. I only started getting this error after I moved the structure to the code segment (I get the warning whether I use "const" or "code" to pu the structure into the code segment): const struct _CAN_init CANInitData[2] = { { CAN0_CTRL, { 0x00, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF }, CAN0_MOVX, CAN_BPRV, CAN_TS1, CAN_TS2, CAN_SJW, CAN_MLSMP, { (CAN_MSG_MASK < 3) >> 24, ((CAN_MSG_MASK < 3) >> 16) & 0xff, ((CAN_MSG_MASK < 3) >> 8) & 0xff, (CAN_MSG_MASK < 3) & 0xff }, { (CAN_MSG_MASK < 3) >> 24, ((CAN_MSG_MASK < 3) >> 16) & 0xff, ((CAN_MSG_MASK < 3) >> 8) & 0xff, (CAN_MSG_MASK < 3) & 0xff }, { {1, 0x0C, {0,0,0,0}}, {2, 0x0C, {0,0,0,0}}, {3, 0x36, {CAN_MSG_PRI_MSG << 4,0,0,0}}, {4, 0x06, {CAN_MSG_PRI_TIME << 4,0x1f,0xff,0xf8}}, {5, 0x36, {CAN_MSG_PRI_DTATB << 4,0,0,0}}, {6, 0x26, {CAN_MSG_PRI_FBCST << 4,0,0x7,0xf8}}, {15, 0x36, {CAN_MSG_PRI_DTAFMC << 4,0,0,0}} } }, { CAN1_CTRL, { 0x00, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF }, CAN1_MOVX, CAN_BPRV, CAN_TS1, CAN_TS2, CAN_SJW, CAN_MLSMP, { (CAN_MSG_MASK < 3) >> 24, ((CAN_MSG_MASK < 3) >> 16) & 0xff, ((CAN_MSG_MASK < 3) >> 8) & 0xff, (CAN_MSG_MASK < 3) & 0xff }, { (CAN_MSG_MASK < 3) >> 24, ((CAN_MSG_MASK < 3) >> 16) & 0xff, ((CAN_MSG_MASK < 3) >> 8) & 0xff, (CAN_MSG_MASK < 3) & 0xff }, { {1, 0x0C, {0,0,0,0}}, {2, 0x0C, {0,0,0,0}}, {3, 0x36, {CAN_MSG_PRI_MSG << 4,0,0,0}}, {4, 0x06, {CAN_MSG_PRI_TIME << 4,0x1f,0xff,0xf8}}, {5, 0x36, {CAN_MSG_PRI_DTATB << 4,0,0,0}}, {6, 0x26, {CAN_MSG_PRI_FBCST << 4,0,0x7,0xf8}}, {15, 0x36, {CAN_MSG_PRI_DTAFMC << 4,0,0,0}} } } }; At the end of the initializer on the line: {15, 0x36, {CAN_MSG_PRI_DTAFMC << 4,0,0,0}} (which is line 125 in my code) I get the above warnings. I don't understand how the static initializer can be different levels of indirection. Second, I get warnings from the linker that it can't find several routines that are part of the standard support libraries: __gptrput __gptrget __decdptr The linker cannot find these routines even after I explicitly include the three libraries on the command line with an absolute path to the directory. Third, in looking over some of the code generated at a line that the compiler flags with the message: Ack: three operands in far space! (gen.c:4746 filename.c:241) I get the following code snippet: 1908 ; Peephole 220a removed bogus DPS set 0744 75 86 01 1909 mov dps, #0x01 0747 90 00 F5 09 1910 mov dptr, #_init_CAN_sloc2_1_0 074B 90 00 F5 29 1911 mov dptr,#_init_CAN_sloc18_1_0 074F 75 86 00 1912 mov dps, #0x00 0752 E0 1913 movx a,@dptr 0753 75 86 01 1914 mov dps, #0x01 0756 C5 9C 1915 xch a, ap 0758 E0 1916 movx a,@dptr 0759 75 86 00 1917 mov dps, #0x00 075C C5 9C 1918 xch a, ap 075E 45 9C 1919 orl a,ap 0760 75 86 01 1920 mov dps, #0x01 0763 F0 1921 movx @dptr,a 0764 75 86 00 1922 mov dps, #0x00 It looks like lines 1909 & 1910 are reversed. With the above order the secondary dptr will be overwritten and the primary dptr is not being written to. Thanks in advance for any clarification that anyone can give me, and sorry for the length of this message, I couldn't think of any other way to make myself understood. Greg Lindberg |