<< Previous | Index | Next >>

15. Command Line Interface

The Dynamic C command line compiler (dccl_cmp.exe) performs the same compilation and program execution as its GUI counterpart (dcrabxx.exe), but is invoked as a console application from a DOS window. It is called with a single source file program pathname as the first parameter, followed by optional case-insensitive switches that alter the default conditions under which the program is run. The results of the compilation and execution, all errors, warnings and program output, are directed to the console window and are optionally written or appended to a text file.

15.1 Default States

With versions of Dynamic C prior to 7.10, the default states of Dynamic C environment variables are used each time dccl_cmp is called. If a sequence of calls is written into a batch file, variations from the defaults must be repeated for each call. For instance, if a change is made to the serial parameters


dccl_cmp myProgram.c -s 2:115200:1:0

the next call will revert to the default settings of 1:115200:1:0 unless the switch is used with that next call as well.

Starting with Dynamic C v 7.10, the command line compiler uses the values of the environment variables that are in the project file indicated by the -pf switch, or if the -pf switch is not used, the values are taken from default.dcp. For more information, please see Chapter 16, "Project Files" on page 227.

15.2 User Input

Applications requiring user input must be called with the -i option:


dccl_cmp myProgram.c -i myProgramInputs.txt

where myProgramInputs.txt is a text file containing the inputs as separate lines, in the order in which myProgram.c expects them.

15.3 Saving Output to a File

The output consists of all program printf's as well as all error and warning messages.

Output to a file can be accomplished with the -o option


dccl_cmp myProgram.c -i myProgramInputs.txt -o myOutputs.txt

where myOutputs.txt is overwritten if it exists or is created if it does not exist.

If the -oa option is used, myOutputs.txt is appended if it exists or is created if it does not.

15.4 Command Line Switches

Each switch must be separated from the others on the command line with at least one space or tab. Extra spaces or tabs are ignored. The parameter(s) required by some switches must be added as separate text immediately following the switch. Any of the parameters requiring a pathname, including the source file pathname, can have imbedded spaces by enclosing the pathname in quotes.

15.4.1 Switches Without Parameters

-b


Description:

Compile to .bin file using attached target. The resulting file is created or overwritten with the same pathname as the source file, but with a .bin extension. This switch is available only in Dynamic C v 7.05 and 7.06.


Default:

Compilation is written only to the target and not to a file.


GUI Equivalent:

Select the Compile | Compile to .bin file | Use attached target menu option.


-bf- (Available starting with Dynamic C v 7.10)


Description:

Undo user-defined BIOS file specification.


Factory Default:

None.


GUI Equivalent:

Uncheck the Options | Compiler | User defined BIOS file | Use dialog box option.


-h


Description:

Print program header information. This switch is available only in
Dynamic C v 7.05 and 7.06.


Default:

No header information will be printed.


GUI Equivalent:

None.


Example:

dccl_cmp samples\demo1.c -h -o myoutputs.txt

Header text preceding output of program:

********************************************************
4/5/01 2:47:16 PM
dccl_cmp.exe, Version 7.05P - English
samples\demo1.c
Options: -h -o myoutputs.txt
Program outputs:

Note: Version information refers to dcwd.exe with the same compiler core.


-h+ (Available starting with Dynamic C v 7.10)


Description:

Print program header information.


Factory Default:

No header information will be printed.


GUI Equivalent:

None.


Example:

dccl_cmp samples\demo1.c -h -o myoutputs.txt

Header text preceding output of program:

********************************************************
4/5/01 2:47:16 PM
dccl_cmp.exe, Version 7.10P - English
samples\demo1.c
Options: -h+ -o myoutputs.txt
Program outputs:

Note: Version information refers to dcwd.exe with the same compiler core.


-h- (Available starting with Dynamic C v 7.10)


Description:

Disable printing of program header information.


Factory Default:

No header information will be printed.


GUI Equivalent:

None.


-id+ (Available starting with Dynamic C v 7.30)


Description:

Enable separate instruction and data space.


Factory Default:

