I have been trying to compile the drivers for the LPC4357 found at www.lpcware.com/.../lpc4350apdlzip for a while now, but I keep getting lots of strange errors, usually something like this:
compiling lpc43xx_i2c.c... H:\LPC4357\Source\lpc43xx_i2c.c(1155): error: #136: struct "<unnamed>" has no field "MASK" I2Cx->MASK[0] = I2C_I2MASK_MASK((uint32_t) \ H:\LPC4357\Source\lpc43xx_i2c.c(1160): error: #136: struct "<unnamed>" has no field "MASK" I2Cx->MASK[1] = I2C_I2MASK_MASK((uint32_t) \ H:\LPC4357\Source\lpc43xx_i2c.c(1165): error: #136: struct "<unnamed>" has no field "MASK" I2Cx->MASK[2] = I2C_I2MASK_MASK((uint32_t) \ H:\LPC4357\Source\lpc43xx_i2c.c(1170): error: #136: struct "<unnamed>" has no field "MASK" I2Cx->MASK[3] = I2C_I2MASK_MASK((uint32_t) \ H:\LPC4357\Source\lpc43xx_i2c.c: 0 warnings, 4 errors
There are various other errors like this in a few of the other packages, but I can't quite seem to figure out how to get it to actually compile.
To make matters worse, the board I have came with a few example projects in Keil, which seem to be set up exactly the same in every option they have, and the source files are the same to the character, but it doesn't generate the error. Clearly I'm doing something wrong, but for the life of me I can't figure out what it is.
Any ideas?
I tested the lpc43xx-2013-09-04.zip, but did not encounter the same problem.
/*********************************************************************//** * @brief Set Own slave address in I2C peripheral corresponding to * parameter specified in OwnSlaveAddrConfigStruct. * @param[in] I2Cx I2C peripheral selected, should be * - LPC_I2C0 :I2C0 peripheral * - LPC_I2C1 :I2C1 peripheral * @param[in] OwnSlaveAddrConfigStruct Pointer to a I2C_OWNSLAVEADDR_CFG_Type * structure that contains the configuration information for the * specified I2C slave address. * @return None **********************************************************************/ void I2C_SetOwnSlaveAddr(LPC_I2Cn_Type *I2Cx, I2C_OWNSLAVEADDR_CFG_Type *OwnSlaveAddrConfigStruct) { uint32_t tmp; CHECK_PARAM(PARAM_I2Cx(I2Cx)); CHECK_PARAM(PARAM_I2C_SLAVEADDR_CH(OwnSlaveAddrConfigStruct->SlaveAddrChannel)); CHECK_PARAM(PARAM_FUNCTIONALSTATE(OwnSlaveAddrConfigStruct->GeneralCallState)); tmp = (((uint32_t)(OwnSlaveAddrConfigStruct->SlaveAddr_7bit << 1)) \ | ((OwnSlaveAddrConfigStruct->GeneralCallState == ENABLE) ? 0x01 : 0x00))& I2C_I2ADR_BITMASK; switch (OwnSlaveAddrConfigStruct->SlaveAddrChannel) { case 0: I2Cx->ADR0 = tmp; /*Line 1155*/ I2Cx->MASK[0] = I2C_I2MASK_MASK((uint32_t) \ (OwnSlaveAddrConfigStruct->SlaveAddrMaskValue)); break;
H:\LPC4357\Source\lpc43xx_i2c.c(1155): error: #136: struct "<unnamed>" has no field "MASK" I2Cx->MASK[0] = I2C_I2MASK_MASK((uint32_t) \
You need to find the definition of LPC_I2Cn_Type that Keil tool-chain uses.
LPC43xx.h
/** * @brief Product name title=UM10430 Chapter title=LPC18xx I2C-bus interface Modification date=1/14/2011 Major revision=0 Minor revision=7 (I2Cn) */ typedef struct { /*!< (@ 0x400xx000) I2C0 Structure */ __IO uint32_t CONSET; /*!< (@ 0x400xx000) I2C Control Set Register. When a one is written to a bit of this register, the corresponding bit in the I2C control register is set. Writing a zero has no effect on the corresponding bit in the I2C control register. */ __I uint32_t STAT; /*!< (@ 0x400xx004) I2C Status Register. During I2C operation, this register provides detailed status codes that allow software to determine the next action needed. */ __IO uint32_t DAT; /*!< (@ 0x400xx008) I2C Data Register. During master or slave transmit mode, data to be transmitted is written to this register. During master or slave receive mode, data that has been received may be read from this register. */ __IO uint32_t ADR0; /*!< (@ 0x400xx00C) I2C Slave Address Register 0. Contains the 7-bit slave address for operation of the I2C interface in slave mode, and is not used in master mode. The least significant bit determines whether a slave responds to the General Call address. */ __IO uint32_t SCLH; /*!< (@ 0x400xx010) SCH Duty Cycle Register High Half Word. Determines the high time of the I2C clock. */ __IO uint32_t SCLL; /*!< (@ 0x400xx014) SCL Duty Cycle Register Low Half Word. Determines the low time of the I2C clock. SCLL and SCLH together determine the clock frequency generated by an I2C master and certain times used in slave mode. */ __O uint32_t CONCLR; /*!< (@ 0x400xx018) I2C Control Clear Register. When a one is written to a bit of this register, the corresponding bit in the I2C control register is cleared. Writing a zero has no effect on the corresponding bit in the I2C control register. */ __IO uint32_t MMCTRL; /*!< (@ 0x400xx01C) Monitor mode control register. */ __IO uint32_t ADR1; /*!< (@ 0x400xx020) I2C Slave Address Register. Contains the 7-bit slave address for operation of the I2C interface in slave mode, and is not used in master mode. The least significant bit determines whether a slave responds to the General Call address. */ __IO uint32_t ADR2; /*!< (@ 0x400xx024) I2C Slave Address Register. Contains the 7-bit slave address for operation of the I2C interface in slave mode, and is not used in master mode. The least significant bit determines whether a slave responds to the General Call address. */ __IO uint32_t ADR3; /*!< (@ 0x400xx028) I2C Slave Address Register. Contains the 7-bit slave address for operation of the I2C interface in slave mode, and is not used in master mode. The least significant bit determines whether a slave responds to the General Call address. */ __I uint32_t DATA_BUFFER; /*!< (@ 0x400xx02C) Data buffer register. The contents of the 8 MSBs of the DAT shift register will be transferred to the DATA_BUFFER automatically after every nine bits (8 bits of data plus ACK or NACK) has been received on the bus. */ __IO uint32_t MASK[4]; /*!< (@ 0x400xx030) I2C Slave address mask register */ } LPC_I2Cn_Type;
You should probably be attentive of the include paths the compiler is using, and make sure it uses the includes from the package, rather than random versions Keil may stumble into. Review the project options/settings, and where files fall in the directory tree.