PlatformIO Community

Zephyr out-of-tree driver doesn't get compiled


I am trying to build a custom device driver for eeprom m2402m with zephyr framework. I followed the instruction described here and here

So in my zephyr directory inside the root platformio project looks like this:

___ zephyr

In the root zephyr CMakeLists.txt I’ve added the drivers path above to the ZEPHYR_EXTRA_MODULES. When running the build, zephyr didn’t complain and seemed to understand that I put a custom module there. But when platformio compiling, it stopped and gave me error:

*** [.pio/build/solemetrix_dwm1001/…solemetrix-repo__gms-firmware__zephyr__drivers__m24m02__zephyr/modules/m24m02/m24m02.c.o] Source src/drivers/m24m02/zephyr/m24m02.c' not found, needed by target .pio/build/solemetrix_dwm1001/……__…__solemetrix-repo__gms-firmware__zephyr__drivers__m24m02__zephyr/modules/m24m02/m24m02.c.o’.

I replicated the the project structure and managed to compile it using west build. Please kindly advise to get it working in platformio.


I resolved this issue by putting the module directory outside zephyr. So I moved the drivers directory in the above post to one level back ( … ), same level with the zephyr directory.