Separate I&D space is disabled.


GUI Equivalent:

Check Separate I&D Space in the Options | Compiler dialog box.


-id- (Available starting with Dynamic C v 7.30)


Description:

Disable separate instruction and data space.


Factory Default:

Separate I&D space is disabled.


GUI Equivalent:

Uncheck Separate I&D Space in the Options | Compiler dialog box.


-lf- (Available starting with Dynamic C v 7.10)


Description:

Undo Library Directory file specification.


Factory Default:

No Library Directory file is specified.


GUI Equivalent:

Uncheck the Options | Compiler | User Defined Libraries File | Use menu dialog box option.


-mf


Description:

Memory BIOS setting: Flash.


Default:

Memory BIOS setting: Flash.


GUI Equivalent:

Select the Options | Compiler | Code and BIOS in Flash menu dialog box option.


-mfr


Description:

The BIOS and code are compiled to flash, and then the BIOS copies the flash image to RAM to run the code.


Default:

Memory BIOS setting: Flash


GUI Equivalent:

Uncheck the Options | Compiler | Code and BIOS in Flash, Run in RAM menu dialog box option.


-mr


Description:

Memory BIOS setting: RAM.


Default:

Memory BIOS setting: Flash.


GUI Equivalent:

Select the Options | Compiler | Code and BIOS in RAM menu dialog box option.


-n (Available starting with Dynamic C v 7.25)


Description:

Null compile for errors and warnings without running the program. The program will be downloaded to the target.


Default:

Program is run.


GUI Equivalent:

Select Run | Run menu option.


-rb


Description:

Do not include BIOS when compiling to a file. This option is ignored if not compiling to a file. This switch is available only in Dynamic C v 7.05 and 7.06.


Default:

BIOS is included if Compile to .bin file is selected.


GUI Equivalent:

Uncheck the Compile | Compile to .bin file | Include BIOS menu option.


-rb+ (Available starting with Dynamic C v 7.10)


Description:

Include BIOS when compiling to a file.


Default:

BIOS is included if Compile to .bin file is selected.


GUI Equivalent:

Check the Compile | Compile to .bin file | Include BIOS menu option.


-rb- (Available starting with Dynamic C v 7.10)


Description:

Do not include BIOS when compiling to a file.


Default:

BIOS is included if Compile to .bin file is selected.


GUI Equivalent:

Uncheck the Compile | Compile to .bin file | Include BIOS menu option.


-rd


Description:

Do not include debug (RST 28) code when compiling to a file. This option is ignored if not compiling to a file. This switch is available only in
Dynamic C v 7.05 and 7.06.


Default:

RST 28 is included if Compile to file is selected.


GUI Equivalent:

Uncheck the Compile | Compile to .bin file | Include debug code/RST 28 instructions menu option.


-rd+ (Available starting with Dynamic C v 7.10)


Description:

Include debug code when compiling to a file.


Default:

RST 28 instructions are included


GUI Equivalent:

Check the Compile | Compile to .bin file | Include debug code/RST 28 instructions menu option.


-rd- (Available starting with Dynamic C v 7.10)


Description:

Do not include debug code when compiling to a file. This option is ignored if not compiling to a file.


Default:

RST 28 instructions are included.


GUI Equivalent:

Uncheck the Compile | Compile to .bin file | Include debug code/RST 28 instructions menu option.


-rf- (Available starting with Dynamic C v 7.10)


Description:

Undo RTI file specification.


Default:

None.


GUI Equivalent:

Select the Compile | Compile to Target menu option.


-ri


Description:

Disable runtime checking of array indices.
This switch is available only in Dynamic C v 7.05 and 7.06.


Default:

Runtime checking of array indices is performed.


GUI Equivalent:

Uncheck the Options | Compiler | Array Indices menu option.


-ri+ (Available starting with Dynamic C v 7.10)


Description:

Enable runtime checking of array indices.


Default:

Runtime checking of array indices is performed.


GUI Equivalent:

Check the Options | Compiler | Array Indices menu option.


