STM32 and CMSIS Project Include path not found

Hi,

This is my first post and the first project on platformIO. I have created the STM32 project with the CMSIS framework but I am getting include file not found upon compiling it. I have tried this on an example project as well. I know this is a basic setup configuration, but I would be grateful if someone could suggest. I have attached a screenshot.

Regards
Shahid

You are building your code the wrong way, as I can see by that raw gcc command which tries to generate a binary for your desktop computer, not the for the microcontroller.

You must use the build button in the taskbar or the project task “build” to build the firmware. Not any other method, like clicking on the play button to the right of the filename.

See documentation.

1 Like

I recreated your project exactly and on my Linux system, the stm32f4xx.h file can be found in:

  • $HOME/.platformio/packages/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32F4xx/Include/
  • $HOME/.platformio/packages/framework-cmsis-stm32f4/Include/

It should be found in a similar place on Windows. Sorry, I don’t use Windows so I can’t point you straight at it. :slightly_frowning_face:

However, see the reply above from @maxgerhardt for the reason your compiler is not finding it. I can also recreate your exact error by running my Linux gcc compiler against the source in main.c.

main.cpp:1:10: fatal error: stm32f4xx.h: No such file or directory
    1 | #include <stm32f4xx.h>
      |          ^~~~~~~~~~~~~
compilation terminated.

Cheers,
Norm.

1 Like

Thank you very much. What is the procedure to debug on platformIO? Thanks

See documentation.

1 Like