# SitaraWare

### From Ap-fpdsp-swapps

Contact Pasupathy Visuvanadan or Nageswari Srinivasan for any queries.

# Document License

This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.

# SitaraWare Overview

SitaraWare provides no-OS platform support for Sitara family of processors on the Texas Instruments recommended Sitara EVMs. SitaraWare provides Device Abstraction Layer libraries and peripheral/board level sample/demo examples that demonstrate the capabilities of the peripherals on the Sitara processors. This package includes the following components:

NOTE
Though SitaraWare is intended to support multiple processors of the Sitara family, support may be in a phased manner. The supported list of processors and the assosciated device abstraction layer of the peripherals as part of the library is mentioned in the release notes for every release.

- Device Abstraction Layer Library. This contains device abstraction layer for supported peripherals. The included object files are built with Sourcery G++ Lite 2009q1-161 for ARM-NONE-EABI from CodeSourcery.
- Peripheral Examples. This contains the sample applications which shall demonstrate some of the capabilities of the peripheral by using the Device Abstraction Layer APIs. The executables of the sample applications included with this release is built with Sourcery G++ Lite 2009q1-161 for ARM-NONE-EABI from CodeSourcery
- System Configuration code. This contains the primary code that sets up the Sitara processor core and prepares the system for execution of the sample application.
- Platform Code. This contains the EVM specific initialization code. This code sets up the EVM specifics like pinmux, IO expanders, GPIOs and similar board specific stuff that shall enable proper exucution of the applications.

## Directory Stucture

    |----SitaraWare-#.#.#.#
    |-- Software-manifest.html
    |-- docs
    |   |-- ReleaseNotes-#.#.#.#.pdf
    |   `-- UserGuide-#.#.#.#.pdf
    |-- drivers
    |   `--build
    |   `--src
    |-- examples
    |   `--evmAM1808
    |      |-- uart
    |          `-- build
    |              |-- ccs
    |-- include
    |   `-- am1808
    |   `-- cslr
    |-- platform
    |   `-- build
    |   `-- evmAM1808
    |-- system_config
    |   `-- am1808
    |       `-- build
    |-- bootloader
    |   `--build
    |   `--include
    |   `--src
    |-- third_party
    |-- tools
    |-- utils

- drivers - This directory contains the source files for the driver library APIs and build files for the driver library. The build directory contains compiler/tools specific directories which hold the related files. For example, the makefiles for the GCC are under gcc directory. Once build, the library/archive is placed in a tool specific directory under drivers/. For example, when make is invoked from driver/buils/gcc, the driverlib.a is placed as drivers/gcc/driverlib.a
- examples - Examples provided as part of the package showcase some 9not all) functionality of the peripheral. This depends on the availability of a peripheral instance and its association, mux settings etc on the EVM. Thus examples differ between EVMs, and thus are classified at the top level based the EVMs that there are intended to run. Each example contains a src/ directory which contains the source files and a build/ directory containing the build files. The build files are grouped based on the tools/compiler. For example, ccs/ shall contain the Code Composer Studio (CCS) project files and gcc shall only contain the make file. Note that, only the applications are supplied with a CCS project for aiding in loading and debugging applications. The library build files are internally invoked by the application build files. The generated binary/executable is placed in toll specific directory under the example. For example, uart.out is placed under uart/gcc/uart.out
- include - The header files for inclusion are all placed under include/. The include files are classified as,
  1. user interface driver headers, for example uart.h, which contain macro definitions and prototypes for the functions which a user might need to use for programming.
  2. SOC or EVM specific header files which contain SOC specfic information/definitions, for example interrupts, CPU operations or definitions.
  3. Peripheral register level definitions like register offsets and macros.