-ri- (Available starting with Dynamic C v 7.10)


Description:

Disable runtime checking of array indices.


Default:

Runtime checking of array indices is performed.


GUI Equivalent:

Uncheck the Options | Compiler | Array Indices menu option.


-rp


Description:

Disable runtime checking of pointers.
This switch is available only in Dynamic C v 7.05 and 7.06.


Default:

Runtime checking of pointers is performed.


GUI Equivalent:

Uncheck the Options | Compiler | Pointers menu option.


-rp+ (Available starting with Dynamic C v 7.10)


Description:

Enable runtime checking of pointers.


Default:

Runtime checking of pointers is performed.


GUI Equivalent:

Uncheck the Options | Compiler | Pointers menu option.


-rp- (Available starting with Dynamic C v 7.10)


Description:

Disable runtime checking of pointers.


Default:

Runtime checking of pointers is performed.


GUI Equivalent:

Uncheck the Options | Compiler | Pointers menu option.


-rw


Description:

Restrict watch expressions--may save root code space.
This switch is available only in Dynamic C v 7.05 and 7.06.


Default:

Allow any expressions in watch expressions.


GUI Equivalent:

Select the Options | Compiler | Restrict watch expressions menu dialog box option.


-rw+ (Available starting with Dynamic C v 7.10)


Description:

Restrict watch expressions--may save root code space.


Default:

Allow any expressions in watch expressions.


GUI Equivalent:

Select the Options | Compiler | Restrict watch expressions menu dialog box option.


-rw- (Available starting with Dynamic C v 7.10)


Description:

Don't restrict watch expressions.


Default:

Allow any expressions in watch expressions.


GUI Equivalent:

Select Options | Compiler | Allow any expressions ... menu dialog box option.


-sp


Description:

Optimize code generation for speed.


Default:

Optimize for speed.


GUI Equivalent:

Select the Options | Compiler | Speed menu dialog box option.


-sz


Description:

Optimize code generation for size.


Default:

Optimize for speed.


GUI Equivalent:

Select the Options | Compiler | Size menu dialog box option.


-td


Description:

Disable type demotion checking. This switch is available only in
Dynamic C v 7.05 and 7.06.


Default:

Type demotion checking is performed.


GUI Equivalent:

Uncheck the Options | Compiler | Demotion menu dialog box option.


-td+ (Available starting with Dynamic C v 7.10)


Description:

Enable type demotion checking.


Default:

Type demotion checking is performed.


GUI Equivalent:

Check the Options | Compiler | Demotion menu dialog box option.


-td- (Available starting with Dynamic C v 7.10)


Description:

Disable type demotion checking.


Default:

Type demotion checking is performed.


GUI Equivalent:

Uncheck the Options | Compiler | Demotion menu dialog box option.


-tp


Description:

Disable type checking of pointers.
This switch is available only in Dynamic C v 7.05 and 7.06.


Default:

Type checking of pointers is performed.


GUI Equivalent:

Uncheck the Options | Compiler | Pointer menu dialog box option.


-tp+ (Available starting with Dynamic C v 7.10)


Description:

Enable type checking of pointers.


Default:

Type checking of pointers is performed.


GUI Equivalent:

Check the Options | Compiler | Pointer menu dialog box option.


-tp- (Available starting with Dynamic C v 7.10)


Description:

Disable type checking of pointers.


Default:

Type checking of pointers is performed.


GUI Equivalent:

Uncheck the Options | Compiler | Pointer menu dialog box option.


-tt


Description:

Disable type checking of prototypes.

This switch is available only in Dynamic C v 7.05 and 7.06.


Default:

Type checking of prototypes is performed.


GUI Equivalent:

Uncheck the Options | Compiler | Prototype menu dialog box option.


-tt+ (Available starting with Dynamic C v 7.10)


Description:

Enable type checking of prototypes.


Default:

Type checking of prototypes is performed.


GUI Equivalent:

Check the Options | Compiler | Prototype menu dialog box option.


-tt- (Available starting with Dynamic C v 7.10)


Description:

