The program is controlled by command sequences, either given on the command line or placed in a so called Jom File. Jom files are simple text files containing a sequence of JTAG-O-MAT commands.
jtagomat -v HALTStops the target CPU in verbose mode. The CPU status will be printed out.
jtagomat BATCH memdump.jomStarts execution of the command sequence in the file memdump.jom.
All commands can be specified with their full name or abbreviated by the first letters, as long as they are unique among all commands. Up to now, all commands do have a unique first letter. Also note, that commands are not case sensitive, thus
C c Cont CONTINUEdo all specify the same command.
Most commands allow or require one or more parameters, which may be values, register names, filenames or special keywords.
We will now look to each command in detail and provide examples about how to use them.
Continues execution of commands contained in the specified batch file, optionally starting at a given label. Batch files can be nested without limitation.
Each command in a batch file must be placed in a seperate line. Empty lines are allowed and are ignored. The same applies for leading or trailing spaces.
Semicoli can be used to add comments or temporarely disable (commenting out) certain lines. The semicolon and all following characters up to the end of the line are ignored.
Labels may be added as the first word in a line and can be used as targets for the JUMP and the ONERR command.
Examples:
BATCH remap.jomStarts execution of commands contained in a text file named remap.jom.
BATCH upload.jom FlashStarts execution of commands in upload.jom at label Flash.
Switches the target CPU to normal execution mode. An optional parameter can be used to specify a new program counter value.
Examples:
CONTINUEContinues target execution at the address, where the CPU had been stopped previously.
CONTINUE 0Continues target execution at the address zero. The following sequence will do the same.
SAVE PC 0 CONTINUE
Queries the JTAG ID code of the target device. An optional parameter can be used to verify the retrieved code with an expected value.
Examples:DEVICEQueries the device ID. If JTAG-O-MAT is running in verbose mode, the value will be printed out.
DEVICE 0x1F0F0F0F ONERR BadDeviceQueries the device ID and verifies it against 0x1F0F0F0F. If not equal, the next command ONERR will continue execution at label BadDevice.
Programs or erases FLASH memory. On some platform implementations this requires, that a flasher utility is running on the target. At least one parameter is required, which specifies the base address of the FLASH device.
Examples:
FLASH 0x10000000Queries the FLASH memory at base address 0x10000000 for its device ID. If JTAG-O-MAT is running in verbose mode, the value will be printed out. The program may internally check the ID and may set the error flag in case of unknown device codes. An ONERR command can then be used to handle such an error.
FLASH 0x10000000 0x10002000Erases the sector at address 0x10002000 of the FLASH device at base address 0x10000000. The error flag will be set if the erase fails.
FLASH 0x28000000 0x28104400 0x12345678 0xF0F0F0F0Writes the value 0x12345678 at address 0x28104400 and the value 0xF0F0F0F0 at address 0x28104404. The base address of the flash device is at 0x28000000. The error flag will be set in case of an error.
SAVE 0x00000000 ./flasher.bin ONERR Exit CONTINUE 0 FLASH 0x10000000 0x10000000 FLASH 0x10000000 0x10002000 ONERR Exit FLASH 0x10000000 0x10000000 ./image.bin ONERR Exit NOTE Flash programming OK! QUIT Exit: NOTE Flash programming failed! QUIT 3This command sequence will load a flasher utility into the target RAM starting at address zero and start this utility. Then the first two 8 kByte sectors are erased and the contents of a binary image file will be written into the FLASH device, A message will be printed on the screen about success or failure.
Stops the target CPU to enter debug mode.
Example:
HALT LOAD PC 1 STDOUT CONTINUEStops the target CPU, prints the contents of the program counter and continues execution.
Continues execution at a specified label. This command is useful in batch files only.
Note, that labels are case sensitive.
Example:
JUMP Label01 CONTINUE Label01: QUITContinues with the command following Label01, which is a QUIT. The CONTINUE command is skipped.
Downloads memory or register contents from the target. The downloaded values may be displayed on the screen or stored in a file and can be optionally verified against expected values.
Examples:
LOAD 0Download memory contents at address zero.
LOAD 0x100 128Download 128 bytes starting at memory address 100hex.
LOAD 0x100 128 STDOUTDownloads 128 bytes starting at memory address 100hex. Each 32 bit value will be printed out on a single line with its address in front. If the output is redirected to a file, this file may be later fed to SAVE STDIN to restore the memory contents.
LOAD 0xFFE00000 32 STDOUTDisplays memory map registers of the AT91 CPU.
LOAD R13 1 STDOUT LOAD SP 1 STDOUTBoth commands display the stack pointer of an ARM CPU.
LOAD 0x10000000 0x2000 ./romimage.binDownloads 8 kBytes starting at memory address 0x10000000 and saves the binary image in the specified file.
LOAD 0 1024 ./ram.bin ./expect.binDownloads 1 kBytes starting at memory address zero, saves the binary image in ram.bin and verifies the downloaded contents against the contents of expect.bin. If not equal, the error flag will be set.
LOAD R0 1 STDOUT R1 ONERR NotEqual SAVE R2 0Compares the contents of register R0 with the contents of register R1. If both are equal, register R2 will be cleared. Otherwise the execution continues at label NotEqual.
Not yet implemented.
Example:
MODE LOADFORMAT=IHEXSwitches format of downloaded images from binary (default) to Intel Hex.
Displays a note.
Example:
NOTE Hello world!
Similar to the JUMP command. However, the jump is performed only if the internal error flag is set. Otherwise execution continues on the next line. If the error flag is set, then the ONERR command will clear it again.
Examples:
HALT ONERR FailedIf stopping the target CPU failed, execution of the batch file commands continues at label Failed.
LOAD R0 1 0 LOAD R1 1 0 LOAD R2 1 0 ONERR UnexpectedVerifies that registers R0, R1 and R2 are all cleared to zero. If any of the three registers contains a non-zero value, the sequence will continue at label Unexpected and the error flag will be cleared again.
Stops execution of the current Jom Batch. Optionally an error code may be returned.
Examples:
QUITStops execution of the current batch file. If it has been called from within another batch file via the BATCH command, then execution will continue with the next command within the calling batch. Otherwise JTAG-O-MAT will exit.
QUIT 2Stops execution of the current batch file and returns the error code 2. If it has been called from within another batch file via the BATCH command, then the error flag will be set and execution will continue with the next command within the calling batch. Otherwise JTAG-O-MAT itself will exit with this error code.
Toggles the hardware reset of the target. This may not be supported by all hardware adapters. Optionally the hardware reset may be set or cleared with this command.
Examples:
RESETToggles the target hardware reset.
RESET 1 WAIT 1000 RESET 0Keeps the hardware reset active for 1 second.
Uploads memory or register contents to the target. For FLASH memory the FLASH command must be used.
Examples:
SAVE 0 0Clears memory location 0.
SAVE LR 0x1000Sets the link register to 1000 hex.
SAVE R0 R1Copies contents of register R1 to register R0.
SAVE 0x100 ./app.binStores binary image file at memory address 0x100.
SAVE STDINReads a sequence of lines with a memory addresse or a register name followed by a value and stores these values at the given locations. The standard input may be re-directed to a file, which had been created by re-direction of the standard output of a LOAD command. Here is an example how to store and re-store the program counter from the command line.
jtagomat LOAD PC 1 STDOUT >regs.txt jtagomat SAVE STDIN <regs.txt
SAVE 0xFFE00000 0x1000213D SAVE 0xFFE00004 0x20003E3D SAVE 0xFFE00020 0x00000001This example shows how to invoke the remap command for an AT91 CPU.
Delays command execution for one second or a specified number of milliseconds.
Examples:
WAITWaits one second before continuing.
CONTINUE 0 WAIT 200 HALTStarts the target CPU at address zero and stops it again after 200 milliseconds. The actual running time of the CPU will be larger, depending on the speed of the host computer running JTAG-O-MAT.
For further flexibility, macros may be used in batch files. While reading a batch sequence, JTAG-O-MAT will check each line for macros and expand them before the line is finally executed. Macro definitions may be nested. That means, a macro may expand to another macro, which is expanded again and so forth until all macros had been expanded.
Macros are given as simple words with a dollar sign in front. Replacements for macros may either be specified as command line paramters (-D) or environment variables.
Example:SAVE $ADDR 0This is how a line in a batch file with a macro looks like. Something will be set to zero. Without an adequate macro definition, this line will result in a syntax error.
jtagomat -DADDR=0x100 batch.jomWhen starting JTAG-O-MAT like this, all occurences of $ADDR in the batch file will be replaced by 0x100.
SET ADDR=0x100 jtagomat batch.jomThis gives the same result, when running JTAG-O-MAT on a Windows PC. The replacement for $ADDR will be retrieved from the shell environment.
export ADDR=0x100 jtagomat batch.jomThis shows how to use the environment on a Linux PC.
SET ADDR=0x100 jtagomat -DADDR=PC batch.jomIf both, the environment and a command line parameter define the same macro expansion, then the latter will be used, PC in this case.
SET ROMSTART=0x10000000 jtagomat -DADDR=$ROMSTART batch.jomThis example uses recursive macro expansions. Finally all occurences of $ADDR will be replaced by 0x10000000.