Connect the debugger to a running target¶
Connecting the debugger to a target can help when you want to see the status of your target after it has been running for several hours, or even days; or if you cannot reproduce a crash with the debugger attached. Once the debugger connected to the target, all the usual functionalities (break points, step-by-step, variable view, ROV, memory view…) are available.
This step-by-step guide will help you to configure CCS in order to connect to a running target
Modify the GEL file
In a very simplistic view, the GEL files describe the way the device’s debugger has to act (more details can be found in the CCS’s help). By default, the GEL files ask the device to reset when the debugger is started up. Fortunately we can modify this:
Identify the GEL file to modify
Start a debug session as always
(If needed), display the debug view
Right-click on the program being, “Open GEL files View”.
In the GEL files list, open the corresponding GEL file by double-clicking it. Chose cc26x2.gel for CC26x2 and CC13x2 devices. Chose cc26x0.gel for CC26x0 and CC13x0 devices.
Locate the GEL file to modify.¶
locate_gel_fileshows how to find the GEL file to modify.Note
Another possibility consists in looking directly in
<CCS directory>\ccs_base\emulation\gelfor the GEL file.Caution
The modifications done in a GEL file affect all the devices using the same GEL files. In other words, it affects all the CC26X2 and CC13X2 if you modified cc26x2.gel, and all the CC26x0 and CC13x0 if you modified cc26x0.gel. By default, two different CCS versions do not use the same GEL files.
In the
StartUp()function, comment out the code executing the reset. If needed, an explicit comment will help you to identify the code to comment out.The StartUp() function after modification.¶1StartUp(int major, int minor, int patch) 2{ 3 /* Initialize memory map */ 4 memorymap_init(); 5 6 /* Debugger specific handling */ 7 if(GEL_MatchesConnection(".*TIXDS.*") == 1) 8 { 9 GEL_LoadGel("$(GEL_file_dir)/cc26xx_connect_util.gel"); 10 GEL_LoadGel("$(GEL_file_dir)/cc26x2_xds.gel"); 11 12 DefineResets(0); 13 14 // Issue Board Reset to ensure device is in a known state 15 // Note: If you want to attach to a running target without resetting the 16 // device, you must comment out the following 4 lines: 17 // if(!GEL_IsConnected()) 18 // { 19 // GEL_AdvancedReset("Board Reset"); 20 // } 21 } 22 else if(GEL_MatchesConnection(".*JLink.*") == 1) 23 { 24 GEL_LoadGel("$(GEL_file_dir)/cc26xx_jlink.gel"); 25 } 26 else 27 { 28 GEL_TextOut("Error: Unknown debugger.\n"); 29 return; 30 } 31}
Save your modification and close the file. Stop your debugging session
Caution
The modification of the debug configurations only affects one project.
Modify the Debug Configuration of your project
Once you have clicked CCS’s debug button (the green bug), CCS is doing a lot of actions for you. For example, CCS loads the program and stops the execution of the code on the target. In our case, we don’t want CCS to load the program (as we already have a running program…). In addition, we don’t necessarily want to stop the execution of the code on the target. Fortunately, the way CCS is running a debug session is highly configurable. So let’s adapt those configurations to our needs.
On the right of the Debug button, there is an arrow. Click this arrow and select Debug Configurations….
Select your project
Prevent CCS from loading the program: in the Program tab, chose the proper Loading options (Load symbols only)
Open the Debug configurations and modify the loading options.¶
Prevent CCS from stopping the target: in the Target tab, deselect the option Halt the target on a connect
In the Debug configurations, modify the Connection options.¶
[Optional] Prevent CCS from building the program before load
As no program will be loaded, it is a bit useless to ask CCS to build an image when you start a debug session. As result, you can disable this option by using the small arrow at the right of the Flash button. Click on Build Project Before Load in order to disable the option.
Disable “Build Project Before Load” option.¶
Now, the debug button does not anymore load code on the device. So, how can you load a new image on the device? The easiest way is to use the Flash button and select the image to flash. Don’t forget to rebuild your image manually (as we have disabled the option before). Another solution consists in undoing all the configuration changes we did before. A third solution consists in using a different version of CCS.
Tip
You are all set now! Let the code running and, when needed, connect to the running target by using the Debug button as you usually do.