PlatformIO IDE can't find west

I have a nucleo_f429zi board on which I have compiled, signed, and flashed mcuboot using the default key. I have also compiled, signed, and flashed the hello world zephyr example on it and verified that it loads and runs. This was all done with the plain (non-platformio) Zephyr instructions and the ‘west’ tool.

Now I want to build a basic blinky app within PlatformIO and sign and flash it onto the nucleo_f429zi.

I am using Windows 10 and a clean up-to-date install of VSCode and PlatformIO IDE.

I have used the following prj.conf file:

CONFIG_PRINTK=y
CONFIG_HEAP_MEM_POOL_SIZE=256
CONFIG_ASSERT=y
CONFIG_GPIO=y
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUBOOT_SIGNATURE_KEY_FILE="/key/root-rsa-2048.pem"

Note that /key/… is a valid path to the pem. I copied it there just to rule out path problems.
This is my platformio.ini

[platformio]
default_envs = nucleo_h743zi

[env:nucleo_f429zi]
platform = ststm32
board = nucleo_f429zi
framework = zephyr

Compilation succeeds, but I get an error during signing. The error I receive is:

CMake Error at C:/Users/mcalsyn/.platformio/packages/framework-zephyr/cmake/mcuboot.cmake:31 (message):
  Can't sign images for MCUboot: west not found.  To fix, install west and
  ensure it's on PATH.

I have verified that west.exe is in the system path (‘where west’ returns the expected answer from within VSCode and from a standalone command line)

If I comment out the check for NOT WEST at line 31 in mcuboot.cmake, a similar error occurs when it looks for imgtool, so something is missing or misconfigured.

So, have I missed installing something? Is CMake not finding west and imgtool correctly?

Maybe @valeros has some thoughts on this.

1 Like

Went through getting started on MacOS - same result - west not found, yet it works from the command line.

-- The C compiler identification is GNU 8.2.1
-- The CXX compiler identification is GNU 8.2.1
-- The ASM compiler identification is GNU
-- Found assembler: /Users/mcalsyn/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gcc
-- Configuring incomplete, errors occurred!
See also "/Users/mcalsyn/pd/Tritium/Tritium/runtime/.pio/build/nucleo_f429zi/CMakeFiles/CMakeOutput.log".
See also "/Users/mcalsyn/pd/Tritium/Tritium/runtime/.pio/build/nucleo_f429zi/CMakeFiles/CMakeError.log".

sh: ps: command not found
Error: Could not run sw_vers:
No such file or directory
sh: ps: command not found
Error: Could not run sw_vers:
No such file or directory
sh: ps: command not found
Error: Could not run sw_vers:
No such file or directory
CMake Error at /Users/mcalsyn/.platformio/packages/framework-zephyr/cmake/mcuboot.cmake:31 (message):
  Can't sign images for MCUboot: west not found.  To fix, install west and
  ensure it's on PATH.
Call Stack (most recent call first):
  /Users/mcalsyn/.platformio/packages/framework-zephyr/cmake/mcuboot.cmake:142 (zephyr_mcuboot_tasks)
  /Users/mcalsyn/.platformio/packages/framework-zephyr/CMakeLists.txt:1266 (include)

From terminal in VSCode:

mcalsyn@Martins-Mac-mini runtime % where west
/usr/local/bin/west

Hi @mcalsyn ! Zephyr is compiled in an isolated environment, so you need to make it visible to PlatformIO manually. Just open the terminal in the IDE and run pip install west.

Please keep in mind that we haven’t tested the integration with MCUBOOT, so you’re on your own here.

So how is this supposed to work if you are running “pio” from a terminal?

$ pio west
points to ~/.local/bin/west
$PATH contains /home/pakar/.local/bin

running “pio run” from the same terminal results in:
framework-zephyr/cmake/mcuboot.cmake:31 (message):
Can’t sign images for MCUboot: west not found. To fix, install west and
ensure it’s on PATH.

Even if now pio runs in it’s own isolated environment would is not make sense to inherit whatever is set in $PATH in the executing shell?