- platform - Every supported EVM is called as a (hardware) platform inside the package. This exports functions specfic to an EVM that usually do (as required) peripheral mux settings, EVM mux/IO expander settings etc, to enable a peripheral operation on the platform. This code is separated out of the main applications/examples to provide a simpler look at the first level.
- system_config - The system configuration and setup code, like stratup code, interrupt vector initialization, low level CPU specific code etc are provided here. Since, this may involve assmebly level coding, such code is placed under tools specific directory.
- bootloader - Contains the boot loader specific files. The make file for building bootloader can be found in build/gcc/ folder. The bootloader executable boot.out file can be found in /gcc folder.
- third_party - May contain software from third party used, if any.
- tools - May contain tools used, if any.
- utils - May contain utility scripts etc used, if any.

## Host platform Requirements

Building and runnning SitaraWare applications can be from a Windows machine or a Linux machine

A host machine is required only for:

1. Compiling the SitaraWare applications
2. Launching CCS v5 and loading and runnning the applications on the Sitara target

### Host Software Requirements

- Code Composer Studio version CCS 5.0.0.00081 for Linux and/or Windows (needed for (re)building and/or loading and running applications on the target/EVM)
- CodeSourcery tool chain for ARM : Sourcery G++ Lite 2009q1-161 for ARM-NONE-EABI for Linux and/or Windows
- Cygwin (for Windows host only) to facilitate GCC build
- Serial console terminal application (like Teraterm, minicom, HyperTerminal)

# Getting Started Quickly

The SitaraWare package contains pre-compiled peripheral level examples that can be run on the EVM. Steps to run the examples are detailed here in:

## Creating a target configuration, if one doesn't exist already.

1. Launch Code Composer Studio v5 eclipse IDE
2. File menu-> New-> Other-> General ->Target Configuration File. Click Next
3. Filename : AM1808EVM. Check "Use shared location" to be available to anyone who uses the workspace. Click Finish. A window opens up which is to configure the connection details
4. Connection: Chose the host-to-target connection details. For example "Spectrum Digital XDC510 USB Emulator", if XDS510 is being used.
5. Device: Type AM1808. AM1808 should be available in the device list. Select AM1808
6. Click on "Target Configration". "Initialization Script" should point to a proper GEL file that needs to be used.
7. Click Save.

## Launching a debug session and connecting to the target

1. Run Menu ->Debug. This will launch the debugging session for AM1808
2. Right Click on the ARM9 target and select Connect.

## Loading and running a program/executable

1. Run menu ->Load ->Load Program. Here browse to the required exeuctable and click OK
2. Run menu -> Run

## Building application - CCS project

SitaraWare package also contains the build files and CCS project files to enable the user to rebuild any modifications. The CCS project files enable those users who are comfortable with building the projects rather than command line invocation of make file. CCS projects are provided only for applications, which internally invoke the make files.

1. Make changes to the source files and edit the makefiles accordingly
2. Launch Code Composer Studio v5 eclipse IDE
3. File menu-> Import-> CCS-> Existing CCS/CCE Eclipse Projects
4. Select search-directory . Here, browse to the required example directory and click OK. A list of available projects will be displayed.
5. Check only the example that is intended and click finish
6. Project Menu-> Build All. This will build the selected project

## Building application - Command line

From the shell window, change to the application build directory and type "make clean; make"

NOTE
1. In both cases of building the application, as detailed above, the library makefiles are are internally invoked.
2. If a Windows host is used, then cygwin needs to be installed.
3. Ensure that the PATH envirinment variable contains the path for the compiler/tool chain.
4. When compiling via CCSv5, ensure that the environment for each build configuration (Cygwin and Linux) of the project the follwoing variable(s) are set:
LIB_PATH points to the Code Sourcery installation: Ex: LIB_PATH=/opt/tools/CodeSourcery/Sourcery_G++_Lite/
5. When compiling via command line, ensure that the following variable is exported :
export LIB_PATH=/opt/tools/CodeSourcery/Sourcery_G++_Lite/
6. If Cygwin is to be used, ensure that the code sourcery installation path does not contain any white space.