Memory Commands


DUMP memory

    DUMP addr size

Dumps "size" bytes of data beginning at the specified address expression. Data is displayed in both hex and ASCII. If "size" is not specified,

    DUMP addr

then the size is the same as that of the previous dump. The dump size is initially set to 128 bytes.

If no address is specified, the next block after the previous dump is displayed.

"D" is an abbreviation of "DUMP". The F2 function key is equivalent to "DUMP" with no parameters.

The command DUMP16 has output similar to DUMP, but shows data as 16-bit hex values in target byte order.

The command DUMP32 has output similar to DUMP, but shows data as 32-bit hex values in target byte order.


EDIT: Examine/change memory

    EDIT {addr} {%type} {val} {val2} {val...}

This command allows the user to examine and/or change memory locations or program variables in a variety of formats.

If an address expression is specified on the command line, that address will be opened. Thus

    EDIT 1000

will open the Edit Memory dialog beginning at address 1000.

If no address is specified, then the last opened address will be reopened. After completion of the previous example, entering

    EDIT

will open the Edit Memory dialog beginning at address 1000. If one or more data values, separated by spaces, are specified on the command line, those values will be written to the one or more successive bytes beginning at the specified address, and the dialog will not be opened:

    EDIT 1000 55 66 77

will store the value 55 at address 1000, the value 66 at address 1001, and 77 at the address 1002. In this case, the original contents of the locations will not be shown, and control will return to the NoICE command prompt. This form of the command is primarily useful when issued from command files, but may be used at any time.

If the address specified has a data type, then display and entry will be done using that data type. For example, if "retry" is DEFINEd as a 16 bit signed integer, then

    EDIT retry

will display the value of the 16 bit word at address "retry" as an integer, and accept entry of a new value as a 16 bit integer. Structures and arrays may also be edited.

The default data type may be overridden by specifying a data type name preceded by "%". For example,

    EDIT 1000 %S16

will display the contents of the 16 bit word at address 1000 as a integer, and accept entry of a new value as a 16 bit integer. See DEFTYPE and subsequent commands for more information about data types.

"E" is an abbreviation of "EDIT".


MEM: Edit memory in hex

This command is a shortcut to specify an address in the Memory tab of the lower window. The command

    MEM addr

will make the Memory Window visible, and display the contents of memory beginning at the specified address expression. Data is displayed in both hex and ASCII, and either format can be edited by clicking on the appropriate location. You can also use the Tab and Shift-Tab keys to move between the hex and ASCII fields.

"M" is an abbreviation of "MEM".


DISASSEMBLE or UNASM: Disassemble

This command allows the user to disassemble a program in target memory. To view the source code for a program, refer to the SOURCE command.

To begin disassembly at address expression "addr", enter

    DISASSEMBLE addr

To continue disassembly at the instruction after the last one shown in the source window, enter

    DISASSEMBLE

