code composer studio v4

50
0 - 0 - 1 © 2010Texas Instruments Inc, Content developed in partnership with Tel-Aviv University Content developed in partnership with Tel-Aviv University C6000 Teaching Materials Code Composer Studio V4

Upload: holleb

Post on 25-Jan-2016

72 views

Category:

Documents


4 download

DESCRIPTION

Code Composer Studio V4. Agenda. Introduction of CCS4 Starting a new project. Overview. CCS 4 is the integrated development environment (IDE) for TI’s Digital Signal Processors (DSP), microcontrollers and application processors. Source code editor Project environment Compiler Debugger - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Code Composer Studio V4

0 - 0 - 11

© 2010Texas Instruments Inc,

Content developed in partnership with Tel-Aviv University

Content developed in partnership with Tel-Aviv University

C6000 Teaching Materials

Code Composer Studio V4

Page 2: Code Composer Studio V4

Slide Slide 22©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Agenda

• Introduction of CCS4

• Starting a new project

Page 3: Code Composer Studio V4

Slide Slide 33©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Page 4: Code Composer Studio V4

Slide Slide 44©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Overview

• CCS 4 is the integrated development environment (IDE) for TI’s Digital Signal Processors (DSP), microcontrollers and application processors.

• Source code editor

• Project environment

• Compiler

• Debugger

–Software (simulator)

–Hardware (emulator)

• Graph windows

• Image visualization

• Profiler

• Scripting capability

• Flash programmer

Page 5: Code Composer Studio V4

Slide Slide 55©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

IDE: C/C++ Perspective

Project view Text

editor

Outline view

Build view

Problems view

Perspective bar

Fast view bar

Page 6: Code Composer Studio V4

Slide Slide 66©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

IDE: Debug Perspective

Debug view

Source code

editor

Register view / watch view / etc

Graph window

Memory view

Page 7: Code Composer Studio V4

Slide Slide 77©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Agenda

• Introduction of CCS4

• Starting a new project

• Compiling a project

Page 8: Code Composer Studio V4

Slide Slide 88©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Starting a project

Select the workspace

Defines the location of your project

Automatically saved on close

Contains:

Project settings

Macros

Views on close

Other custom settings specific for YOUR

personal computer

Cannot be zipped and forwarded to

others

Can be changed later on

Page 9: Code Composer Studio V4

Slide Slide 99©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

New Project Wizard

• New projects are created by using the “New Project Wizard:

Page 10: Code Composer Studio V4

Slide Slide 1010©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

New Project Wizard• This will allow to select:

–The project type

» Processor used: e.g. C6000, C2000, etc…–The configurations

» Default are

• Debug

• Release–Referenced projects (if any)

–The used C/C++ indexer

» Full

» Fast

» None–Output type

–A default linker command file

–Various project settings

» Device variant

» Code Generation tools version

» Runtime Support Library

» Target content

» etc

Page 11: Code Composer Studio V4

Slide Slide 1111©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Adding Files

• There are two ways to add files to the project:

– Create a new source file

– Drop existing source files in the project directory

» All files in the directory of a project are automatically added to the project.

» Take care that you are not adding unwanted content!

Page 12: Code Composer Studio V4

Slide Slide 1212©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

C Language Symbols

• Files are automatically parsed and variables, declaration and definitions displayed. These can be accessed from the outline view or from the project view

Page 13: Code Composer Studio V4

Slide Slide 1313©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Importing an Existing Project

• Accessed from

• You can import a single project or multiple projects in one step:This will also give you theopportunity to copy theprojects into your workspace

Page 14: Code Composer Studio V4

Slide Slide 1414©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Importing a CCS 3.3 Project

• The CCS 3.3 import wizard is called from:

• This will help you to import the existing project, but manual re-work might still be required

– Change or add path names for library functions

– Change of .cdb files

• Note: CCS 3.1 and CCS 2.x projects cannot be imported automatically. They need to be converted to a CCS 3.3 project first (using CCS 3.3)

Page 15: Code Composer Studio V4

Slide Slide 1515©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Agenda

• Introduction of CCS4

• Starting a new project

• Building a project

Page 16: Code Composer Studio V4

Slide Slide 1616©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Compile Flow

• You can either write standard assembly directly, or it can be created by the compiler.

• Object files, created by the assembler, are linked together to create the executable output file of the processor. The map file is an output report of the linker.

• The .out file can be loaded into your system by the debugger portion of CCS.

Compiler

Editor ASM Linker

Link.cmd

.map

.out.asm

.c / cpp

.obj

Page 17: Code Composer Studio V4

Slide Slide 1717©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Build Configurations

• By default, CCS includes two sets of build options:

– Debug

– Release

• Users can create any number of additional build configurations.

• Users can modify the settings of any pre-defined build option

Page 18: Code Composer Studio V4

Slide Slide 1818©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Build Options

• Build options are controlled by the “Properties” dialog of the project:

Page 19: Code Composer Studio V4

Slide Slide 1919©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Compiler: Basic Options

Page 20: Code Composer Studio V4

Slide Slide 2020©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Compiler: Include Options

Page 21: Code Composer Studio V4

Slide Slide 2121©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Compiler: Runtime Model Options

Page 22: Code Composer Studio V4

Slide Slide 2222©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Compiler: Optimizations

Page 23: Code Composer Studio V4

Slide Slide 2323©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Linker: Basic Options

Note:

The stack size field is empty by default, causing a linker warning during build (but the default size of 0x400 will be used). Also, the default linker command file does not include the stack settings, so you need to set it here!

Page 24: Code Composer Studio V4

Slide Slide 2424©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Linker: File Search Path

Page 25: Code Composer Studio V4

Slide Slide 2525©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Linker: Linker Output

Page 26: Code Composer Studio V4

Slide Slide 2626©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Linker: Runtime Environment

Page 27: Code Composer Studio V4

Slide Slide 2727©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

CCS Build: General

Page 28: Code Composer Studio V4

Slide Slide 2828©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Finally, the Actual Build

• There are a couple of ways to build the project:

– Use the menu bar:

– Use the drop-down menu:

– Use the keyboard –shortcuts CTRL+SHIFT+P or ALT+SHIFT+P

Page 29: Code Composer Studio V4

Slide Slide 2929©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Build: The Differences

• Build Active Project– Builds only the active project

– Compiles only new or changed files (incremental build)

• Rebuild Active Project– Builds only the active project

– Compiles all files, independently of their state

• Build All– Builds all projects in the workspace

• Rebuild All– Rebuilds all projects in the workspace

• Build Project– The same as “Build Active Project”

• Build Working Set– Build a pre-defined set of projects

• Clean– Cleans a defined set of projects

• Build Automatically– Builds automatically once a changed file is saved

Page 30: Code Composer Studio V4

Slide Slide 3030©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Build: One Last Way

• Clicking will build the active project, switch to the debug perspective and load the executable.

• This will work only if a valid target configuration is loaded.

• If CCS is already in the debug perspective, the project will be recompiled and the executable loaded.

Page 31: Code Composer Studio V4

Slide Slide 3131©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

CCS Debug Options

Page 32: Code Composer Studio V4

Slide Slide 3232©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Debugging a Project

• Once all source files are added to the project and all project settings are made, the project can be debugged.

• But, before we can do that, a target description (aka a target configuration is needed)

Page 33: Code Composer Studio V4

Slide Slide 3333©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Creating the Target Configuration

Page 34: Code Composer Studio V4

Slide Slide 3434©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Debugging a Program

Run (F8) / Run Low Power / Free Run

Halt program

Terminate debug session. This will switch back to the C/C++ perspective (CTRL+ALT+T)

Step into (F5)

Step over (F6)

Assembly step into

Assembly step over

Step return (F7)

Reset CPU (ALT+R) / Reset Emulator

Restart (ALT+F8)

Page 35: Code Composer Studio V4

Slide Slide 3535©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

IDE: Debug Perspective

Debug view

Source code

editor

Register view / watch view / etc

Graph window

Memory view

Page 36: Code Composer Studio V4

Slide Slide 3636©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Breakpoints

• Breakpoints can be set in two ways:

–Double clicking in the grey bar at the left side of the file view

–Right-clicking on the line where the breakpoint should be located and selecting “New Breakpoint”

• Breakpoints can be viewed and manipulated (and if needed added) in the “Breakpoint View”

• Breakpoints can be:

–Software

–Hardware

–Profile related (pause, resume, terminate)

Page 37: Code Composer Studio V4

Slide Slide 3737©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Disassembly View

• Opened by selecting“View Disassembly

• Shows:

–Address

–Opcode

–Disassembly

• Can be customized

• Can be shown

–Always

–Only if no C-source code is available

• Can also be used to set breakpoints

Page 38: Code Composer Studio V4

Slide Slide 3838©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Watch Views• Local variables are displayed automatically

• Other watch expressions can be added easily

• Expressions can be a global or a local variable or logical / arithmetic expressions using them (or use it as a quick calculator)

• Additional watch views can be added and the display can be customized

• Variables can also be watched in Q format

Page 39: Code Composer Studio V4

Slide Slide 3939©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Memory View• This view can be opened by

“View Memory”

• Displays the contents of the memory at a certain address

–If variables are used to set the address the ‘&’ operator needs to be used unless the variable is an array.

• Memory contents can be displayed in several ways:

–Floating point

–Integer

–Hexadecimal (TI and C style)

–Binary

–Character

–8/16/32/40/64 bit

• The memory view also allows to save, load and fill memory

• Several memory views can be open simultaneously

Page 40: Code Composer Studio V4

Slide Slide 4040©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Register View• Opened from “View

Registers”

• One window will display all the register sets

