cancel
Showing results for 
Search instead for 
Did you mean: 

Couldn't compile Stm32 project

ronk123
Visitor

I am trying to compile a STM32 project with my own code structure. I have not changed the structure created by the IDE when creating the project and have added my .c and .h files in the Src and Inc folders in Core directory. But I am getting an error where the compiler is not able to find the include paths. I am attaching the error and screenshots for your reference. I have added the include paths in project settings. Is there something that I am missing?

ronk123_0-1732009629708.png

ronk123_2-1732009911071.png

 

6 REPLIES 6
SofLit
ST Employee

Hello @ronk123 and welcome to the community,

It's an issue related to the path. Is that possible to share your project? if you don't want to share it in public send it in private.

Thank you.

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.

Sure, I am attaching a .zip file of the project

Andrew Neil
Evangelist III

@ronk123 wrote:

But I am getting an error where the compiler is not able to find the include paths. 


What error, exactly, are you getting?

Please copy the full build output from the 'Console' window, and post here as text.

 


@ronk123 wrote:

 I have added the include paths in project settings. Is there something that I am missing?

ronk123_2-1732009911071.png


So do those paths cover every include file in you project?

Yes, those are all the include paths in my project. I have attached a txt file which has the console output


@ronk123 wrote:

Yes, those are all the include paths in my project. I have attached a txt file which has the console output


Thanks - so these are the actual errors:

<command-line>: fatal error: ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy: No such file or directory
compilation terminated.
<command-line>: fatal error: ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy: No such file or directory
compilation terminated.
<command-line>: fatal error: ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy: No such file or directory
compilation terminated.
<command-line>: fatal error: ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy: No such file or directory
compilation terminated.
make: *** [Drivers/STM32F4xx_HAL_Driver/Src/subdir.mk:64: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o] Error 1
make: *** Waiting for unfinished jobs....
<command-line>: fatal error: ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy: No such file or directory
compilation terminated.
make: *** [Drivers/STM32F4xx_HAL_Driver/Src/subdir.mk:64: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.o] Error 1
<command-line>: fatal error: ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy: No such file or directory
compilation terminated.
<command-line>: fatal error: ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy: No such file or directory
compilation terminated.
<command-line>: fatal error: ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy: No such file or directory
compilation terminated.

They are, in fact, all the same error - they all refer to just one folder, ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy

Note that this is specified as a relative path.

The trouble with relative paths is that they only work when you start from the right place...

Hello,

I don't know how did you land on this error and why you modified the include paths as there is no new path generated from CubeMx.

I've regenerated your project based on your ioc file and added uart.c file to the project, did a litte modification in main and it's compiling fine. (attached).

Removed Sys_init.c from the compilation as I don't think it will be usable. system clock is already generated automatically in main.c

Hope it helps.

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.