<< Previous | Index | Next >> | |
|
Dynamic C can be used to edit source files, compile and run programs, and choose options for these activities using pull-down menus or keyboard shortcuts. There are two modes: edit mode and run mode, which is also known as debug mode. Various debugging windows can be viewed in run mode. Programs can compile directly to a target controller for debugging in RAM or flash. Programs can also be compiled to a
.bin
file, with or without a controller connected to the PC.To debug a program, a controller must be connected to the PC, either directly via a programming cable or indirectly via an Ethernet connection and a RabbitLink board. Multiple instances of Dynamic C can be run simultaneously. This means multiple debugging sessions are possible over different serial ports. This is useful for debugging boards that are communicating among themselves.
14.1 Editing
Once a file has been created or has been opened for editing, the file is displayed in a text window. It is possible to open or create more than one file and one file can have several windows. Dynamic C supports normal Windows text editing operations.
Use the mouse (or other pointing device) to position the text cursor, select text, or extend a text selection. Scroll bars may be used to position text in a window. Dynamic C will, however, work perfectly well without a mouse, although it may be a bit tedious.
It is also possible to scroll up or down through the text using the arrow keys or the PageUp and PageDown keys or the Home and End keys. The left and right arrow keys allow scrolling left and right.
14.1.0.1 Arrow Keys
Use the up, down, left and right arrow keys to move the cursor in the corresponding direction.
The Ctrl key works in conjunction with the arrow keys this way.
- Ctrl-Left Move to previous word
Ctrl-Right Move to next word
Ctrl-Up Scroll up one line (text moves down)
Ctrl-Down Scroll down one line
14.1.0.2 Home
Moves the cursor backward in the text to the start of the line.
- Home Move to beginning of line
Ctrl-Home Move to beginning of file
Shift-Home Select to beginning of line
Shift-Ctrl-Home Select to beginning of file
14.1.0.3 End
Moves the cursor forward in the text.
- End Move to end of line
Ctrl-End Move to end of file
Shift-End Select to end of line
Shift-Ctrl-End Select to end of file
Sections of the program text can be cut and pasted or new text may be typed in directly. New text is inserted at the present cursor position or replaces the current text selection.
The Replace command in the EDIT menu is used to perform search and replace operations either forwards or backwards.
14.2 Menus
Dynamic C has eight command menus, as well as the standard Windows system menus. An available command can be executed from a menu by clicking the menu and then clicking the command, or by (1) pressing the Alt key to activate the menu bar, (2) using the left and right arrow keys to select a menu, (3) and using the up or down arrow keys to select a command, and (4) pressing Enter. It is usually more convenient to type keyboard shortcuts (such as <Ctrl-H> for HELP) once they are known. Pressing the Esc key will make any visible menu disappear. A menu can be activated by holding the Alt key down while pressing the underlined letter of the menu name. For example, press <Alt-F> to activate the FILE menu.
14.2.1 File Menu
Click the menu title or press <Alt-F> to select the FILE menu. Prior to Dynamic C 8.x, there is a 10,000 line limit on the size of a single source file. If your source code is that big, split up some of it into libraries.
New
- Creates a new, blank, untitled program in a new window
.
Open
- Presents a dialog in which to specify the name of a file to open. Unless there is a problem, Dynamic C will present the contents of the file in a text window. The program can then be edited or compiled.
- To select a file, type in the desired file name, or select one from the list. The file's directory may also be specified.
Save
- The Save command updates an open file to reflect the latest changes. If the file has not been saved before (that is. the file is a new untitled file), the Save As dialog will appear.
- Use the Save command often while editing to protect against loss during power failures or system crashes.
Save As
- Allows a new name to be entered for a file and saves the file under the new name.
Close
- Closes the active window. The active window may also be closed by pressing <Ctrl-F4> or by double-clicking on its system menu. If there is an attempt to close a file before it has been saved, Dynamic C will present a dialog similar to one of these two dialogs.
- The file is saved when Yes (or type "y") is clicked. If the file is untitled, there will be a prompt for a file name in the Save As dialog. Any changes to the document will be discarded if No is clicked or "n" is typed. Cancel results in a return to Dynamic C, with no action taken.
Project
- Allows a project file to be opened, saved, saved as a different name and closed. See Chapter 16 for more information.
Print Preview
- Shows approximately what printed text will look like. Dynamic C switches to preview mode when this command is selected, and allows the programmer to navigate through images of the printed pages.
- Text can be printed from any Dynamic C window. There is no restriction to printing source code. For example, the contents of the assembly window or the watch window can be printed. Dynamic C displays the a standard print dialog box when the Print command is selected.
- As many copies of the text as needed may be printed. If more than one copy is requested, the pages may be collated or uncollated.
- If the Print to File option is selected, Dynamic C creates a file (it will ask for a pathname) in the format suitable to send to the specified printer. (If the selected printer is a PostScript printer, the file will contain PostScript.)
- To choose a printer, click the Setup button in the Print dialog, or choose the Print Setup.. command from the FILE menu.
Print Setup
- Allows choice of which printers to use and to set them up to print text.
- There is a choice between using the computer system's default printer or selecting a specific printer. Depending on the printer selected, it may be possible to specify paper orientation (portrait or tall, vs. landscape or wide), and paper size. Most printers have these options. A specific printer may or may not have more than one paper source.
- The Options button allows the print options dialog to be displayed for a specific printer. The Network button allows printers to be added or removed from the list of printers.
Exit
- To exit Dynamic C. When this is done, Windows will either return to the Windows Program Manager or to another application. The keyboard shortcut is <Alt-F4>.
14.2.2 Edit Menu
Click the menu title or press <Alt-E> to select the EDIT menu.
Undo
- This option undoes recent changes in the active edit window. The command may be repeated several times to undo multiple changes. The amount of editing that may be undone will vary with the type of operations performed, but should suffice for a few large cut and paste operations or many lines of typing. Dynamic C discards all undo information for an edit window when the file is saved. The keyboard shortcut is <Alt-Backspace>.
Redo
- Redoes modifications recently undone. This command only works immediately after one or more Undo operations. The keyboard shortcut is <Alt-Shift-Backspace>.
Cut
- Removes selected text from a source file. A copy of the text is saved on the clipboard. The contents of the clipboard may be pasted virtually anywhere, repeatedly, in the same or other source files, or even in word processing or graphics program documents. The keyboard shortcut is <Ctrl-X>.
Copy
- Makes a copy of selected text in a file or in one of the debugging windows. The copy of the text is saved on the "clipboard." The contents of the clipboard may be pasted virtually anywhere. The keyboard shortcut is <Ctrl-C>.
Paste
- Pastes text on the clipboard as a result of a copy or cut (in Dynamic C or some other Windows application). The paste command places the text at the current insertion point. Note that nothing can be pasted in a debugging window. It is possible to paste the same text repeatedly until something else is copied or cut. The keyboard shortcut is <Ctrl-V>.
Find
- Finds specified text. Enter the text to be found in the Find box. The Find command (and the Find Next command) will find occurrences of the entered text. If Case sensitive is clicked, the search will find occurrences that match exactly. Otherwise, the search will find matches having upper- and lower-case letters. For example, "switch," "Switch," and "SWITCH" would all match. If Reverse is clicked the search will proceed toward the beginning of the file, rather than toward the end of the file. Use the From cursor checkbox to choose whether to search the entire file or to begin at the cursor location. The keyboard shortcut is <Ctrl F>.
Replace
- Replaces specified text. Type the text to be found in the Find text box (there is a pulldown list of previously entered strings). Then type the text to substitute in the Change to text box. If Case sensitive is selected, the search will find an occurrence that matches exactly. Otherwise, the search will find a match having upper- and lower-case letters. For example, "reg7" "REG7" and "Reg7" all match.
- If Reverse is clicked, the search will occur in reverse, that is, the search will proceed toward the beginning of the file, rather than toward the end of the file. The entire file may be searched from the current cursor location by clicking the From cursor box, or the search may begin at the current cursor location.
- The Selection only box allows the substitution to be performed only within the currently selected text. Use this in conjunction with the Change All button. This box is disabled if no text is selected.
- Normally, Dynamic C will find the search text, then prompts for whether to make the change. This is an important safeguard, particularly if the Change All button is clicked. If No prompt is clicked, Dynamic C will make the change (or changes) without prompting.
- The keyboard shortcut for Replace is <F6>.
Find Next
- Once search text has been specified with the Find or Replace commands, the Find Next command (F3 for short) will find the next occurrence of the same text, searching forward or in reverse, case sensitive or not, as specified with the previous Find or Replace command. If the previous command was Replace, the operation will be a replace.
Goto
- Positions the insertion point at the start of the specified line.
- Type the line number (or approximate line number) to go to. That line, and lines in the vicinity, will be displayed in the source window.
Previous Error
- Locates the previous compilation error in the source code. Any errors will be displayed in a list in the message window after a program is compiled. Dynamic C selects the previous error in the list and positions the offending line of code in the text window when the Previous Error command (<Ctrl-P> for short) is made. Use the keyboard shortcuts to locate errors quickly.
Next Error
- Locates the next compilation error in the source code. Any errors will be displayed in a list in the message window after a program is compiled. Dynamic C selects the next error in the list and positions the offending line of code in the source window when the Next Error command (<Ctrl-N> for short) is made. Use the keyboard shortcuts to locate errors quickly.
Edit Mode
- Switches Dynamic C back to edit mode from run mode (also called debug mode). After a program has been compiled or executed, Dynamic C will not allow any modification to the program unless the Edit Mode is selected. The keyboard shortcut is F4.
14.2.3 Compile Menu
Click the menu title or press <Alt-C> to select the COMPILE menu.
Compile to Target
- Compiles a program and loads it in the target controller's memory. The keyboard shortcut is F5.
- Dynamic C determines whether to compile to RAM or flash based on the current compiler options (set with the Options menu). Any compilation errors are listed in the automatically activated message window. Hit <F1> to obtain a more descriptive message for any error message that is high-lighted in this window.
Compile to .bin file
- Compiles a program and writes the image to a
.bin
file. The.bin
file can then be used with a device programmer to program multiple chips; or the Rabbit Field Utility can load the.bin
files to the target. In most cases, the Include BIOS option is checked. This causes the BIOS, as well as the user program, to be included in the.bin
file. If you are creating special program such as a cold loader that starts at address 0x0000, then this option should be unchecked.- When compiling to a
.bin
file, choose Use attached target to use the parameters of the controller connected to your system. (Some versions of Dynamic C do not support this menu option.) If there is no connected controller, or if there is but you want to use a different configuration, choose Compile with defined target configuration. To define a target configuration, access the Configure Targetless Compilation dialog box. It has been relocated to Options | Define target configuration and the Compile | Compile to a .bin file menu selection now compiles with those parameters upon acceptance of a confirmation prompt.Reset Target/Compile BIOS
- This option reloads the BIOS to RAM or flash, depending on the BIOS memory setting chosen in Options | Compiler dialog box. The default option is flash.
- The following box will appear upon successful compilation and loading of BIOS code.
Include Debug Code/RST 28 Instructions
- If this is checked, debug code will be included in the program even if
#nodebug
precedes the main function in the program. Debug code consists mainly ofRST 28h
instructions inserted after every C statement. At anRST 28h
instruction, program execution is transferred to the debug kernel where communication between Dynamic C and the target is tended to before returning to the user program. There are certain loop optimizations that are not generated when code is compiled as debug. This option also controls the definition of a compiler-defined macro symbol,DEBUG_RST
. If the menu item is checked thenDEBUG_RST
is set to1
, otherwise it is0
.- If the option is not checked, the compiler marks all code as
nodebug
and debugging is not possible. The only reason to check this option if debugging is finished and the program is ready to be deployed is to allow some current (or planned) diagnostic capability of the Rabbit Field Utility (RFU) to work in a deployed system. This option effects both code compiled to.bin
files and code compiled to the target . In order to run the program after compiling to the target with this option, disconnect the target from the programming port and reset the target CPU.14.2.4 Run Menu
Click the menu title or press <Alt-R> to select the RUN menu.
Run
- Starts program execution from the current breakpoint. Registers are restored, including interrupt status, before execution begins. The keyboard shortcut is F9.
Run w/ No Polling
- This command is identical to the Run command, with an important exception. When running in polling mode (F9), the development PC polls or interrupts the target system every 100 ms to obtain or send information about target breakpoints, watch lines, keyboard-entered target input, and target output from
printf
statements. Polling creates interrupt overhead in the target, which can be undesirable in programs with tight loops. The Run w/ No Polling command allows the program to run without polling and its overhead. (Any
printf
calls in the program will cause execution to pause until polling is resumed. Running without polling also prevents debugging until polling is resumed.) The keyboard shortcut for this command is <Alt-F9>.
Stop
- The Stop command places a hard breakpoint at the point of current program execution. Usually, the compiler cannot stop within ROM code or in
nodebug
code. On the other hand, the target can be stopped at theRST
028h
instruction ifRST
028h
assembly code is inserted as inline assembly code innodebug
code. However, the debugger will never be able to find and place the execution cursor innodebug
code. The keyboard shortcut is <Ctrl-Z>.Reset Program
- Resets program to its initial state. The execution cursor is positioned at the start of the main function, prior to any global initialization and variable initialization. (Memory locations not covered by normal program initialization may not be reset.) The keyboard shortcut is <Ctrl-F2
>
.- The initial state includes only the execution point (program counter), memory map registers, and the stack pointer. The Reset Program command will not reload the program if the previous execution overwrites the code segment. That is, if your code is corrupted, the reset will not be enough; you will have to reload the program to the target.
Trace into
- Executes one C statement (or one assembly language instruction if the assembly window is displayed) with descent into functions. Execution will not descend into functions stored in ROM because Dynamic C cannot insert the required breakpoints in the machine code. If
nodebug
is in effect, execution continues until code compiled without thenodebug
keyword is encountered. The keyboard shortcut is F7.
Step over
- Executes one C statement (or one assembly language instruction if the assembly window is displayed) without descending into functions. The keyboard shortcut is F8.
Source Trace into
- Executes one C statement with descent into functions when the assembly window is open. Execution will not descend into functions stored in ROM because Dynamic C cannot insert the required breakpoints in the machine code. If
nodebug
is in effect, execution continues until code compiled without thenodebug
keyword is encountered. The keyboard shortcut is <Alt-F7>.
Source Step over
- Executes one C statement without descending into functions when the assembly window is open. The keyboard shortcut is <Alt-F8>.
Toggle Breakpoint
- Toggles a regular ("soft") breakpoint at the location of the execution cursor. Soft breakpoints do not affect the interrupt state at the time the breakpoint is encountered, whereas hard breakpoints do. The keyboard shortcut is F2.
Toggle Hard Breakpoint
- Toggles a hard breakpoint at the location of the execution cursor. A hard breakpoint differs from a soft breakpoint in that interrupts are disabled when the hard breakpoint is reached. The keyboard shortcut is <Alt-F2>.
Clear All Breakpoints
- Self explanatory. The keyboard shortcut is <Ctrl-A>.
Toggle Interrupt Flag
- Toggles interrupt state. The keyboard shortcut is <Ctrl-I>.
Toggle Polling (Prior to DC 7.30)
- Toggles polling mode. When this option is chosen, polling will be toggled until the next debugger operation. If the program is currently running and Dynamic C is polling the target, you may choose Toggle Polling to stop Dynamic C from polling the target. However, as soon as the program stops executing, or Dynamic C sets a breakpoint, or a watch expression is added, etc., Dynamic C will reenable polling.
- When running in polling mode (F9
)
, the development PC polls or interrupts the target system every 100 ms to obtain or send information regarding target breakpoints, watch lines, keyboard-entered target input, and target output fromprintf
statements. Starting with Dynamic C 7.10, the polling is done every 3 seconds instead of every 100 ms.
- Polling creates interrupt overhead in the target, which can be undesirable in programs with tight loops. This command is useful to switch modes while a program is running. The keyboard shortcut is <Ctrl-O>.
Poll Target (Starting with DC 7.30)
- This menu option used to be named Toggle Polling (see above). A check mark indicates that Dynamic C will poll the target. The absence of a check mark indicates that Dynamic C will not poll the target. This differs from Toggle Polling in that Dynamic C will not restart polling without the user explicitly requesting it. The keyboard shortcut is <Ctrl-O>.
Reset Target
- Tells the target system to perform a software reset including system initializations. Resetting a target
always
brings Dynamic C back to edit mode. The keyboard shortcut is <Ctrl-Y>.
Close Serial Port
- Disconnects the programming serial port between PC and target so that the target serial port is accessible to other applications.
14.2.5 Inspect Menu
Click the menu title or press <Alt-I> to select the INSPECT menu.
The INSPECT menu provides commands to manipulate watch expressions, view disassembled code, and produce hexadecimal memory dumps
.
The INSPECT menu commands and their functions are described here.Add/Del Watch Expression
- This command provokes Dynamic C to display the following dialog.
- This dialog works in conjunction with the Watch window. The text box at the top is the current expression. An expression may have been typed here or it was selected in the source code. This expression may be evaluated immediately by clicking the Evaluate button or it can be added to the expression list by clicking the Add to top button. Expressions in this list are evaluated, and the results are displayed in the Watch window, every time the Watch window is updated. Items are deleted from the expression list by clicking the Del from top button.
- An example of the results displayed in the Watch window appears below.
Clear Watch Window
- Removes entries from the Watch dialog and removes report text from the Watch window. There is no keyboard shortcut.
Update Watch Window
- Forces expressions in the Watch Expression list to be evaluated and displayed in the Watch window only when the function
runwatch()
is called from the application program.runwatch()
monitors for watch update requests and should be called periodically if watch expressions are used. Normally the Watch window is updated every time the execution cursor is changed, that is when a single step, a breakpoint, or a stop occurs in the program. The keyboard shortcut is <Ctrl-U>.Disassemble at Cursor
- Loads, disassembles and displays the code at the current editor cursor. This command does not work in user application code declared as
nodebug
. Also, this command does not stop the execution on the target. The keyboard shortcut is <Ctrl-F10>.Disassemble at Address
- Loads, disassembles and displays the code at the specified address. This command produces a dialog box that asks for the address at which disassembling should begin. Addresses may be entered in two formats: a 4-digit hexadecimal number that specifies any location in the root space, or a 2-digit page number followed by a colon followed by a 4-digit logical address, from 00 to FF. The keyboard shortcut is <Alt-F10>.
Dump at Address
- Allows blocks of raw values in any memory location (except the BIOS 0-2000H) to be looked at. Values can be displayed on the screen or written to a file. If separate I&D space is enabled, you can choose which logical space to examine.
- When writing to a file, the option Dump to File requires a file pathname and the number of bytes to dump. The option Save Entire Flash to File requires a file pathname. If you are running in RAM, then it will be RAM that is saved to a file, not Flash, because this option simply starts dumping physical memory at address 0.
- When displaying to the screen, the Memory Dump window is opened. A typical screen display appears below.
- The Memory Dump window may be scrolled. Scrolling causes the contents of other memory addresses to appear in the window. Hotkeys ArrowUp, ArrowDown, PageUp, PageDown are active in the Memory Dump window. The window always displays 128 bytes and their ASCII equivalent. Values in the Dump window are updated only when Dynamic C stops, or comes to a breakpoint.
14.2.6 Options Menu
Click the menu title or press <Alt-O> to select the OPTIONS menu.
14.2.6.1 Editor
The Editor command gets Dynamic C to display the following dialog.
Use this dialog box to change the behavior of the Dynamic C editor. By default, tab stops are set every three characters, but may be set to any value greater than zero. Auto-Indent causes the editor to indent new lines to match the indentation of previous lines. Remove Trailing Whitespace causes the editor to remove extra space or tab characters from the end of a line.
14.2.6.2 Compiler
The Compiler command gets Dynamic C to display the following dialog, which allows compiler operations to be changed.
Run-Time Checking
- These options, if checked, can allow a fatal error at run-time. They also increase the amount of code and cause slower execution, but they can be valuable debugging tools.
- Array Indices--Check array bounds. This feature adds code for every array reference.
- Pointers--Check for invalid pointer assignments. A pointer assignment is invalid if the code attempts to write to a location marked as not writable. Locations marked not writable include the entire root code segment. This feature adds code for every pointer reference.
BIOS Memory Setting
- A single, default BIOS source file that is defined in the system registry when installing Dynamic C is used for both compiling to RAM and compiling to flash. Dynamic C defines a preprocessor macro,
_FLASH_
,_RAM_
or_FAST_RAM_
depending on which of the following options is selected. This macro is used to determine the relevant sections of code to compile for the corresponding memory type.
- Code and BIOS in Flash--If you select this option, the compiler will load the BIOS to flash when cold-booting, and will compile the user program to flash where it will normally reside.
- Code and BIOS in RAM--If you select this option, the compiler will load the BIOS to RAM on cold-booting and compile the user program to RAM. This option is useful if you want to use breakpoints while you are debugging your application, but you don't want interrupts disabled while the debugger writes a breakpoint to flash (this can take 10 ms to 20 ms or more, depending on the flash type used). Note that when you single step through code, the debugger is writing breakpoints at the next point in code you will step to. It is also possible to have a target that only has RAM for use as a slave processor, but this requires more than checking this option because hardware changes are necessary that in turn require a special BIOS and coldloader.
- Code and BIOS in Flash, Run in RAM--If you select this option, the compiler will load the BIOS to flash when cold-booting, compile the user program to flash, and then the BIOS will copy the flash image to the fast RAM attached to CS2. This option supports a CPU running at a high clock speed (anything above 29 MHz).
User Defined BIOS File
- Use this option to change from the default BIOS to a user-specified file. Enter or select the file using the browse button/text box underneath this option. The check box labeled use must be selected or else the default file BIOS defined in the system registry will be used. Note that a single BIOS file can be made for compiling both to RAM and flash by using the preprocessor macros
_FLASH_
or_RAM_
. These two macros are defined by the compiler based on the currently selected radio button in the BIOS Memory Setting group box.User Defined Lib Directory File
- The Library Lookup information retrieved with <Ctrl-H> is parsed from the libraries found in the
lib.dir
file, which is part of the Dynamic C installation. Checking the Use box for User Defined Libraries File, allows the parsing of a user-defined replacement forlib.dir
when Dynamic C starts. Library files must be listed inlib.dir
(or its replacement) to be available to a program.- If the function description headers are formatted correctly ( See "Function Description Headers" on page 40.), the functions in the libraries listed in the user-defined replacement for
lib.dir
will be available with <Ctrl-H> just like the user-callable functions that come with Dynamic C.- This is the same as the command line compiler
-lf
option.Watch Expressions
- Allow any expressions in watch expressions. This option causes any compilation of a user program to pull in all the utility functions used for expression evaluation.
- Restricting watch expressions (may save root code space) Choosing this option means only utility code already used in the application program will be compiled.
Separate I&D Space
- When checked, this option enables separate instruction and data space, doubling the amount of root code and root data space available.
- Please note that if you are compiling to a 128K RAM, there is only about 12K available for user code when separate I&D space is enabled.
Type Checking
- This menu item allows the following choices:
- Prototypes--Performs strict type checking of arguments of function calls against the function prototype. The number of arguments passed must match the number of parameters in the prototype. In addition, the types of arguments must match those defined in the prototype. Z-World recommends prototype checking because it identifies likely run-time problems. To use this feature fully, all functions should have prototypes (including functions implemented in assembly).
- Demotion--Detects demotion. A demotion automatically converts the value of a larger or more complex type to the value of a smaller or less complex type. The increasing order of complexity of scalar types is:
char
unsigned int
int
unsigned long
long
float
- A demotion deserves a warning because information may be lost in the conversion. For example, when a
long
variable whose value is 0x10000 is converted to anint
value, the resulting value is 0. The high-order 16 bits are lost. An explicit type casting can eliminate demotion warnings. All demotion warnings are considered non-serious as far as warning reports are concerned.
- Pointer--Generates warnings if pointers to different types are intermixed without type casting. While type casting has no effect in straightforward pointer assignments of different types, type casting does affect pointer arithmetic and pointer dereferences. All pointer warnings are considered non-serious as far as warning reports are concerned.
Warning Reports
- This tells the compiler whether to report all warnings, no warnings or serious warnings only. It is advisable to let the compiler report all warnings because each warning is a potential run-time bug. Demotions (such as converting a
long
to anint
) are considered non-serious with regard to warning reports.Optimize For
- Allows for optimization of the program for size or speed. When the compiler knows more than one sequence of instructions that perform the same action, it selects either the smallest or the fastest sequence, depending on the programmer's choice for optimization.
- The difference made by this option is less obvious in the user application (where most code is not marked
nodebug
). The speed gain by optimizing for speed is most obvious for functions that are markednodebug
and have no auto local (stack-based) variables.Max Shown
- This limits the number of error and warning messages displayed after compilation.
Defines
- The Defines button brings up a dialog box with a window for entering (or modifying) a list of defines that are global to any source file programs that are compiled and run. The macros that are defined here are seen by the BIOS during its compilation.
- The syntax expected is a semi-colon separated list of defined constants with optional values given with an equal sign. This is the same as the command line compiler -d option, except that the CLC expects a single defined expression to follow each -d:
dccl_cmp mysourcefile.c -d DEF1 -d MAXN=10 -d DEF2
- while the GUI window expects a semi-colon separated list
DEF1;MAXN=10;DEF2
- The end result is the same as if every file compiled and run were prepended with:
#define DEF1
#define MAXN 10
#define DEF214.2.6.3 Debugger
Choosing the Debugger menu item from the Options dialog box displays the following:
The options in the Debugger dialog box may be helpful when debugging programs. In particular, they allow printf statements and other STDIO output to be logged to a file. (Starting with Dynamic C version 7.25, the macro
STDIO_DEBUG_SERIAL
may be defined to redirect STDIO output to a designated serial port--A, B, C or D. For more information, please see the sample programSamples/STDIO_SERIAL.C
.)Check the box labeled Log STDOUT to send a copy of all standard output to the named log file. For a file that already exists, check Append Log unless you want to overwrite instead. Dynamic C automatically opens the STDIO window when a program first attempts to print to it if a check appears in the checkbox labeled Auto Open STDIO Window.
The last three checkboxes allow the user to control the size and capabilities of the debug kernel. The debug kernel has grown significantly in size, so if there are tight code space requirements parts of the debug kernel can be disabled to save room. The three checkboxes are:
Enable Breakpoints
- If this box is checked, the debug kernel will be able to toggle breakpoints on and off and will be able to stop at set breakpoints. Using the scroll bar to the right of Max breakpoints, one may enter up to the maximum amount of breakpoints the debug kernel will support. The debug kernel uses a small amount of root ram for each breakpoint, so reducing the number of breakpoints will slightly reduce the amount of root ram used.
- If this box is unchecked, the debug kernel will be compiled without breakpoint support and the user will receive an error message if they attempt to add a breakpoint.
Enable Watch Expressions
- If this is checked, watch expressions will be enabled. Using the scroll bar to the right of Max watch expressions, enter up to the maximum amount of watch expressions the debug kernel will support. The debug kernel uses a small amount of root ram for evaluating each watch expression, so reducing the amount of watches will slightly reduce the amount of root ram used.
- With it unchecked, the debug kernel will be compiled without watch expressions support and the user will receive an error message if they attempt to add a watch expression.
Enable Instruction Level Single Stepping
- If this is checked when the assembly window is open, single stepping will be by instruction rather than by C statement. Unchecking this box will disable instruction level single stepping on the target and, if the assembly window is open, the debug kernel will step by C statement.
14.2.6.4 Display
The Display command gets Dynamic C to display the following dialog.
Use the Display Options dialog box to change the appearance of Dynamic C windows. First choose the window from the window list. Then select an attribute from the attribute list and click the change button. Another dialog box will appear to make the changes. Note that Dynamic C allows only fixed-pitch fonts and solid colors (if a dithered color is selected, Dynamic C will use the closest solid color).
The Editor window attributes affect all text windows, except two special cases. After an attempt is made to compile a program, Dynamic C will either display a list of errors in the message window (compilation failed), or Dynamic C will switch to run mode (compilation succeeded). In the case of a failed compile, the editor will take on the Error Editor attributes. In the case of a successful compile, the editor will take on the Debug Editor attributes.
14.2.6.5 Communications
The Options | Communications menu item displays the following dialog box. Use it to tell Dynamic C how to communicate with the target controller.
TCP/IP Options
- In order to program and debug a controller across a TCP/IP connection, the Network Address field must have the IP address of either the Z-World RabbitLink board that is attached to the controller, or the IP address of a controller that has its own Ethernet interface.
- To accept control commands from Dynamic C, the Control Port field must be set to the port used by the ethernet-enabled controller. The Controller Name is for informational purposes only. The Discover button makes Dynamic C broadcast a query to any RabbitLinks attached to the network. Any RabbitLinks that respond to the broadcast can be selected and their information will be placed in the appropriate fields.
Serial Options
- The following options are available when the Use Serial Connection radio button is selected.
- Port - This is the COM port of the PC that is connected to the target. It defaults to COM1.
- Debug Baud Rate - This defaults to 115200 bps. It is the baud rate used for target communications after the program has been downloaded.
- Max Download Baud Rate - When baud negotiation is enabled, the compiler will start out at the selected baud rate and work downwards until it reaches one both the compiler and target can handle. Prior to Dynamic C 7.26, this value was accessible in the registry instead of the GUI.
- Stop Bits - The number of stop bits used by the serial drivers. Defaults to 1.
- Enable Processor Verification - Processor detection is enabled by default. The connection is normally checked with a test using the Data Set Ready (DSR) line of the PC serial connection. If the DSR line is not used as expected, a false error message will be generated in response to the connection check.
- To bypass the connection check, uncheck the Enable Processor Verification checkbox. This allows custom designed systems to not connect the STATUS pin to the programming port. Also disabling the connection check allows non-standard PC ports or USB converters which might not implement the DSR line to work.
- Use USB to Serial Converter - Check this checkbox if a USB to serial converter cable is being used. Dynamic C will then attempt to compensate for abnormalities in USB converter drivers. This mode makes the communications more USB/RS232 converter friendly by allowing higher download baud rates and introducing short delays at key points in the loading process. Checking this box may also help non-standard PC ports to work properly with Dynamic
C.
- Disable Baud Negotiation - Since Dynamic C version 7.25, the compiler negotiates a baud rate for program download. (This helps with USB or anyone who happens to have a high-speed serial port.) This default behavior may be disabled by checking the Disable Baud Negotiation checkbox. When baud negotiation is disabled, the program will download at 115k baud or 56k baud only. When enabled, it will download at speeds up to 460k baud, as specified by Max Download Baud Rate.
14.2.6.6 Define Target Configuration
The Define target configuration menu option displays the following dialog box:
There are three options available in this dialog box for choosing the board parameters that will be used in the compile. Select Board Type is the default choice and activates the Board ID pull-down menu, a list of all known board configurations. Specify Board Parameters, when checked, brings up a dialog box to enter data for a new board configuration. The name specified in the dialog box for the new board configuration will be automatically included in the Board ID pull-down menu. Use Target Information File, when checked, will prompt for a Remote Target Information (RTI) file. Any target configuration can be saved as a
.rti
file by clicking the Save as RTI button at the bottom of the dialog box.The baud rate, set in the Base Frequency (MHz) pulldown menu, only applies to debugging. The fastest baud rate for downloading is negotiated between the PC and the target.
14.2.6.7 Other Menu Choices
Show Tool Bar
- The Show Tool Bar command toggles the display of the tool bar. Dynamic C remembers the toolbar setting on exit.
Save Environment
- The Save Environment command gets Dynamic C to update the registry and
DCW.CFG
initialization files immediately with the current options settings. Dynamic C always updates these files on exit. Saving them while working provides an extra measure of security against Windows crashes.14.2.7 Window Menu
Click the menu title or press <Alt-W> to select the Window menu.
The first group of items is a set of standard Windows commands that allow the application windows to be arranged in an orderly way.
The second group of items presents the various Dynamic C debugging windows. Click on one of these to activate or deactivate the particular window. It is possible to scroll these windows to view larger portions of data, or copy information from these windows and paste the information as text anywhere. The contents of these windows can be printed.
The third group is a list of current windows, including source code windows. Click on one of these items to bring that window to the front.
Message
- Click the Message command to activate or deactivate the Message window. A compilation with errors also activates the message window because the message window displays compilation errors.
Watch
- The Watch menu option activates or deactivates the watch window. The Add/Del Items command on the INSPECT menu will do this too. The watch window displays the results whenever Dynamic C evaluates watch expressions.
Stdio
- Click the Stdio command to activate or deactivate the Stdio window. The Stdio window displays output from calls to
printf
. If the program callsprintf
, Dynamic C will activate the Stdio window automatically, unless another request was made by the programmer. (See the Debugger Options under the OPTIONS menu.)Assembly
- Click the Assembly command to activate or deactivate the Assembly window. The Assembly window displays machine code generated by the compiler in assembly language format.
- The Disassemble at Cursor or Disassemble at Address commands also activate the Assembly window.
- The Assembly window shows the memory address on the far left, followed by the code bytes for the instruction at the address, followed by the mnemonics for the instruction. The last column shows the number of cycles for the instruction, assuming no wait states. The total cycle time for a block of instructions will be shown at the lowest row in the block in the cycle-time column, if that block is selected and highlighted with the mouse. The total assumes one execution per instruction, so the user must take looping and branching into consideration when evaluating execution times.
- Use the mouse to select several lines in the Assembly window, and the total cycle time for the instructions that were selected will be displayed to the lower right of the selection. If the total includes an asterisk, that means an instruction such as
ldir
orret
nz
with an indeterminate cycle time was selected.Registers
- Click the Registers command to activate or deactivate the Register window. The Register window displays the processor register set, including the status register. Letter codes indicate the bits of the status register (F register). The window also shows the source-code line and column at which the snapshot of the register was taken. It is possible to scroll back to see the progression of successive register snapshots. Registers may be changed when program execution is stopped by clicking the right mouse button over the name or value of the register to be changed. Registers PC, XPC, and SP may not be edited as this can adversely effect program flow and debugging.
Stack
- Click the Stack command to activate or deactivate the Stack window. The Stack window displays the top 8 bytes of the run-time stack. It also shows the line and column at which the stack "snapshot" was taken. It is possible to scroll back to see the progression of successive stack snapshots.
Information
- Click the Information menu option to activate the Information window.
- The Information window displays how the memory is partitioned and how well the compilation went.
14.2.8 Help Menu
Click the menu title or press <Alt-H> to select the HELP menu. The choices are given below:
Online Documentation
- Opens a browser page and displays a file with links to other manuals. When installing Dynamic C from CD, this menu item points to the hard disk; after a Web upgrade of Dynamic C, this menu item optionally points to the Web.
Keywords
- Opens a browser page and displays an HTML file of Dynamic C keywords, with links to their descriptions in this manual.
Operators
- Opens a browser page and displays an HTML file of Dynamic C operators, with links to their descriptions in this manual.
HTML Function Reference
- Opens a browser page and displays an HTML file that has two links, one to Dynamic C functions listed alphabetically, the other to the functions listed by functional group. Each function listed is linked to its description in the Dynamic C Function Reference Manual.
Function Lookup/Insert
- Displays descriptions for library functions. The function is chosen in the Library Lookup dialog box by clicking on its name and then clicking OK.
- This dialog box is also displayed when the keyboard shortcut <Ctrl-H> is used anywhere in the source code. If a Dynamic C function is selected at the time
<Ctrl-H>
is pressed, then the dialog box is skipped and the Function Lookup/Insert screen displays the function description.
- Although this may be sufficient for most purposes, the Insert Call button can be clicked to invoke a "function assistant." This is only useful if the Function Lookup/Insert dialog box was displayed in response to selecting a function in source code. Otherwise the function assistant will only restate the function description information.
- The function assistant will place a call to the function displayed at the insertion point in the source code. The function call will be prototypical if OK is clicked; the call needs to be edited for it to make sense in the context of the code.
- Each parameter can be specified, one-by-one, to the function assistant. The function assistant will return the name and data type of the parameter. When parameter expressions are specified in this dialog, the function assistant will use those expressions when placing the function call.
- If the text cursor is placed on a valid C function call (and one that is known to the function assistant), the function assistant will analyze the function call, and will copy the actual parameters to the function lookup dialog. Compare the function parameters in the Expr. in Call box in the dialog with the expected function call arguments.
- Consider, for example, the following code.
...
x = strcpy( comment,
"Lower tray needs paper.");
...- If the text cursor is placed on
strcpy
and the Function Lookup/Insert command is issued, the function assistant will show the comment as parameter 1 and "Lower tray needs paper." as parameter 2. The arguments can then be compared with the expected parameters, and the arguments in the dialog can then be modified.Instruction Set Reference
- Invokes an on-line help system and displays the alphabetical list of instructions for the Rabbit 2000 microprocessor and the Rabbit 3000 microprocessor.
Keystrokes
- Invokes an on-line help system and displays the keystrokes page. Although a mouse or other pointing device may be convenient, Dynamic C also supports operation entirely from the keyboard.
Contents
- Invokes an on-line help system and displays the contents page. From here view explanations of various features of Dynamic C.
Tech Support Bulletin Board
- Opens a browser window to a Z-World/Rabbit Semiconductor forum for products based on the Rabbit 2000 and the Rabbit 3000.
Tip of the Day
- Brings up a window displaying some useful information about Dynamic C. There is an option to scroll to another screen of Dynamic C information and an option to disable the feature. This is the same window that is displayed when Dynamic C initializes.
About
- The About command displays the Dynamic C version number and the copyright notice.
| |
<< Previous | Index | Next >> | |
Z-World, Inc. www.zworld.com Phone: 1.530.757.3737 Fax: 1.530.757.3792 |
Rabbit Semiconductor www.rabbitsemiconductor.com Phone: 1.530.757.8400 Fax: 1.530.757.8402 |