Spresense Header CodeSpresense Header Code

Spresense - 低功耗下的边缘计算

在干电池供电的Spresense板上体验正真的边缘计算

!
无中文翻译

Spresense SDK

1. Spresense SDK Getting Started Guide

This section describes how to start working with the Spresense SDK.

1.1. Installation

1.1.1. Prerequisites

  1. Install the necessary packages and GCC ARM toolchain for cross-compilation:

    $ sudo apt-get install git gperf libncurses5-dev flex bison gcc-arm-none-eabi genromfs pkg-config autoconf automake cmake --install-recommends
  2. Install the kconfig-frontends package from nuttx-tools:

    $ git clone https://bitbucket.org/nuttx/tools.git
    $ cd tools/kconfig-frontends/
    $ ./configure --disable-shared
    $ make
    $ sudo make install
  3. Clone the Spresense SDK repository:

    $ git clone --recursive https://github.com/sonydevworld/spresense.git

1.2. USB connection setting

  • 64bit Linux Ubuntu 16.04 requires USB connection setting for using USB serial port on Spresense SDK.

    1. Add user to dialout groups:

      $ sudo usermod -a -G dialout $USER
    2. Logout and login again into the Ubuntu PC to activate the new group settings:

    3. Connect the Spresense main board USB to the PC:

spresense musb connect
Figure 1. Main board USB connection
The steps in USB connection setting are necessary to be able to upload your image to the Spresense board.

1.3. Setting Up the Spresense SDK

1.3.1. Build instructions

  1. Navigate to the folder where you have stored the cloned Spresense SDK code, and enter the sdk folder:

    $ cd spresense/sdk
  2. Set the initial NuttX kernel configuration:

    $ tools/config.py --kernel release
  3. Set the initial SDK configuration:

    $ tools/config.py examples/hello
  4. Build the example image:

    $ make buildkernel
    $ make

A nuttx.spk file will be created in the sdk folder when this step has successfully finished. This file is the final result and can be flashed onto the Spresense board. See Tutorial to flash SW for details.

1.4. Tutorial to flash SW

1.4.1. Flash the bootloader

The correct bootloader is required for the Spresense board to function.

Bootloader information
  • The bootloader has to be flashed the very first time the board is used.

  • You have to accept the End User License Agreement to be able to download and use the Spresense bootloader binary.

A WARNING message (example shown below) may be shown when using tools/config.py or tools/flash.sh if the bootloader is missing. In this case you have to flash the Spresense bootloader onto the Spresense board.

WARNING: New loader v1.0.003 is required, please download and install.
         Download URL   : https://developer.sony.com/file/download/spresense-binaries-vx.x.x.zip
         Install command:
                          1. Extract loader archive into host PC.
                             ./tools/flash.sh -e <download zip file>
                          2. Flash loader into Board.
                             ./tools/flash.sh -l /home/user/mySpresense/spresense/firmware/spresense -c <port>
  1. Download the EULA binary zip archive.

    Go to the Download URL in WARNING description which will provide a link to the specific version you need, and download it to your PC.

  2. Extract EULA binary zip in your PC by executing:

    $ ./tools/flash.sh -e spresense-binaries-vx.x.x.zip
  3. Flash Spresense bootloader into Spresense board.

    Execute the command that is shown in WARNING description. (In this example <port> is /dev/ttyUSB0):

    $ ./tools/flash.sh -l ../firmware/spresense -c /dev/ttyUSB0
  4. Finish.

    On installation completion, the Spresense board will reboot.

Flash the user nuttx.spk image

Use the tools/flash.sh script to flash nuttx.spk to Spresense board.

  1. Connect the USB cable from the Spresense main board to your PC.

  2. Check serial port number by using next command.

    $ dmesg | grep "cp21.*attached"
    [12220.625979] usb 1-1: cp210x converter now attached to ttyUSB0

    In this case, Spresense board use /dev/ttyUSB0 for serial connection.

  3. Type tools/flash.sh for flashing nuttx.spk into Spresense board.

    $ tools/flash.sh -c /dev/ttyUSB0 nuttx.spk
    tutorial nuttx image load
    Figure 2. nuttx.spk flashing
  4. On installation completion, the Spresense board will reboot.

1.5. Run "Hello, World!"

This section will describe how to run the "Hello world!" example application. Minicom is used as serial terminal.

  1. Install minicom

    $ sudo apt-get install minicom
  2. Open minicom with parameter

    $ minicom -D /dev/ttyUSB0 -b 115200 -s
    The default baud rate is 115200. If you change the baud rate, please change this parameter.
  3. Select Serial port setup for open serial port setting.

    tutorial nuttx minicom setting open
    Figure 3. minicom setting page 1
  4. Type F to set No for the Hardware Flow Control setting.

    tutorial nuttx minicom setting done
    Figure 4. minicom setting page 2
    Hardware Flow Control should be set No for input commands.
  5. If nsh> is shown after typing Enter and Esc keys, the Spresense board working properly. nsh> is the command prompt for NuttShell.

    tutorial nuttx minicom
    Figure 5. Terminal
  6. Type hello

    tutorial nuttx hello
    Figure 6. hello sample application
Spresense board will reboot every time you open the serial terminal.