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:编译时出现问题

Guru**** 657500 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1095110/tm4c1230e6pm-problem-compilate

部件号:TM4C1230E6PM

您好,

我有一个包含许多错误的代码。

说明   资源   路径   位置   类型
#131预期会出现"{"   srv_tick.h   /boot_Bateau_TI/Sources/SRV   line 21   C/C++问题
#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"未定义   srv_tick.h   /boot_Bateau_TI/Sources/SRV   line 25   C/C++ problem
#29预期表达式   srv_tick.h   /boot_Bateau_TI/sources/SRV   行26   C/C++问题
#66预期会出现“;”   srv_tick.h   /boot_Bateau_TI/sources/SRV   行26   C/C++问题

问题是从typedef声明的开始到结束,如果我评论这几句话,问题就会出现在另一个typedef上。

/**
 *@文件srv_tick.h
 *@tick服务的简短标题文件
 *@作者L.MICOU
 *@日期:1/22
 */
#ifndef _SRV_tick_H_
#define _SRV_tick_H_

包括"tm4c1230e6p.h"
#include <stdint.h>

/*宏______________________________________________________________ */
#define U8_delay_not _active ((((uint8_t)0U)
#define U8_day_active     (((uint8_t) 1U)
#define U8_delay_in_progress (((uint8_t)2u)
#define U8_delay_end        ((uint8_t) 3u)
#define U8_day_error_ID   ((uint8_t)4U)
/*常量______________________________________________________________ */
/*类型____________________________________________ */
typedef枚举

   DELAY非活动,
   Delay_active,
   Total_Delay_status_ID/*请勿更改Total_Delay_ID */的位置
} eDelayStatus_t;

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好Micou:

    文件中是否包含所有代码?

    如果不是,该typedef前面的代码是什么?

    我想说的是,问题不在于该细分市场,而在于上面那个细分市场。 因为当我将您发布的内容放入工作项目中的文件时,它会毫无问题地进行编译,我可以使用#define等变量

    文件 末尾是否有#endif?

    此致,

    Ralph Jacobi

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好Jacobi:

    这只是第一行,我在文件末尾有一个#endif。问题出在其他文件中,该文件的函数是在*。h文件中声明的,而不是在*。c中声明的 但我有一个新问题:  

    说明资源路径位置类型
    #1.0056万 SYMBOL "e_LedStatus" redefined:首先在"./main.obj"中定义;在"./micro/we中断.obj" boot_Bateau_TI C/C++ problem中重新定义

    说明资源路径位置类型
    #1.0056万 SYMBOL "e_LedStatus" redefined:首先在"./main.obj"中定义;在"./sources/SRV/srv_boot.obj" boot_Bateate_TI C/C++ problem中重新定义

    我有很多文件的问题。 e_LedStatus仅在*.h文件中声明。

    /**
     * @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_ */
    
    
    

    此致,

    Ludovic Micou

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好Micou:

    嗯,也许您需要对we中断和srv_boot文件中的变量声明使用'extern’标记吗?

    老实说,这是一个C代码问题,而不是TM4C设备特有的问题,虽然我对C编码有相当的了解,但我很少使用typedef enum,也不知道它们的工作原理。

    最好是在堆栈溢出时获得有关C代码相关问题的帮助。

    此致,

    Ralph Jacobi