This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1230E6PM: problem compilate

Part Number: TM4C1230E6PM

Hello,

I have a code with many error.

Description    Resource    Path    Location    Type
#131 expected a "{"    srv_tick.h    /BOOT_BATEAU_TI/Sources/Srv    line 21    C/C++ Problem
#20 identifier "DELAY_ACTIVE" is undefined    srv_tick.h    /BOOT_BATEAU_TI/Sources/Srv    line 24    C/C++ Problem
#20 identifier "DELAY_NOT_ACTIVE" is undefined    srv_tick.h    /BOOT_BATEAU_TI/Sources/Srv    line 23    C/C++ Problem
#20 identifier "TOTAL_DELAY_STATUS_ID" is undefined    srv_tick.h    /BOOT_BATEAU_TI/Sources/Srv    line 25    C/C++ Problem
#29 expected an expression    srv_tick.h    /BOOT_BATEAU_TI/Sources/Srv    line 26    C/C++ Problem
#66 expected a ";"    srv_tick.h    /BOOT_BATEAU_TI/Sources/Srv    line 26    C/C++ Problem

the problems are from the beginning to the end of the typedef declaration. if I put in comment these lines, the problems come on another typedef.

/**
 * @file srv_tick.h
 * @brief Header file of the tick service
 * @author L.MICOU
 * @date 1/04/22
 */
#ifndef _SRV_TICK_H_
#define _SRV_TICK_H_

#include "tm4c1230e6pm.h"
#include <stdint.h>

