C2000 Getting Started with Code Composer Studio v4

From Texas Instruments Wiki
Jump to: navigation, search

Chinese (中文) translation

Introduction

Because Code Composer Studio v4.0 (CCSv4) is now based on the open-source Eclipse 3.2 IDE, there are a number of changes between Code Composer Studio v3.x (CCSv3.x) upon which all legacy C2000 collateral is based. This wiki explains in detail how C2000 collateral can be migrated from CCSv3.x to CCSv4, and helps users get started with their first CCSv4.0 programs.

For all generic CCSv4 topics which are not C2000-specific, or to better understand CCSv4 in more detail, please visit the Code Composer Studio Wiki at:

Starting Up CCSv4

Select a workspace

When you first open CCSv4, a dialog box will prompt you to select a workspace. This is a folder where all of your CCSv4 custom settings will be saved for your specific personal computer. This includes all of your project settings, macros, and views when you shut down CCSv4. For instance, if you have several projects + memory windows + graph window + watch variables that you were working with when you closed CCSv4, these same projects and settings will be available when you re-open CCSV4.

1 workspace launcher.jpg

Workspaces save automatically when you close CCSv4. If you don't want to overwrite the settings you have for a current workspace, you can open/ switch to a new workspace by going to: "File-> Switch Workspace".

Note that workspaces are not portable in CCSv4 because they contain data specific to your computer system. So you cannot save a workspace, zip it up, and send it to another user.

Run Your First C2000 Project in CCSv4

Open the CCSv4 cpu_timer project included with the C2833x/2823x C/C++ Header Files and Peripheral Examples (v1.30 or later)

  • Go to Project->Import Existing CCS/CCE Eclipse Project


2 import existing.jpg


  • Next to “Select root directory:” click on the “Browse” button and browse to the <header file base>/DSP2833x_examples_ccsv4/cpu_timer directory folder and select “OK”. Make sure “Example_2833xCpuTimer” is selected in the “Projects:” textbox. Do NOT check the “Copy projects into workspace” checkbox. Click on the “Finish” button.


3 import ccsv4 existing.jpg


  • You are now in the C/C++ Perspective view. The project files appear in the “C/C++ Projects” window.
    • Under Binaries – after the project is built, the .out file for the project is located here.
    • Under Includes – All directories with include referenced by the build options are listed here. Expanding the directories lists all .h and .inc files in these directories which may or may not be used by the project.
    • Under Debug – all debug files are located here, including .map and .obj files.
    • Afterwards, all source files are listed. If any source files contain functions, include files, or structures, selecting the “cross” next to the source file lists all the function, include file, and structure names in that file. Double-clicking the function names brings you to where the function, include file, and structures are defined in the source code.


4 example projectview.jpg


Set up the Target Configuration Options for Device Emulation

  • For the current example, to set up an emulator target configuration, go to “Target->New Target Configuration”
  • Type a name for the target configuration file. It will have a “.ccxml” suffix. Leave the “Use default location” box checked, and select “Finish”.

5 target configuration.jpg


  • In the window that appears, select your emulator via the “Connection” pull-down list. Then in the “Device” list, select your device. In this example, we have selected the “Spectrum Digital XDS510USB Emulator” and the “TMS320F28335” device checkbox.


6 basic target config setup.jpg


  • Then go to “File->Save”.
  • Now go to “View->Target Configuration”
  • Under “User-Defined”, you will see your new target configuration .ccxml file. Right-click the file.
    • Select “Link File to Project ->”Example_2833xCpuTimer”, to always use this target configuration for this specific project in your workspace.
    • Or select “Set as Default” if you want to use this emulator and device GEL file by default for all future projects opened in your workspace that do not have a target configuration assigned to them.

7 link target config.jpg


Build and Load Project

  • To Build the Project, Connect to the Target, and Load the active project into the target all at once, click on the green bug (Debug) button on the toolbar. Then skip the "Reset the CPU" step below


8 debug toolbar.jpg


  • To build the project without automatically connecting the target and loading the active project object code into the device, go to “Project->Build Active Project”.


9 build active project.jpg


  • Then select the down-arrow next to the green bug on the toolbar and select “Launch TI Debugger”. You are now in the “Debug” perspective view.