Disable type checking of prototypes.


Default:

Type checking of prototypes is performed.


GUI Equivalent:

Uncheck the Options | Compiler | Prototype menu dialog box option.


-vp+ (Available starting with Dynamic C v 7.20)


Description:

Verify the processor by enabling a DSR check. This should be disabled if a check of the DSR line is incompatible on your system for any reason.


Default:

Processor verification is enabled.


GUI Equivalent:

Check the Options | Communications | Enable DSR verification box.


-vp- (Available starting with Dynamic C v 7.20)


Description:

Assume a valid processor is connected.


Default:

Processor verification is enabled.


GUI Equivalent:

Uncheck the Options | Communications | Enable DSR verification box.


-wa


Description:

Report all warnings.


Default:

All warnings reported.


GUI Equivalent:

Select the Options | Compiler | All menu dialog box option.


-wn


Description:

Report no warnings.


Default:

All warnings reported.


GUI Equivalent:

Select the Options | Compiler | None menu dialog box option.


-ws


Description:

Report only serious warnings.


Default:

All warnings reported.


GUI Equivalent:

Select the Options | Compiler | Serious menu dialog box option.


15.4.2 Switches Requiring a Parameter

-bf BIOSFilePathname


Description:

Compile using a BIOS file found in BIOSFilePathname.


Default:

\Bios\RabbitBios.c


GUI Equivalent:

Select the Options | Compiler | User Defined BIOS File | Use | ... menu dialog box option.


Example:

dccl_cmp myProgram.c -bf MyPath\MyBIOS.lib


-d MacroDefinition


Description:

Define macros and optionally equate to values.

The following rules apply and are shown here with examples and equivalent #define form:

Separate macros with semicolons.


dccl_cmp myProgram.c -d DEF1;DEF2

#define DEF1
#define DEF2

A defined macro may be equated to text by separating the defined macro from the text with an equal sign (=).


dccl_cmp myProgram.c -d DEF1=20;DEF2

#define DEF1 20
#define DEF2

Macro definitions enclosed in quotation marks will be interpreted as a single command line parameter.


dccl_cmp myProgram.c -d "DEF1=text with spaces;DEF2"

#define DEF1 text with spaces
#define DEF2

A backslash proceeding a character will be kept except for semicolon, quote and backslash, which keep only the character following the backslash. An escaped semicolon will not be interpreted as a macro separator and an escaped quote will not be interpreted as the quote defining the end of a command line parameter of text.


dccl_cmp myProgram.c -d DEF1=statement\;;ESCQUOTE=\\\"

#define DEF1 statement;
#define ESCQUOTE \"
dccl_cmp myProg.c -d "FSTR = \"Temp = %6.2F DEGREES C\n\"" #define FSTR "Temp = %6.2f degrees C\n"

Default:

None.


GUI Equivalent:

Select the Options | Compiler menu option, then select the Defines button.


-d- MacroToUndefine (Available starting with Dynamic C v 7.10)


Description:

Undefines a macro that might have been defined in the project file. If a macro is defined in the project file read by the command line compiler and the same macro name is redefined on the command line, the command line definition will generate a warning. A macro previously defined must be undefined with the -d- switch before redefining it. Undefining a macro that has not been defined has no consequence and so is always safe although possibly unnecessary. In the example, all compilation settings are taken from the project file specified except that now the macro MAXCHARS was first undefined before being redefined.


Default:

None.


GUI Equivalent:

None.


Example:

dccl_cmp myProgram.c -pf myproject -d- MAXCHARS -d MAXCHARS=512


-eto EthernetResponseTimeout (Available starting with Dynamic C v 7.10)


Description:

Time in milliseconds Dynamic C waits for a response from the target on any retry while trying to establish ethernet communication.


Default:

8000 milliseconds.


GUI Equivalent:

None.


Example:

dccl_cmp myProgram.c -eto 6000

-i InputsFilePathname


Description:

Execute a program that requires user input by supplying the input in a text file. Each input required should be entered into the text file exactly as it would be when entered into the Stdio Window in dcwd.exe. Extra input is ignored and missing input causes dccl_cmp to wait for keyboard input at the command line.


