2020-09-04 23:00:59 +02:00
|
|
|
.. include:: /substitutions.rst
|
|
|
|
.. _running:
|
|
|
|
|
2020-09-11 23:55:50 +02:00
|
|
|
=======
|
2020-09-04 23:00:59 +02:00
|
|
|
Running
|
|
|
|
=======
|
|
|
|
|
2020-09-11 23:55:50 +02:00
|
|
|
In order to finally run NuttX on your board, you first have to flash the NuttX
|
|
|
|
binary. As an easy start, it is recommended that you choose a well supported board
|
|
|
|
which also integrates the debugger/programmer in the board itself exposed via USB
|
|
|
|
connector.
|
|
|
|
|
|
|
|
A good choice is a Nucleo or Discovery board from ST Microelectronics,
|
|
|
|
as there is a wide choice of suported boards for the STM32 architecture in NuttX.
|
|
|
|
Also, these boards expose an UART port over the USB connection which allows you
|
|
|
|
to interact with NuttX via the interactive console without any extra hardware.
|
|
|
|
For the purposes of this guide, we will use the Nucleo F103RB board.
|
|
|
|
|
|
|
|
Flashing
|
|
|
|
========
|
|
|
|
|
|
|
|
There are various tools you can use to flash the NuttX binary to your Nucleo
|
2020-12-06 03:24:34 +01:00
|
|
|
board. One common option is to use ``openocd`` which supports a large number
|
2020-10-18 18:48:44 +02:00
|
|
|
of programmers and target microcontrollers.
|
2020-09-11 23:55:50 +02:00
|
|
|
|
2020-12-06 03:24:34 +01:00
|
|
|
You should note that ``openocd`` project has not made stable releases for long
|
|
|
|
time and support for newer hardware will probably be only available in the
|
|
|
|
latest Git version, so it is actually recommended to install latest development
|
|
|
|
version.
|
2020-09-11 23:55:50 +02:00
|
|
|
|
2020-12-06 03:24:34 +01:00
|
|
|
.. tabs::
|
2020-09-11 23:55:50 +02:00
|
|
|
|
2020-12-06 03:24:34 +01:00
|
|
|
.. code-tab:: console Install stable version (Ubuntu)
|
2020-10-18 18:48:44 +02:00
|
|
|
|
2020-12-06 03:24:34 +01:00
|
|
|
$ apt install openocd
|
2020-09-11 23:55:50 +02:00
|
|
|
|
2020-12-06 03:24:34 +01:00
|
|
|
.. tab:: Install latest version from source
|
2020-09-11 23:55:50 +02:00
|
|
|
|
2020-12-06 03:24:34 +01:00
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ git clone git://git.code.sf.net/p/openocd/code openocd
|
|
|
|
$ cd openocd
|
|
|
|
$ ./bootstrap
|
|
|
|
$ ./configure --prefix=install/
|
|
|
|
$ make install
|
2020-09-11 23:55:50 +02:00
|
|
|
|
2020-12-06 03:24:34 +01:00
|
|
|
The resulting installation will be under ``openocd/install``. You can add
|
|
|
|
``openocd/install/bin`` to your ``PATH``.
|
|
|
|
|
2020-09-11 23:55:50 +02:00
|
|
|
Now, to flash the binary to your board, connect the USB cable and do:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ cd nuttx/
|
|
|
|
$ openocd -f interface/st-link-v2.cfg -f target/stm32f1x.cfg -c 'init' \
|
|
|
|
-c 'program nuttx/nuttx.bin verify reset' -c 'shutdown'
|
2020-10-18 18:48:44 +02:00
|
|
|
|
2020-09-11 23:55:50 +02:00
|
|
|
Access NuttShell
|
|
|
|
================
|
|
|
|
|
|
|
|
Once you flash your board, it will reset and offer a prompt over the serial
|
|
|
|
console. With the Nucleo board, you can simply open the terminal program
|
2020-12-06 03:24:34 +01:00
|
|
|
of your choice where you will see the ``nsh>`` prompt (press :kbd:`enter`
|
|
|
|
if you don't see anything):
|
2020-09-11 23:55:50 +02:00
|
|
|
|
|
|
|
.. tabs::
|
|
|
|
|
|
|
|
.. code-tab:: console picocom (CLI)
|
2020-10-18 18:48:44 +02:00
|
|
|
|
2020-09-11 23:55:50 +02:00
|
|
|
$ picocom -b 115200 /dev/ttyUSB0
|
2020-10-18 18:48:44 +02:00
|
|
|
|
2020-09-11 23:55:50 +02:00
|
|
|
.. code-tab:: console gtkterm (GUI)
|
2020-10-18 18:48:44 +02:00
|
|
|
|
2020-09-11 23:55:50 +02:00
|
|
|
$ gtkterm -s 115200 -p /dev/ttyUSB0
|
2020-12-06 03:24:34 +01:00
|
|
|
|
|
|
|
.. tip::
|
|
|
|
|
|
|
|
You may have to add yourself to the ``dialout`` group on Linux to have permission
|
|
|
|
to access serial ports:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ gpasswd -a <user> dialout
|
|
|
|
|
|
|
|
Where ``<user>`` is your username. You will need to log out from your desktop
|
|
|
|
for the change to have effect.
|