Terminal configuration file

Out CommTool terminal program has many features. One of these is the ability to read its configuration from a file. Since CommTool.Exe itself can be renamed, the program will ascertain its own name from the command line and will, by default, attempt to obtain its configuration from the file in the local (i.e., current working) directory named (Filename).CFG.

In the prior lesson, the command line that we used to start CommTool was this one:

C:\>CommTool /C6 /B57600
                                                                                

Let's create a configuration file that contains those startup parameters. At the command prompt, let's create a new subdirectory and a CommTool configuration file in it. We'll start in the C:\ root directory.

C:\>MkDir PM_COM6
C:\>CD PM_COM6
C:\PM_COM6>Copy CON CommTool.Cfg
; This configuration is USB port COM6.
B=57600 ; BAUD (data communication) rate
C=6     ; COM port to use

F9=Capture
  (press Control-Z on the new line, then press Enter)

The file created is C:\PM_COM6\CommTool.Cfg and we're now using that directory as our current working directory.

CommTool can be prevented from reading a configuration file by using either the "/NoCfg" or "/Neither" command line switch. If not prevented, the configuration file will be read first then any command line switch parameters applied. So, for example, if you were to type "CommTool /C4", CommTool would save COM6 as the port to be opened, but change it to COM4 when it encountered "/C4" on the command line. It would then attempt to open only COM2, having forgotten entirely about COM6.

Anything after the first non-quoted semicolon on a particular line is treated as a comment. CommTool simply discards the rest of the line. Comments are to help you remember or explain the meaning of a line or block of lines. They may certainly be omitted. Finally, if the line in CommTool.Cfg had been entered as "/C6" instead of just "C6" above, it would disregard the slash and select COM6 as expected. "COM6" and "/COM6" are also acceptable.

There is something in the CommTool.Cfg file which is new, however. It is the "F9=Capture" line which toggles capturing of output to disk. We'll be adding more lines to the configuration file as we go forward, but for now, let's see how to use the capture feature.

Downloading and saving the initial device content

The terms "download" and "upload" can be a little ambiguous. When we use the term "download", we mean receiving a block of data (like a file) into your computer from another device, either from the Internet or from some other device (like our MIRTOS-based device.) In the same vein, when we use the term "upload", we mean transmitting a block of data from your computer to another device, either to another local device, or computer, or to a device on the Internet.

Another way to obtain the very same output as the "DSE" command is "DE+ 0 80", in which the data range is specified explicitly, as in the center section below. This is simply called "Debug format." The data can also be output in another format, suitable for reinput later, using the "DEH+ 0 80" command, at the bottom in the example output shown below.

>DSE
EEPROM contents:
0000:  10 21 00 9F 01 00 84 FF-04 00 FF FF 28 01 50 FF  .!..........(.P.
0010:  C0 00 3F FF 60 08 03 67-FF 15 74 FF FF FF FF FF  ..?.`..g..t.....
0020:  22 28 05 00 FF FF 38 FF-FF FF 14 20 00 08 FF FF  "(....8.... ....
0030:  80 16 FF FF FF FF FF FF-90 00 B0 00 80 01 FF FF  ................
0040:  FF FF FF FF F0 01 00 36-FF FF FF FF FF FF FF FF  .......6........
>DE+ 0 80
EEPROM contents:
0000:  10 21 00 9F 01 00 84 FF-04 00 FF FF 28 01 50 FF  .!..........(.P.
0010:  C0 00 3F FF 60 08 03 67-FF 15 74 FF FF FF FF FF  ..?.`..g..t.....
0020:  22 28 05 00 FF FF 38 FF-FF FF 14 20 00 08 FF FF  "(....8.... ....
0030:  80 16 FF FF FF FF FF FF-90 00 B0 00 80 01 FF FF  ................
0040:  FF FF FF FF F0 01 00 36-FF FF FF FF FF FF FF FF  .......6........
>DEH+ 0 80
EEPROM contents:
:02000002E0001C
:100000001021009F010084FF0400FFFF280150FF22
:10001000C0003FFF60080367FF1574FFFFFFFFFF8D
:1000200022280500FFFF38FFFFFF14200008FFFF14
:100030008016FFFFFFFFFFFF9000B0008001FFFF71
:10004000FFFFFFFFF0010036FFFFFFFFFFFFFFFF95
:00000001FF
>                                                                               

That last format is "Intel® Hexadecimal" object file format, commonly called "iHex" format. MIRTOS can both output iHex and accept iHex as an input format. It has two (2) additional, short lines of text. The first, beginning with ":02", specifies segment 0xE000, which is the designation for EEPROM to MIRTOS. The last, beginning with ":00" is the End-Of-File (EOF) marker.

When no range is specified with a Display EEPROM command, whether in iHex or Debug format, MIRTOS will output (or "dump") all of the device's EEPROM. The "+" specifies foreground output and the "-" to omit the "EEPROM contents:" row in the command below. We'll toggle on capture, using the F9 key defined in the configuration file both before and after the output.

>DEH+-  ; and press "F9" just before "Enter" Capturing to: 20180905_162051.Cap

:02000002E0001C
:100000001021009F010084FF0400FFFF280150FF22
:10001000C0003FFF60080367FF1574FFFFFFFFFF8D
:1000200022280500FFFF38FFFFFF14200008FFFF14
:100030008016FFFFFFFFFFFF9000B0008001FFFF71
  . . . (removed 56 lines of iHex output)
:1003C0000CE21C02FFF00020A078E8031027FF8059
:1003D00008E21C02FFF00020A07864001400FFA0D7
:1003E0000CE21C02FFF00020A078E8031027FFA019
:1003F00009F21C01003800280000F4013075FFFFED
:00000001FF
>; Press "F9" again now Closed capture file 20180905_162051.Cap
>                                                                               

The captured file now contains a complete backup of the EEPROM. To perform the same backup of the entire visible FLASH, or PROGRAM, memory, just replace "E" with "P", again using F9 to toggle capture. So, "DPH+-" is the command, which is NOT case sensitive. This would capture 16 KBytes (0x0000 to 0x3FFF) in the 328P, over 107 KBytes (0x00000 to 0x1AEFF) in the 1284P, and over 235 KBytes (0x00000 to 0x3ACFF) in the 2560. Most of these ranges are User FLASH memory, but some of it is System FLASH as well. Of course, only certain sections can be captured using Display command range syntax.

>dph+-  ; Press "F9" now Capturing to: 20180905_162427.Cap

:100000000C9480301002436F707972696768742CA9
:1000100020323031332D323031382C20534341449B
:100020004120537570706F72742047726F75702C19
:1000300020496E632E0D0A536F6E6F6D612C204345
  . . . (removed 1,017 lines of iHex output)
:103FC0000010270000E8030000640000000A000061
:103FD0000053657269616C204E756D6265723A209E
:103FE00044656D6F5F37345041003BF90212A831D0
:103FF000523FA00242ABDF560E79C38410A4FFFFEC
:00000001FF
>; Again, press "F9" now Closed capture file 20180905_162427.Cap
                                                                                

The same capture method can be used to save a copy of either EEPROM or FLASH using "DE" or "DP" in Debug format by omitting the "H". These are easier for people to read, but more difficult to reinput. There is also the "DS" version to display all of the system SRAM. It could also be captured, but that would be mostly for documentation instead of backup purposes.

Please refer to the program description webpage for much more detailed CommTool.Exe program documentation.