10 launch debugger.jpg


  • Go to “Target->Connect Target”, to connect to the target device.


11 connect target.jpg


  • Go to “Target->Load Program” and browse to “Example_2833xCpuTimer.out” (in the “/cpu_timer/Debug” directory)

Reset the CPU

Select “Target->Reset->Reset CPU” to reset the device. To restart the program, select “Target->Restart”.

Add Watch Variables to Watch Window

  • If “Example_2833xCpuTimer.c” is not already open, in the upper right-hand corner of screen, click on the small C/C++ icon to switch back to “C/C++” Perspective and open the source file. Then click on the small Debug icon in the upper right-hand corner of the screen with the green bug next to it to switch back to the “Debug” Perspective.


12 debug perspective.jpg


  • In “Example_2833xCpuTimer.c”, scroll down in the Comments at the top of the file until you reach “Watch Variables”. Highlight “CpuTimer0.InterruptCount”, right-click, and select “Add Watch Expression”. Then repeat for “CpuTimer1.InterruptCount” and “CpuTimer2.InterruptCount”. These variables are now in the watch window.


13 add watch exp.jpg


Enable real-time mode to monitor the watch variables as they are changing

  • Go to “Tools->Debugger Options”. In the window that opens, scroll down to "Realtime Options" and select “Enable silicon real-time mode (service critical interrupts when halted, allow debugger accesses while running)”. Then select “Yes” if a dialog box pops up asking if you want to allow real-time switching.

14 realtime options.jpg


  • In the upper right-hand corner of the watch window, click on the white down-arrow and select “Customize Continuous Refresh Interval…”. Change the Continuous Refresh Interval to “1” (second) instead of the default “5” (seconds).

15 cont refresh interval.jpg

  • In the upper right-hand corner of the watch window, click on the icon of the yellow arrows rotating in a circle over a pause sign to enable continuous refresh mode so watch variables will continuously refresh in real-time while the program is running.

16 refresh icon.jpg

Run the program

  • Select the green arrow icon on the toolbar or go to "Target->Run"

17 run icon.jpg

  • Watch the variables in the Watch Window increment once per second as the CPU timers interrupt.

18 example watchwindow.jpg

  • Congratulations!! You just finished running your first C2000 project in CCSV4!


Migrating C2000 Projects from CCSv3.3 to CCSv4

Code Composer Studio v4 allows users to migrate projects from CCSv3.3 to CCSv4. The user has the flexibility of migrating a single project at a time or multiple projects at once. This way, if there are many projects in a single directory which need conversion from CCSv3.x to CCSv4, in one run, all the projects can be easily migrated.

To start the migration process, go to “Project->Import Legacy CCSv3.3 Project” to open the Project Migration Wizard.

19 migrate project.jpg

Migrating a Single Project from CCSv3.3 to CCSv4

  • In the Project Wizard, select the “Select Project:” radio button and browse to the CCSv3.3 .pjt project file you wish to migrate. In the below figure, the Example_2833xCpuTimer.pjt file is selected. Then hit the “Next” button.

20 select pjt migrate.jpg

  • Next, select the Code Generation Tools version desired for building the selected project.

