cancel
Showing results for 
Search instead for 
Did you mean: 

Cube generated code doesn't compile, multiple structs and enums undefined/correct headers not linked.

hmorris
Associate

I am attempting to create a program to implement SPI communication from my STM32H753XI MCU, all I did to do this was start a new project in Keil's uVision and generate the code from Cube after selecting my pinouts.

Once my code was generated, however, I attempted to compile it and got 30 errors regarding identifiers that haven't been defined. These appear to be structs and enums from other header files that haven't been included in my project when I generated the code, I've listed examples below.

C:\Users\User\AppData\Local\Arm\Packs\Keil\STM32H7xx_DFP\2.3.0\CMSIS\Driver\SPI_STM32H7xx.h(284): error: #20: identifier "SPI_HandleTypeDef" is undefined

"" "" error: #20: identifier "HAL_SPI_STATE_ABORT" is undefined

"" "" error: #20: identifier "HAL_SPI_STATE_RESET" is undefined

"" "" error: #20: identifier "HAL_SPI_STATE_ERROR" is undefined

These are just a few of them. Is this a mistake I made when generating the code from CubeMX?

1 ACCEPTED SOLUTION

Accepted Solutions

CubeMX is supposed to generate viable projects.

You might look at the stm32h7xx_hal_conf.h file in your project directory to see what sub-components have been pulled.

Keil looks to be using it's own libraries here, not the HAL ones, so perhaps some incompatible mixing-n-matching going on. You should be using CubeMX to generate the project, not Keil.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

2 REPLIES 2

CubeMX is supposed to generate viable projects.

You might look at the stm32h7xx_hal_conf.h file in your project directory to see what sub-components have been pulled.

Keil looks to be using it's own libraries here, not the HAL ones, so perhaps some incompatible mixing-n-matching going on. You should be using CubeMX to generate the project, not Keil.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
hmorris
Associate

Thank you for the super quick response!

This is my first time utilizing this software so I didn't realize it would be an issue starting the project in Keil instead of CubeMX.

I went ahead and redid everything, this time from CubeMX, and it built correctly without any errors, I think that was it!

Thank you!