Pio project init fails for custom board

Hi All,
I am trying to initialize a project for a custom board and zephyr. i tried it for Clion and VScode but in both cases i get an error. The custom board works well when building the application using zephyr west tool. I am looking forward for some help. Thanks in advance!
Init result screen dump


Filetree after init.

Platformio.ini after init

platformio board definition

And what variant in Zephyr is the board suppossed to use? Without a zephyr object that has a variant field in the build object of the board JSON file, it will look for a Zephyr board definition named after the filename, aka superconductor in your case. And I don’t see that in zephyr/boards/arm at main · zephyrproject-rtos/zephyr · GitHub.

def get_zephyr_target(board_config):
    return board_config.get("build.zephyr.variant", env.subst("$BOARD").lower())

(from C:\Users\<user>\.platformio\packages\framework-zephyr\scripts\platformio\platformio-build.py)

Since Zephyr doesn’t directly have a board definition for the STM32H743XI (only H735G, H747I, H7B3I), you would have to give it one. Like Enabling PlatformIO and Zephyr on custom hardware | PlatformIO Labs shows.

I will dive into variant setting. This is new to me.
the board is a custom board and i add it only to my local installed zephyr repository.


West build output:

Great, if you have these files, it should be as easy as copying them in the project’s zephyr/boards/arm/SuperConductor folder and reference SuperConductor as the Zephyr variant in the board’s JSON file, like in the blog post.

Thanks again!
I updated the platform board JSON file with a variant setting like in the next image
VariantSetting
I moved my zephyr board files to the project/zephyr directory. Wahu… it now creates a project without errors.
However the command PIO RUN result in the next error.


To make sure it has nothing to do with my custom board, i created a new directory and initialize a new project with a standard nucleo board from ST… PIO RUN gives the same result .

Hm that’s weird. It seems there is a path escaping problem or a confusion as to which tools are used. Eror messages like

‘C:\program’ is not recognized as an internal or external command

Hints at something try to execute a tool like

C:\program files\SomeProgram\Program.exe --param xyz

which is invalid if the path to the program is not quoted in ", it will get cut-off at the first space character.

Does your PlatformIO project live in a path that has spaces in it?

Did you set any global environment variables which may override the compiler or any other tool that Zephyr may use?

Where is the Python interpreter that PlatformIO uses?

In the CLI, what is the output of

pio system info

?


There’s nothing like program.* in the path.
User path settings:
userPath

I will investigate further… to be continued

Aha, but you are using your global python installation in c:\program files\python39\python.exe. Seems like that is “the culprit”, next to the scripts not quoting the path properly.

Can you globally pip uninstall platformio and then the regular installer that will create an isolated python environment within <user dir>/.platformio/penv? See Installer Script (Recommended) — PlatformIO latest documentation.

Thanks, i am up and running. I already had a isolated phyton environment. But also a global installation. I changed the sort order of directories in the path.
I think i have a version difference between native zephyr installation and platformio zephyr.
My native zephyr app has CONFIG_PINCTRL=y This wont link in platformio (undefine or missing xxx during link) . I removed PINCTRL and Added CONFIG_PINUX=y that made it compile and link
Thanks again!

1 Like

Great! I’ll see if I can find the culprit for the missing path quoting in the script and report it…