Default:

None.


GUI Equivalent:

Using -i is like entering inputs into the Stdio Window in dcwd.exe.


Example

dccl_cmp myProgram.c -i MyInputs.txt

-lf LibrariesFilePathname


Description:

Compile using a file found in LibrariesFilePathname which lists all libraries to be made available to your programs.


Default:

Lib.dir.


GUI Equivalent:

Select Options | Compiler | User Defined Libraries File | Use | ... from the menu dialog box.


Example

dccl_cmp myProgram.c -lf MyPath\MyLibs.txt


-ne maxNumberOfErrors


Description:

Change the maximum number of errors reported.


Default:

A maximum of 10 errors are reported.


GUI Equivalent:

Enter the maximum errors reported in the Options | Compiler | Errors menu dialog box option.


Example:

Allows up to 25 errors to be reported:


dccl_cmp myProgram.c -ne 25

-nw maxNumberOfWarnings


Description:

Change the maximum number of warnings reported.


Default:

A maximum of 10 warnings are reported.


GUI Equivalent:

Enter the maximum warnings reported in the Options | Compiler | Warnings menu dialog box option.


Example:

Allows up to 50 warnings to be reported:


dccl_cmp myProgram.c -nw 50

-o OutputFilePathname


Description:

Write header information (if specified with -h) and all program errors, warnings and outputs to a text file. If the text file does not exist it will be created, otherwise it will be overwritten.


Default:

None.


GUI Equivalent:

Select Options | Debugger | Log STDOUT | Log file menu dialog box option.


Example

dccl_cmp myProgram.c -o MyOutput.txt

dccl_cmp myProgram.c -o MyOutput.txt -h

dccl_cmp myProgram.c -h -o MyOutput.txt


-oa OutputFilePathname


Description:

Append header information (if specified with -h) and all program errors, warnings and outputs to a text file. If the text file does not exist it will be created, otherwise it will be appended.


Default:

None.


GUI Equivalent:

Select the Options | Debugger | Log STDOUT | Log file, Append Log menu dialog box option.


Example

dccl_cmp myProgram.c -oa MyOutput.txt


-pf projectFilePathname (Available starting with Dynamic C v 7.10)


Description:

Specify a project file to read before the command line switches are read. The environment settings are taken from the project file specified with -pf, or default.dcp if no other project file is specified. Any switches on the command line, regardless of their position relative to the -pf switch, will override the settings from the project file.


Default:

The project file default.dcp.


GUI Equivalent:

Select the File | Project | Open... menu dialog box option.


Example

dccl_cmp myProgram.c -ne 25 -pf myProject.dcp
dccl_cmp myProgram.c -ne 25 -pf myProject

Note: The project file extension, .dcp, may be omitted.


-pw TCPPassPhrase


Description:

Enter the passphrase required for your TCP/IP connection. If no passphrase is required this option need not be used.


Default:

No passphrase.


GUI Equivalent:

Enter the passphrase required at the dialog prompt when compiling over a TCP/IP connection


Example:

dccl_cmp myProgram.c -pw "My passphrase"

-ret Retries (Available starting with Dynamic C v 7.10)


Description:

The number of times Dynamic C attempts to establish communication if the given timeout period expires.


Default:

3


GUI Equivalent:

None.


Example:

dccl_cmp myProgram.c -ret 5

-rf RTIFilePathname


Description:

Compile to a .bin file using targetless compilation parameters found in RTIFilePathname. The resulting compiled file will have the same pathname as the source (.c) file being compiled, but with a .bin extension.


Default:

None.


GUI Equivalent:

For Dynamic C v 7.05 and 7.06, select the Compile | Compile to .bin file | Define target information | Use Target Information File menu option.

For Dynamic C v 7.10 and later, select the Options | Define target configuration | Use Target Information File menu option


Example:

dccl_cmp myProgram.c -rf MyTCparameters.rti

