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.

1 ACCEPTED SOLUTION

Accepted Solutions
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.

View solution in original post

23 REPLIES 23
raptorhal2
Lead

I must be making some simple, fundamental mistake.

Apparently we both are. If I figure it out first, I will post here. Request you do the same.

KDJEM.1
ST Employee

Hello @DRobe.4​ ,

Please make sure that you are using the “/�? and not the “\�? in the paths.

This discussion can help you to add path with Keil.

Could you please share what errors did you found?

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

DRobe.4
Senior

Here is a sample of the errors... I can send the whole file to you if it helps. The project was previously running successfully for years on a Microchip CPU, but I thought it could be converted easily to STM32... apparently not.

ERNode_G070.c(447): error: use of undeclared identifier 'GPIO_InitStruct'

ERNode_G070.c(433): warning: no previous prototype for function 'USART4_IRQHandler' [-Wmissing-prototypes]..... I guess I need to declare it

ERNode_G070.c(435): error: use of undeclared identifier 'USART4_IRQn'

ERNode_G070.c(413): note: declare 'static' if the function is not intended to be used outside of this translation unit

void USART3_IRQHandler(void)  

ERNode_G070.c(395): error: no member named 'DR' in 'ADC_Common_TypeDef'

    ADC16 = ADC->DR; 

ERNode_G070.c(393): error: no member named 'CR' in 'ADC_Common_TypeDef'

               ADC->CHSELR = 0x80; Delayus(1); ADC->CR = 1; 

ERNode_G070.c(395): error: no member named 'DR' in 'ADC_Common_TypeDef'

               ADC16 = ADC->DR; 

../../STM32Cube/Repository/STM32Cube_FW_G0_V1.6.1/Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_adc.h(4148): error: use of undeclared identifier 'ADC_AWD1TR_HT1'

            ADC_AWD1TR_HT1 | ADC_AWD1TR_LT1,

            ^

../../STM32Cube/Repository/STM32Cube_FW_G0_V1.6.1/Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_adc.h(4148): error: use of undeclared identifier 'ADC_AWD1TR_LT1'

            ADC_AWD1TR_HT1 | ADC_AWD1TR_LT1,

                             ^

../../STM32Cube/Repository/STM32Cube_FW_G0_V1.6.1/Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_adc.h(4223): error: no member named 'AWD1TR' in 'ADC_TypeDef'

 __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->AWD1TR,

KDJEM.1
ST Employee

Hello @DRobe.4​ ,

Could you please share your project and the whole build output file?

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

DRobe.4
Senior

Can you give me a link to send it to.. code is 660 lines including comments.

KDJEM.1
ST Employee

Hi @DRobe.4​ ,

you can add your project in the comment with .zip extension by clicking on this icon (as shown the below figure.


_legacyfs_online_stmicro_images_0693W00000bjDsnQAE.png Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Pavel A.
Evangelist III

Do you have stm32g0xx_hal_conf.h file in your project?

Are the needed modules (GPIO ...) enabled there?

I don't mind sending you, an ST employee, my files, but I would rather not send the whole world my files. If that is a problem for you, I will have to do without your help.

I have a working Microchip 18F47Q84 solution for this code and it did not require all this effort and confusion. I was hoping to improve that solution with a faster CPU, faster ADC, CPU that has a hardware multiplier ... these are the advantages that the STM32G0 gives me...but I can stay with Microchip. The whole project has an STM32F7 for human interface and another Microchip for solar/battery interface. The STM32F7 works well and the 2 Microchip boards work well. I guess I will forsake the improvement. Thanks for your help so far.