Tutorial Introduction PURPOSE: - To explain how to prepare a project for debugging and describe how to configure the CodeWarrior Debugger to communicate with various types of embedded hardware OBJECTIVES: - Explain how to configure the tools to generate symbolic information. - Describe how to select and configure the IDE Debugger for a specific communications protocol. - Describe how to launch the integrated Debugger. CONTENT: - 10 pages - 3 questions LEARNING TIME: -5 minutes This tutorial explains how to prepare a project for debugging and how to configure the CodeWarrior integrated Debugger. When properly configured, the CodeWarrior IDE automatically compiles, launches, and starts the Debugger. You can use the IDE Debugger to debug a program at the source-code level. Upon completion of this tutorial, you ll be able to configure the tools to generate the symbolic information required for debugging. You ll also be able to configure the Debugger to communicate with various types of embedded hardware. 1
Debug Info Your program MUST generate debug information in order to use the Debugger. Generate DWARF In the linker panel, turn on symbolics Edit ==> Target Name Settings ==> Chip Name Linker panel. Check Generate DWARF Info Note: When no Debug Information is generated for a target the Debug button becomes inactive. CodeWarrior normally creates stationery-based projects that have a specific Debug target. That target is pre-configured to be used while debugging using the connection methods specified during the New Project Wizard. For the debug button to be active, the linker must be configured to generate debug information, or symbolics. To manually enable symbolics generation, select the Generate DWARF Info option in the EPPC Linker preference panel. 2
Controlling Symbolics You MUST generate symbolics for a file to see source code when debugging that file. To control symbolics for a file --- Use the Project window Files view, or Link Order view (shown). Click the Debug column to toggle the dot. The dot means that, if symbolics are generated for the Build, then symbolics are generated for this file. Note: Build without symbolics for final release. You must generate symbolics for a file to see the source code when debugging. If you don t generate the file symbolics, you ll only see the assembly language for the file. CodeWarrior allows you to control symbolics for each individual file. To enable symbolics for a specific file, click in the Debug column next to the file to toggle the dot. You can toggle the symbolics generation for a group of files by clicking the column next to the group instead of each individual file in the group (only in Files view). Because symbolics are typically stored inside the output file, they make your final Build image larger. Also, the compiler adds hooks to the code so that the Debugger can take control, which makes the code run slower. Therefore, when preparing the release version of your program, you should turn symbolics generation off to reduce the image size and improve the performance. 3
IDE Preferences: Window Settings Use Edit ==> Preferences ; Go to the Debugger section of the IDE Preferences panels. Use panels at that location to control: The User Interface Windowing Default behavior You can adjust how the integrated Debugger operates when you start debugging a program, using global IDE Preferences. Several panels in the IDE Preferences window include options to configure how the Debugger uses windows. For example, one setting causes the IDE to hide all other open windows, such as the Editor windows, except those belonging to the Debugger. This helps you to reduce screen clutter as you debug your program. 4
IDE Preferences: Remote Connections An IDE Preferences panel allows you to adjust the integrated Debugger connections easily within CodeWarrior. The Remote Connections panel includes all of the pre-configured connection methods. You are able to add your own remote connection, or change one of the existing methods. This will keep track of the settings on a global IDE scale, and then connection methods in this list will be available for use in the Project settings windows. 5
Project Settings: Debugger Settings Use Edit ==> Target Name Settings ==> Debugger Settings Use panel to control: If/Where debugger stops on launch Cache symbolics between runs Log system messages Let s take a closer look at some of the target-specific Debugger panels that are local to each target. Settings changed for one target will not be changed for all targets. You use the Debugger Settings panel to configure the operation of the IDE s built-in Debugger. For example, you can adjust the time interval at which the Debugger gathers new information from the target hardware. This panel also includes options to configure the following: the path to relocated libraries the location to stop on launch, such at stop at main versus stopping at start up code 6
Project Settings: Connection Settings Use Edit ==> Target Name Settings ==> Remote Debugging Use panel to control: Connection Method Edit Connection Method settings The Connection Settings panel is used to configure the operation of the connection hardware. You use this panel to set the connection interface. You use the Connection Settings panel to specify the connection method to be used, and edit the connection. Note that editing a connection will modify its global settings and could affect other projects/targets that use that connection. The pull down list will show the complete list found in the IDE Preferences Remote Connections Panel. 7
Project Settings: Chip Name Debugger Settings Use Edit ==> Target Name Settings ==> Chip Name Debugger Settings Use panel to control: Target Processor Target OS Target Initialization Memory Configuration Download Options The EPPC Debugger Settings panel is used to control how the Debugger loads and starts a program under debug control. You can perform memory checks to ensure validity of the download and check for memory access errors. You can specify the Target Initialization File to use when initiating a debug session. You can also use a memory configuration file. This file programs the processor to safeguard sections of the target s memory from errant write accesses and thus to expose programming errors. Note that some hardware targets don t support this feature. 8
MetroTRK Protocol The Target Resident Kernel --- uses either serial or Ethernet communication. uses the Connection Settings panel for connection interface options. Hardware selections determine precise settings. Please refer to the Targeting Manual for details. MetroTRK features --- cannot debug ROM, that is, software breakpoints. are provided as source code and libraries. have hardware initialization built-in. Let s take a closer look at MetroTRK. MetroTRK is Freescale's own embedded monitor for debug support. It has a small memory footprint and uses a minimum of system resources. MetroTRK typically uses a serial port-based connection protocol to communicate with the IDE s Debugger. A version of MetroTRK that uses an Ethernet connection is available for some platforms. The source code for MetroTRK is provided so that you can tailor the monitor to meet special hardware target needs. The source code is factored so that you can readily modify MetroTRK to use a different connection interface or execute a unique initialization sequence for custom hardware. 9
Connecting to Embedded Hardware Follow the directions given in the Targeting Manual. Follow the directions provided with the device. Example devices include: WireTAP, PowerTAP, BDM, and Serial Cable. The connection will be valid if the Debugger can download a file. Because hardware and communications protocols vary widely, we won t discuss how to connect your computer to a specific embedded hardware target. Instead, this page provides general directions for the procedure. For target specific directions, refer to the Targeting manual that came on the CodeWarrior software setup CD. Also, you should refer to the connection hardware manual for directions on how to attach the embedded board to the computer. 10
Question What does a black dot signify in the Debug Column of the Project Manager Link Order View? Click on your choice. A) That no symbolics are generated for that specific file. B) Generates DWARF information for the entire project. C) That symbolics are enabled for that particular file. Let s complete this tutorial with a couple of questions. What does a black dot signify in the Debug Column of the Project Manager Link Order View? Answer: A black dot in the debug column signifies that symbolics are enabled for that particular file. 11
Question A CodeWarrior Project s LOCAL settings provide you the ability to configure which of the following debugger options? Click on your choice. A) The location to stop upon launching the debugger. B) Whether to cache symbolics between runs C) The Target Initialization File to use. D) All of the above. A CodeWarrior Project s LOCAL settings provide you the ability to configure which of the following debugger options? Answer: All of those options are found in each and every projects settings. 12
Tutorial Completion The CodeWarrior IDE supports many processors and connection interfaces. The IDE s built-in Debugger uses these interfaces and communications protocols to inter-operate with the target hardware. You use several settings panels to select the interface, its communications protocol, and how it manages the download of the program to the test hardware. Let s review some of the features of the CodeWarrior IDE that we discussed in this tutorial. CodeWarrior can inter-operate with a wide variety of processors using different connection interfaces and protocols. You select which interface to use and configure its communications protocol using various settings panels. The type of support available for each platform varies. For custom hardware, you have the option to use the debug monitor. The MetroTRK establishes communications with the IDE Debugger and operates the program under the Debugger s control. Its source code is available so that you can tailor it to a unique embedded system design. 13