dccl_cmp myProgram.c -rf "My Long Pathname\MyTCparameters.rti"


-rti BoardID:CpuID:CrystalSpeed:RAMSize:FlashSize


Description:

Compile to a .bin file using parameters defined in a colon separated format of BoardID:CpuID:CrystalSpeed:RAMSize:FlashSize. The resulting compiled file will have the same pathname as the source (.c) file being compiled, but with a .bin extension.

BoardID: Hex integer
CpuID: Decimal integer
CrystalSpeed: Decimal floating point, in MHz
RAMSize: Decimal, in KBytes
FlashSize: Decimal, in KBytes.

Default:

None.


GUI Equivalent:

For Dynamic C v 7.05 and 7.06, select the Compile | Compile to .bin file | Define target information | Specify Board Parameters menu option.

For Dynamic C v 7.10 and later, select the Options | Define target configuration | Specify Board Parameters menu option.


Example:

dccl_cmp myProgram.c -rti 0x0101:2000:29.4912:128:256


-s Port:Baud:Stopbits:BackgroundTx


Description:

Use serial transmission with parameters defined in a colon separated format of Port:Baud:Stopbits:BackgroundTx.

Port: 1, 2, 3, 4, 5, 6, 7, 8
Baud: 110, 150, 300, 600, 1200, 2400, 4800, 9600, 12800, 14400, 19200, 28800, 38400, 57600, 115200, 128000, 230400, 256000
Stopbits: 1, 2
BackgroundTx: 0: None, 1: Sync, 2: Full Speed

Include all serial parameters in the prescribed format even if only one is being changed.

Starting with Dynamic C v 7.10, the last parameter is ignored and therefore may be dropped from the command line without consequence.


Default:

1:115200:1:0


GUI Equivalent:

Select the Options | Communications Serial dialog box options.


Example:

Changing port from default of 1 to 2:


dccl_cmp myProgram.c -s 2:115200:1:0

-sto SerialResponseTimeout (Available starting with Dynamic C v 7.10)


Description:

Time in milliseconds Dynamic C waits for a response from the target on any retry while trying to establish serial communication.


Default:

300 ms.


GUI Equivalent:

None.


Example:

dccl_cmp myProgram.c -sto 400

-t NetAddress:TcpName:TcpPort


Description:

Use TCP with parameters defined in a contiguous colon separated format of NetAddress:TcpName:TcpPort. Include all parameters even if only one is being changed.

netAddress: n.n.n.n
tcpName: Text name of TCP port
tcpPort: decimal number of TCP port

Default:

None.


GUI Equivalent:

Select the Options | Communications | Use TCP/IP Connection dialog box options.


Example:

dccl_cmp myProgram.c -t 10.10.6.138:TCPName:4244

15.5 Examples

The following examples illustrate using multiple command line switches at the same time. If the switches on the command line are contradictory, such as -mr and -mf, the last switch (read left to right) will be used.

15.5.1 Example 1

In this example, all current settings of default.dcp are used for the compile.


dccl_cmp samples\timerb\timerb.c

15.5.2 Example 2

In this example, all settings of myproject.dcp are used, except timer_b.c is compiled to timer_b.bin instead of to the target and warnings or errors are written to myouputs.txt.


dccl_cmp samples\timerb\timer_b.c -o myoutputs.txt -b -pf myproject

15.5.3 Example 3

These examples will compile and run myProgram.c with the current settings in default.dcp but using different defines, displaying up to 50 warnings and capture all output to one file with a header for each run.


dccl_cmp myProgram.c -d MAXCOUNT=99 -nw 50 -h -o myOutput.txt

dccl_cmp myProgram.c -d MAXCOUNT=15 -nw 50 -h -oa myOutput.txt

dccl_cmp myProgram.c -d MAXCOUNT=15 -d DEF1 -nw 50 -h -oa myOutput.txt

The first run could have used the -oa option if myOutput.txt were known to not initially exist. myProgram.c presumably uses a constant MAXCOUNT and contains one or more compiler directives that react to whether or not DEF1 is defined.


<< 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