"U" (for "unassemble", since "D" is used for "DUMP) is an abbreviation of "DISASSEMBLE"..


ASSEMBLE memory at address

This command allows the user to enter instructions into target memory using their assembly mnemonics.

To begin entering assembly instructions at address expression 1000, enter

    ASSEMBLE 1000

This will open the Assemble Memory dialog beginning at address 1000. If no address is specified, then the last opened address will be reopened.

Note that all currently defined symbols may be used as instruction arguments. Thus for the 68HC11

    LDAA 1000h
    ADDA FOO
    STAA FOO+1000h

are all legal instructions if FOO has been previously defined.

As an alternative to the dialog, if the user follows the address by a valid assembly language statement, the statement will be assembled and written to memory without showing the dialog. For example:

   ASM 1000 LDAA 1000h

You may also specify a file containing assembly statements by prefixing the name with "@":

   ASM 1000 @myfile.asm

Lines will be read from the file and assembled into sequential memory locations. Occurrence of an assembly error will cause the file operation to be aborted. Note that this will typically not work with a normal assembly source file, because such files usually contain pseudo-ops such an EQU and ORG that are not known to NoICE. Comment lines beginning with ";" are allowed, however.

Please note that the ASM command is intended for use in patching code and entering small programs. It is not intended to replace a stand-alone assembler. In particular, the parser is not guaranteed to catch all illegal combinations of arguments, and the error messages may at times be misleading.

"ASM" is an abbreviation of "ASSEMBLE".


LOAD file

    LOAD file {load offset}

This command writes the contents of a disk-resident file to target memory. NoICE supports

In addition to directly LOADing these formats, NoICE includes utility programs that can convert a variety of other formats into information suitable for symbolic and source-level debugging with NoICE.

If you have occassion to load multiple files as part of a debug session, you may want to read about the LOADGROUP command as well.

Except for binary files, NoICE automatically determines the file type based on the data in the file.

For hex files, an optional load offset can specify an address expression to be added to 16 bit addresses within the load file. Data is written to the target locations specified by the effective address. Thus

    LOAD file 33:0

will load "file" into page 33, and

    LOAD file 1234

will add hex 1234 to all load addresses in "file". This option is not supported for Elf or IEEE-695 files. The offset - actaully a load address - is required for binary files, since such files do not contain any address information.

To abort a load in progress, press the Escape key or click on the Cancel button on the toolbar.

"L" is an abbreviation of "LOAD".

LOAD is associated with the Debug Context, and may affect breakpoints and watchpoints.

Every compiler and emulator vendor seems to have a slightly different interpretation of the formats described below. If you experience difficulty loading any of these formats, please contact us with information about the compiler or assembler used and example source and load files.

Elf With Dwarf or Stabs Debug Information

Many current compilers, including GNU/GCC and Metrowerks CodeWarrior, can generate debug files using the Elf/Dwarf standard. Some compilers generate debug information in the Elf/Stabs format. If your compiler gives you both Dwarf and Stabs options, choose Dwarf.

Elf files often have the extension ".elf". CodeWarrior generates ".abs". Consult your compiler documentation to find what your compiler generates. In many cases you an specify the filename and extension to be used, which may make it easier for the file filter in NoICE's Load File dialog to see the file. To see these files in the Load File dialog, change "Files to type" to "Elf Files".

If the Run until "main" after LOAD option on the Run menu is checked, NoICE will automatically place a breakpoint at "main" and execute the C startup code after you LOAD an Elf file.

For 16-bit targets, NoICE normally assumes addresses above 0xFFFF are paged/banked, and will use bits 23 through 16 to specify the page. However, GCC for HC11/HC12 uses a different format. NoICE contains special code that detects Elf files produced by GCC11/12 and interprets the addresses accordingly.

Optimizing compilers can generate code that it is very difficult for a debugger to deal with. For example, if you compile an ARM program with GCC using optimization level 2 (-O2), it will in some cases generate instructions out of order with respect to the lines of C code. When you single-step this sort of code, the PC seems to jump around the code in a most peculiar manner.

We recommend that you begin by disabling optimization (-O0 in GCC) at least until you have verified NoICE's operation. Once you see how NoICE handles non-optimized code, you can try various optimization settings to see if they adversely affect debugging.

Please note: Dwarf is very well defined by the "DWARF Debugging Information Format Specification". However, it is a very complex format that can encode all sorts of things that NoICE cannot deal with, such as local variables that move from register to various stack locations during the course of a function. In most cases, NoICE will ignore information that it cannot understand. In some cases this may resultin "missing" variables etc.

In contrast to Dwarf, the Stabs debug format is poorly documented and ambiguous. What documentation there is was mostly gathered by the fine folks at Cygnus who read source code and reverse-engineered a document that details the many inconsistent ways that different compilers use Stabs.

All of which is to say that there may be cases where NoICE cannot understand a file and generates incorrect debug information or indicates an error. If this happens to you, try reducing your compiler's optimization level or turning off optimization completely. Some compilers offer various options for elf formats. Read your compiler documentation and try those which may be appropriate. If you still have trouble, please send us the offending Elf file, and if possible the source code that produced it, and we will do our best to find a solution.

We would also like to mention that doing a Google search for "elf stabs dwarf" turns up a large number of items not related to debugging...

ImageCraft DBG format

Version 6 and later of the ImageCraft compiler can generate debug files in the ImageCraft .DBG format. By default, these files will have a .abs extension. To see these files in the Load File dialog, change "Files to type" to "ImageCraft DBG Files". These files contain symbol and source debug information. When NoICE loads an ImageCraft DBG file, it will also try to load an ImageCraft-generated S19 file with the same name.

The original .DBG format supports primitive data types, pointers, and arrays, but does not support C structure or union definitions.

DBG format 1.1, supported by ImageCraft Professional Version 6.13 and later, does support structures, unions, and bitfields.

To produce a DBG file, use the ImageCraft "-g" compiler switch. When using the ImageCraft IDE, select "Options" from the "Project" menu. Select the "Compiler" tab.

Build your project (myproject.prj in our example here). Then run NoICE and LOAD myproject.dbg.

If the Run until "main" after LOAD option on the Run menu is checked, NoICE will automatically place a breakpoint at "main" and execute the C startup code after you LOAD an ImageCraft DBG file.

Motorola/Freescale Format

NoICE will load data from S1 (16-bit address), S2 (24-bite address) and S3 (32-bit address) records.

If a Motorola/Freescale S7, S8, or S9 record is encountered, the target program counter will be set to the start address contained in the record. Motorola/Freescale S0 records are ignored.

S2 and S8 records contain 24-bit addresses. If the target processor is the 68HC08, 68HC11 or 68HC12, these addresses are interpreted as recommended by Motorola/Freescale:

For other processors, a 24-bit address is interpreted as

Note: The ImageCraft IDE calls the first format "Linear" and the second one "CPU / Banked". NoICE's default for Motorola/Freescale targets is "Linear".

Note: Even though Motorola/Freescale recommends the linear format, their Metrowerks compiler and free MCUez assembler generates the banked format. Doh!

To change NoICE's interpretation of S2 addresses to match your compiler or assembler, you can use the S2FORMAT command or the checkbox in the Load File dialog..

As if that weren't bad enough, GNU/GCC for the HC11 and HC12 defines a third way to interpret S-records: If memory banking is used, all records in the file will be S2 records. If the address is less than 0x10000, it is an unbanked address. If the address is 0x10000 or greater, it is interpreted as a "linear" address after subtracting 0x10000 from the address in the S-record. NoICE will not correctly load S-records in this format. If you are using GNU/GCC11 or 12, you should load the Elf file rather than a Motorola file. In addition to eliminating the address format problem, you can get source-level debugging.

EatS9

(If you don't understand this section, you probably don't need it.)

Some projects are linked in pieces to produce more than one hex file. However, in some cases NoICE performs special actions before or after loading a hex file, and you may not want this action to be performed for each file. For example

NoICE includes the utility EatS9 to get around these issues. EatS9 simply removes the S9 (or S8 or S7 for extended address records) from the end of a file. This allows files to be concatenated and burned as a single file.

Beginning with NoICE 9.2, you may find it more convenient to use the LOADGROUP command instead of EatS9.

In operation,

Intel Format

The following record types are supported

Extended Tektronix Format

NoICE supports record types 6 (data), 8 (end), and 3 (symbol). If a non-zero address is specified in an end record, NoICE will set the target program counter to the start address contained in the record.

Section names defined in symbol records will be converted into NoICE file scope specifications, in order that local scope symbols may be defined. This use of sections is not supported by all tools which produce Tektronix records. In cases where actual section names are used, it may be possible (via compiler or assembler directive) to set the section name equal to the file name (without extension) for each module.

Symbols defined with Tektronix symbol types 1 through 4 will be defined as global. Symbols defined with Tektronix symbol types 5 and above will be defined as file scope within the current file (section).

Symbols of type 7 (local code address) with names of the form L_123 will be interpreted as line number information within the current file (section). Not all tools which produce Tektronix records can generate line number information.

IEEE 695 Format

NoICE will load both memory content and symbolic debug information from IEEE 695 binary and ASCII format files, using the HP/Microtec extensions. The extensions are quite complex, and ambiguous in places. If you experience any difficulty loading a IEEE 695 file, please contact us.

We note that the Production Languages Corp. 8051 compiler uses proprietary extensions to IEEE 695 for structure definitions. These files cannot be loaded by NoICE.

By default, IEEE 695 files will have a .695 extension. To see these files in the Load File dialog, change "Files to type" to "IEEE 695 Files".

If the Run until "main" after LOAD option on the Run menu is checked, NoICE will automatically place a breakpoint at "main" and execute the C startup code after you LOAD an IEEE 695 file.

Binary Files

NoICE can also load files that contain a binary memory image. In this case, you must provide a load address, since the binary file does not contain anything except memory content.

If the file has the extension "BIN", then the file will be loaded as a binary image. To force a file with any extension to be loaded as a binary image, specify the file name, a load address, and the letter "B". Thus

    LOAD file 1000 B

will load "file" as a binary image beginning at address 1000.

Loading Symbol and Line Number Information

The original definitions of the Motorola/Freescale and Intel hex formats contain only data, with no symbolic information. However, various emulator manufacturers have extended the formats to include symbolic information. While not as full-featured as Elf or IEEE 695, these formats can provide useful debug information.

If your assembler or compiler cannot produce any of these formats, you may still be able to extract the necessary information from MAP and LST files. Utilities are provided to perform this task.

The following symbol formats are supported by the NoICE LOAD command for Motorola/Freescale and Intel hex files:

"Intel format" (sometimes known as "Applied Microsystems format") symbol definitions appear before the hex records, and are of the form

    0 name hexvalueH

"Zax" format symbol and line number definitions appear before the hex records, and are of the form

    $$file
    name hexvalueH
    #linenumber hexvalueH

Symbols declared in the block after $$file will be defined as having scope limited to that file. A "file" name of GLOBAL will cause subsequent symbol definitions to be global.

The file name will often occur without either extension or path. In this case, NoICE will be unable to open the file for source-level debug, because it does not know the file's extension. This can be corrected either before or after loading the Zax symbols by issuing a FILE command for each file, including the extension and any necessary path information. Often, it will be convenient to include these definitions in a command file, which may also load the hex file. For example, such a file might contain:

    FILE ctest.c
    FILE \cxx\lib\start.s
    LOAD ctest.hex

"Atron" format symbol and line number definitions appear before the hex records, and are of the form

    $$ file.ext
    name $hexvalue
    #linenumber $hexvalue

Symbols declared in the block after $$file.ext will be defined as having scope limited to that file. A "file" name of GLOBAL will cause subsequent symbol definitions to be global.

Atron format includes path and extension information for files.


LOADGROUP: begin loading a group of files to memory

Normally, NoICE's LOAD command performs a series of actions

If you have multiple files to load, such a boot loader and a main application, or an application program and calibration data, the default operation may not be acceptable. You can use the LOADGROUP and ENDLOADGROUP commands to allow multiple files to be loaded and burned as a unit.

To use LOADSGROUP, create a Command File that wraps the loading of your files like this:

	LOADGROUP
	LOAD file1.elf
	LOAD file2.s19
	...
	LOAD fileN.s19
	ENDLOADGROUP

When you PLAY the command file, NoICE modifies the normal sequence:

In general, debug information such as ELF from multiple files cannot be merged. If more than one of the files in a load group contain debug information, only the information from the first file will be retained.

Preserving Calibration and Configuration Data

Some applications store calibration or configuration data in Flash along with the program. You can use LOADGROUP to preserve such data when you replace the application: Simply use the SAVE command to read the calibration data from the target and save it to a file. Then user LOADGROUP to burn both the application and the calibration data. As an example, suppose that the calibration data begins at memory address 0x1000, and that there are 0x200 bytes of data. Your command file would look like this:

	SAVE calibration.s9 0x1000 0x200
	LOADGROUP
	LOAD application.elf
	LOAD calibraion.s19
	ENDLOADGROUP

ENDLOADGROUP: finish loading a group of files to memory

ENDLOADGROUP is used to terminate a list of files being grouped by the LOADGROUP command.


S2FORMAT: Set Motorola/Freescale S2 Address Format

As described above, the addresses in Motorola/Freescale S2-records may be interpreted in two different ways:

For processors like the HC12 that have memory banking, Motorola/Freescale recommends a format called "linear":

The most common mode for non-Motorola/Freescale processors is "banked" mode, where the top eight bits of the 24-bit address is the page or bank:

By default, NoICE assumes that Motorola/Freescale target architectures will use "linear" format, and that other target architectures will use "banked" format. The S2FORMAT command may be used to change the interpretation.

    S2FORMAT linear

will set the format to linear, and

    S2FORMAT banked

will set the format to banked.

The format is saved in the Registry, so you only need to set it once.

You may also examine or change this setting using the checkbox labelled "S2 Records have linear addresses" in the LOAD dialog.


SAVE memory to file

    SAVE file addr size {type}

This command writes the contents of the specified region of target memory to a disk file in Motorola/Freescale or Intel hex format, or as a binary image. If the file already exists, it is deleted and a new file of the same name is created.

The default save format is Motorola/Freescale hex. Record-type conventions match the LOAD command.

To force a file with any extension to be written as Intel hex, specify the file name, start address, size, and the letter "I". Record-type conventions match the LOAD command.

If the file has the extension "BIN", then the file is written as a binary image. To force a file with any extension to be written as a binary image, specify the file name, start address, size, and the letter "B":

    SAVE file 1000 100 B

To abort this command, press the Escape key or click on the Cancel button on the toolbar.

Note: prior to version 8.2, the default format was Intel hex. The default was changed to Motorola because it can address more than 64K of memory, as is required on some targets such as the HC12.


WATCH memory at address

The "WATCH" or "W" command allows the contents of a byte, word, or region of memory to be displayed in the Watch window. The display is updated:

Watch data may be displayed in various formats as described below.

Syntax to create a watch is

    WATCH addr {%type}

where

"addr"
is an address expression
"type"
is an optional data type specifier. See DEFTYPE and subsequent commands for more information about data types.

Examples:

    W 1000

will show the byte at address 1000 in hex in the data window.

    W 1000 %S16

will show the word at address 1000 (i.e., the bytes at addresses 1000 and 1001) as a signed decimal integer in the data window. The byte order for words is processor dependent.

    W 1000 %S16[10]

will show the 20 bytes beginning address 1000 as an array of 10 signed decimal integer in the data window. The byte order for words is processor dependent.

    W -

will delete all watches.

    W -1000

will delete the (first) watch at address 1000.

Watches are part of the Debug Context, and may be saved, restored, or removed by the LOAD, and PLAY/LASTFILELOADED commands.


FILL Initialize memory block

    FILL addr size value

Sets "size" bytes of target memory beginning at "addr" to "value".

To abort this command, press the Escape key or click on the Cancel button on the toolbar.


COPY memory block

    COPY addr1 size addr2

Copies "size" bytes of target memory beginning at "addr1" to target memory beginning at "addr2".

To abort this command, press the Escape key or click on the Cancel button on the toolbar.


CHECKSUM: Compute checksum

    CHECKSUM addr size

Computes and displays the 32-bit sum of "size" bytes of target memory beginning at "addr". Also computes and displays the 16-bit CRC-CCITT (x16 + x12 + x5 + 1) on the memory region, starting with an initial CRC of 0xFFFF.

The additive checksum is frequently generated by EPROM programmers and other tools, and this command can be used to generate a checksum for comparison purposes.

This command is most often used to tell whether or nor a region of memory has changed, or whether two regions of memory have identical contents. The CRC value is better than the checksum for this purpose: the checksum will not distinguish between changes in the order of bytes in a region, while the CRC will.

To abort this command, press the Escape key or click on the Cancel button on the toolbar.

"CHECK" is an abbreviation of "CHECKSUM".


NoICE (tm) Debugger, Copyright 2012 by John Hartman

Using NoICE - Contact us - NoICE Home