...
...
...
...
...
...
Setup prerequisites and build Zephyr demo app
Install Prerequisites:
Code Block |
---|
sudo apt-get update sudo apt-get upgrade sudo apt-get install git sudo apt install build-essential ncurses-dev doxygen dfu-util device-tree-compiler |
...
Download zephyr-sdk from the link below:
Code Block |
---|
chmod +x zephyr-sdk-<version>-setup.run ./zephyr-sdk-<version>-setup.run |
...
Code Block |
---|
cd <zephyr_root_path> . zephyr-env.sh cd samples/hello_world/ make BOARD=96b_nitrogen |
Flashing, Running and Debugging using pyOCD
Install Prerequisites:
Code Block |
---|
sudo apt-get install python-pip python-dev python-yaml minicom gdb-arm-none-eabi sudo -H pip install --upgrade pip sudo -H pip install --pre -U pyocd |
...
Code Block |
---|
sudo pyocd-gdbserver arm-none-eabi-gdb outdir/96b_nitrogen/zephyr.elf target remote localhost:3333 |
Flashing, Running and Debugging using openOCD
Build OpenOCD:
Follow Getting started with OpenOCD Development to build openOCD from sources.
Spawn openOCD connection to Nitrogen Board:
Code Block |
---|
/src/openocd -s tcl/ -f interface/cmsis-dap.cfg -c "transport select swd" -f target/nrf52.cf arm-none-eabi-gdb outdir/96b_nitrogen/zephyr.elf target remote localhost:3333 target remote localhost:3333 |
Adding udev rule:
At this point you might be able to use OpenOCD without any issue. However, chances are that you will face with this error message when you try to use OpenOCD on the terminal.
...
Code Block |
---|
pip install --pre -U git+https://github.com/mbedmicro/pyOCD.git#egg=pyOCD |
Common Errors:
Info | ||
---|---|---|
| ||
If you don’t use sudo when invoking pyocd-flashtool, you might get any of these errors |
...
Info | ||
---|---|---|
| ||
echo 'ATTR{idProduct}=="0204", ATTR{idVendor}=="0d28", MODE="0666", GROUP="plugdev"' > /etc/udev/rules.d/50-cmsis-dap.rules |
Flashing an Application to 96Boards Nitrogen:
This example uses the Hello World sample with the pyOCD tools. Use the make flash build target to build your Zephyr application, invoke the pyOCD flash tool and program your Zephyr application to flash.
Code Block |
---|
cd <zephyr_root_path> . zephyr-env.sh cd samples/hello_world/ make BOARD=96b_nitrogen |
References:
- https://www.zephyrproject.org/doc/getting_started/getting_started.html
- https://wiki.zephyrproject.org/view/96B-Nitrogen#Debugging_with_GDB
- https://www.hashdefineelectronics.com/compiling-and-installing-openocd-with-cmcsis-dap-support/
- http://openocd.zylin.com/#/c/3511/
- https://patch-diff.githubusercontent.com/raw/mbedmicro/pyOCD/pull/196.diff
- https://github.com/mbedmicro/pyOCD/pull/196
- https://www.zephyrproject.org/doc/getting_started/getting_started.html
- https://www.96boards.org/documentation/IoTEdition/nitrogen/getting-started/
- http://openocd.org/doc/doxygen/html/patchguide.html#stepbystep