Skip to content

Latest commit

 

History

History
139 lines (90 loc) · 4.14 KB

quick_start_guide.rst

File metadata and controls

139 lines (90 loc) · 4.14 KB

Quick Start Guide

This document will provide a quick tour through the |lib_camera| repository. It will go through the process of building the example application and taking a photo in RAW8 format.

Hardware requirements

  • xcore.ai evaluation kit (XK-EVK-XU316)
  • Camera module
  • Camera ribbon connector
  • 2x Micro USB cable (Power supply and xTag)
  • xTag debugger and cable

Software requirements

  • XTC tools (15.2.1): `SW_TOOLS`_
  • CMake
  • Python 3.9 or later

Sandbox Structure

This repository is structured as a sandbox. It will install dependencies above the current folder. So the folder structure should look like this:

sandbox
  |
  |--- lib_camera (current repository)
  |--- xscope_fileio
  |--- xcommon_cmake
  |--- other_libs...

Installation

Clone the following repositories using the commands:

git clone https://github.com/xmos/lib_camera.git
git clone https://github.com/xmos/xscope_fileio.git ../xscope_fileio
git clone https://github.com/xmos/xcommon_cmake.git ../xcommon_cmake

Install a Python virtual environment and install the Python dependencies:

pip install -r requirements.txt
pip install -e ../xscope_fileio

Xcommon cmake setup

This repository uses xcommon_cmake and xmake as a build system.

  • xcommon_cmake is a collection of CMake functions and macros that are used to build XCORE.AI projects. xcommon_cmake/doc.
  • xmake is a fork of make, native to XTC tools. xmake-manual.

In order to build the examples, you need to set the XCOMMON_CMAKE_PATH environment variable to the path of the xcommon_cmake repository.

.. tab:: MacOS and Linux

    .. code-block:: console

       # MacOS and Linux
       export XMOS_CMAKE_PATH=/home/user/xcommon_cmake

.. tab:: Windows

    .. code-block:: console

       # Windows
       set XMOS_CMAKE_PATH=C:/Users/user/xcommon_cmake


Xscope fileio setup (Windows)

On Windows the host app of xscope_fileio is not built by default, the user needs to build it manually. Ninja can be used as a build system for building the host application.

Please follow the steps below:

  1. Make sure you have a C compiler installed. We recommend using VS tools with a cl compiler.
  2. Open a terminal or command prompt.
  3. Build the host app using the following commands:
cmake -G Ninja -S ../xscope_fileio/host -B ../xscope_fileio/host
ninja -C ../xscope_fileio/host

Your xscope_fileio host app is now ready to use.

Build instructions

In order to build any example, go to the example that you want to build and follow the instructions in the README.rst file. Alternatively, you can build all the examples using the following command:

python examples/build_examples.py

Below we demonstrate how to build and run the take picture RAW camera demo.

Building and Running the RAW camera demo

This demo uses the RAW camera module to capture a RAW8 image and save it to a .raw file. Then, this image can be decoded using the Python script python decode_raw8.py.

  1. Ensure that the camera is connected to the board.
  2. Connect the Power Supply and xTag debugger.
  3. Build the example using the following command inside the examples/take_picure_raw folder:
cmake -G "Unix Makefiles" -B build
xmake -C build
  1. Run the example using the following command in the example folder:
python python/run_xscope_bin.py \
examples/take_picture_raw/bin/take_picture_raw.xe
  1. The camera should communicate with the host and save the image to a .raw file
  2. To decode the image use the following command:
python python/decode_raw8.py
  1. The decoded image should be displayed on the screen