diff --git a/documentation/source/quick-start/nitrogen-96-board.rst b/documentation/source/quick-start/nitrogen-96-board.rst index be7daa5adb12fe64c5e6166690c303e34e56d612..1055595a1a308941faa487e929ca5252db17fa7a 100644 --- a/documentation/source/quick-start/nitrogen-96-board.rst +++ b/documentation/source/quick-start/nitrogen-96-board.rst @@ -7,86 +7,31 @@ Nitrogen is a 96Boards compliant IoT Edition board which aims to provide economi Figure 1 Nitrogen 96 Board -Addition information -******************** - -+-------------+--------------------------------------------+ -| Component | Description | -| | | -+=============+============================================+ -| SoC | nRF52832 microcontroller | -| | | -+-------------+--------------------------------------------+ -| CPU | Cortex-M4 | -| | | -+-------------+--------------------------------------------+ -| Clock speed | 64MHz | -| | | -+-------------+--------------------------------------------+ -| RAM | 64MHz | -| | | -+-------------+--------------------------------------------+ -| Storage | 512KB onboard Flash | -| | | -+-------------+--------------------------------------------+ -| Battery | Onboard battery connector and charger | -| | | -+-------------+--------------------------------------------+ -| Debugger | LPC11U35 on board SWD debugger | -| | | -+-------------+--------------------------------------------+ -| Wireless | nRF51832 Bluetooth ® wireless | -| | technology with BLE power consumption | -| | measurement | -+-------------+--------------------------------------------+ -| Connectors | SWD debug, nRF52832 SWD, | -| | nRF52832 UART | -+-------------+--------------------------------------------+ -| Expansion | 40 Pin Low-speed expansion | -| Interface | | -+-------------+--------------------------------------------+ -| Digital | 1.8V | -| Output (V) | | -+-------------+--------------------------------------------+ -| Analog | 0V - 1.8V | -| Input (V) | | -+-------------+--------------------------------------------+ -| Antenna | Onboard chip antenna | -| | | -+-------------+--------------------------------------------+ -| Power | USB power supply with | -| Source | fuse protect | -+-------------+--------------------------------------------+ -| OS Support | Zephyr | -| | | -+-------------+--------------------------------------------+ -| Size | 60x30mm | -| | | -+-------------+--------------------------------------------+ - For more details on Nitrogen 96 board, refer https://www.96boards.org/documentation/iot/nitrogen/. -Flashing Zephyr onto 96Boards Nitrogen -************************************** +Installing pyOCD +**************** -The 96Boards Nitrogen board can be flashed via the `CMSIS DAP interface <https://os.mbed.com/handbook/CMSIS-DAP>`_, which is provided by the micro USB interface to the LPC11U35 chip. +pyOCD is an open source Python package for programming and debugging Arm Cortex-M microcontrollers using multiple supported types of USB debug probes. It is fully cross-platform, with support for Linux, macOS, and Windows. -Using the CMSIS-DAP interface, the board can be flashed via the USB storage interface (drag-and-drop) and also via `pyOCD <https://github.com/pyocd/pyOCD>`_. +The latest stable version of pyOCD can be installed via `pip <https://pip.pypa.io/en/stable/>`_ as follows: -Installing pyOCD -================ +.. code-block:: console + + pip install --pre -U pyocd -The latest stable version of pyOCD can be installed via pip as follows: +TTo install the latest prerelease version from the HEAD of the master branch, you can do the following: .. code-block:: console - pip install --pre -U pyocd + pip install --pre -U git+https://github.com/mbedmicro/pyOCD.git + -To install the latest development version (master branch), do the following: +You can also install directly from the source by cloning the git repository and running: .. code-block:: console - pip install --pre -U git+https://github.com/mbedmicro/pyOCD.git#egg=pyOCD + python setup.py install You can then verify that your board is detected by pyOCD by running: @@ -94,71 +39,110 @@ You can then verify that your board is detected by pyOCD by running: pyocd-flashtool -l -Common Errors -************* -No connected boards -=================== +Common errors in pyOCD +====================== -If you don’t use sudo when invoking pyocd-flashtool, you might get any of the following errors: +* If you do not use sudo when invoking pyocd-flashtool, you might get any of the following errors: .. code-block:: console No available boards are connected No connected boards - Error: There is no board connected. + Error: There is no board connected +* Lack of permission gets reported as ValueError (The device has no langid), perform the instructions as suggested in + https://github.com/pyocd/pyOCD/tree/master/udev. -To fix the permission issue, simply add the following udev rule for the NXP LPC1768 interface: +Flashing an Application to 96Boards Nitrogen +******************************************** -.. code-block:: console +The 96Boards Nitrogen board can be flashed via the CMSIS DAP interface. CMSIS-DAP provides a standardized way to access the Coresight Debug Access Port (DAP) of an ARM Cortex microcontroller via USB. - echo 'ATTR{idProduct}=="0204", ATTR{idVendor}=="0d28", MODE="0666", GROUP="plugdev"' > /etc/udev/rules.d/50-cmsis-dap.rules +Using the CMSIS-DAP interface, the board can be flashed via the USB storage interface (drag-and-drop) and also via pyOCD. -Finally, unplug and plug the board again. +For flashing an application to board **pyocd** must be installed in your system. You can flash Zephyr samples to 96b-nitrogen boards. -ValueError: The device has no langid -==================================== +To flash the example you built with command e.g. -As described by `pyOCD issue 259 <https://github.com/pyocd/pyOCD/issues/259>`_, you might get the **ValueError: The device has no langid** error when not running pyOCD as root (e.g. sudo). +.. code-block:: console + + 96b-nitrogen bitbake zephyr-philosophers + +Call similar command with explicit flash usb command: + +.. code-block:: console -To fix the above error, add the udev rule shown in the previous section and install a more recent version of pyOCD. + 96b-nitrogen bitbake zephyr-philosophers -c flash_usb Building an Application to 96Boards Nitrogen ******************************************** -Here is an example for the `Hello World application <https://docs.zephyrproject.org/latest/samples/hello_world/README.html#hello-world>`_. -This requires installing the `pyOCD Debug Host Tools <https://docs.zephyrproject.org/latest/guides/flash_debug/host-tools.html#pyocd-debug-host-tools>`_. +OpenHarmony can be hosted on top of variety of kernels. Currently supported kernels (a.k.a. OHOS flavours) are Linux, Zephyr and FreeRTOS (experimental). + +To build OHOS flavour issue following commands: .. code-block:: console - From the root of the zephyr repository - west build -b 96b_nitrogen samples/hello_world - west flash + $ TEMPLATECONF=../sources/meta-ohos/flavours/<lower_case_flavour> . ./sources/poky/oe-init-build-env build-<flavour>-<target_machine> + $ bitbake <image-name> -Run your favorite terminal program to listen for output. +MACHINE variable can be set up in conf/local.conf file under build directory or via command line, e.g.: .. code-block:: console - minicom -D <tty_device> -b 115200 + $ MACHINE=<target_machine> bitbake <image-name> + +OHOS Zephyr flavour is based on zephyr distribution and supports following images/machines: -Replace **<tty_device>** with the port where the board 96Boards Nitrogen can be found. For example, under Linux, **/dev/ttyACM0**. The **-b** option sets baud rate ignoring the value from config. +* Supported images: + * zephyr-philosophers -Press the Reset button and you should see the the following message in your terminal: +* Supported machines: + * qemu-cortex-m3 + * qemu-x86 (default) + +Example +======= .. code-block:: console - Hello World! arm + $ TEMPLATECONF=../sources/meta-ohos/flavours/zephyr . ./sources/poky/oe-init-build-env build-ohos-zephyr-qemu-x86 + $ bitbake zephyr-philosophers -Debugging with GDB -****************** +You can test the image built for the qemu-x86 target by issuing: -You can debug an application in the usual way. Here is an example for the Hello World application. This also requires pyOCD. +.. code-block:: console + + $ DEPLOY_DIR_IMAGE=tmp-newlib/deploy/images/qemu-x86 runqemu qemu-x86 + +After successful bootup, you should see following: .. code-block:: console - From the root of the zephyr repository - west build -b 96b_nitrogen samples/hello_world - west debug + Booting from ROM..*** Booting Zephyr OS build zephyr-v2.4.0 *** + Philosopher 0 [P: 3] THINKING [ 300 ms ] + Philosopher 1 [P: 2] EATING [ 575 ms ] + Philosopher 2 [P: 1] STARVING + Philosopher 3 [P: 0] EATING [ 525 ms ] + Philosopher 4 [C: -1] THINKING [ 475 ms ] + +To exit qemu, use key combination: + +.. code-block:: console + + Ctrl-a followed by 'x' + + + + + + + + + + + +