2016-01-27 09:09:55 -08:00
|
|
|
.. _arduino_101:
|
|
|
|
|
2016-02-09 08:21:58 -05:00
|
|
|
Arduino 101
|
|
|
|
###########
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
Overview
|
|
|
|
********
|
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
The Arduino 101 board is an Arduino product with an Intel Quark SE
|
|
|
|
processor. Zephyr can be flashed to an Arduino 101 for experimentation
|
|
|
|
and testing purposes; keep in mind this is configuration is unsupported
|
|
|
|
by Arduino.
|
|
|
|
|
|
|
|
The Quark SE contains both an ARC and an X86 core, so be sure to
|
|
|
|
flash an ARC and an X86 image if you wish to use both. Either **arduino_101**
|
|
|
|
(for x86) or **arduino_101_sss** (for ARC) board configurations work to build
|
|
|
|
a Zephyr Kernel that can be flashed to and run on the Arduino 101 platform.
|
|
|
|
The default configuration for Arduino 101 boards can be found in
|
2016-02-01 23:10:14 -05:00
|
|
|
:file:`boards/arduino_101/arduino_101_defconfig` for the X86 and
|
2016-02-09 08:21:58 -05:00
|
|
|
:file:`boards/arduino_101_sss/arduino_101_sss_defconfig` for the ARC.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
Board Layout
|
|
|
|
************
|
|
|
|
|
|
|
|
General information for the board can be found at the `Arduino website`_,
|
2016-02-16 11:03:08 -08:00
|
|
|
which also includes `schematics`_ and BRD files.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
Supported Features
|
|
|
|
******************
|
|
|
|
|
|
|
|
The Zephyr kernel supports multiple hardware features on the Arduino 101
|
2016-02-16 11:03:08 -08:00
|
|
|
through the use of drivers. Some drivers are functional on the x86 side only,
|
|
|
|
some on the ARC side only, and a few are functional on both sides. The table
|
|
|
|
below shows which drivers and functionality can be found on which architectures:
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
+-----------+------------+-----+-----+-----------------------+
|
|
|
|
| Interface | Controller | ARC | x86 | Driver/Component |
|
|
|
|
+===========+============+=====+=====+=======================+
|
2016-02-13 11:12:56 -05:00
|
|
|
| APIC | on-chip | N | Y | interrupt_controller |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-----------+------------+-----+-----+-----------------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| UART | on-chip | N | Y | serial port-polling; |
|
2016-01-27 09:09:55 -08:00
|
|
|
| | | | | serial port-interrupt |
|
|
|
|
+-----------+------------+-----+-----+-----------------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| SPI | on-chip | Y | Y | spi |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-----------+------------+-----+-----+-----------------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| ADC | on-chip | Y | N | adc |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-----------+------------+-----+-----+-----------------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| I2C | on-chip | Y | Y | i2c |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-----------+------------+-----+-----+-----------------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| GPIO | on-chip | Y | Y | gpio |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-----------+------------+-----+-----+-----------------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| PWM | on-chip | Y | Y | pwm |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-----------+------------+-----+-----+-----------------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| mailbox | on-chip | Y | Y | ipm |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-----------+------------+-----+-----+-----------------------+
|
|
|
|
|
|
|
|
Flashing Arduino 101 for Zephyr
|
|
|
|
*******************************
|
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
The sample hello_world application used in this tutorial can be
|
|
|
|
found in :file:`$ZEPHYR_BASE/samples/hello_world/nanokernel`.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
To boot an image on a Arduino 101 board, follow the steps in this
|
|
|
|
section:
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
.. contents:: Procedures
|
|
|
|
:depth: 1
|
|
|
|
:local:
|
|
|
|
:backlinks: entry
|
|
|
|
|
|
|
|
Required Hardware and Software
|
|
|
|
==============================
|
|
|
|
|
|
|
|
Before flashing the Zephyr kernel onto an Arduino 101, a few additional
|
|
|
|
pieces of hardware are required.
|
|
|
|
|
|
|
|
* `FlySwatter2 JTAG debugger`_
|
|
|
|
|
|
|
|
* ARM Micro JTAG Connector, Model: `ARM-JTAG-20-10`_
|
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
* The USB port for power will work; however, we recommend the 7V-12V barrel
|
|
|
|
connector be used when working with the JTAG connector.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
* :ref:`The Zephyr SDK <zephyr_sdk>`
|
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
* If you wish to grab any data off the serial port, you will need a TTY-to-USB
|
|
|
|
adaptor. Two kinds the Zephyr team has tested and found to work are listed
|
|
|
|
here. Both require male-to-male jumper cables in order to connect to the
|
|
|
|
Arduino 101 board.
|
2016-02-03 11:38:13 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
#. `USB to TTL Serial Cable`_
|
2016-02-03 11:38:13 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
#. FTDI USB to TTL Serial Part #TTL-232R-3V3
|
2016-02-03 11:38:13 -08:00
|
|
|
http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm
|
|
|
|
|
2016-01-27 09:09:55 -08:00
|
|
|
Connecting JTAG to Arduino 101
|
|
|
|
==============================
|
|
|
|
|
|
|
|
#. Connect the ARM Micro JTAG Connector to the FlySwatter2.
|
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
#. Locate the micro JTAG connector on the Arduino 101 board. It is
|
|
|
|
adjacent to the SCL and SDA pins in the Arduino headers, highlighted
|
2016-02-03 15:48:59 -08:00
|
|
|
as the red square in the figure below.
|
|
|
|
|
|
|
|
.. figure:: figures/arduino_101_01.png
|
|
|
|
:scale: 50 %
|
|
|
|
:alt: Highlight of the JTAG connector.
|
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
#. Beside the micro JTAG header is a small white dot indicating the
|
2016-02-17 11:15:43 -08:00
|
|
|
location of pin 1 on the header. The orange arrow on the figure points to
|
2016-02-03 15:48:59 -08:00
|
|
|
the dot.
|
|
|
|
|
|
|
|
.. figure:: figures/arduino_101_02.png
|
|
|
|
:scale: 50 %
|
2016-02-17 11:15:43 -08:00
|
|
|
:alt: Pointer to the pin 1 of the JTAG connector.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
#. Connect the FlySwatter2 to the Arduino 101 micro JTAG connector.
|
|
|
|
|
2016-02-17 11:15:43 -08:00
|
|
|
#. Ensure that both the cable and header pin 1 locations line up. The cable
|
2016-01-27 09:09:55 -08:00
|
|
|
from the ARM Micro JTAG connector uses a red wire on the cable to denote
|
2016-02-17 11:15:43 -08:00
|
|
|
which end on the cable has the pin 1.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
#. Plug the USB Type B cable into the FlySwatter2 and your computer. On
|
|
|
|
Linux, you should see something similar to the following in your dmesg:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
usb 1-2.1.1: new high-speed USB device number 13 using xhci_hcd
|
|
|
|
usb 1-2.1.1: New USB device found, idVendor=0403, idProduct=6010
|
|
|
|
usb 1-2.1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
|
|
|
|
usb 1-2.1.1: Product: Flyswatter2
|
|
|
|
usb 1-2.1.1: Manufacturer: TinCanTools
|
|
|
|
usb 1-2.1.1: SerialNumber: FS20000
|
|
|
|
ftdi_sio 1-2.1.1:1.0: FTDI USB Serial Device converter detected
|
|
|
|
usb 1-2.1.1: Detected FT2232H
|
|
|
|
usb 1-2.1.1: FTDI USB Serial Device converter now attached to ttyUSB0
|
|
|
|
ftdi_sio 1-2.1.1:1.1: FTDI USB Serial Device converter detected
|
|
|
|
usb 1-2.1.1: Detected FT2232H
|
|
|
|
usb 1-2.1.1: FTDI USB Serial Device converter now attached to ttyUSB1
|
|
|
|
|
2016-02-03 15:48:59 -08:00
|
|
|
|
|
|
|
|
2016-01-27 09:09:55 -08:00
|
|
|
Making a Backup
|
|
|
|
===============
|
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
Before continuing, consider creating a backup image of the ROM device as
|
|
|
|
it stands today. This would be necessary if you wanted to run Arduino sketches
|
|
|
|
on the hardware again, as the Arduino IDE requires updating via a USB flashing
|
|
|
|
method that is not currently supported by Zephyr.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
Typically Arduino hardware can re-program the Bootloader by connecting
|
2016-02-02 16:54:23 -08:00
|
|
|
the ICSP header and issuing the "Burn Bootloader" option from the Arduino
|
2016-02-16 11:03:08 -08:00
|
|
|
IDE. On the Arduino 101, this option is not currently functional.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
#. Confirm the Zephyr SDK has been installed on your platform.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
#. Open a terminal window.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 16:12:47 -08:00
|
|
|
#. Verify the JTAG debugger is properly attached to the Arduino 101 board and
|
|
|
|
to the host computer.
|
|
|
|
|
|
|
|
#. Connect the Arduino 101 to a power source.
|
|
|
|
|
|
|
|
#. Open a terminal window
|
|
|
|
|
2016-02-02 16:54:23 -08:00
|
|
|
#. Source the :file:`zephyr-env.sh` file.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-03 15:48:58 -08:00
|
|
|
#. Change directories to :file:`$ZEPHYR_BASE`.
|
2016-02-02 16:54:23 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
#. In the terminal window, enter:
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-03 15:48:58 -08:00
|
|
|
.. code-block:: console
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-03 15:48:58 -08:00
|
|
|
$ sudo -E ./boards/arduino_101/support/arduino_101_backup.sh
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-03 15:48:58 -08:00
|
|
|
.. note::
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
This command tells the JTAG to dump two files in your :file:`$ZEPHYR_BASE`:
|
|
|
|
directory: :file:`A101_BOOT.bin` and :file:`A101_OS.bin`. These contain copies
|
|
|
|
of the original flash, which can be used to restore the state of the board to
|
|
|
|
factory conditions.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
Done! You have finished creating a backup for the Arduino 101.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-02 16:54:23 -08:00
|
|
|
Restoring a Backup
|
|
|
|
==================
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
#. Confirm the Zephyr SDK has been installed on your development
|
2016-02-02 16:54:23 -08:00
|
|
|
environment.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
#. Open a terminal window.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 16:12:47 -08:00
|
|
|
#. Verify the JTAG debugger is properly attached to the Arduino 101 board and
|
|
|
|
to the host computer.
|
|
|
|
|
|
|
|
#. Connect the Arduino 101 to a power source.
|
|
|
|
|
|
|
|
#. Open a terminal window
|
|
|
|
|
2016-02-02 16:54:23 -08:00
|
|
|
#. Source the :file:`zephyr-env.sh` file.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
#. Change directories to :file:`$ZEPHYR_BASE`.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
#. In the terminal window, enter:
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-03 15:48:58 -08:00
|
|
|
.. code-block:: console
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-03 15:48:59 -08:00
|
|
|
$ sudo -E ./boards/arduino_101/support/arduino_101_load.sh
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-03 15:48:58 -08:00
|
|
|
.. note::
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
This script expects two files in your :file:`$ZEPHYR_BASE` directory
|
|
|
|
named :file:`A101_OS.bin` and :file:`A101_BOOT.bin`.
|
2016-02-02 16:54:23 -08:00
|
|
|
|
|
|
|
Flashing an Application to Arduino 101
|
|
|
|
======================================
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
By default, the Arduino 101 comes with an X86 and ARC image ready to run. Both
|
|
|
|
images can be replaced by Zephyr OS image by following the steps below. When
|
|
|
|
only the X86 image is needed or wanted, it is important to disable the ARC
|
|
|
|
processor; the X86 OS will appear to hang waiting for the ARC processor.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
Details on how to disable the ARC can be found in the `Debugging on Arduino 101`_
|
2016-02-02 16:54:23 -08:00
|
|
|
section.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
Flashing the ROM
|
|
|
|
================
|
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
The default boot ROM used by the Arduino 101 requires that any binary
|
|
|
|
be authorized. Currently the Zephyr project is not supported by this ROM. To
|
2016-01-27 09:09:55 -08:00
|
|
|
work around this requirement, an alternative boot ROM has been created that
|
2016-02-16 11:03:08 -08:00
|
|
|
needs to be flashed just once. To flash a Zephyr-compatible boot ROM, use
|
|
|
|
:command:`zflash` to flash the :file:`quark_se_rom.bin` to the board.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
.. note::
|
2016-02-16 11:03:08 -08:00
|
|
|
|
|
|
|
This will cause the Arduino 101 board to lose Arduino sketch functionality
|
|
|
|
and it will no longer work with the Arduino IDE.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-02 16:54:23 -08:00
|
|
|
#. Source the :file:`zephyr-env.sh` file.
|
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
#. Change directories to :file:`$ZEPHYR_BASE`.
|
2016-02-02 16:54:23 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
#. The Zephyr Project includes a pre-compiled version of a bootloader for
|
|
|
|
general use on the Arduino 101. Details for how to build your own
|
2016-02-02 16:54:23 -08:00
|
|
|
bootloader can be found in the
|
|
|
|
:file:`$ZEPHYR_BASE/boards/arduino_101/support/README`
|
|
|
|
|
2016-02-16 16:12:47 -08:00
|
|
|
#. Verify the JTAG debugger is properly attached to the Arduino 101 board and
|
|
|
|
to the host computer.
|
|
|
|
|
|
|
|
#. Connect the Arduino 101 to a power source.
|
|
|
|
|
|
|
|
#. The Zephyr Project has included a pre-compiled version of a bootloader for
|
|
|
|
general use on the Arduino 101. Details about how to build your own
|
|
|
|
|
2016-01-27 09:09:55 -08:00
|
|
|
.. code-block:: console
|
|
|
|
|
2016-02-12 07:22:28 -08:00
|
|
|
$ cd $ZEPHYR_BASE/boards/arduino_101/support
|
|
|
|
$ sudo -E ./arduino_101_load.sh rom
|
2016-02-02 16:54:23 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
This script will flash the boot ROM located in
|
2016-02-02 16:54:23 -08:00
|
|
|
:file:`$ZEPHYR_BASE/boards/arduino_101/support/quark_se_rom.bin` to the
|
|
|
|
Arduino 101 device, overwriting the original shipping ROM.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
Flashing an ARC Kernel
|
|
|
|
======================
|
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
#. Make sure the binary image has been built. Change directories to your local
|
2016-02-13 11:12:56 -05:00
|
|
|
checkout copy of Zephyr, and run:
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
2016-02-13 11:12:56 -05:00
|
|
|
$ source ./zephyr-env.sh
|
|
|
|
$ cd $ZEPHYR_BASE/samples/hello_world/nanokernel
|
|
|
|
$ make pristine && make BOARD=arduino_101_sss ARCH=arc
|
2016-02-12 16:54:07 -08:00
|
|
|
|
2016-02-16 16:12:47 -08:00
|
|
|
#. Verify the JTAG debugger is properly attached to the Arduino 101 board.
|
|
|
|
|
|
|
|
#. Verify the Arduino 101 has power.
|
|
|
|
|
2016-02-13 11:12:56 -05:00
|
|
|
#. Once the image has been built, flash it with:
|
2016-02-12 16:54:07 -08:00
|
|
|
|
2016-02-13 11:12:56 -05:00
|
|
|
.. code-block:: console
|
2016-02-12 16:54:07 -08:00
|
|
|
|
2016-02-03 15:48:58 -08:00
|
|
|
$ make BOARD=arduino_101_sss flash
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
When building for the ARC processor, the board type is listed as
|
2016-02-02 16:54:23 -08:00
|
|
|
arduino_101_sss and the ARCH type is set to arc.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
Congratulations, you have now flashed the hello_world image to the ARC
|
2016-01-27 09:09:55 -08:00
|
|
|
processor.
|
|
|
|
|
|
|
|
Flashing an x86 Kernel
|
|
|
|
======================
|
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
#. Make sure the binary image has been built. Change directories to your local
|
2016-02-13 11:12:56 -05:00
|
|
|
checkout copy of Zephyr, and run:
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
2016-02-02 16:54:23 -08:00
|
|
|
$ source ./zephyr-env.sh
|
2016-02-09 19:47:18 -05:00
|
|
|
$ cd $ZEPHYR_BASE/samples/hello_world/nanokernel
|
2016-02-12 16:52:32 -08:00
|
|
|
$ make pristine && make BOARD=arduino_101 ARCH=x86
|
2016-02-12 16:54:07 -08:00
|
|
|
|
2016-02-16 16:12:47 -08:00
|
|
|
#. Verify the JTAG debugger is properly attached to the Arduino 101 board.
|
|
|
|
|
|
|
|
#. Verify the Arduino 101 has power.
|
|
|
|
|
2016-02-13 11:12:56 -05:00
|
|
|
#. Once the image has been built, flash it with:
|
2016-02-12 16:54:07 -08:00
|
|
|
|
2016-02-13 11:12:56 -05:00
|
|
|
.. code-block:: console
|
2016-02-12 16:54:07 -08:00
|
|
|
|
|
|
|
$ make BOARD=arduino_101 flash
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
2016-02-02 16:54:23 -08:00
|
|
|
When building for the x86 processor, the board type is listed as
|
|
|
|
arduino_101 and the ARCH type is set to x86.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
Congratulations you have now flashed the hello_world image to the x86
|
|
|
|
processor.
|
|
|
|
|
|
|
|
Debugging on Arduino 101
|
|
|
|
========================
|
|
|
|
|
|
|
|
The image file used for debugging must be built to the corresponding
|
|
|
|
architecture that you wish to debug. For example, the binary must be built
|
|
|
|
for ARCH=x86 if you wish to debug on the x86 core.
|
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
#. Build the binary for your application on the architecture you wish to
|
|
|
|
debug. Alternatively, use the instructions above as template for testing.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
When debugging on ARC, you will need to enable the :option:`ARC_INIT_DEBUG`
|
|
|
|
configuration option in your X86 PRJ file. Details of this flag can be
|
|
|
|
found in :file:`arch/x86/soc/quark_se/Kconfig`. Setting this variable will
|
2016-01-27 09:09:55 -08:00
|
|
|
force the ARC processor to halt on bootstrap, giving the debugger a chance
|
|
|
|
at connecting and controlling the hardware.
|
|
|
|
|
2016-02-13 11:12:56 -05:00
|
|
|
This can be done by editing the file
|
|
|
|
:file:`samples/hello_world/nanokernel/prj.conf` to include:
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
CONFIG_ARC_INIT=y
|
|
|
|
CONFIG_ARC_INIT_DEBUG=y
|
|
|
|
|
2016-02-02 16:54:23 -08:00
|
|
|
.. note::
|
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
By enabling :option:`CONFIG_ARC_INIT`, you *MUST* flash both an ARC and an X86
|
|
|
|
image to the hardware. If you do not, the X86 image will appear to hang
|
2016-02-02 16:54:23 -08:00
|
|
|
at boot while it is waiting for the ARC to finish initialization.
|
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
#. Open two terminal windows.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
#. In terminal window 1, type:
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-13 11:12:56 -05:00
|
|
|
.. code-block:: console
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-13 11:12:56 -05:00
|
|
|
$ cd $ZEPHYR_BASE/samples/hello_world/nanokernel
|
2016-02-16 11:03:08 -08:00
|
|
|
$ make BOARD=arduino_101 debugserver
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
These commands will start an ``openocd`` session with a local telnet
|
|
|
|
server (on port 4444 for direct openocd commands to be issued), and a
|
|
|
|
gdbserver (for gdb access). The command should not return to a command line
|
|
|
|
interface until you are done debugging, at which point you can press :kbd:`Ctrl+C`
|
|
|
|
to shutdown everything.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
#. Start GDB in terminal window 2:
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
* To debug on x86:
|
|
|
|
|
2016-02-13 11:12:56 -05:00
|
|
|
.. code-block:: console
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-09 19:47:18 -05:00
|
|
|
$ cd $ZEPHYR_BASE/samples/hello_world/nanokernel
|
2016-02-02 16:54:23 -08:00
|
|
|
$ gdb outdir/zephyr.elf
|
|
|
|
gdb$ target remote :3333
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-03 15:48:58 -08:00
|
|
|
* To debug on ARC:
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
ARC debugging will require some extra steps and a third terminal. It is
|
2016-02-03 15:48:58 -08:00
|
|
|
necessary to use a version of gdb that understands ARC binaries.
|
|
|
|
Thankfully one is provided with the Zephyr SDK at
|
|
|
|
:envvar:`$ZEPHYR_SDK_INSTALL_DIR`
|
|
|
|
:file:`/sysroots/i686-pokysdk-linux/usr/bin/arc-poky-elf/arc-poky-elf-gdb`.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-03 15:48:58 -08:00
|
|
|
It is suggested to create an alias in your shell to run this command,
|
|
|
|
such as:
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-03 15:48:58 -08:00
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
alias arc_gdb= "$ZEPHYR_SDK_INSTALL_DIR/sysroots/i686-pokysdk-
|
|
|
|
linux/usr/bin/arc-poky-elf/arc-poky-elf-gdb"
|
|
|
|
|
|
|
|
a) On Terminal 2:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
2016-02-09 19:47:18 -05:00
|
|
|
$ cd $ZEPHYR_BASE/samples/hello_world/nanokernel
|
2016-02-03 15:48:58 -08:00
|
|
|
$ arc_gdb outdir/zephyr.elf
|
|
|
|
gdb$ target remote :3334
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-03 15:48:58 -08:00
|
|
|
At this point you may set the breakpoint needed in the code/function.
|
2016-01-27 09:09:55 -08:00
|
|
|
|
2016-02-03 15:48:58 -08:00
|
|
|
b) On Terminal 3 connect to the X86 side:
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ gdb
|
2016-02-02 16:54:23 -08:00
|
|
|
gdb$ target remote :3333
|
2016-01-27 09:09:55 -08:00
|
|
|
gdb$ continue
|
|
|
|
|
2016-02-02 16:54:23 -08:00
|
|
|
.. note::
|
2016-02-16 11:03:08 -08:00
|
|
|
|
2016-02-02 16:54:23 -08:00
|
|
|
In previous versions of the SDK, the gdbserver remote ports were reversed.
|
|
|
|
The gdb ARC server port was 3333 and the X86 port was 3334. As of SDK
|
|
|
|
v0.7.2, the gdb ARC server port is 3334, and the X86 port is 3333.
|
|
|
|
|
2016-02-03 15:48:58 -08:00
|
|
|
The :code:`continue` on the X86 side is needed as the ARC_INIT_DEBUG flag has
|
2016-01-27 09:09:55 -08:00
|
|
|
been set and halts the X86 until the ARC core is ready. Ready in this case
|
|
|
|
is defined as openocd has had a chance to connect, setup registers, and any
|
|
|
|
breakpoints. Unfortunately, there exists no automated method for notifying
|
|
|
|
the X86 side that openocd has connected to the ARC at this time.
|
|
|
|
|
|
|
|
Once you've started the X86 side again, and have configured any debug
|
|
|
|
stubs on the ARC side, you will need to have gdb issue the continue
|
|
|
|
command for the ARC processor to start.
|
|
|
|
|
2016-02-03 11:38:13 -08:00
|
|
|
Connecting Serial Output
|
|
|
|
************************
|
|
|
|
|
|
|
|
In the default configuration, Zephyr's Arduino 101 images support serial output
|
|
|
|
via the UART0 on the board. To read the output, you will need a USB to TTL
|
|
|
|
serial cable. To enable serial output:
|
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
* Connect the Serial Cable RX pin to the Arduino 101's TX->1 pin.
|
2016-02-03 11:38:13 -08:00
|
|
|
|
2016-02-13 11:12:56 -05:00
|
|
|
.. figure:: figures/arduino_101_03.png
|
2016-02-03 11:38:13 -08:00
|
|
|
:scale: 50 %
|
|
|
|
:alt: Image for pin positions and serial output
|
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
* Connect the Serial Cable TX pin to the Arduino 101's RX<-0 pin.
|
2016-02-03 11:38:13 -08:00
|
|
|
|
2016-02-13 11:12:56 -05:00
|
|
|
.. figure:: figures/arduino_101_04.png
|
2016-02-03 11:38:13 -08:00
|
|
|
:scale: 50 %
|
|
|
|
:alt: Image for pin positions and serial output
|
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
* Connect the Serial Cable GND pin to the Arduino 101's GND pin.
|
2016-02-03 11:38:13 -08:00
|
|
|
|
2016-02-13 11:12:56 -05:00
|
|
|
.. figure:: figures/arduino_101_05.png
|
2016-02-03 11:38:13 -08:00
|
|
|
:scale: 50 %
|
|
|
|
:alt: Image for pin positions and serial output
|
|
|
|
|
2016-02-16 11:03:08 -08:00
|
|
|
Once connected, on your development environment, you will need to:
|
2016-02-03 11:38:13 -08:00
|
|
|
|
|
|
|
* Open a serial port emulator (i.e. on Linux minicom, screen, etc)
|
|
|
|
|
|
|
|
* Attach to the USB to TTL Serial cable, for example, on Linux this may be
|
|
|
|
:file:`/dev/ttyUSB0`
|
|
|
|
|
|
|
|
* Set the communication details to:
|
|
|
|
** Speed: 115200
|
|
|
|
** Data: 8 bits
|
|
|
|
** Parity: None
|
|
|
|
** Stopbits: 1
|
|
|
|
|
2016-01-27 09:09:55 -08:00
|
|
|
|
|
|
|
Arduino 101 Pinout
|
|
|
|
******************
|
|
|
|
|
|
|
|
When using the Zephyr kernel, the pinout mapping for the Arduino 101 becomes a
|
2016-02-16 11:03:08 -08:00
|
|
|
little more complicated. The table below details which pins in Zephyr map to
|
|
|
|
those on the Arduino 101 board for control. Full details of the pinmux
|
2016-01-27 09:09:55 -08:00
|
|
|
implementation, what valid options can be configured, and where things map can
|
|
|
|
be found in the :file:`boards/arduino_101/pinmux.c`.
|
|
|
|
|
|
|
|
|
|
|
|
+-------------+----------+------------+
|
|
|
|
| Arduino Pin | Function | Zephyr Pin |
|
|
|
|
+=============+==========+============+
|
2016-02-13 11:12:56 -05:00
|
|
|
| IO-0 | UART1-RX | 17 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| IO-1 | UART1-TX | 16 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| IO-2 | GPIO | 52 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| IO-3 | GPIO | 51 |
|
|
|
|
| | | 63 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| IO-4 | GPIO | 53 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| IO-5 | GPIO | 49 |
|
|
|
|
| | | 64 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| IO-6 | PWM2 | 65 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| IO-7 | GPIO | 54 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| IO-8 | GPIO | 50 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| IO-9 | PWM3 | 66 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| IO-10 | AIN0 | 0 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| IO-11 | AIN3 | 3 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| IO-12 | AIN1 | 1 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| IO-13 | AIN2 | 2 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| ADC0 | GPIO SS | 10 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| ADC1 | GPIO SS | 11 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| ADC2 | GPIO SS | 12 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| ADC3 | GPIO SS | 13 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| ADC4 | AIN14 | 14 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
2016-02-13 11:12:56 -05:00
|
|
|
| ADC5 | AIN9 | 9 |
|
2016-01-27 09:09:55 -08:00
|
|
|
+-------------+----------+------------+
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
IO3 and IO5 require both pins to be set for functionality changes.
|
|
|
|
|
|
|
|
Release Notes
|
|
|
|
*************
|
|
|
|
|
|
|
|
When debugging on ARC, it is important that the x86 core be started and
|
2016-02-16 11:03:08 -08:00
|
|
|
running BEFORE attempting to debug on ARC. This is because the IPM console
|
2016-01-27 09:09:55 -08:00
|
|
|
calls will hang waiting for the x86 core to clear the communication.
|
|
|
|
|
|
|
|
Bibliography
|
|
|
|
************
|
|
|
|
|
|
|
|
.. _Arduino Website: https://www.arduino.cc/en/Main/ArduinoBoard101
|
|
|
|
|
|
|
|
.. _schematics: https://www.arduino.cc/en/uploads/Main/Arduino101Schematic.pdf
|
|
|
|
|
|
|
|
.. _FlySwatter2 JTAG debugger:
|
|
|
|
http://www.tincantools.com/JTAG/Flyswatter2.html
|
|
|
|
|
2016-02-02 16:54:23 -08:00
|
|
|
.. _Intel Datasheet:
|
|
|
|
http://www.intel.com/content/www/us/en/embedded/products/quark/mcu/se-soc/overview.html
|
|
|
|
|
2016-01-27 09:09:55 -08:00
|
|
|
.. _ARM-JTAG-20-10:
|
|
|
|
http://www.amazon.com/gp/product/
|
|
|
|
B009UEO9ZY/ref=oh_aui_detailpage_o04_s00?ie=UTF8&psc=1
|
2016-02-11 10:21:43 -06:00
|
|
|
|
2016-02-12 07:22:28 -08:00
|
|
|
.. _USB to TTL Serial Cable: https://www.adafruit.com/products/954
|