64
CCStudio IDE Tips & Tricks Last Modified: 3 Sept 2008

CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

  • Upload
    lamkiet

  • View
    227

  • Download
    1

Embed Size (px)

Citation preview

Page 1: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

CCStudio IDE Tips & Tricks

Last Modified: 3 Sept 2008

Page 2: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Topics

• Windows Management• CCS Startup• Project Management / Building• Debugging• GEL• Miscellaneous• Improving CCS Reliability

Page 3: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Window Management

• Window styles

• Multiple monitor support• Switching between docking and

floating

Page 4: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Window Styles

Free Floating•Always on top•Able to move outside CCS frame

MDI•Displays within editor client area•Able to cascade, tile…

Docked•Anchors to side of CCS frame

•Proportionally resized when new window docked

Page 5: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Windowing Tip

2 Window Sizes•Remembers size in docked and free floating states•Double-click to switch between states

Double-click here

Page 6: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Windowing Tip

• Hold CTRL when dragging a window to keep it from docking– You know you are doing it correct when you see an empty

rectangle being moved around

Page 7: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Monitor # 2Monitor # 1

Multiple Monitor Support

• Useful for PDM and multi-task configurations– Put ARM on one screen and DSP on the other…– Put different task-specific control windows on

different monitors

Page 8: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Monitor # 1

Multiple Monitor Support• Single processor configuration

– Can arrange free floating windows on the second monitor– Alternatively stretch the control window across both monitors

and align one of the docking frames with the edge between monitors (so that source files show up in one monitor)

Monitor # 2

Page 9: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

CCS Startup

• Workspaces• Shortcuts• GEL Startup• Multiple Users

Page 10: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Workspaces• Use workspaces to load

projects, save breakpoints, probe points, window positions…

• Default workspaces– Default.wks is saved

automatically when you shutdown CCS (located in <install dir>\cc\bin)

• Load it to get your old workspace back

– Put this in your cc_appshortcut if you want it automatically loaded as well

Page 11: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

CCS Desktop Shortcuts

• cc_app.exe shortcuts– Cc_app.exe workspace.wks

• cc_setup.exe shortcuts– Import CCS setup configuration, launch CCS, open

workspace with one shortcut• CC_setup.exe –i ”config.ccs” –startCCS

workspace.wks

– Create a shortcut for each target configuration

Page 12: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Use GEL for Startup

• Startup GEL files– Configure memory map– Define extra reset behavior

• Loading additional GELs– GEL_LoadGEL()– Hotmenu items to load additional GELs

Page 13: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Multiple Users• Batch file

– Copy in personal cc_app.ini, cc_app.key, exclude.dat, macro.ini (if exists)– Configure setup, launch CCS– Use another batch file to save copied in files back to personal folder– Create a CCS desktop shortcut that calls the batch files

REM RestoreUser1.bat

REM copy in personal ini filecopy cc_app.ini ..\..\cc_app.ini

REM copy in personal key filecopy cc_app.key ..\..\cc_app.key

REM copy in personal exclude filecopy exclude.dat ..\..\exclude.dat

REM copy in personal default workspacecopy default.wks ..\..\default.wks

REM Launch setup utility, configure target for C641 6 simulator, launch CCStudio..\..\cc_setup.exe -i ..\..\..\..\drivers\import\c6416_ltl_endian_functio nal_sim.ccs -startCCS default.wks

exit

REM SaveUser1.bat

REM save personal ini filecopy ..\..\cc_app.ini cc_app.ini

REM save personal key filecopy ..\..\cc_app.key cc_app.key

REM save personal exclude filecopy ..\..\exclude.dat exclude.dat

REM save personal default workspacecopy ..\..\default.wks default.wks

exit

Page 14: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Project Management / Building

• Working with Project Files• Macros/variables• Custom build steps• Custom files• Header files• Batch builds• Makefiles• Source Control

Page 15: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Editing the Project File

• Project files (*.pjt) are text– can be edited using any text

editor

• Some settings have no GUI– Edit the project file directly

to change settings that can’t be done within the IDE after initial project creation:

• Project Type (ProjectType)• Target (CPUFamily)