• Multiple register windows can be opened at any time

• Registers can be manipulated from this view

• Two different views are available:

–Tree (default)

–Grid (with a selectable number of grids)

• Registers can be copied individually or as complete set

Page 41: Code Composer Studio V4

Slide Slide 4141©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Graph View• Can be accessed from

Tools Graph

• Time-Domain

–Single / Dual

• FFT:

–Magnitude / Magnitude Phase

–Complex

–Waterfall

• Different update modes:

–Manual

–Refresh on halt

–Continuous refresh

• Display can be customized

–Line style

–Grid

–etc.

• If in continuous refresh mode, the update interval can be set in the local menu of the Watch View

• Data can be exported

Page 42: Code Composer Studio V4

Slide Slide 4242©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Image Analyzer

• Can be accessed fromTools Image Analyzer

• Image Format

–RGB

–Bayer

–YUV

–Bitonal

Page 43: Code Composer Studio V4

Slide Slide 4343©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Debugging Options

• Under “Tools Debugger Generic Options other stuff can be configured as well:

– Behavior of breakpoints if another program is loaded

– Autorun: Where the program should run to after a load or a reset

– Different launch options: Connect to target, restore breakpoints from previous session (can be dangerous!) etc

– Display of processes etc

– Interrupt handling during assembly debugging.

Page 44: Code Composer Studio V4

Slide Slide 4444©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Static System ConceptsWhat is a static system?

• All components remain during the life of a system (no create/delete)

• No “heap” or use of C’s malloc()/free() functions

• Opposite is a “dynamic” system

Benefits

• Reduced code size – no create/delete or heap mgmt (just declarations)

• Reduced MIPS for environment creation

• Deterministic – malloc() is non-deterministic

• Optimal when most resources are required concurrentlyLimitations

• Fixed allocation of memory usage (cannot create new components at runtime)Bottom Line• Pick static or dynamic based on system requirements – both are supported by BIOS

Page 45: Code Composer Studio V4

Slide Slide 4545©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Sections

short m = 10;short x = 2;short b = 5;

main(){ short y = 0;

y = m * x; y = y + b;

printf("y=%d",y);}

Every C program consists of different parts called Sections

All default section names begin with "."

Let’s review thelist of compiler

sections…

Global Vars (.bss) Init Vals (.cinit)

Local Vars(.stack)

Code(.text)

Std C I/O

(.cio)

Page 46: Code Composer Studio V4

Slide Slide 4646©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Compiler's Section Names

Section Name

Description Memory Type

.text Code initialized

.switch Tables for switch instructions initialized

.const Global and static string literals initialized

.cinit Initial values for global/static vars initialized

.pinit Initial values for C++ constructors initialized

.bss Global and static variables uninitialized

.far Aggregates (arrays & structures) uninitialized

.stack Stack (local variables) uninitialized

.sysmem Memory for malloc fcns (heap) uninitialized

.cio Buffers for stdio functions uninitialized

Page 47: Code Composer Studio V4

Slide Slide 4747©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Placing Sections In Memory

.text

.bss

.far

.cinit

.cio

.stack

How do you define the memory areas(e.g. IRAM, FLASH, DDR2) ?

How do you place the sections intothese memory areas ?

6400_0000

C000_0000 512MB DDR2

4MB FLASH

128K IRAM1180_0000

Page 48: Code Composer Studio V4

Slide Slide 4848©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Linking

Linker

Linker.cmd

.map

.obj .out

H/W Memory Description• Name, location, length

• Ex: IRAM, origin = …, len = …

S/W Sections• Name, memory area to link to

• Ex: .far → IRAM

Page 49: Code Composer Studio V4

Slide Slide 4949©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

Linker Command File

-l rts6400.lib

-stack 0x800-heap 0x800

MEMORY { IRAM: origin = 0x11800000, len = 0x40000 FLASH: origin = 0x64000000, len = 0x400000 DDR: origin = 0xC0000000, len = 0x8000000}

SECTIONS { .bss {} > IRAM .far {} > IRAM .text {} > DDR .cinit {} > FLASH}

LIBRARIES

STACK/HEAP SIZES

MEMORY AREAS

CODE/DATA SECTIONS

Page 50: Code Composer Studio V4

Slide Slide 5050©© 2011 Texas Instruments Inc, 2011 Texas Instruments Inc, C6000 Teaching Materials

User Defined Sections

#pragma DATA_SECTION(x, “.far:mysect”);int x[1024];

#pragma CODE_SECTION(fir, “.text:myfir”);void myfir (short * Src, short * Dst, short len) {

user.c

SECTIONS

{

.far:mysect :> IRAM

.text:myfir :> FAST_RAM

}

user.cmd

Users can place their code/data in default C Sections(e.g. .text, .far, .bss) or …

Create User-Defined sections to link critical code/data tospecific memory locations (vs. being lumped in with .far, e.g.)