PlatformIO Community

Fatal error: zephyr.h: No such file or directory 1 | #include <zephyr.h>

HI
when i run my project in VSC + platformIO i face an error that says:
[Running] cd “/home/mohammad/Documents/PlatformIO/Projects/secondP/src/” && gcc main.c -o main && "/home/mohammad/Documents/PlatformIO/Projects/secondP/src/"main
main.c:1:10: fatal error: zephyr.h: No such file or directory
1 | #include <zephyr.h>
| ^~~~~~~~~~
compilation terminated.

[Done] exited with code=1 in 10.828 seconds

i would be thankfull if anyone help me.

You are using some other extension to build your project, probably with a right-click → Compile this file command? This is not how it works with PlatformIO. Uninstall conflicting C++ extensions, there should only be PlatformIO and C/C++ by Microsoft there. Then follow this tutorial on how to build stuff.

1 Like

tnx I ran ino another error while i was trying to upload the code on a bluepill :slight_smile:

Processing bluepill_f103c8 (platform: ststm32; board: bluepill_f103c8; framework: zephyr)
------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/bluepill_f103c8.html
PLATFORM: ST STM32 (14.1.0) > BluePill F103C8
HARDWARE: STM32F103C8T6 72MHz, 20KB RAM, 64KB Flash
DEBUG: Current (stlink) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES: 
 - framework-zephyr 2.20600.210721 (2.6.0) 
 - tool-cmake 3.16.4 
 - tool-dfuutil 1.9.200310 
 - tool-dtc 1.4.7 
 - tool-gperf 3.0.4 
 - tool-ninja 1.7.1 
 - tool-openocd 2.1100.0 (11.0) 
 - tool-stm32duino 1.0.1 
 - toolchain-gccarmnoneeabi 1.80201.181220 (8.2.1)
Installing `trusted-firmware-m` package...
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Checking size .pio/build/bluepill_f103c8/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  21.6% (used 4419 bytes from 20480 bytes)
Flash: [===       ]  25.2% (used 16514 bytes from 65536 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, dfu, jlink, mbed, stlink
CURRENT: upload_protocol = stlink
Uploading .pio/build/bluepill_f103c8/firmware.elf
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.11.0-00155-ge392e485e (2021-03-15-16:43)
Licensed under GNU GPL v2
For bug reports, read
       
debug_level: 1

hla_swd
none separate

Warn : UNEXPECTED idcode: 0x2ba01477
Error: expected 1 of 1: 0x1ba01477
in procedure 'program'
** OpenOCD init failed **
shutdown command invoked

*** [upload] Error 1
=================== [FAILED] Took 3.75 seconds ===================
The terminal process "platformio 'run', '--target', 'upload'" terminated with exit code: 1.

can you help me?

You have a ‘fake’ bluepill with either a CS32 or GD32 MCU, but not a genuine STM32 one. Does the topic Debugging of STM32F103 clone "BluePill" board, wrong idcode - #2 by manuelbl help?

1 Like

Hi
and tnx for your help .
i have another issue with my project.
how can i code in zephyr with stm32cube?
or maybe its better to ask my question this way how should i include stm32cube in my project zephyr?
tnx alot for your helping