Bonjour à toutes et à tous,
Dans le cadre d'un changement de compilateur, je rencontre une erreur que je n'arrive pas à résoudre pour la migration de mon projet.
Le projet en question est en langage c, et se fait du compilateur C18 vers le compilateur XC8 de microchip.
J'utilise la version de MPLab X IDE 3.26, compilateur XC8 v1.37 PRO
Voici l'erreur en question :
La fonction "vMBPortClose" est définie dans le fichier mbport.h (librairie microchip) :Code::0: error: (499) undefined symbol: _vMBPortClose(dist/default/production/BNE-DEV-SFW-021.X.production.obj) (908) exit status = 1
Et utilisée dans le fichier "mb.c" (librairie microchip également) :Code:#ifndef _MB_PORT_H #define _MB_PORT_H #ifdef __cplusplus PR_BEGIN_EXTERN_C #endif #include <xc.h> /* ----------------------- Type definitions ---------------------------------*/ typedef enum { EV_READY, /*!< Startup finished. */ EV_FRAME_RECEIVED, /*!< Frame received. */ EV_EXECUTE, /*!< Execute function. */ EV_FRAME_SENT /*!< Frame sent. */ } eMBEventType; /*! \ingroup modbus * \brief Parity used for characters in serial mode. * * The parity which should be applied to the characters sent over the serial * link. Please note that this values are actually passed to the porting * layer and therefore not all parity modes might be available. */ typedef enum { MB_PAR_NONE, /*!< No parity. */ MB_PAR_ODD, /*!< Odd parity. */ MB_PAR_EVEN /*!< Even parity. */ } eMBParity; /* ----------------------- Supporting functions -----------------------------*/ BOOL xMBPortEventInit( void ); BOOL xMBPortEventPost( eMBEventType eEvent ); BOOL xMBPortEventGet( /*@out@ */ eMBEventType * eEvent ); /* ----------------------- Serial port functions ----------------------------*/ BOOL xMBPortSerialInit( UCHAR ucPort, ULONG ulBaudRate, UCHAR ucDataBits, eMBParity eParity ); void vMBPortClose( void ); void xMBPortSerialClose( void ); void vMBPortSerialEnable( BOOL xRxEnable, BOOL xTxEnable ); BOOL xMBPortSerialGetByte( CHAR * pucByte ); BOOL xMBPortSerialPutByte( CHAR ucByte ); UCHAR CalcParity( UCHAR ucData ); /* ----------------------- Timers functions ---------------------------------*/ BOOL xMBPortTimersInit( USHORT usTimeOut50us ); void xMBPortTimersClose( void ); void vMBPortTimersEnable( void ); void vMBPortTimersDisable( void ); void vMBPortTimersDelay( USHORT usTimeOutMS ); /* ----------------------- Callback for the protocol stack ------------------*/ /*! * \brief Callback function for the porting layer when a new byte is * available. * * Depending upon the mode this callback function is used by the RTU or * ASCII transmission layers. In any case a call to xMBPortSerialGetByte() * must immediately return a new character. * * \return <code>TRUE</code> if a event was posted to the queue because * a new byte was received. The port implementation should wake up the * tasks which are currently blocked on the eventqueue. */ extern BOOL( *pxMBFrameCBByteReceived ) ( void ); extern BOOL( *pxMBFrameCBTransmitterEmpty ) ( void ); extern BOOL( *pxMBPortCBTimerExpired ) ( void ); /* ----------------------- TCP port functions -------------------------------*/ BOOL xMBTCPPortInit( USHORT usTCPPort ); void vMBTCPPortClose( void ); void vMBTCPPortDisable( void ); BOOL xMBTCPPortGetRequest( UCHAR **ppucMBTCPFrame, USHORT * usTCPLength ); BOOL xMBTCPPortSendResponse( const UCHAR *pucMBTCPFrame, USHORT usTCPLength ); #ifdef __cplusplus PR_END_EXTERN_C #endif #endif
Il y a bien un #include "mbport.h"
Voilà je n'arrive pas à compiler, à part en commentant les lignes où sont utilisé la fonction ce qui n'est pas la solution, ça fait plusieurs jours que je bloque la dessus.Code:#define __MB_C #include "common.h" #if defined(EM2xxL_MBR) || defined(EM2xxL_MBW) /* ----------------------- System includes ----------------------------------*/ #include "stdlib.h" #include "string.h" /* ----------------------- Platform includes --------------------------------*/ #include "port.h" /* ----------------------- Modbus includes ----------------------------------*/ #include "mb.h" #include "mbconfig.h" #include "mbframe.h" #include "mbproto.h" #include "mbfunc.h" #include "mbport.h" #if MB_RTU_ENABLED > 0 #include "mbrtu.h" #endif #if MB_ASCII_ENABLED > 0 #include "mbascii.h" #endif #if MB_TCP_ENABLED > 0 #include "mbtcp.h" #endif #ifndef MB_PORT_HAS_CLOSE #define MB_PORT_HAS_CLOSE 0 #endif /* ----------------------- Static variables ---------------------------------*/ static UCHAR ucMBAddress; static eMBMode eMBCurrentMode; static enum { STATE_ENABLED, STATE_DISABLED, STATE_NOT_INITIALIZED } eMBState = STATE_NOT_INITIALIZED; /* Functions pointer which are initialized in eMBInit( ). Depending on the * mode (RTU or ASCII) the are set to the correct implementations. */ static peMBFrameSend peMBFrameSendCur; static pvMBFrameStart pvMBFrameStartCur; static pvMBFrameStop pvMBFrameStopCur; static peMBFrameReceive peMBFrameReceiveCur; static pvMBFrameClose pvMBFrameCloseCur; /* Callback functions required by the porting layer. They are called when * an external event has happend which includes a timeout or the reception * or transmission of a character. */ BOOL( *pxMBFrameCBByteReceived ) ( void ); BOOL( *pxMBFrameCBTransmitterEmpty ) ( void ); BOOL( *pxMBPortCBTimerExpired ) ( void ); BOOL( *pxMBFrameCBReceiveFSMCur ) ( void ); BOOL( *pxMBFrameCBTransmitFSMCur ) ( void ); /* An array of Modbus functions handlers which associates Modbus function * codes with implementing functions. */ xMBFunctionHandler xFuncHandlers[MB_FUNC_HANDLERS_MAX] = { #if MB_FUNC_OTHER_REP_SLAVEID_ENABLED > 0 {MB_FUNC_OTHER_REPORT_SLAVEID, eMBFuncReportSlaveID}, #endif #if MB_FUNC_READ_INPUT_ENABLED > 0 {MB_FUNC_READ_INPUT_REGISTER, eMBFuncReadInputRegister}, #endif #if MB_FUNC_READ_HOLDING_ENABLED > 0 {MB_FUNC_READ_HOLDING_REGISTER, eMBFuncReadHoldingRegister}, #endif #if MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED > 0 {MB_FUNC_WRITE_MULTIPLE_REGISTERS, eMBFuncWriteMultipleHoldingRegister}, #endif #if MB_FUNC_WRITE_HOLDING_ENABLED > 0 {MB_FUNC_WRITE_REGISTER, eMBFuncWriteHoldingRegister}, #endif #if MB_FUNC_READWRITE_HOLDING_ENABLED > 0 {MB_FUNC_READWRITE_MULTIPLE_REGISTERS, eMBFuncReadWriteMultipleHoldingRegister}, #endif #if MB_FUNC_READ_COILS_ENABLED > 0 {MB_FUNC_READ_COILS, eMBFuncReadCoils}, #endif #if MB_FUNC_WRITE_COIL_ENABLED > 0 {MB_FUNC_WRITE_SINGLE_COIL, eMBFuncWriteCoil}, #endif #if MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED > 0 {MB_FUNC_WRITE_MULTIPLE_COILS, eMBFuncWriteMultipleCoils}, #endif #if MB_FUNC_READ_DISCRETE_INPUTS_ENABLED > 0 {MB_FUNC_READ_DISCRETE_INPUTS, eMBFuncReadDiscreteInputs}, #endif }; /* ----------------------- Start implementation -----------------------------*/ eMBErrorCode eMBInit( eMBMode eMode, UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity eParity ) { eMBErrorCode eStatus = MB_ENOERR; /* check preconditions */ if( ( ucSlaveAddress == MB_ADDRESS_BROADCAST ) || ( ucSlaveAddress < MB_ADDRESS_MIN ) || ( ucSlaveAddress > MB_ADDRESS_MAX ) ) { eStatus = MB_EINVAL; } else { ucMBAddress = ucSlaveAddress; switch ( eMode ) { #if MB_RTU_ENABLED > 0 case MB_RTU: pvMBFrameStartCur = eMBRTUStart; pvMBFrameStopCur = eMBRTUStop; peMBFrameSendCur = eMBRTUSend; peMBFrameReceiveCur = eMBRTUReceive; pvMBFrameCloseCur = MB_PORT_HAS_CLOSE ? vMBPortClose : NULL; pxMBFrameCBByteReceived = xMBRTUReceiveFSM; pxMBFrameCBTransmitterEmpty = xMBRTUTransmitFSM; pxMBPortCBTimerExpired = xMBRTUTimerT35Expired; eStatus = eMBRTUInit( ucMBAddress, ucPort, ulBaudRate, eParity ); break; #endif #if MB_ASCII_ENABLED > 0 case MB_ASCII: pvMBFrameStartCur = eMBASCIIStart; pvMBFrameStopCur = eMBASCIIStop; peMBFrameSendCur = eMBASCIISend; peMBFrameReceiveCur = eMBASCIIReceive; pvMBFrameCloseCur = MB_PORT_HAS_CLOSE ? vMBPortClose : NULL; pxMBFrameCBByteReceived = xMBASCIIReceiveFSM; pxMBFrameCBTransmitterEmpty = xMBASCIITransmitFSM; pxMBPortCBTimerExpired = xMBASCIITimerT1SExpired; eStatus = eMBASCIIInit( ucMBAddress, ucPort, ulBaudRate, eParity ); break; #endif default: eStatus = MB_EINVAL; } if( eStatus == MB_ENOERR ) { if( !xMBPortEventInit( ) ) { /* port dependent event module initalization failed. */ eStatus = MB_EPORTERR; } else { eMBCurrentMode = eMode; eMBState = STATE_DISABLED; } } } return eStatus; }
Je suis interessé par n'importe qu'elle petite piste / astuce / aide.
Merci d'avance
-----