21 migrate codegentools.jpg

  • If the legacy project included references to DSP/BIOS DELETE THEM even if your project does not use DSP/BIOS (See C2000 Getting Started with Code Composer Studio v4#Missing_Source_Files_Caused_by_References_to_DSP_BIOS for more details). Then the below screen will not show up during migration. If you are using DSP/BIOS select the DSP/BIOS tools version used for the project. Although the C2000 examples do not use DSP/BIOS by default, because the .PJT file includes an empty reference to the “DspBiosBuilder”, the migration wizard will select a default DSP/BIOS tools version. Hit the “Next” button.

22 migrate dspbios.jpg

  • De-select “Use common root for all migrated projects” to allow CCS to automatically determine the unique common root for all files referenced by the project and click “Finish”. (For more detailed information on defining a “common root” for project migration and the generated macros.ini file, see Portable Projects in CCSv4 for C2000).

23 singleproject commonroot.jpg

  • Congratulations! You have migrated a CCSv3.x project to CCSv4. In your project folder, you can now delete all files except:
  1. .cdtproject
  2. .cdtbuild
  3. .project
  4. Any source files and header files (.c,.asm,.h,.inc,.cmd,.lib, etc.) in the project directory

There is no need to keep the CCSv3.3 .pjt file.


Migrating Multiple Projects at Once from CCSv3.3 to CCSv4

  • In the Project Wizard, select the “Select search-directory:” radio button and browse to the directory holding all or some of the CCSv3.3 project folders you wish to migrate. In the below figure, the directory selected is: “C:/tidcs/c28/DSP2833x/v130/DSP2833x_examples/”. The migration wizard will then search for all legacy projects under the selected directory, and these projects will appear in the “Discovered Legacy Projects:” box. Check those projects you wish to migrate. Then hit the “Next” button.
  • Next, select the Code Generation Tools version desired for building the selected projects (same as with single project migration).
  • If the legacy projects included references to DSP/BIOS, select the DSP/BIOS tools version used for the project. Although the C2000 examples do not use DSP/BIOS by default, because the .PJT file includes an empty reference to the “DspBiosBuilder”, the migration wizard will select a default DSP/BIOS tools version. Hit the “Next” button. (same as with single project migration)

Migrate multiple pjts.jpg

  • Next, select the Code Generation Tools version desired for building the selected projects (same as with single project migration).
  • If the legacy projects included references to DSP/BIOS, select the DSP/BIOS tools version used for the project. Although the C2000 examples do not use DSP/BIOS by default, because the .PJT file includes an empty reference to the “DspBiosBuilder”, the migration wizard will select a default DSP/BIOS tools version. Hit the “Next” button. (same as with single project migration)
  • In the Set Advanced Options window, select the “Use a common root for all migrated projects” checkbox. This checkbox is used when multiple projects share a common root directory for files included in those projects.

Multiple pjts common root.jpg

For instance, the below figure shows the directory file structure for the projects being migrated. All projects to be migrated for this example are located in individual folders in the “DSP2833x_examples” directory. All of these projects include common header, source files, and libraries, under the DSP2833x_common and DSP2833x_headers directories which, in turn, are located under the “v130” root directory.

Directory structure.jpg

Because all the projects being migrated use common files under the “C:/tidcs/c28/DSP2833x/v130” root directory, the “Path” specified should be “C:/tidcs/c28/DSP2833x/v130”. Select also, a unique “Path-variable name”, which serves as a macro/replacement name for typing out the entire path. For this example, we have chosen “INSTALLROOT_2833X_V130”.

Note: In a given workspace, a path variable name/macro can only be defined only once for a particular path. In other words, “INSTALLROOT_2833X_V130” cannot be defined again for another project for a different path in the same workspace. Instead, a different path variable/macro must be defined. You can read more about macros and their usefulness when transferring projects from user to user or PC to PC on the following page: Portable Projects in CCSv4 for C2000.

When finished, click the “Finish” button.

  • Congratulations! You have migrated multiple CCSv3.x projects to CCSv4. In your project folders, you can now delete all files except:
  1. .cdtproject
  2. .cdtbuild
  3. .project
  4. Any source files and header files (.c,.asm,.h,.inc,.cmd,.lib, etc.) in the project directory

There is no need to keep any CCSv3.3 .pjt files.

Known Migration Issues

"No rule to make target" Error

The following build error(s) may occur with some imported projects:

C:\Program Files\Texas Instruments\ccsv4\utils\gmake\gmake -k all

C:\Program Files\Texas Instruments\ccsv4\utils\gmake\gmake: *** No rule to make target `myFile.obj', needed by `myApp.out'.

...

In those cases, right-click on the project with errors and select "Build Properties" from the menu. Under "C2000 Compiler->Directory Specifier:", examine the contents of the "Object file directory (default is .)(--obj_directory, -fr)". If the directory is identical to the contents of "Temporary file directory" or "Assembly file directory" (i.e. "<path>/Debug"), then there will be an error.

You can resolve the issue by:

  1. Changing this path to any other location.
  2. Delete contents of the box.
Fig. 15: Build Properties - Object File Directory

Missing Source Files Caused by References to DSP BIOS

By default, DSP/BIOS is not supported in the Microcontroller Core (code-size limited) version of CCStudio v4.0.0 as of RTM (July 20, 2009).

The problem is:

  1. If you are using the Microcontroller Core (code size limited) version of CCStudio v4.0, while migrating your project which has the reference to Tool="DspBiosBuilder" at the top of the .pjt file, you will receive a screen titled "Select DSP/BIOS Tools" with your example name next to a "Tool Version" of "0.0.0". The project appears to finish migrating, but none of your source files will link properly to your project, and building the project will fail.
  2. If you are using the full Platinum version of CCStudio V4.0, your project will migrate fine, and the migration tool will automatically fill in the DSP/BIOS tool version with whatever version fo DSP/BIOS has been installed with CCStudio v4.0. The project will also build fine. BUT: if you send your CCSv4 project to anyone using the Microcontroller Core version of CCStudio v4.0, they will not be able to build the project.

If your .PJT file has the text: Tool="DspBiosBuilder" near the top under the [Project Settings] category:

  1. Remove this before running the project migration tool in Code Composer Studio v4.x. OR
  2. Download DSP/BIOS 5.40 and XDCtools/RTSC into the same directory as your /ccsv4/ folder (default is C:/Program Files/Texas Instruments/) and restart CCSv4. The download link is: Download DSP/BIOS and XDCtools/RTSC here.

NOTE: This issue will be resolved in Code Composer Studio v4.0.1 which will be issued to Code Composer Studio v4.0.0 users via an auto-notification patch download. At that time, the Microcontroller Core (Code-size limited) version of Code Composer Studio will no longer have migration issues with CCSv3.3 projects which included references to the DspBiosBuilder tool.

Errors with "hello world" project using F281x Devices

Users who attempt to build the generic "hello world" template project via Code Composer Studio v4 Getting Started while setting any of the 281x (2812, 2811, 2810) devices as the target processor, may see the following errors:

"../2812_RAM_lnk.cmd", line 86: error: placement fails for object ".text", size

0x182a (page 0). Available ranges:

PRAMH0 size: 0xffe unused: 0xf89 max hole: 0xf89

error: errors encountered during linking; "Test.out" not built

This is because the "printf" command used in the "hello world" project takes a large amount of memory which is not available on the 2812 devices. The 281x linker command file, 2812_RAM_lnk.cmd, by default does not define enough memory for code (.text) to support the "printf" command.

For getting started on the 2812, users should instead start with the CCSv4 peripheral examples in the 2812 C/C++ Header Files and Peripheral Examples software package. A good "first project" to get started with is the "cpu timer" project following the same instructions on this wiki page as were used for 2833x devices.

Portable Projects in CCSv4 for C2000 (macros/linked variables/etc.)

Refer to: Portable Projects in CCSv4 for C2000.

Target Configurations: Device Target and Emulation Setup

With Code Composer Studio v3.3, in order to configure the device emulation settings for a target, the user must open the Setup CCStudio v3.3 utility, which is independent of the Code Composer Studio IDE to select the correct emulator and device GEL file for CCStudio. This then requires the user to close the CCStudio IDE and run the setup utility every time the target or emulator changes.

Code Composer Studio v4 includes emulator target configuration within the CCSv4 IDE itself. The user can specify different target configurations for different emulators and device settings either for general use, or for specific projects.

To see existing Target Configurations on your computer:

  1. Go to “View-> Target Configurations”.
  2. Any target configurations you have created will be under “User Defined”.

Target configurations view.jpg

To create a new target configuration (this MUST be done prior to anything you do on any device):

  1. Go to “Target-> New Target Configuration” OR in the Target Configurations window, click on the “New” icon (leftmost icon in toolbar at top of window): Target config new icon.jpg
  2. Select a File Name for your target configuration (for instance, F28335_XDS510USB.ccxml, if you are using an F28335 device and an XDS510USB emulator).
  3. Then select the “Use shared location” checkbox to save your new target configuration to the default location on your PC where CCSv4 looks for target configuration files, OR uncheck the box and select a project to associate the target configuration file to a particular project in the workspace.
  4. Hit the “Finish” button and follow the instructions on the “Cheat Sheet” that appears to select your “Connection” (emulator) and “Device”.

Programming to C28x Flash

An improvement in CCSv4 over CCSv3.3 is that the flash-programmer plug-in is now built into CCSv4. When you debug a project which has its source code and command linker file configured for flash memory, you no longer need to load the symbols only and then separately use the flash programmer plugin to program the code to flash. Instead, as long as the correct device target configuration is loaded, if CCSv4 detects that there is code in flash memory via the command linker file in your project, it will automatically program the relevant code to flash when you load your program.

To set up the flash programming settings and program to flash memory in CCSv4:

  1. First ensure that your target configuration is set up properly for your device.
  2. Go to "Target-> Launch TI Debugger"
  3. In Debug view, go to "Tools->On-chip Flash"
  4. Configure Flash settings – you can erase Flash from here as well.
  5. Then you can either: Click on the Debug “bug” icon, or Go to "Target->Debug Active Project", OR Go to "Target->Load program" and select the .out file you want to program. The CCSv4 IDE will automatically program/load the code to the appropriate memory locations in flash and/or RAM, similar to how code is automatically loaded to RAM for RAM-based projects.


Flash options.jpg


Note: Source code and linker command files still have to be pre-configured for Flash options the same as with CCSv3.3 (For instructions on how to do this, see your device-specific C/C++ Header Files and Peripheral Examples Quickstart Readme document located in the /docs folder of the install package)

For more information on Flash Programming for the 28x with CCSv4, visit the Code Composer Studio v4 Wiki page link: Flash_Programming_F28x

C2000 GEL File Migration

The device gel files from CCSv3.3 still work with CCSv4.0. Calls to manipulate projects (i.e. Build Project) and “WatchAdd()” functions to add variables to the watch window are no longer supported. GEL hotmenu items now appear in the “Scripts” pull-down menu.

More information on GEL files, including how to load GELs and which GEL functions are still supported can be found at the CCSv4 GEL Wiki page here: GEL

Register WatchAdd() in Device GEL Replaced by View->Registers

The C2000 device GEL files include “WatchAdd()” functions to all the peripheral registers, allowing the user to quickly add any peripheral’s registers to the watch window in CCSv3.x when not using the TI-provided C/C++ header files. Because the WatchAdd() function no longer works in CCSV4, the peripheral registers are now available via the Registers window, which can be accessed from "View->Registers". If using the TI-provided C/C++ header files (downloadable from device product folders on the TI website) while debugging, register structures defined in the header files can also be added to the Watch Window same as before. Expanding these register structures allows access to individual bit fields as well (i.e., adding "AdcRegs" to the Watch Window, will display all the ADC registers and their bit field expansions).

Enabling Function Profiling with CCSv4 for C28x Devices

HW Function Profiling is breakpoint based and not recommended for cases where there are a limited amount of breakpoints available (such as code in persistent memory like flash).
Note that function profiling for C28x is not officially supported (untested).
For other profiling options please visit the Profiling on C28x Targets wiki page.
If you wish to try this feature, enable it by taking the following steps:
  1. Browse to <INSTALL DIR>\ccsv4\DebugServer\bin\win32\SerializedProfileActivities
  2. Open 'ProfileFunctionsHW.prof_ini' in a text editor
  3. Under the list of ISA, add 'TMS320C28' to the list
  4. Save file and restart CCSv4
  5. The 'ProfileFunctionsHW.prof_ini' would now look something like:
[Name]
Profile all Functions for CPU Cycles 

[Events]
dataclass.pcdt.events.Cycles
dataclass.pcdt.events.CPU Cycles
dataclass.pcdt.events.cycle.Total

[EventClasses]
pcdt

[ISA]
TMS320C28
TMS320C56
TMS320C55
TMS320C621x
TMS320C641x
TMS320C671x
TMS470R1
TMS470R2
TMS470R3
TMS470Rd
TMS470Re

Other Resources

To discuss technical questions, the E2E Community is a great resource. Visit e2e.ti.com.




Forums on the E2E site include:

and many more...


CN C2000 Getting Started with Code Composer Studio v4