• Create Portable Projects– Edit the project file directly

to take advantage of custom macros to create a ‘portable project’

Page 16: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Macros

• Utilize user variables in project files• Purposes:

– Portable projects– Multi-user development

• Built-in variables:– $(Install_dir)– $(Proj_dir)– …

• Define custom variables– E.g. SourcePath1

• Values to be defined in macro.ini located in <install dir>\cc\bin– Defined: SourcePath = C:\ti\myprojects\project\source– Usage: $(SourcePath)

• Application Note:– http://www-s.ti.com/sc/psheets/spra913/spra913.pdf

Page 17: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Maintaining Many Project Files

• Take advantage of “options”files for projects that share many of the same options– Remove all commonly

shared options from the *.pjtand put them in an “options”file that gets referenced by all the projects

– Can change compiler options for many projects by changing just one options file

#shared_options.opt#standard compiler options -q -mv6710 -ml3 -mpic -pdsw225 -mo

Page 18: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Custom Build Steps• Project Level

– Initial Build Steps• Run prior to initiating application build

– Final Build Steps• Run after link

• File Level– Pre Build Step

• Run prior to compile, assemble…– Post Build Step

• Run after compile, assemble… but before next file starts

– Custom• Run instead of compile, assemble…

– Exclude• Excludes the file from the build process for that configuration

Page 19: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Custom Files (2.40+)

• Add ‘custom’ files to the project– ‘Custom’ files are file types not

recognized by CCS– Custom files are added to the

‘Documents’ folder in the Project View

• Have the built-in editor recognize custom files – Edit FileExt.ini in .\cc\bin\editor

and add additional entries for the custom files

– Double-clicking on the file in the Project View opens the file in the editor

…text:Generated List Files (*.lst):*.lsttext:Configuration Files (*.tcf;*.cdb):*.tcf;*.cdbtext:Perl Files (*.pl):*.pl

Page 20: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Custom Files - Building

• Use the ‘File Specific Options’ to configure CCS on how to ‘build’the custom file:– Build Command: Utility to build

the file (i.e. perl.exe cscript.exe, etc)

– Outputs: The output generated by the build command (generated source file, object file, etc). If the file generated is recognized by CCS (ex. *.c file) then that file is then added to the build

Page 21: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Hiding Unwanted Header Files

• Default behavior– CCStudio hides system and bios

header files from the ‘Include’ folder in the Project View

• Exclude.dat– Specifies files to be hidden– <install dir>\cc\bin\exclude.dat– Add or remove entries in the list to

suit your personal preference

Page 22: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Building from the Command Line

• timake.exe– Command-line build utility that accepts CCS project files– Uses the same DLLs as CCS to do the builds

• i.e. result is identical to using CCS

• Exporting *.pjt to makefile– It is possible to export a standard makefile from a CCS

Project– For dependent projects a series of makefiles will be created– If you want to use the makefile on Unix you will need to

make modifications to paths– Application Note SPRA762:

• http://focus.ti.com/lit/an/spra762/spra762.pdf

Page 23: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Using Makefiles in CCS

• External make support– Parses makefile to create

dummy project file that ‘wraps’the makefile

– CCS build command launches make utility specified

• Use GEL to call make– GEL_System(“”);– Create menu items for

incremental, full, different configs…

Page 24: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

CVS

• CCS supports the MS SCC API for source control integration

• By default CVS does not implement the MS SCC API• WinCVS + Igloo plug-in adds support for this API

allows it to function with CCS

Page 25: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

ClearCase TM

• Reloading files modified outside CCS– Select the option to auto reload the files (CCSv2.30+)– Pre 2.30 close files after check-in then open from the project view

• Version Tree– Launch using a GEL function

• GEL_System("cleartool lsvtree D:\\snapshots\\my_view\\somefile.c");

• Incremental build not working?– Are you using a dynamic view?

• There are settings for snapshots that make the files update to the current time. The dynamic view could be updating the files to the current time periodically. This would cause a lot of network activity and it would prevent incremental build from working.

• Performance– Same issue with dynamic views listed above– CodeMaestro (CCS 2.2) can significantly slow things down (turn it

off)

