This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

identifier is not defined

Hi,

I am trying to use HAL driver for STM32L053C8 discovery board.
In DMA.h I defined:

typedef struct
{
  DMA_Channel_TypeDef    *Instance;          /*!< Register base address                  */

  DMA_InitTypeDef       Init;           /*!< DMA communication parameters           */

  __IO DMA_StateTypeDef  State;        /*!< DMA transfer state                     */

  void                  *Parent;           /*!< Parent object state                    */

  //void                  (* XferCpltCallback)( struct __DMA_HandleTypeDef * hdma);     /*!< DMA transfer complete callback         */

  //void                  (* XferHalfCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA Half transfer complete callback    */

  //void                  (* XferErrorCallback)( struct __DMA_HandleTypeDef * hdma);    /*!< DMA transfer error callback            */

}DMA_HandleTypeDef;

then in ADC.h I include that DMA.h file but after compilation, the compiler reports:
..\Inc\ADC.h(127): error: #20: identifier "DMA_HandleTypeDef" is undefined DMA_HandleTypeDef *DMA_Handle; /*!< Pointer DMA Handler */
..\Src\DMA.c: 0 warnings, 1 error

Actually there is no red cross on the right of DMA_HandleTypeDef in Keil uvision5 IDE in ADC.h file.

typedef struct __ADC_HandleTypeDef
{
  ADC_TypeDef                   *Instance;              /*!< Register base address */

  ADC_InitTypeDef               Init;                   /*!< ADC required parameters */

  DMA_HandleTypeDef             *DMA_Handle;            /*!< Pointer DMA Handler */

  __IO ADC_StateTypeDef                 State;                  /*!< ADC communication state */

  //__IO uint32_t                 ErrorCode;              /*!< ADC Error code */
}ADC_HandleTypeDef;


I dont know the reason why that happenes. Can anyone help me? Thank you.

Parents
  • Rebuild target 'STM32L053C8_Discovery'
    compiling system_stm32l0xx.c...
    assembling startup_stm32l053xx.s...
    compiling main.c...
    compiling stm32l0xx_it.c...
    compiling Memory.c...
    compiling ADC.c...
    compiling DMA.c...
    ..\Inc\ADC.h(127): error: #20: identifier "DMA_HandleTypeDef" is undefined DMA_HandleTypeDef *DMA_Handle; /*!< Pointer DMA Handler */
    ..\Src\DMA.c: 0 warnings, 1 error
    "STM32L053C8_Discovery\STM32L053C8_Discovery.axf" - 1 Error(s), 0 Warning(s).
    Target not created.
    Build Time Elapsed: 00:00:02

    Here is the output of compilation.
    It seems that ADC is compiled ealier than DMA. Maybe that is the reason? How to change that order?

    Thank you.

Reply
  • Rebuild target 'STM32L053C8_Discovery'
    compiling system_stm32l0xx.c...
    assembling startup_stm32l053xx.s...
    compiling main.c...
    compiling stm32l0xx_it.c...
    compiling Memory.c...
    compiling ADC.c...
    compiling DMA.c...
    ..\Inc\ADC.h(127): error: #20: identifier "DMA_HandleTypeDef" is undefined DMA_HandleTypeDef *DMA_Handle; /*!< Pointer DMA Handler */
    ..\Src\DMA.c: 0 warnings, 1 error
    "STM32L053C8_Discovery\STM32L053C8_Discovery.axf" - 1 Error(s), 0 Warning(s).
    Target not created.
    Build Time Elapsed: 00:00:02

    Here is the output of compilation.
    It seems that ADC is compiled ealier than DMA. Maybe that is the reason? How to change that order?

    Thank you.

Children