cmsis tiva spma041c

Download Cmsis Tiva Spma041c

Post on 27-Dec-2015

88 views

Category:

Documents

4 download

Embed Size (px)

DESCRIPTION

Cmsis for Tiva

TRANSCRIPT

  • Application ReportSPMA041CJanuary 2012Revised January 2014

    Using the CMSIS DSP Library in Code Composer Studiofor Tiva C Series ARM MCUs

    JordanWills

    ABSTRACTThis application report describes the process required to build the ARM CMSIS DSP library in CodeComposer Studio v5. This document also describes how to use Code Composer Studio v5 to build, run,and verify the 11 ARM DSP example projects that are included in the CMSIS package.

    Project collateral and source code discussed in this application report can be downloaded from thefollowing URL: http://www.ti.com/lit/zip/spmc017.

    NOTE: This document applies to both the Tiva C Series and the Stellaris Cortex-M4 MCUs.Many screen captures reflect the Stellaris version of the device.

    Contents1 Introduction .................................................................................................................. 12 CMSIS DSP Library ......................................................................................................... 13 Building the DSP Library in Code Composer Studio v5 ............................................................... 24 ARM Example Projects ................................................................................................... 145 Conclusion .................................................................................................................. 286 References ................................................................................................................. 29

    1 IntroductionMany microcontroller-based applications can benefit from the use of an efficient digital signal processing(DSP) library. To that end, ARM has developed a set of functions called the CMSIS DSP library that iscompatible with all Cortex M3 and M4 processors and that is specifically designed to use ARM assemblyinstructions to quickly and easily handle various complex DSP functions. Currently, ARM supplies exampleprojects for use in their Keil uVision IDE that are meant to show how to build their CMSIS DSP librariesand run them on an M3 or M4. This application report details the steps that are necessary to build theseDSP libraries inside Code Composer Studio version 5 and run these example applications on a Tiva CSeries TM4C123G Launchpad.

    2 CMSIS DSP LibraryTo build the CMSIS DSP library, download and extract the source code from the ARM CMSIS website:http://cmsis.arm.com. The source code for the DSP library and example projects are in this directory:

    CMSIS-/CMSIS/DSP_Lib

    A full description of the DSP libraries, including a description of examples, the data structures used, andan API for each available function, is in the ARM-provided documentation at this location:

    CMSIS-/CMSIS/Documentation/DSP_Lib/html/index.html

    Code Composer Studio, Tiva are trademarks of Texas Instruments.Stellaris is a registered trademark of Texas Instruments.Cortex is a trademark of ARM Limited .ARM is a registered trademark of ARM Limited.All other trademarks are the property of their respective owners.

    1SPMA041CJanuary 2012Revised January 2014 Using the CMSIS DSP Library in Code Composer Studio for Tiva CSeries ARM MCUsSubmit Documentation Feedback

    Copyright 20122014, Texas Instruments Incorporated

  • Building the DSP Library in Code Composer Studio v5 www.ti.com

    If ARM releases a future update to CMSIS, you might need to download and install a patch to the DSPlibrary in order to provide support for new functionality and to fix any bugs that ARM discovers in theCMSIS source code. After you download the patch files from the ARM web site, follow these instructionsto install:1. Unzip the patch file.2. Navigate to the patch directory and copy any files found in that directory to the corresponding location

    of the CMSIS DSP library.3. Overwrite existing files when prompted.

    For example, if the patch directory contains a file named arm_common_tables.c in theCMSIS/DSP_Lib/Source/CommonTables directory, copy this file into the same directory(CMSIS/DSP_Lib/Source/CommonTables) of your original CMSIS installation, overwriting thearm_common_tables.c that already exists in the original installation directory.

    After the CMSIS source code has been downloaded, you must download and run the SW01291 installerfrom Texas Instruments. This installer is located on the Texas Instruments website athttp://www.ti.com/lit/zip/spmc017. The installer contains a set of support files that are needed for buildingand running the CMSIS DSP library in Code Composer Studio. After you download the installer, run theinstaller and select a location in which to extract the files.

    3 Building the DSP Library in Code Composer Studio v5This section details the steps required to build the ARM CMSIS DSP library from source. It is possible toskip this section by using a precompiled .lib (such as one of those found in CMSIS-/CMSIS/Lib/ARM or CMSIS-/CMSIS/Lib/GCC), but doing so requires changing theCode Composer Studio compiler settings to call floating-point functions in a way that is different from thedefault Code Composer Studio settings. This requires rebuilding all .lib files that are used in a project withthe DSP libraries, most notably the TivaWare for C Series Software driverlib, grlib, and usblib libraries.This method is not recommended and the process is not described in this application report.

    3.1 Adding the CCS-Required Header Files to the DSP LibrariesTo compile the CMSIS DSP libraries using Code Composer Studio, you must modify the DSP libraryinclude files, add a Code Composer Studio specific include file, and add a new assembly file. TheSW01291 installer creates pre-modified versions of these files, which can be used during the buildprocess or you can elect to modify the files yourself by using the following steps:1. Modify the arm_math.h file found at CMSIS/Include to redefine the __INLINE macro used for Code

    Composer Studio by adding the following block of code after string.h and math.h have been included:#if defined (__TMS470__)#undef __INLINE#define __INLINE inline

    #endif2. Create an assembly file to take the place of the file arm_bitreversal2.S, which is found in

    CMSIS/DSP_Lib/Sources/TransformFunctions. Unfortunately, the Texas Instruments ARM assembleruses a vastly different syntax when handling macro statements than other assemblers, so it is notpossible to have a single assembly file which can be properly parsed by the TI assembler and theother assemblers supported by CMSIS. It is highly recommended that you simply copy thearm_bitreversal2.asm file that accompanies this application report into the TransformFunctionsdirectory. If you do wish to instead modify the assembly file to work with the TI assembler, you must:(a) Replace all #if statements to use the .if syntax defined in the ARM Assembly Language Tools

    Users Guide (SPNU118)(b) Replace the CODESECT definition to be .text(c) Replace the THUMB definition to be .thumb(d) Replace the EXPORT definition to be .global(e) Replace the PROC definition to be : .asmfun(f) Replace the LABEL definition to be :(g) Replace the ENDP definition to be .endasmfunc

    2 Using the CMSIS DSP Library in Code Composer Studio for Tiva C SPMA041CJanuary 2012Revised January 2014Series ARM MCUs Submit Documentation Feedback

    Copyright 20122014, Texas Instruments Incorporated

  • www.ti.com Building the DSP Library in Code Composer Studio v5

    (h) Replace the and the END definition to be an empty #define.3. Add the header file cmsis_ccs.h that accompanies this application report into the CMSIS/Include

    directory. This file is used by the DSP library to inform the build system of the syntax necessary to callvarious compiler intrinsics using the TI ARM C/C++ Compiler.

    If you wish to use pre-modified versions of the above files, the SW01291 installer creates an Includedirectory and a TransformFunctions directory, which contains a pre-modified version of arm_math.h, acopy of cmsis_ccs.h, and the arm_bitreversal2.asm assembly file that will build with the most recentversion of CMSIS as of this document being created, version 3 patch 1. To use these files:1. Rename the arm_math.h that was created in the CMSIS installation process to arm_math.h.backup2. Copy arm_math.h and cmsis_ccs.h from this application report into the CMSIS/Include directory3. Copy arm_bitreversal2.asm from this application report into

    CMSIS/DSP_Lib/Sources/TransformFunctions.

    3.2 Creating the dsplib ProjectBefore building the DSP library in Code Composer Studio, you must create a project for the library. Youcan build a project by completing the following steps:1. Launch CCSv5 and select an empty workspace.2. Select File > New > CCS Project. The New Code Composer Studio Project window will be displayed.3. Type dsplib-cm4f (or cm3 if using a Cortex-M3 part) in the Project name field.4. Select Static Library from the Output drop-down menu. The location of the project does not matter, so

    the default location is used for this example.5. In the Device area, make the following selections from the drop-down menus:

    Family: ARM Variant: Tiva C Series Part: Tiva C Series TM4C123GH6PGE

    6. Select the Empty Project in the Project templates and examples field.7. Click Finish to create the project (see Figure 1). The dsplib-cm4f project appears in the Project

    Explorer.

    Figure 1. Creating the dsplib Project

    3SPMA041CJanuary 2012Revised January 2014 Using the CMSIS DSP Library in Code Composer Studio for Tiva CSeries ARM MCUsSubmit Documentation Feedback

    Copyright 20122014, Texas Instruments Incorporated

  • Building the DSP Library in Code Composer Studio v5 www.ti.com

    3.3 Adding the dsplib Source CodeBefore adding the dsplib source code to the project, you should familiarize yourself with the CMSIS librarystructure.

Recommended

View more >