*ClearCase and Rational are registered trademarks of IBM

Page 26: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Debugging

• Working without project files• Conditional Breakpoints• Watch Window• Viewing Registers• Logging• Running• Debug on multi-processor targets

Page 27: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Source Search Paths

• CCS needs to know where source files are located– Source files in open project files are known to CCS– Setup Source Directory Search paths for source files not in

CCS project files• Automate this using GEL

Page 28: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Conditional Breakpoints• Condition can be any GEL expression

– Simple: R1 == 0x00001234

– Complex: call a built in or custom GEL function

• Setting conditions– Breakpoint manager– Editor context menu

• Count– Specify # of times

to skip the breakpoint

Page 29: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Watch Window Tips• Multiple instances

– You can open more than one watch window

• Freeze– Stops watch window from updating– You can open 2 watch windows, freeze one at a certain

point and then later compare values

• Default Radix (2.30)– Make it so all new items use hex…

• Multiple select– It is possible to select multiple items and then change the

radix or delete…

• Open memory window (2.30)– Open memory window at location of variable

Page 30: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Viewing Registers• CCS Register windows

– Provide visibility and access to CPU and some peripheral registers

– View -> Registers

• Create a custom register window using the watch window (pre 3.2)– Open a watch window and add the registers you want (save screen real-

estate)• Automate this by writing a GEL script that creates a menu item for opening a watch

window and adding your list of registers• You can even give an item a name and specific the display format

– GEL_WatchAdd("*(int *)0x1000,x", “Label");– X is the format (in this case hex)– Label is the name that will appear in the watch window

– CCS 3.2+ Register Window supports creating custom register windows

• New Register Window in CCS 3.2+– Register window that is driven by XML files

– You define what you want to see and how you want to see it and access it• Specify memory mapped registers, define bit fields, etc…

Page 31: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Logging Output to File

• Automatically have output streamed to file– Build– CIO– Messages– Find in Files– Source Control

• Controllable from GEL– GEL_TransfertoFile()– GEL_StopTransfertoFile()– GEL_TransfertoFileConfig()

• Access from context menu of output window

• TIP– Use GEL and a Probe Point to trigger logging

at a certain point in code

Page 32: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Running• Run

– Target will halt when a breakpoint is encountered

• Animate– When a breakpoint is encountered

• Execution halts• Windows are updated• Execution resumes

• Free Run– Breakpoints are disabled

Page 33: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Multiprocessor Setup (3.0+)

• Provide ‘Master/Slave’ designation for each processor in setup– Ensures that CCS will connect to the ‘master’ first,

then ‘slave’ on a board level connect command

Page 34: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Multi-processor Debug• Global breakpoints

– Breakpoint on one processor will halt all processors– Enable from Parallel Debug Manager (PDM)

• Synchronous operations– Controlled from Parallel Debug Manager (PDM)– Step, run, halt, load program, etc…

• PDM option for always on top

Page 35: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

GEL

• Background• Callback Functions• New GEL Features• GEL Tips• Examples

Page 36: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Background• Majority of built-in GEL functions are asynchronous• Interface to debuggers expression evaluator• You can enter expressions/functions in:

– GEL file– Watch window– Conditions on breakpoints/Probe Points– GEL Toolbar– Command Window

• Expression list– View -> Expression List– Shows the queue– Can abort expressions being evaluated

Page 37: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

GEL Tip

• GEL can run any windows executable– GEL_System(“command”)– Create a GEL file with hotmenus for other utilities that you

use in conjunction with CCS• Launch make• Perform CVS operations

• Remember: Many built-in GEL functions are asynchronous in behavior!– Keep this in mind when creating GEL scripts where actions

rely on the previous action being completed

Page 38: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Callback Functions• Startup()

– Executed when CCS is launched

• OnTargetConnect()– Executed after CCS established connection with the target

• OnPreFileLoaded()– Executed before loading a program

• OnFileLoaded()– Executed after loading a program

• OnReset()– Executed after a reset

• OnHalt()– Executed after a user halt

Page 39: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

GEL Global Variables

• GEL globals are supported in CCStudio 3.1+– Declare global variables outside function scope– Use recommended format: ‘gGEL_variableName’

int gGEL_initialStartup = 1;

StartUp(){

gGEL_initialStartup = 1;}

OnTargetConnect(){

if ( gGEL_initialStartup ){// assume first time connection to target// do first time initialization steps// then clear value of gGEL_initialStartupgGEL_initialStartup = 0;

} else {// assume this is a “re-connect” with no target powe r cycle and// “one time” target initialization steps already do ne

}}

Page 40: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Relative Paths with GEL

• New built-in GEL macro $(GEL_file_dir) is supported in CCS 3.1+– $(GEL_file_dir) refers to the location of the

current GEL file• GEL_LoadGEL(“$(GEL_file_dir)\\..\\..\\gel\\mygel.gel”);

– Avoid using absolute paths in your GEL file (make your GEL files portable)

Page 41: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

More GEL Tips

• #define macros for strings and paths

#define OUTFILE “$(GEL_File_Dir)\\..\\..\\app\\Debug \\app.out”#define LOAD_MSG “Application Loaded!”

hotmenu LoadApp(){

GEL_Load(OUTFILE);GEL_TextOut(LOAD_MSG);

}

Page 42: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Example: Auto-add Source Paths

• Utilize the GEL callback function OnFileLoaded() to auto-add your source search paths when you load your *.out file

#define SRC_DIR_1 “C:\\app\\main\\sourcedir1”#define SRC_DIR_2 “C:\\app\\main\\sourcedir2”

OnFileLoaded(int nErrorCode, int bSymbolsOnly){

// add the source search path(s)// add your source path directories hereGEL_SrcDirAdd( SRC_DIR_1 ); GEL_SrcDirAdd( SRC_DIR_2 );

}

Page 43: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Example: Calculate Exponents

pow(double base, double exp) {double answer = 1; // initializedouble temp;int i; // counter for loopif (exp == 0){

return 1.0;}

if (exp > 0){

for (i = 1; i<=exp; i++) // multiple answer by base exp timesanswer = answer * base;

}else // (exp < 0){

temp = -1.0 * exp; // make exp a positive numberfor (i = 1; i<=temp; i++) // multiply answer by base exp times

answer = answer * base;

answer = 1.0 / answer;}