/* macros ___________________________________________________________________ */
#define U8_DELAY_NOT_ACTIVE  ((uint8_t)0u)
#define U8_DELAY_ACTIVE      ((uint8_t)1u)
#define U8_DELAY_IN_PROGRESS ((uint8_t)2u)
#define U8_DELAY_END         ((uint8_t)3u)
#define U8_DELAY_ERROR_ID    ((uint8_t)4u)
/* constants ________________________________________________________________ */
/* types ____________________________________________________________________ */
typedef enum
{
    DELAY_NOT_ACTIVE,
    DELAY_ACTIVE,
    TOTAL_DELAY_STATUS_ID/* DON'T CHANGE THE PLACE OF TOTAL_DELAY_ID */
}eDelayStatus_t;

  • Hello Micou,

    Is that all the code in the file?

    If not, what is the code directly preceding that typedef?

    I have a hunch the issue is not with that segment, but the one above it. Because when I take what you posted and put it into a file in a working project it compiles without issues and I can use the variables that are #define'd etc.

    Also do you have the #endif at the end of the file?

    Best Regards,

    Ralph Jacobi

  • Hello Jacobi,

    This just the first line, I have a #endif at the end of file. the problem is in other file with a function who is declared in *.h file and not in the *.c. But I have a new problem : 

    Description Resource Path Location Type
    #10056 symbol "e_LedStatus" redefined: first defined in "./main.obj"; redefined in "./micro/we_interrupt.obj" BOOT_BATEAU_TI C/C++ Problem

    Description Resource Path Location Type
    #10056 symbol "e_LedStatus" redefined: first defined in "./main.obj"; redefined in "./Sources/Srv/srv_boot.obj" BOOT_BATEAU_TI C/C++ Problem

    I have the problem for many file. The e_LedStatus is declared only in a *.h file.

    /**
     * @file srv_stor.h
     * @brief Header file of the log service
     * @author S. LE GUEN
     * @date 16/05/17
     */
    #ifndef _SRV_STOR_H_
    #define _SRV_STOR_H_
    #include "tm4c1230e6pm.h"
    #include <stdbool.h>
    #include <stdint.h>
    /* macros ____________________________________________________________________ */
    #define U8_STOR_SET                     ((uint8_t)1u)
    #define U8_STOR_RESET                   ((uint8_t)0u)
    #define U8_CHARGEUR_SOFT_START_DELAY_MS ((uint8_t)100u)
    #define GPIO_PIN_RESET                  ((uint8_t)0u)
    #define GPIO_PIN_SET                    ((uint8_t)1u)
    
    #define DEBUG 2
    typedef enum
    {
        eLED_BOOT_OFF,
        eLED_BOOT_ON,
        TOTAL_LED_BOOT_NB
    }eLEDStatusId_t;
    eLEDStatusId_t  e_LedStatus = eLED_BOOT_OFF;
    /* constants ________________________________________________________________ */
    /* types ____________________________________________________________________ */
    
    /** @Enum who define the list of MCU STOR */
    typedef enum
    {
        HOLD_ALIM12,
        PORT_DEBUG,
        CMD_SWITCH_EQUIL_MCU,
        CMD_MCU_ACTIVE_CONV,
        CMD_MCU_LED,
        CMD_SWITCH_DECH_MCU,
        CMD_SWITCH_CHARGE_MCU,
        REFRESH_WATCHDOG,
        TOTAL_STOR_ID_NB
    }eDefSTORId_t;
    
    /** @Enum who define the list of MCU STOR */
    
    
    
    /** @enum This enum describes all the led cmd */
    typedef enum
    {
        LED_OFF,
        LED_FIX,
        LED_ON_50P_1S,
        LED_ON_50P_2S,
        LED_ON_20P_2S,
        LED_ON_80P_2S,
    }eDefLedCmd_t;
    
    typedef enum
    {
        LED_PERIOD_RESET,
        LED_PERIOD_SET,
        TOTAL_PERIOD_LED
    }eDefPeriodLed_t;
    
    
    /* structures _______________________________________________________________ */
    /** @struct sDefSTORCfg_t
     *@brief This stuct contains the configuration for each STOR
     *@param p_CmdGPIOx MCU Gpio port
     *@param u16_GpioPin MCU Gpio pin
     *@param e_PinState Current STOR Value
     */
    typedef struct
    {
        uint32_t u32_Port;
        uint16_t      u16_GpioPin;
        uint8_t e_PinState;
    }sDefSTORCfg_t;
    
    
    /* private variables ________________________________________________________ */
    /* private functions ________________________________________________________ */
    /* public variables _________________________________________________________ */
    /* functions prototypes _____________________________________________________ */
    extern void vd_srv_STOR_Init(void);
    extern void vd_srv_STOR_SetCmdChargeur(uint8_t e_NewPinState);
    extern uint8_t vd_srv_STOR_GetCmdChargeur(void);
    extern void vd_srv_STOR_SetCmdSwitchCharge(uint8_t e_NewPinState);
    extern uint8_t vd_srv_STOR_GetCmdSwitchCharge(void);
    extern void vd_srv_STOR_SetCmdSwitchDecharge(uint8_t e_NewPinState);
    extern uint8_t vd_srv_STOR_GetCmdSwitchDecharge(void);
    extern void vd_srv_STOR_SetCmdSwitchEquil(uint8_t e_NewPinState);
    extern uint8_t vd_srv_STOR_GetCmdSwitchEquil(void);
    extern void vd_srv_STOR_SetCmdLed(uint8_t e_NewPinState);
    extern uint8_t vd_srv_STOR_GetCmdLed(void);
    extern void vd_srv_STOR_SetCmdHoldAlim12(uint8_t e_NewPinState);
    extern uint8_t vd_srv_STOR_GetCmdHoldAlim12(void);
    extern void vd_srv_STOR_SetCmdSwDbgPin(uint8_t e_NewPinState);
    extern void vd_srv_STOR_SetCmdSwRefreshWdg(void);
    extern uint8_t u8_srv_STOR_SoftStartTerminate(void);
    extern void vd_srv_STOR_StartDecharge(void);
    extern void vd_srv_STOR_ActivationDecharge(void);
    extern void vd_srv_STOR_SetCmdExternalLed(eDefLedCmd_t e_NewExtLedCmd);
    extern void vd_srv_STOR_RefreshExternalLed(void);
    extern void vd_srv_STOR_ResetStartDecharge(void);
    #endif /* _SRV_STOR_H_ */
    
    
    

    Best Regards,

    Ludovic Micou

  • Hello Micou,

    Hmmm, maybe you need to use the 'extern' tag for the variable declarations in the we_interrupt and srv_boot files?

    Honestly this is a C code question more than TM4C device specific and while I have decent knowledge of C coding, I have rarely used typedef enum and don't know the workings of them very well.

    You might be better off getting help on C code related issues on stackoverflow.

    Best Regards,

    Ralph Jacobi