cancel
Showing results for 
Search instead for 
Did you mean: 

Need Help with Include paths in Keil compiler

DRobe.4
Senior

Using Keil V5, C program for stm32g0. Have tried to add include paths in Project.Options for target. C tab. include paths, for instance:

C:/Users/ashto/STM32Cube/Repository/STM32Cube_FW_G0_V1.6.1/Drivers/CMSIS/Include;..\..\STM32Cube\Repository\STM32Cube_FW_G0_V1.6.1\Drivers\STM32G0xx_HAL_Driver\Inc

but GPIOInitStruct is undefined, interrupt request names, USART and Timer register names. Many errors. I must be making some simple, fundamental mistake.

23 REPLIES 23
raptorhal2
Lead

Here is another way to tackle the problem, if you don't mind a more automated process:

Create your project in Cube MX, and then in Project Manager, choose MDK-ARM as the Toolchain/IDE.

My attempt at this resulted in a zero error(s) and warning(s) message for the build.

Perhaps it's my error, but header files were not listed in the Project view.

raptorhal2
Lead

Here is another way, if you don't mind a more automated approach.

Create your project with CUBE MX, then in the Project Manager window select MDK-ARM as the Toolchain/IDE, filling in the rest of the window as appropriate. My attempt resulted in a build with no errors or warnings. Perhaps it was my error, but header files were in the project directory, but not listed in the uVision project window.

I had heard about this before. All other methods failed to link correctly, but this one worked. So thank you for reminding me of this idea. I now can't download on ST-Link for some reason, so I will have to enter another question to the ST audience of experts.

raptorhal2
Lead

A standard ST-Link V2 pod downloaded to flash OK for an STM32L562 application. Make sure your pod firmware is the latest.

Edit: This was in SWD mode.

However, uVision Debug would not run to main. It hung on the first startup code line and would not step. It would not run to main until the second click on Run, then it stepped OK and ran OK. But a power cycle still hung on startup. At this point, I don't know if this is an STLink or Keil uVision problem, or some KEIL/ST integration problem.