return answer; // return value stored in answer}

• pow– Used to calculate exponents

Page 44: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Example: Periodic Execution of a GEL Function

menuitem "test";

hotmenu EnableMessageFlagChecker() {GEL_SetTimer(20 /* interval in ms*/ , 1 /* timer id */ ,"MessageFlagTest()" /* function to run */ );

}

hotmenu DisableMessageFlagChecker() {GEL_CancelTimer(1 /* timer id */ );

}

MessageFlagTest() {if (flag == 1 ) {

GEL_TextOut("Bad message flag.\n");}

}

• Configure timers that trigger a GEL function at a set interval– Check for error flags

Page 45: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

menuitem "Keep Alive";

hotmenu Enable() {GEL_SetTimer(20 /* interval */ , 1 /* timer id */ ,"PokeWatchDog()" /* function to run */ );

}

hotmenu Disable() {GEL_CancelTimer(1);

}

PokeWatchDog() {*0x8000 = 1;*0x8010 = 1;

}

• Second example– Use for keeping a target alive (if there is a power down watch dog)

Example: Periodic Execution of a GEL Function

Page 46: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Example: Logging Variables, Data… (Trace)

• You can configure CCS to log a set of variables, memory locations… every time the processor is halted

• Try using the multiple operations toolbar to step all of the waythrough a routine and gather trace data

OnHalt(){

GEL_TextOut("Program Counter: %x\n", "Trace Display" ,,,,PC); //Output the PCGEL_TextOut(" Accumulator 0: %x\n", "Trace Display ",,,,AC0); //First item to traceGEL_TextOut(" Accumulator 1: %x\n", "Trace Display ",,,,AC1); //Second item to traceGEL_TextOut(" Accumulator 2: %x\n", "Trace Display ",,,,AC2); //Third item to traceGEL_TextOut(" Accumulator 3: %x\n", "Trace Display ",,,,AC3); //Forth item to trace

}

