DebugFactory Builder for MN103S Tutorial
September 29, 2006 2nd Printing
Software & Solutions Development Center 2-2
Corporate System LSI Division
Semiconductor Company
Matsushita Electric Industrial Co., Ltd.
1
0. Introduction....................................................................................................................4
0.1. Purpose..................................................................................................................4 0.2. Requirement..........................................................................................................4 0.3. Organization..........................................................................................................4 0.4. Other information .................................................................................................4
1. What is DebugFactory Builder? .....................................................................................5 1.1. Overview................................................................................................................5 1.2. Operating environment ........................................................................................7 1.3. Design mode / Debug mode...................................................................................7 1.4. Target environment ..............................................................................................7 1.5. License...................................................................................................................8
2. Preparation ....................................................................................................................9 2.1. Installation............................................................................................................9 2.2. Run the program.................................................................................................12 2.3. Window configuration .........................................................................................13
3. Use DebugFactory Builder...........................................................................................15 3.1. Basic development flow ......................................................................................15
3.1.1. Read a project...............................................................................................15 3.1.2. Coding...........................................................................................................17 3.1.3. Create an executable file (Make).................................................................18 3.1.4. Debug ...........................................................................................................18
4. Commonly-used functions ...........................................................................................24 4.1. Project..................................................................................................................24
4.1.1. Create a new project (Project creation wizard)...........................................24 4.1.2. Add a file to the project................................................................................28 4.1.3. Create a project for debugging ....................................................................29 4.1.4. Create a project from an execution file .......................................................30
4.2. Make ....................................................................................................................33 4.2.1. Specify the way to make ..............................................................................33 4.2.2. Select language tools ...................................................................................34 4.2.3. Specify paths of header files for language tools, and paths of library files 35 4.2.4. Option setting for language tools ................................................................36 4.2.5. Section setting of an executable file............................................................36 4.2.6. Set an execution file name ..........................................................................37
2
4.3. Debug...................................................................................................................38 4.3.1. How to set debugging function ....................................................................38 4.3.2. Set Software break / Hardware break ........................................................38 4.3.3. Execute a program.......................................................................................41 4.3.4. Display / Change register ............................................................................41 4.3.5. Display / Change memory ...........................................................................42 4.3.6. Display / Change variable ...........................................................................43 4.3.7. Display execution history ............................................................................45
5. Useful functions ...........................................................................................................48 5.1. How to run DebugFactory Builder .....................................................................48
5.1.1. Settings for startup......................................................................................48 5.1.2. Command options ........................................................................................48
5.2. Control debug mode ............................................................................................49 5.2.1. Control by commands ..................................................................................49 5.2.2. Settings for debug mode ..............................................................................49
5.3. User processing of make function ......................................................................50 5.4. Measure performance .........................................................................................50
5.4.1. Profile function (PROF) ...............................................................................50 5.4.2. Coverage function (COV) * Only when the target is a simulator..........51
5.5. Edit /Execute macro............................................................................................51 5.6. Save debugging functions ...................................................................................53
5.6.1. Save/Load debugging settings.....................................................................53 5.6.2. Restore previous debug setting ...................................................................53
5.7. Customize............................................................................................................53 6. Appendix......................................................................................................................55
6.1. Debug function list..............................................................................................55 6.1.1. In-circuit emulator.......................................................................................55 6.1.2. Onboard (Dwire/JTAG)................................................................................56
6.2. Environment file (*.df4 / *.dft / DFbuild.ini) .....................................................58
3
0. Introduction 0.1. Purpose
This tutorial is written to present basic functions of Integrated Development Environment (DebugFactory Builder for MN103S, hereinafter DebugFactory Builder) and how to operate it.
0.2. Requirement This tutorial is for users who have general knowledge of microcomputer, C language, assembler and debugger, and basic knowledge about Microsoft Windows operation method.
0.3. Organization This tutorial is divided into 6 chapters as follows:
Chapter1 Introduction Chapter2 What is DebugFactory Builder? Chapter3 Use DebugFactory Builder Chapter4 Commonly-used functions Chapter5 Useful functions Chapter6 Appendix (Debug function list)
0.4. Other information This tutorial does not describe individual functions of DebugFactory Builder in detail, but describes representative operations, mainly menus, as means to realize the functions. Please note that other means such as tool buttons of tool bars or shortcuts can also be used, however not all of means are explained here. For details, refer to the online documentation, from the [Start] menu, select [Program]-[Panasonic DebugFactory Builder4]-[Mn103s]-[Help].
4
1. What is DebugFactory Builder? 1.1. Overview
DebugFactory Builder is the integrated development environment for the microcomputer program development and debugging, and provides comfortable operation for source code editing, compiling and linking, setting compiling options as well as debugging with actual hardware. DebugFactory Builder is loaded with a simulator so that debugging can be easily performed without actual hardware. DebugFactory Builder has the following functions. 1. Project management function
Create project files (*.df4). Information such as related source file names and compile options are included in a project file. A makefile is created by these information. Debug setting information such as screen position, breakpoints, etc. at the time DebugFactory Builder is terminated are stored in a temporary file with an extension (*.dft) in the folder containing a project file. A project file can be easily created using the project creation wizard by specifying required information such as project type (Standard, For debug, Specify execution file).
2. Source code editing function DebugFactory Builder provides an editor, in which functions such as code assist, color display of reserved words, symbol list display, string searching, advanced searching/replacing such as GREP, etc. are prepared for source code editing. The file outline function enables to list functions or variables described in a file being displayed with the editor. If one of the items in the list is clicked, corresponding section is highlighted. Instead of the built-in editor, you can specify a commercially available editor with the option setting. Then a source can be displayed on the specified editor when specifying the source in the source file list, for example.
3. Build function DebugFactory Builder incorporates a make tool. Compiling and linking can be performed by one clicking. It is necessary to set compiler path before compiling. DebugFactory Builder does not include a compiler therefore it must be purchased
5
separately. However for trial compiling, the trial version compiler incorporated in DebugFactory Builder can be used. Note that the trial version compiler is for 103S version 4 (ELF/DWARF format). DebugFactory Builder can automatically generate a makefile. Instead of using a makefile generated by DebugFactory Builder or the incorporated make tool, it is also possible to use an existing makefile or an existing make tool, or to compile or to link by specifying a batch file.
4. Debugging function There are two types of debugging: debugging with actual hardware such as an in-circuit emulator (ICE) and an onboard environment, and debugging without actual hardware using a simulator. The debugging functions include displaying and operating memory or register, Go execution, step execution, step-out execution, COME execution, forcible break, software break, inspection display, watch display, RAM monitor, real time trace, profiler, coverage, etc.
5. Supporting functions for debugging with a simulator The microcomputer simulator of DebugFactory Builder equips not only a debugging function which is as sophisticated as that of an actual hardware, but also following supporting functions to effectively perform debugging without actual hardware.
Panel tool Panel tool is used to debug user interface processing. Swap function Swap function is used to execute a function for
debugging in place of the lower function in the microcomputer program.
Memory access event Memory access event is used to execute a specified function when the microcomputer program accesses a specified memory space.
Timer event Timer event is used to execute a specified function at specified time.
6
1.2. Operating environment Following minimum systems are required for DebugFactory Builder.
OS Windows98/Me/2000/XP (Windows2000/XP are recommended)
CPU Intel Pentium III 450MHz or higher (Pentium III 1GHz or higher recommended)
Memory 256MB minimum (512MB or more recommended)
Hard disk space 400MB minimum (1GB or more recommended)
1.3. Design mode / Debug mode DebugFactory Builder has the design mode and the debug mode. The design mode is used for operations to creating executable files to be debugged, such as setting projects, editing sources and Make, while the debug mode is for debugging operations in connected to the target. Switching modes can be performed by connecting to the target (select [Debug]-[Debugging start] in the main menu) when switching from design mode to debug mode, and by disconnecting from the target (select [Debug]-[Debugging end] in the main menu) when switching from debug mode to design mode.
1.4. Target environment DebugFactory Builder supports three types of environment: a simulator environment, an in-circuit emulator environment and an onboard environment, as a target environment where executable files can be operated in the debug mode.
Simulator environment DebugFactory Builder incorporates an instruction set simulator that operates in the host computer (Windows) and performs debugging by executing a program to be debugged in the simulator. In this target environment, only the DebugFactory Builder software is used. In-circuit emulator environment DebugFactory Builder executes a program to be debugged with the actual microcomputer on the target board and performs debugging. In this target environment, the in-circuit emulator (ICE), etc. in addition to the DebugFactory Builder software are needed.
7
Onboard environment
DebugFactory Builder executes a program to be debugged with the system including the actual microcomputer on the target board and performs debugging. In this target environment, the onboard unit, the trace unit, etc. in addition to the DebugFactory Builder software are needed. To switch target environment, select [Debug]-[Target setting…] in the main menu, and specify in [Target type] in the “Target setting” dialog box. Selectable target type depends on product type selected.
1.5. License If DebugFactory Builder was made available via download, it can be used on a trial basis for up to 30 days. The trial versions of language processor tools such as a C compiler, an assembler and a linker are also embedded. However for full-scale usage as product development, please purchase a license of DebugFactory Builder, and prepare language processor tools such as a C compiler, an assembler and a linker separately. If you purchased a license during the trial period, open the user registration dialog box by selecting [Help]-[Licenses] in the main menu, and enter your key code. After the key code has been confirmed, the trial period is cleared. Even if the trial period has already been expired, the same dialog box appears when running DebugFactory Builder, therefore enter the key code in the same way. DebugFactory Builder license key (DFKey) is written on the sticker in the CD case of “PanaX Series Setup Disk” packed at first-time purchase. Please note that CD key (used when installing other software tools) as well as DebugFactory Builder license key (DFKey) are written on the sticker in the CD case. When upgrading from the conventional debugger, we will issue a license key and send it to you by FAX, etc. upon application.
8
2. Preparation 2.1. Installation
When using Windows 2000/XP, installation must be done by users (including Power User) who belong to the Administrator group. Set “PanaX Series Setup Disk” in the CD drive and execute a file in the following folder.
[Setup file name] “CD drive name” :\DebugFactory\ ”mn103s” \DFBuilder103s_vXXXXE.exe
(Type version number for XXXX) Run the setup program and click <Next> following the instructions. After having accepted the license agreement, the key code input screen appears.
Enter DebugFactory Builder license key (DFKey: written on the sticker in the CD case of a software tool packed at first-time purchase) issued at the time of purchase or upgrading. Even if you do not have a DebugFactory Builder license key, you can use it on a trial basis for up to 30 days. When the trial period is over, the program does not run unless a license key is entered.
9
In this wizard, specify a folder where DebugFactory Builder will be installed, then click [Next].
Specify whether to create a shortcut on the desktop, then installation will be started.
10
After installation has been successfully completed, this wizard appears. Click <Finish> to exit the wizard. When debugging with actual hardware, restart the computer.
11
2.2. Run the program After the setup is completed in 2.1, the [Panasonic DebugFactory Builder 4]-[MN103S] group is created in [Programs] on the [Start] menu. Note that the program folder name specified in 2.1 is displayed in [Panasonic DebugFactory Builder 4]. (Default is [Panasonic DebugFactory Builder 4].)
DebugFactory Builder can be started as follow. Click the [start] menu, and select
[Programs]-[Panasonic DebugFactory Builder 4]-[MN103S]-[Builder].
12
2.3. Window configuration The following window shows the basic configuration of DebugFactory Builder.
Design mode
Project tree Main window
Command window
File outline window
Code window Make output window (Tab)
13
Debug mode
Main window Register window
Project tree
Code window
Disassembler window (Tab)Stack window
Debug setting tree
Command window Memory window
14
3. Use DebugFactory Builder 3.1. Basic development flow
In this section, you can experience and understand the basic development flow of DebugFactory Builder using a completed sample program. The procedures for the development flow are outlined below.
(1) Read a project * For creating a new project, refer to 4.1.1. (2) Coding (3) Create an executable file (Build) (4) Debug
3.1.1. Read a project
When DebugFactory Builder starts * Default settings When DebugFactory Builder starts, the startup window appears.
Specify [Open project] and click the [OK] button, then the following dialog box appears. When opening the last project, specify [Open last project].
15
Select an existing project (Example: C:\My Documents\Panasonic\DebugFactory Builder\"103s"\Project\test1.df4). * When creating a new project, specify [New project creation] in the startup window, click [OK] and then the “Project creation wizard” appears. Specify required items following the instructions and a project is created. For details, refer to 4.1.1.
After DebugFactory Builder started Select [File]-[Open project...] in the main menu, and the dialog box appears. Select a project as described above. * When creating a new project, select [File]-[New]-[Project] in the main menu. Then a
project is created.
16
3.1.2. Coding
Open a file in the code window. The file can be edited directly.
Project tree Code window
Pop-up menu of Code window
When opening a new file, select [File]-[Open in code window...] in the main menu. When displaying files that are already opened in the code window, files can be switched by clicking the tab. It is also possible to open a file registered in the project tree by double-clicking or selecting [Open in code window...] in the pop-up menu, or selecting [Open source file...] or [Open…] in a pop-up menu in the code window.
17
3.1.3. Create an executable file (Make)
Create an executable file of the project. This operation is called ‘make’. When performing ‘make’, select [Make]-[Make] in the main menu. During ‘make’, compiling status, etc. is displayed in the “Make output” window.
3.1.4. Debug
1. Select / Set a target Select a target environment to debug the executable file created in 3.1.3. The target environment is for executing an executable file. It can be set in the “Target setting” dialog box opened by selecting [Debug]-[Target setting…] in the main menu. ● When selecting Simulator
Set items in the “target setting” dialog box depend on a selected target type. For details on set items of each target, refer to the online help or Installation manual. Note that selectable target type depends on product type.
18
● When selecting In-circuit emulator ● When selecting Onboard
2. Start debugging Select [Debug]-[Debugging start] in the main menu. This operation is called “Open a target”. If debugging has successfully started, “Start of debug mode” is displayed in the command window, and "[PC=****]" is added in the caption of the main window. If there is an executable file of the project, the following message appears to ask whether to load.
If “Yes” is selected, the executable file to be debugged of the project is loaded. This file can be confirmed in the project tree or the debug source tree.
3. Load an execution file An execution file can be loaded by selecting [Debug]-[Execution file load] in the main menu. Loading starts (after connected to the target in the case of design mode) if there is an executable file of the project.
19
When loading is completed, “Load completed” is displayed in the command window. By opening the debug source tree, a source file list of loaded execution files is displayed from the debug information. When the code window or the disassembler window is being opened, the current PC position is displayed. For loading an executable file, select [Debug]-[Load a specified file], or select [Load] in the pop-up menu of the command window to specify a file.
4. Execute the program For executing the program, select [Debug]-[Go] in the main menu. When the program is executed, the value of the PC being executed is displayed in the caption of the main window.
Simulator (The changing value of the PC is displayed. (Circled in red))
Emulator/Onboard (The changing value of the PC is displayed. (Circled in red))
5. Break setting When setting a software breakpoint by specifying a source line of the program.
Display the source in the code window, move the cursor, display the pop-up menu by right-clicking and select [Software breakpoint setting]. Or it can be set by clicking the circle mark on the left side to the line number in the code window. If set, both the mark and the line are colored. (The color can be customized. Default is red)
20
Code window
Set breaks in the code window.
If a displayed source file has debugging information, source lines
where software breakpoints can be set are indicated with circlemarks on the left side of the code window.
Source files can be displayed in the code window by the following means. - Select [File]-[Open in code window…] - Select from the project tree - Select from the debug source tree
When setting a software breakpoint by specifying an address Select [Debug]-[Debug settings]-[Software break…] in the main menu, or select [Software break] in the debug setting tree and select [Add…] in the pop-up menu. The “Software break setting” dialog box appears. Set in this dialog.
When setting a hardware break Software break points can be set only when specified address range is writable. It is not possible to use software break points to ROM area in actual memory of an actual hardware environment. In this case, hardware breaks can be set.
21
Hardware breaks can be set in the “Hardware break setting” dialog box opened by selecting [Hardware breakpoint setting] in the pop-up menu of the code window, or by selecting [Debug]-[Debug setting]-[Hardware break…] in the main menu.
6. Stop the program When the program executed the breakpoint set in 5, the program stops. It is also possible to stop the program forcibly by selecting [Debug]-[Stop] in the main menu (or pressing the Esc key). When the program stops, the source that was being executed is displayed in the code window, and the entire source line where the program stops is colored.
22
7. End of debugging Select [Debug]-[Debugging end] in the main menu. This is called “Close the target”. If this operation has been succeeded, “End of debug mode” is displayed in the command window.
23
4. Commonly-used functions 4.1. Project
4.1.1. Create a new project (Project creation wizard)
When DebugFactory Builder starts * Default settings When DebugFactory Builder starts, the startup window appears. Specify [New project creation] and the wizard starts to create a project.
In the “Project creation wizard”, select a project type first, and set requirements such as a project name, a folder to save, language tool, target environment, etc. depending on project types. Then a new project can be created. There are three project types as follow. - Standard Specify when creating a standard project (can be used to create and edit source
code, create makefiles, and debug code). - For debugging
Specify when creating a project that will be used only for debugging. Although source code addition and make functionality are not available, it is possible to begin debugging immediately by starting in the debug mode.
- Specify execution file Specify when execution and component source files already exist and you want to edit and make code in addition to just debugging. Setting an execution file and source search path allows source file information contained in execution files to be automatically analyzed and added to the project.
24
In this section, creating procedures for a standard project are described. For the other types, refer to 4.1.3 or 4.1.4 .
Project type Select a type of the project to be created. Here, select “Standard” and click “Next” to move to project setting.
Project setting Specify a project name, a destination folder to save files, and sample source files to be added to the project. Component source files can be added after the project was created, therefore add source files as sample here. After setting required items, click “Next” to move to language tool setting.
25
Language tool setting *Default available (Use the trial version) Specify a language tool to be used for a created project. The trial version is selected by default. When using your language tools, check “Use a following language tool” and set execution files of compiler, assembler and linker respectively. After setting, click “Next” to move to target setting.
Target setting Specify target environment of the project. Click the “Set…” button to display the “target setting” dialog box, and set required items after selecting product type and target type.
Click here to display the
target setting dialog box.
26
For details on set items of each target, refer to the online help or Installation manual. After setting, click “Next” to move to interface setting.
Interface setting Specifies the type of interface board to be connected to the target (an in-circuit emulator, an onboard debug unit, etc.) and your PC. Click the “Set…” button to display the “interface setting” dialog box, and specify interface type and interface address.
Click here to display the
interface setting dialog box.
27
Click “End” in the project creation wizard, and project creating will be completed.
After DebugFactory Builder started Select [File]-[New]-[Project] in the main menu. The “Project creating wizard” appears. Set items following the instruction as described above.
4.1.2. Add a file to the project
An added file to the project is to be a file for ‘make’ at creating an executable file or to be displayed in the code window at source code debugging. Select [Make]-[Source file addition/deletion…] in the main menu, and set a source file in the “Source file setting” dialog box.
It is also possible to display this dialog by selecting an execution file in the project tree and selecting [Source file addition/deletion…] in the pop-up menu. Or source files can be added in the “Source file addition” dialog box opened by selecting [Source file] in the project tree and selecting [Add source…] in the pop-up menu. Header files, debug files and other files can also be added to the project. Besides adding existing source files, it is also possible to add a new file by selecting [Source file] and selecting [New source creation] in the pop-up menu, as well as to
28
add folders by selecting [Add folder…] in the pop-up menu when the logical tree view is applied.
4.1.3. Create a project for debugging
This function enables to debug an executable file created in an existing development environment (editor, make environment, etc). This function is effective for users who upgraded from the conventional PanaX debugger to DebugFactory Builder, since an existing developing environment can remain to be used. When DebugFactory Builder starts * Default settings When DebugFactory Builder starts, the startup window appears. Specify [New project creation] and the wizard starts to create a project.
Specify [For debugging] and set required items. Source search path setting Specify a folder which stores source files comprising an executable file to be debugged. When displaying the stop position in the code window at the time the program stops, etc., folders registered as source search path are firstly searched. Source search path can also be added after the project is created.
29
Set other items in the same way as a standard project. For details, refer to 4.1.1 “Create a new project”. After DebugFactory Builder started Select [File]-[New]-[Project] in the main menu. Then the “Project creation wizard” starts as is the case with startup. Follow the procedures described above.
4.1.4. Create a project from an execution file
This function is incorporated to support easily creating a project from an executable file created in an existing development environment (editor, make environment, etc.). This makes possible to add component source files of the project automatically from the debugging information of a specified execution file, therefore it enables to omit the procedures in 4.1.2 for adding files. However path information of a source file to be registered depends on debugging information (the compiler used), therefore it needs to be set as a source search path as well as setting an execution file. The difference between a project for debugging in 4.1.3 and this project is that the former is exclusively for debugging while the latter enables to edit source codes, make as well as debugging based on source files automatically registered.
When DebugFactory Builder starts * Default settings When DebugFactory Builder starts, the startup window appears. Specify [New project creation] and the wizard starts to create a project.
30
Specify [Specify execution file] to set required items. Execution file setting Specify an execution file to be debugged.
Source search path setting Specify a folder that stores source files comprising an executable file to be debugged. When displaying the stop position in the code window at the time the program stops, etc., folders registered as source search path are firstly searched. Source search path can also be added after the project is created.
31
Set other items in the same way as a standard project. For details, refer to 4.1.1 “Create a new project”. After DebugFactory Builder started Select [File]-[New]-[Project] in the main menu. Then the “Project creation wizard” starts as is the case with startup. Follow the procedures described above.
32
4.2. Make 4.2.1. Specify the way to make
DebugFactory Builder has three ways to make. 1. Execute make by reading a makefile that is automatically generated by the
make tool incorporated in DebugFactory Builder. (When only using the incorporated functions such as a make tool, a makefile, etc.)
2. Execute make by reading an existing makefile using a make tool on the market.
3. Use a batch file.
Specify either way as environment setting of the make function.
Select [Make]-[Environment settings…] in the main menu, and the “Environment settings” dialog box appears. For the check box “Make method selection” in the “Make method” tab, check “Use make file” for No1 and 2, or select “Use batch file” for No3. The tabs to be displayed are changed depending on the way you choose. For No1, uncheck “Use existing make file” in the “Make file/make tool” tab, and for No2, check it and specify a makefile and a make tool to be used. For No3, specify a batch file in the “Batch file” tab.
33
For 1, uncheck “Use existing make file”For 2. check it and set items below.
For No3, specify a batch file to
be used in the “Batch file” tab.
4.2.2. Select language tools
Select [Make]-[Environment setting…] in the main menu, and the “Environment settings” dialog box appears. Select the “Language tool” tab, uncheck “Use a trial-version language tool”, and specify a compiler, an assembler and a linker to be used. However product development is not allowed using the trial version compiler. Therefore purchase the compiler if needed.
34
Note that this setting is needed when executing make using the incorporated make tool, therefore if specifying another way, this setting is not reflected in make.
4.2.3. Specify paths of header files for language tools, and paths of library files
Select [Make]-[Compiler option…] in the main menu, and the “Compiler option” dialog box appears. Specify include paths for a compiler and an assembler as well as a library path for a linker.
Example of compiler setting
Note that this setting is needed when executing make using the incorporated make tool, therefore if specifying another way, this setting is not reflected in make.
35
4.2.4. Option setting for language tools
Select [Make]-[Compile options…] in the main menu, and the “Compiler option” dialog box appears. Set options in the “Compiler”, “Assembler” and “Linker” tabs.
For specifying options other than options of radio buttons and check boxes, type directly in the [Option] item. Make sure to specify options with a hyphen ‘-’. Note that this setting is needed when executing make using the incorporated make tool, therefore if specifying another way, this setting is not reflected in make.
4.2.5. Section setting of an executable file
Specify an object to be linked and memory mapping of code and data. Select [Make]-[Section setting…] in the main menu, and the “Section setting” dialog box appears. Specify mapping addresses and mapping order of objects to be mapped.
36
Note that this setting is needed when executing make using the incorporated make tool, therefore if specifying another way, this setting is not reflected in make.
4.2.6. Set an execution file name
Select [Make]-[Execution file/Library name change…] in the main menu, and the “Execution file name change” dialog box appears. Specify an execution file name and an output folder.
The executable file specified here is to be loaded when connecting to the target, (opening the target), and to be an object to confirm whether compiling or not. Note that this function cannot be used in a project for debugging.
37
4.3. Debug 4.3.1. How to set debugging function
Before setting debugging functions, set debug mode status by selecting [Debug]-[Debugging start] in the main menu. When in the debug mode, various debugging functions can be set by selecting [Debug]-[Debug setting] in the main menu, and selecting submenus. Current setting contents of all debugging functions are displayed in the debug setting tree. Functions whose multiple setting is allowed such as software break are displayed in the tree structure. It is possible to edit as well as to add and delete settings by double clicking each debugging functions or selecting in the pop-up menu.
Debug setting tree
Current multiple break settings
are displayed in the tree.
Select "Edit" in the pop-up menuto edit each setting.
It is possible to display set dialogs
and its results from the pop-up
menus of each debug functions.
4.3.2. Set Software break / Hardware break
There are two breaks: Software break and Hardware break. Software break can be realized by rewriting memory in specified address to trap instruction for break, and is a simple function that occurs when a specified address is executed. Although multiple breakpoints can be set, it is not possible to set software breakpoints to non-rewritable codes such as ROM memory. Hardware break can be realized by in-circuit emulator or microcomputer debugging
38
circuit, and complicated break conditions can be set. However conditions depend on hardware resources to be realized. Although it is possible to set hardware breaks in non-rewritable area such as ROM memory, settable number of breaks is generally fewer than that of software breakpoints.
Hardware break is effective basically only when using actual hardware such as in-circuit emulator or onboard debug unit as target type. However hardware break with a simulator can be realized as if that with actual hardware, therefore it is possible to set hardware breaks with a simulator.
How to set a software breakpoint 1. When specifying a source file and a line number
A) Select [Software breakpoint setting] in the pop-up menu of the code window, and a software breakpoint is set in the cursor line. By selecting the menu again, the setting is cleared.
B) Click the circle mark on the left side to a line number in the code window, and a software breakpoint is set in the line. By clicking the mark again, the setting is cleared. No circle mark in a line indicates the line does not have corresponding code output by a compiler. (Example: When optimization is enabled in compiler option setting)
C) BP command Specify a source file and a line number directly with the BP command. (Example: Type “BP .Test.c:77” when setting a breakpoint in the 77th line of the source file “Test.c”.)
2. When specifying an address A) Select [Debug]-[Debug setting]-[Software break…] in the main menu, then
the “Software breakpoint setting” dialog box appears. Set an address in it.
39
B) Select [Software break] in the debug setting tree and select [Add…] from the pop-up menu, and the “Software breakpoint setting” dialog box appears. Set an address in it as A). * This dialog can also be displayed by selecting [Software break list…] from the pop-up menu of [Software break] and selecting [Add…].
C) BP command Specify a source file and a line number directly with the BP command.
How to set a hardware break
1. When specifying a source file and a line number A) Select [Hardware breakpoint setting] in the pop-up menu of the code window,
and a hardware break is set in the cursor line. By selecting the menu again, the setting is cleared.
B) Hold down the Ctrl key while click the circle mark on the left side to a line number in the code window, and a hardware break is set in the line. By clicking the mark again, the setting is cleared. No circle mark in a line indicates the line does not have corresponding code output by a compiler. (Example: When optimization is enabled in compiler option setting)
C) BH command Specify a source file and a line number directly with the BH command. (Example: Type “BP .Test.c:77” when setting a breakpoint in the 77th line of the source file “Test.c”.)
2. When specifying an address
A) Select [Event] in the debug setting tree and select [Add…] from the pop-up menu, and the “Event setting” dialog box appears. Set required items such as addressed, status, etc. in it. When setting a break, check the “Break” check box.
40
Check here
B) BH command Specify an address directly with the BH command.
A hardware break can be cleared from the pop-up menu of each break settings displayed in the debug setting tree, or with the BC/BHC command.
4.3.3. Execute a program
The following four ways are available to execute a program. A) Go ---------------- Execution continues until a break occurs.
Select [Debug]-[Go] in the main menu or execute with the G command. B) Step-in ---------- Execute one line.
Select [Debug]-[Step-in] in the main menu or execute with the T command. C) Step-over ------- Execute one line. (Regard a function call and a jump
instruction as one line) Select [Debug]-[Step-over] in the main menu or execute with the P command.
D) Step-out -------- Run the user program until the current function returns to its caller. Select [Debug]-[Step-out] in the main menu or execute with the G@ command.
4.3.4. Display / Change register
The following ways are available to display or change microcomputer’s general purpose register values.
41
A) With the register window Select [View]-[Window]-[Register…] in the main menu, and the register window appears. Confirm the names and the values of each registers displayed in the window. For changing the value, double click the register or select [Value change…] in the pop-up menu and change in the “Variable value change” dialog box.
Colored in red when
values are changed
B) With the R command Names and values of each registers can be changed as with the register window.
4.3.5. Display / Change memory
The following ways are available to display or change memory values. A) With the memory dump window
Select [View]-[Windows]-[Memory], and select [New] to display a new memory dump window, or select [Memory x] to activate the already opened memory dump window. For changing displayed addresses of each windows, move with the scroll bar or select [Go to specified address…] in the pop-up menu. For changing values, double click an address to be changed or select [Data change…] in the pop-up menu and change in the "Data change" dialog box.
42
Input value’s radix is corresponded tothe radix set for the memory window.
B) With the D command / the E, F command
Memory values of specified address can be displayed with the D command and changed with the E, F command.
4.3.6. Display / Change variable
The following ways are available to display or change variable (symbol) values. A) With the Real-time watch window
Select [View]-[Window]-[Real-time watch…] in the main menu, and the “Real-time watch” window appears.
For displaying or changing variable (symbol) values, the variable (symbol) needs to be registered as watch. Select [Add watch…] in the pop-up menu of the “Real time watch” window, and the “Watch registration” dialog box appears. Specify register variable (symbol) values in it.
43
Variable (symbol) values can be selected from the variable (symbol) list of source files. Click the […] button at the right of the [Symbol/address] entry box in the [Watch registration] dialog, and select a variable in the [Address specification] dialog box.
It is also possible to directly register variable (symbol) values in the code window by selecting the value with the mouse and selecting [Debug]-[Watch registration] in the pop-up menu. For changing values, select the variable (symbol) to be changed in the “Real-time watch” window, double click it or select [Value change…] in the pop-up menu, and the “Variable value change” dialog box appears. Type and change values in this dialog box.
44
B) With the Local variable window For displaying or changing local variable values, use the “Local variable” window. Local variable values which can be referred within the current scope are displayed in the “Local variable” window when the program stops.
Values can be changed as described in A) “Real-time watch window“.
C) With the Inspect window Select variable (symbol) values in the code window with the mouse, select [Inspect] in the pop-up menu or double click it, and the “Inspect” window appears.
Values can be changed as described in A) “Real-time watch window”.
D) With the VAL/? Command Display the contents of a C language expression or variable as described in C) “Inspect window”.
4.3.7. Display execution history
Program execution histories (execution addresses) can be displayed and confirmed in the “Real-time trace” window. For displaying the window, select [View]- [Window]- [Real-time trace…] in the main menu. By default, execution histories from the program start to the end are recorded. When the program stops, the histories are automatically displayed in the window.
45
Trace window (When selecting disassembler / source output mode)
Disassembler output can be
displayed from the pop-up
menu of the “Trace” window.
Source output can be displayed
from the pop-up menu of the
“Trace” window.
Note that there is limitation on tracing therefore older execution histories are overwritten in the normal mode if exceeded. (Later execution histories before stop are stored.) As the real-time trace function, it has various functions such as storing execution histories of between area events, after an event and events being executed, as well as storing information on memory access. For setting real-time trace, select [Debug]-[Debug settings]-[Trace…] in the main menu, or select [Trace] in the debug setting tree and select [Trace setting…] in the pop-up menu. Note that trace functions (trace history acquisition condition, trace capacity, etc.) depend on target type (simulator, in-circuit emulator, onboard) set in the project. For details, refer to the online help.
46
In-circuit emulator
47
5. Useful functions 5.1. How to run DebugFactory Builder
5.1.1. Settings for startup
For when running DebugFactory Builder by specifying a project, it is possible to specify a mode (design mode or debug mode) and whether to restore previous debugging state. Select [Tools]-[Customize…] in the main menu, and the “Customize” dialog box appears. Select the “General” tab and specify a mode in the “When loading” check box.
5.1.2. Command options
DebugFactory Builder can be started with command line input. The following options can be specified DFB4.exe /S<series name> [[/P<project file name>] [/C<command>]]
/S<series name> * Required Specify a series name of DebugFactory Builder to be started /P<project name> Startup by specifying a project file (df4). If any space is included in the project file name (or path), quote the command with double quotation mark.
48
/C<command> Execute a command at startup. If any space is included in the command, quote the command with double quotation mark.
By combining the following options with options in 5.2 ”Control debug mode” or the q! command for forcible termination, continuous test using batch file can be performed.
5.2. Control debug mode 5.2.1. Control by commands
DebugFactory Builder has the DEBUGMODE command which can control debug mode with command line input. The following options can be specified and used for automatic testing just like startup options.
/OPEN Open the target on the basis of the target settings set in the project. Switch to the debug mode. /CLOSE Close the target. Switch to the design mode. /LOAD Open the target on the basis of the target settings set in the project, and load the program to be debugged set in the project.
5.2.2. Settings for debug mode
DebugFactory Builder can execute commands in a macro file “Init.mcr” when the debug mode is turned on by starting debugging (opening the target) if the macro file is stored in the same folder as a project file. If preprocesses (loading executable files, setting register values, etc.) needed for debugging executable files are previously written, they are automatically executed every time. The Init.mcr file can be edited in the “Macro editing/execution” window. For details, refer to 5.5 “Edit macro”.
49
5.3. User processing of make function When using incorporated make environment as make method, a make file is generated using information from component source files in the project tree, compile options, section settings, etc. It becomes possible to execute user processing after make (or before link) by editing this make file. Specifically, add user processing in the following place in a make file. #======================================================== # User definition processing before link #======================================================== #===================DFUSRBDEF_S========================= **Add user processing here** #===================DFUSRBDEF_E========================= #======================================================== # User definition processing after make #======================================================== #===================DFUSRADEF_S========================= **Add user processing here** #===================DFUSRADEF_E========================= With this function, it is possible to convert a X format execution file to a HEX format file simultaneously with make processing of DebugFactory Builder, for example. An example of user definition processing is shown below. #======================================================== # User definition processing after make #======================================================== #===================DFUSRADEF_S========================= xcv103.exe $(PROJECT) #===================DFUSRADEF_E=========================
5.4. Measure performance 5.4.1. Profile function (PROF)
The profile function calculates frequency of access (execution) of each function (subroutines). By this function, it can be presumed that the execution speed of which function (subroutine) should be raised to enhance the total performance. For using the profile function, this function needs to be enabled with the PROF
50
command (enter “PROF ON”) before executing the program. After the program is executed and stopped, if the PROF command is executed (enter “PROF”), the calculated result is output. Note that this function is realized by sampling the program counter during user program execution, therefore use this calculated result only as a guide. 5.4.2. Coverage function (COV) * Only when the target is a simulator
The coverage function indicates which addresses in the program were executed and which addresses were not executed during user program execution. When the range in functions (or in files) is specified, the achievement ratio in the unit can be acquired. This function is effective in confirming at the end of the test whether all the programs have been tested. For using the coverage function, this function needs to be enabled with the COV command (enter “COV ON”) before executing the program. After the program is executed and stopped, coverage information is displayed with the COV command. (For options of the COV command, refer to the online help)
5.5. Edit /Execute macro The macro function builds new commands by combining multiple dialog commands, and has a C language-like control structure (if, for, while, do, break, etc.) so that efficient new commands can be defined. Created macro commands can be executed just as other dialog commands. New macros can be defined using the {…} command in the command window. However, DebugFactory Builder has the “Macro editing/execution” window which specialized in macro editing, etc. as more convenient means. The “Macro editing/execution” window can be opened by selecting [Tools]-[Macro editing…] in the main menu, or by clicking the leftmost icon button in the tool bar for macro. (In order to display the "Edit/Execute macro" window, it is necessary to previously check "McrExec" in the “Plug-in setting” dialog box displayed by selecting [Tool]-[Plug-in setting…] in the main menu.)
51
The macro Init.mcr described in 5.2.2 and other 10 macros can be defined and registered, and they can also be executed in the same dialog. The registered macros can be executed by selecting [Tool]-[Macro execution]-[Macro x] or from the tool bar for macro.
52
5.6. Save debugging functions 5.6.1. Save/Load debugging settings
DebugFactory Builder allows you to save three settings for software break, hardware event (break) and real-time watch respectively. For saving settings, select [Software breakpoint] or [Hardware break] in the debug setting tree, or display the “Real-time watch” window, and select [Save settings]-[Setting x] from the pop-up menu. For restoring these settings, select [Load settings]-[Setting x] from the pop-up menu. For other debugging functions (such as trace, timer and trigger settings), only the last setting can be saved and restored. For details, refer to 5.6.2. 5.6.2. Restore previous debug setting
DebugFactory Builder allows you to save debug setting status such as break, real-time trace, timer, etc at the end of debugging. When the same executable file is loaded, the previous debug setting status can be restored. In order to enable this function, select [Tools]-[Debugger options…] in the main menu and the “Debugger options” dialog box appears. Select the “General” tab and check “Restore previous debugging setting”.
5.7. Customize DebugFactory Builder allows you to customize the following settings.
Shortcut key It is possible to allocate shortcut keys for each functions and select PanaX, etc. as shortcut type. Tool bar
Control which tool bars are displayed in the main window. Each windows’ settings
Set the color scheme and font for DebugFactory Builder windows. Editor setting Set details such as tab setting and automatic saving.
For customizing shortcut tool bar and each window settings, use the “Customize” dialog box (select [Tool]-[Customize…] in the main menu), and for editor settings, the “Editor option” dialog box (select [Tool]-[Editor option…] in the main menu).
53
Settings using the customize function are reflected in all projects.
54
6. Appendix 6.1. Debug function list
6.1.1. In-circuit emulator
Emulation memory 1MB (internal ROM), 4MB (expansion RAM)
Software break Up to 255 points Execution address break
Up to 4 events Condition:
area specification, pass count specification Data access break Up to 4 events
Condition: area specification, pass count specification, access specification (read, write, read/write), data specification (bit mask, data width), match/not match specification
AND break One breakpoint (Up to 8 conditions) Sequential break One breakpoint (Up to 8 levels) External break None
Break
Other Trace full break Illegal RAM access break
Frame 128K Bus specification Internal RAM bus, Expansion RAM bus Acquired trace data Execution address, Data address, Data value,
Data bus status information Stop condition Continue, Stop on full, Break on full,
Delayed trigger
Trace
Storage condition All cycles, Branch cycle, Data access, Event, Data access & event
Mode Continuous measurement mode, Partial one-shot mode Partial maximum/minimum mode
Time measurement
Resolution Switchable between 25, 50, and 100ns Trigger output 8 bits
Data specification, Address specification,
55
Event occurrence status RAM monitor Sample 1K byte Switchable area Profile Correct function access ratios Coverage None
For details, refer to the online help. 6.1.2. Onboard (Dwire/JTAG)
Software break Up to 255 points (Cannot set in ROM) Execution address break
Up to 8 events (Total of up to 8 hardware breaks) Condition:
area specification, pass count specification Data access break Up to 8 events (Total of up to 8 hardware breaks)
Condition: area specification, pass count specification, access specification (read, write, read/write), data specification (bit mask, data width), match/not match specification
AND break One breakpoint (Up to 8 conditions) Sequential break One breakpoint (Up to 8 levels) External break Up to 8 breakpoints (Total of up to 8 hardware
breaks) Condition:
Detection level specification, pass count specification
Break
Other Trace full break Illegal RAM access break
Method Internal trace External trace Frame 4K 256K Bus specification None
Trace
Acquired trace data Execution address, Data address, Data value, Data bus status information
Branch address, Data address, Data value, Number of continuously executed instructions, Hit condition event number
56
Stop condition Continue, Stop on full, Break on full, Delayed trigger
Storage condition All cycles, Branch cycle, Data access, Event, Instruction complete cycle
Branch cycle, Event, Branch + event cycles, Instruction complete cycle
Mode Continuous measurement mode Partial one-shot mode Partial maximum/minimum mode
Time measurement
Resolution Switchable between 40, 320, 2560, and 20480ns Trigger input/output Up to 8 bits (Switchable input/output of each bits)
Output level specification (High/Low/Reverse) RAM monitor None
(Apparently realized by accessing circuit for debugging) Profile Correct function access ratios Coverage None
For details, refer to the online help.
57
6.2. Environment file (*.df4 / *.dft / DFbuild.ini) DebugFactory Builder creates the following three files (*.df4 / *.dft / DFbuild.ini) to save projects and user information. [*.df4] As basic information about the project, the following contents are stored.
- Component source files of the project - Target setting information (selected product type, target type, etc) - Make settings (language tool, compile option, section setting, etc.)
This file is essential to DebugFactory Builder. [*.dft] As temporary information used for debugging (mode), the following contents are stored.
- Debug setting information to be restored (watch registration, break setting, event setting)
[DFBuilder.ini] As information on user environment, the following contents are stored.
- Customized settings Common customized settings (shortcut key, tool bar, etc.) Editor options (character code, external editor, etc.) Debugger options (verify check, symbol display specification, etc) Plug-in settings, External tool settings
- Window layout One file is created for each user environment, and this file is stored under the following directory in the Windows 2000/XP environment.
C:\Documents and Settings\<account name of Windows>\ApplicationData \Panasonic\DebugFactory Builder\MN103S\
58
Contact for inquiry
For any inquiries concerning technical material on this manual, please contact us at the following URL.
User support Semiconductor Company Matsushita Electric Industrial Co., Ltd. URL: http://panasonic.co.jp/semicon/e-micom/inquiry
DebugFa
Septemb
Matsushita
MN103S Series ctory Builder for MN103S
Tutorial
er 29, 2006 2nd Printing
Electric Industrial Co., Ltd.
59