This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Zephyr ninja flash

I am getting closer to utilizing the Zephyr "toolchain?" within windows 10 environment. It has not been an easy setup and hardly a single exact recipe to set it up exists, however, I am compiling with gnu arm embedded after running cmake and ninja combine to produce a make file. 

I have been back and forth through the Zephyr get started manual and have likely tried many of the commands for setting up windows 10, and I may now have a toolchain that is mutually exclusive, but? 

Looking over the flash errors I have tried the two suggestions logged.

When I run the ninja flash the following error/s arise:

C:\zephyr\zephyr\samples\hello_world\build>ninja flash
[0/1] Flashing nrf52840_mdk
WARNING: ZEPHYR_BASE=C:\zephyr\zephyr\ in the calling environment will be used, but was set to zephyr in west config.
To disable this warning, execute 'west config --global zephyr.base-prefer env'
Using runner: pyocd
Flashing Target Device
Traceback (most recent call last):
File "c:\python\lib\site-packages\pkg_resources\__init__.py", line 581, in _build_master
ws.require(__requires__)
File "c:\python\lib\site-packages\pkg_resources\__init__.py", line 898, in require
needed = self.resolve(parse_requirements(requirements))
File "c:\python\lib\site-packages\pkg_resources\__init__.py", line 789, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (PyYAML 3.13 (c:\python\lib\site-packages), Requirement.parse('pyyaml<5.0,>=4.2b1'), {'pyocd'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Python\Scripts\pyocd-script.py", line 6, in <module>
from pkg_resources import load_entry_point
File "c:\python\lib\site-packages\pkg_resources\__init__.py", line 3126, in <module>
@_call_aside
File "c:\python\lib\site-packages\pkg_resources\__init__.py", line 3110, in _call_aside
f(*args, **kwargs)
File "c:\python\lib\site-packages\pkg_resources\__init__.py", line 3139, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "c:\python\lib\site-packages\pkg_resources\__init__.py", line 583, in _build_master
return cls._build_from_requirements(__requires__)
File "c:\python\lib\site-packages\pkg_resources\__init__.py", line 596, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "c:\python\lib\site-packages\pkg_resources\__init__.py", line 784, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pyyaml<5.0,>=4.2b1' distribution was not found and is required by pyocd
ERROR: command exited with status 1: pyocd flash -e sector -t nrf52 C:/zephyr/zephyr/samples/hello_world/build/zephyr/zephyr.hex
run as "west -v flash --skip-rebuild" for a stack trace
FAILED: zephyr/cmake/flash/CMakeFiles/flash
cmd.exe /C "cd /D C:\zephyr\zephyr\samples\hello_world\build && "C:\Program Files\CMake\bin\cmake.exe" -E env C:/Python/Scripts/west.exe flash --skip-rebuild"
ninja: build stopped: subcommand failed.

C:\zephyr\zephyr\samples\hello_world\build>west config --global zephyr.base-prefer env
WARNING: ZEPHYR_BASE=C:\zephyr\zephyr\ in the calling environment will be used, but was set to zephyr in west config.
To disable this warning, execute 'west config --global zephyr.base-prefer env'

C:\zephyr\zephyr\samples\hello_world\build>

  

  • Hi,

    You need to use -DBOARD=nrf52840_pca10056 if you are building code for the nRF52840 DK, or are using a different development kit with a daplink programmer? 

  • I was not able to follow the instructions and get a working Zephyr toolchain on either the windows or the windows for linux subsystem. However, having done the research I was able to find a good responsive support from the Zephyr channel on Slack. As is often the case I had some misconceptions from the instructions and the toolchain was fickle. After the support from a couple of men we did get my toolchain working consistently.  One such misconception I had is that setting the environment variable and its path was permanent but is only valid for the life of the command line terminal. I took both my set statements and placed them inside a batch file. Now, I cd into the project directory and set both of these.

    cd c:\zephyr\zephyr

    set ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb

    set GNUARMEMB_TOOLCHAIN_PATH=c:\gnu_arm_embedded\7-2018-q2-update

Related