menuitem "Trace Display"

hotmenu ClearTraceDisplay() //used to close the Trace Display window and clear the buffer{

GEL_CloseWindow("Trace Display");}

Page 47: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Example: Debugging Overlays• Use GEL_SymbolShowSection() and GEL_SymbolHideSection() calls

to display the current overlay section• Automate this using GEL

– Set a conditional breakpoint that will evaluate a GEL expression (ex. DynamicSymbolLoader(int index) ) in the application where the overlay copy occurs

#define OUTFILE "$(GEL_file_dir)\\Debug\\overlay_exa mple.out"

DynamicSymbolLoader(int index){

if ( index == 0 ) {

GEL_SymbolHideSection(OUTFILE, ".textFIR"); //hide old symbolsGEL_SymbolShowSection(OUTFILE, ".textFFT", 0x200, 0 x200); //show current symbols

}else {

GEL_SymbolHideSection(OUTFILE, ".textFFT"); //hide old symbolsGEL_SymbolShowSection(OUTFILE, ".textFIR", 0x200, 0 x200); //show current symbols

}

return TRUE}

Page 48: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Example: Dynamic Symbol Loading

// Load symbols for DLL loaded on targetDynamicSymbolLoader(int index /*which DLL is loaded */ ){

// remove symbols for previous DLLRemoveOldDLLSymbols();

GEL_TextOut("Loading symbols for DLL: 0x%x\n",,,,,in dex);

// load symbols with relocation information for the currently loaded DLL if (index == DLL1) {

// The last two parameters are needed only in heter ogeneous debug session (See online help)// NOTE: string paths are CASE sensitiveGEL_SymbolAddRel(DLL1_PATH, DLL1_CODE_START, DLL1_D ATA_START, “C5510” /*, board_name */ );

}else if (index == DLL2){

GEL_SymbolAddRel(DLL2_PATH, DLL2_CODE_START, DLL2_D ATA_START, “C5510” /*, board_name */ );}else if (index == DLL3){

GEL_SymbolAddRel(DLL3_PATH, DLL3_CODE_START, DLL3_D ATA_START, “C5510” /*, board_name */ );}else{

GEL_TextOut("Symbols not loaded. Undefined DLL speci fied: 0x%x\n",,,,,index);

}

gGEL_DLLSymbolsLoaded = index;

// return TRUE; // return TRUE if want to stay halt ed on conditional breakpoint// otherwise will continue execution upon return

}

• Code Loaded from ARM to DSP– Hit breakpoint/probe point on ARM trigger symbol load on DSP using GEL

functions in condition of breakpoint

Page 49: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Example: Dynamic Symbol Loading

DynamicSymbolLoader(int Index){

if ( Index == 0 ) {GEL_SymbolRemove(“symbol file”, “CPU name”, “board n ame”); //remove old symbolsGEL_SymbolAdd(“symbol file”, “CPU name”, “board name ”); //add new symbols

}else if ( Index == 1 ) {

…}

}

• Code Loaded from non-CCS controlled processor– Configure the GEL OnHalt() function to load the correct symbol file when

the DSP is haltedOnHalt(){

if ( address == value1 ) {GEL_SymbolRemove(“symbol file”, “CPU name”, “board n ame”); //remove old symbolsGEL_SymbolAdd(“symbol file”, “CPU name”, “board name ”); //add new symbols

}else if ( address == value2 ) {

…}

}

• Code Loaded from ARM to DSP– Hit breakpoint/probe point on ARM trigger symbol load on DSP using GEL

functions in condition of breakpoint

Page 50: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Example: Dynamic Symbol Loading

• Option 3:– Load all symbols at start of debug session– Use GEL_SymbolShowSection() and

GEL_SymbolHideSection() calls to display correct symbols• GEL_SymbolShowSection( "fileName", "sectionName",

codeStart, dataStart [, "cpuName"] [, "boardName"] );

– Fastest option– Requires unique sections

Page 51: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Dynamic Memory Maps

• If the memory map of the target changes while it is running this can cause debugger instability (especially if some regions become inaccessible)

