...
Host Environment: Ubuntu version 18.04
Hardware requirements: - Nitrogen Board
- Micro USB cable
| Image Modified |
---|
Build Zephyr Blinky demo for Nitrogen board:
...
Code Block |
---|
|
# Install west, and make sure ~/.local/bin is on your PATH environment variable:
pip3 install --user -U west
echo 'export PATH=~/.local/bin:"$PATH"' >> ~/.bashrc
source ~/.bashrc
# Get the Zephyr source code:
west init ~/zephyrproject
cd ~/zephyrproject
west update
# Export a Zephyr CMake package. This allows CMake to automatically load boilerplate code # required for building Zephyr applications.
west zephyr-export
# Zephyr's scripts/requirements.txt file declares additional Python dependencies. Install them # with pip3.
pip3 install --user -r ~/zephyrproject/zephyr/scripts/requirements.txt |
Code Block |
---|
|
# Download the latest SDK installer:
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.11.3/zephyr-sdk-0.11.3-setup.run
# Run the installer, installing the SDK in /opt/zephyr-sdk-0.11.3:
chmod +x zephyr-sdk-0.11.3-setup.run
Sudo ./zephyr-sdk-0.11.3-setup.run -- -d /opt/zephyr-sdk-0.11.3 |
Build blinky demo and load it up using GDB via OpenOCD:
Code Block |
---|
|
# Run from the root of the zephyr repository eg: ~/zephyrproject/zephyr
west build -p auto -b 96b_nitrogen samples/basic/blinky
# Connect Nitrogen board to host computer via micro usb cable
# Wait for the MBED folder to mount automatically
# Run OpenOCD from its source folder
./src/openocd -s tcl/ -f interface/cmsis-dap.cfg -c "transport select swd" -f target/nrf52.cfg
# Start gdb and load blinky demo onto Nitrogen board's flash memory
/opt/zephyr-sdk-0.11.3/arm-zephyr-eabi/bin/arm-zephyr-eabi-gdb ~/zephyrproject/zephyr/build/zephyr/zephyr.elf -ex 'target remote :3333' -ex 'monitor halt' -ex 'monitor reset' -ex load |
Expected output of OpenOCD console after successfully connecting with Nitrogen board
Image Added
Expected output of GDB console after successfully loading blinky demo:
At this point you may run x86_64 host GDB and attach to OpenOCD. As a test set a breakpoint at openocd-src/src/target/cortex_m.c:cortex_m_resume and hit resume. This breakpoint will hit one you hit resume on arm-noneabi-gdb which is debugging blinky demo on Nitrogen board.Image Added
References:
- https://docs.zephyrproject.org/latest/getting_started/index.html
- https://docs.zephyrproject.org/latest/boards/arm/96b_nitrogen/doc/index.html
...