Dataescher DHex Command-Line Tool
DHex is installed with Dataescher HexEditor, and is
a command-line tool designed for developers and embedded engineers who work with complex data
formats. Now you can seamlessly manipulate Intel, Motorola, Tektronix Hex files, ELF files, and more through the command
line. This tool offers precise control over memory regions, file sections, and data transformation, making it an essential
companion for embedded programming and large file manipulation. Imagine replacing all your custom command tools, whether
it be arm-elf-objcopy, srec_cat, with just one tool that does everything much simpler. This tool can be integrated into your
post-build commands to format the output data from your code however you want, embed serial numbers, merge files together
or separate them into multiple files, re-map files or data within the file, and conver between formats.
Downloads
Download HexEditor version 1.1.0.21
Command-Line Interface
General Commands
- Display Help
-?, -h, --help
Shows the help screen with available commands.
- Set Log File
-l, --log <logPath>
Parameters:
- logPath (String) - Specifies the log output file.
- Set Working Directory
--wd <workingDirectory>
Parameters:
- workingDirectory (String): Sets a new working directory.
- Set Logging Verbosity
-v, --verbosity <verbosityLevel>
Parameters:
- verbosityLevel (Byte): Controls the verbosity level (0: Errors only, 1: Success messages, 2: Processing messages, etc.).
- Get Loaded Assemblies
--assemblies
Lists the assemblies loaded by the program.
Data Manipulation
- Change Cursor Address
--cur, --cursor <cursorAddress>
Parameters:
- cursorAddress (UInt32): Changes the cursor position to a specified address.
- Change Selection Range
--sel, --select <startAddress> <endAddress>
Parameters:
- startAddress (UInt32): Specifies the new selection range start address.
- endAddress (UInt32): Specifies the new selection range end address.
- Delete Selected Data
--del, --delete
Deletes all data within the selection range.
- Crop Data
--crop
Crops the data to the selection range, effectively deleting any data outside of the selection range.
- Fill Selected Data
--fill <fillByte>
Fills the selection range with the specified byte.
Parameters:
- fillByte (Byte): The byte to fill into the selection range.
- Fill with Random Data
--rand, --random, --rnd
Fills the selection range with random data.
- Reverse Bytes
--reverse-bytes
Reverses the order of bytes within the selection range.
- Reverse Bits
--reverse-bits
Reverses the order of bits within the selection range.
- Invert Bits
--inv, --invert
Inverts all bits within the selection range.
File Operations
- Load Data from File
--load <fileName>
Loads data from a specified file.
Parameters:
- fileName (String): The name of the file.
- Merge Data from File
--merge <fileName>
Parameters:
- fileName (String): Merges data from another file.
- Save Data to File
--save <fileName>
Saves the current data to a specified file.
Parameters:
- fileName (String): Saves the current data to a specified file.
- Clear All Data
--clear
Clears all data from the current session.
Advanced Data Manipulation
- Move Data by Offset
--off, --offset <offset> <moveUp>
Parameters:
- offset (UInt32): Moves data by the specified number of bytes.
- moveUp (Boolean): If true, moves the data upwards (negative offset); otherwise, downwards (positive offset).
- Move Selected Data by Offset
--move, --mv <offset> <moveUp>
Similar to --offset
, but affects the data in the selection range and not the entire file.
- Copy Data to Memory
--copy, --cpy
Copies the selected data to the copy memory.
- Cut Data
--cut
Cuts the selected data and transfers it to the copy memory.
- Paste Data
--paste
Pastes data from the storage memory to the current cursor address.
- Insert Text at Cursor
--text <data>
Inserts ASCII text at the current cursor location.
Parameters:
- data (String): A ASCII-formatted string to place in the file at the cursor address.
- Insert Hex Data at Cursor
--hex <data>
Inserts hexadecimal data at the cursor.
Parameters:
- data (String): The data to insert. Must contain data with hexadecimal digits (0-9, 'A'-'F', 'a'-'f'), and can optionally start with "0x" if passing a number to embed into the data. Any whitespace characters are ignored.
CRC Computation
- Configure CRC
--crc-conf <crcType> <polynomial> <initialValue> <xorOut> <reflected>
Configures CRC computation properties. By default, the CRC method used is CRC-32/ISO-HDLC. This command can be used to change the CRC computation method.
Parameters:
- crcType (String): The CRC type (valid types: CRC8, CRC16, CRC32, CRC64).
- polynomial (UInt64): The CRC polynomial.
- initialValue (UInt64): The CRC initial value.
- xorOut (UInt64): The CRC XorOut property.
- reflected (Boolean): The CRC reflected property. If reflected, the CRC computation typically begins with the least significant bit; otherwise, begins with the most significant bit.
- Compute CRC
--crc
Computes a CRC for the current selection range. The CRC can then be read using --info
command, or embedded into the datafile using the --crc-paste
command.
- Paste Computed CRC
--crc-paste
Places the last computed CRC at the cursor address.
Program Information
- Display Program Info
--info
Prints program information to the console, including the current cursor address, selection range, copy memory size, and computed CRC.
Examples
- Generate 256 bytes of random data at address 0x100 and place the CRC at address 0x200, then save as Intel Hex format:
DHex.exe --sel 0x100 0x1FF --random --crc --cur 0x200 --crc-paste --save example1.hex
- Load the file example1.hex, invert the data, and save as Motorola Hex format:
DHex.exe --load example1.hex --sel 0x100 0x203 --invert --save example2.s19
- Load example2.hex and remap the file starting at address 0x300, merge with example1.hex, and save as Tektronix Hex format:
DHex.exe --load example2.s19 --offset 0x300 false --merge example1.hex --save example3.tek