• If you have a way to determine what the memory map is supposed to be by reading some value (register, variable, memory location) you can configure CCS to change the memory map when the DSP is halted– Define the GEL OnHalt() callback to read the value and then

setup the appropriate memory map

Page 52: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Miscellaneous

• Multiple Installations / Unstallations• Customizable Options• CCS Monitor

Page 53: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Multiple Installs of CCS

• Issues of multiple installs of different versions CCS on the same PC continue to exist– CCS automatically detects plug-ins from a recently installed

CCS version and will try to enable them with the existing version of CCS (and vice versa)

• Causes headaches since you do not want to use plug-ins from other CCS versions (i.e. CCS 2.x plug-ins for CCS 3.1)

– Rare cases where some essential components are not enabled by default (Project Server, etc..) upon install

• Key feature with a CCS install does not work? Associated component may not be enabled!

Page 54: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Workaround• Check Component Manager and make sure only

valid components are enabled for that particular install

TIP: Check validity of the path of the component

Page 55: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Uninstallation of CCS

• CCS still has a few issues ‘cleaning up after itself’ on uninstall– Leftover files– Leftover registry entries

• Remaining registry key values of uninstalled CCS versions can conflict with newly installed CCS versions

• CCS 3.2+ will help address this issue by better cleaning up the registry after uninstall

Page 56: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Custom Settings

• Automatic actions– Load program after build– Go main after load– Open disassembly after load– Auto-save project file on build

• Resetting directories on project open• I wish CCS would behave this way

– Check the customize dialog, it might be possible

Page 57: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

CCS Monitor

• CCSv2.30 and later have a utility that monitors CCS• Indicates when CCS is:

– Starting up– Shutting down– Hung– OK

• Can be used to kill CCS processes– Cc_app.exe– Cc_setup.exe– Comp_mgr.exe

Page 58: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Tips for Improving CCS Reliability

• Memory Maps

• ‘Running into the Weeds’• Disabling CodeMaestro

Page 59: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

• Memory Mapping is the MOST effective way to avoid emulation errors.– These error messages are often no fault of the

emulator/driver. – If accessing invalid memory causes problems on the

hardware, Memory Mapping allows the user to tell the driver not to access it.

• This is usually set up by the GEL file.

Suggestion #1 Memory Mapping

Page 60: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Example - Breakpoints

• When a software breakpoint is set, the emulation driver replaces part of the instruction opcode with a software breakpoint opcode.

A: If the debugger/driver is not aware of the memory being ROM, the user will get an error message “Cannot set/verify breakpoint.” If it is known to be ROM, a hardware breakpoint will be chosen.

Q: What happens if we try to set a breakpoint in ROM?

Page 61: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Potential Problems Fixed by Memory Mapping

• Hardware/Software Breakpoints in Flash/ROM

• I/O Memory Errors for unimplemented I/O Space

• Debugger wandering over memory boundaries

• Code Downloads when linked improperly

• Debugger writes corrupting Flash controllers

Page 62: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Suggestion #2

• Ensure that the “little things” are configured correctly– Does the Linker Command file match the target

memory– Are the Peripherals configured correctly? (Ex.

EMIF)– Ensure that CCS Setup represents the correct

scan chain.– Could the target application be misbehaving as

such to cause a crash and/or emulation errors?

Page 63: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Running into the Weeds?• Suggestion #3 Try filling unused memory regions with

Halt– C5400: 0xF4F0, C6000: 0x10001000– If the CPU tries to execute from this memory it will

halt as F4F0 is ESTOP– Only works on hardware– GEL_MemoryFill(start address, page, length,

0xF4F0)

Page 64: CCStudio IDE Tips & Tricks - Texas Instrumentsprocessors.wiki.ti.com/images/d/d3/CCStudio_Tips_and_Tricks.pdf · • Project files (*.pjt) are text – can be edited using any text

Suggestion #4: CodeMaestro

• Try turning off the CodeMaestro under Options -> Customize -> CodeMaestro if you are frequently crashing and have a very large project– CCStudio 2.30 does not have CodeMaestro

• CCStudio 3.1+ has CodeWright as the integrated editor and CodeWright’s more robust ‘CodeSense’has replaced CodeMaestro