Hexmodx: User Manual
Hexmodx: User Manual
Version: 8.1.1
HexmodX
User Manual
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 2 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
Abstract
This document shall help the user of HexmodX to know how to work with the tool. The focus is set to
enable the user to generate a modified hex file in a short time.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 3 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
Table of Contents
HexmodX 1
Abstract 2
Table of Contents 3
1. Introduction 5
1.1 General 5
1.1.1 What is HexmodX? 5
1.1.2 What is XML? 5
1.1.3 What is Schema? 5
2. Overview 7
2.1 Functional Overview 7
2.1.1 Executable 8
2.1.2 INCA DLL 8
2.1.2 Main Module 9
2.1.3 Base IO Module 11
2.1.3.1 Input Operations 12
2.1.3.2 Output Operations 15
2.1.3.3 Append Features 16
2.1.3.4 MEM Operations 17
2.1.3.5 Variant Coding 18
2.1.3.6 Variant Coding Backwards 21
2.1.3.7 SegmentA to Segment8 Transition during Variant Coding 22
2.1.4 Infoblock Module 23
2.1.4.1 Building and Linking Infoblock 24
2.1.4.2 Infoblock Log Information Before and After update 24
2.1.4.3 Logging Information of Blocks which are marked as OTP. 25
2.1.4.4 Validating Infoblock 25
2.1.4.5 Deletion of a Infoblock 29
2.1.4.6 Detailed logging of Infoblock Elements 30
2.1.5 Checksum Module 31
2.1.5.1 Checksum Algorithms 32
2.1.5.2 Defining Checksum Range 36
2.1.6 ABM Module 36
2.1.7 Error Module 37
2.1.8 Compress Module 39
2.1.9 HexComp Module 40
2.1.10 Patch and Check Module 41
2.1.10.1 GetAddress and GetInfoTableAddress 43
2.1.10.2 Patch and Check log file (PatchInfo.xml) 44
2.1.11 CleanUp Module 44
2.1.11.1 Cleaning the TPROT and CTPROT 45
2.1.11.2 Cleaned Blocks Serialization 45
2.1.12 Encryption Module 46
2.1.13 Command Line Support 46
2.1.14 Groovy command line parameters. 47
3.1 Introduction 48
3.1.1 General 48
3.2 Installation 49
3.2.1 Installing Middleware 49
3.2.2 Installing the Smart Card reader 49
3.2.3 TPROT module 50
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 4 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 5 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
1. Introduction
1.1 General
The tool HexmodX reads and modifies a Intel hex file and Motorola S19 file. This modification
involves balancing checksum, compatibility modification, variant coding, and tuning protection. This
tool is used by Software Build Environment, Calibration Engineers, INCA and Factory Release
processes.
HexmodX tool is designed for modular approach. Each functionality is separated into different
packages. User can configure the loading of these package modules depending on the functionality
required using a configuration file. This configuration file is in XML format. Each module package
loading requires a XML configuration file. Each XML configuration file is validated against a schema
defined by the tool.
XML (eXtensible Markup Language) is a simple, very flexible text format derived from SGML. XML is
a markup language for documents containing structured information. XML is mainly used for
exchange of a wide variety of data between two parties.
To define the structure of XML-based configuration file, user need a “Schema” or a “DTD (Document
Type Definition)”. In the header of each XML this schema name should be mentioned for validation
purposes.
“Schema” is a definition language used by XML for describing and constraining the content of XML
documents. The “Schema” defines the grammar and structure of the document. User can define the
structure, constraints and data types in Schema.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 6 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
If the rules.xsd is not present in “C:\schemas\rules.xsd” then HexmodX tries to load the rules.xsd from the
schema folder inside the HexmodX installation directory.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 7 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
2. Overview
The tool HexmodX is designed to modify the hex files in Intel format and Motorola format. The
modification involves merging of hex files, copying, moving and deleting data, balancing for
checksum and compatibility, variant coding of data sets, tuning protection and others.
All the features are delivered in java archive (jar) format. The tool is driven by the rules set in the
configuration files, which is in XML format.
User can write their own modules, which can be completely independent. User modules can also
access the data shared by modules provided by the HexmodX tool during its operation. This can be
done by calling user modules using main configuration file, which is explained in later topics.
HexmodX functionalities are delivered in java archive (.jar) format. HexmodX tool uses the
configuration files in XML format to trigger the functionalities required. Each functionality are
mentioned in the main configuration file (usually called as rules.xml) using XML tags sequentially.
Hence modules are called one after the other. Its user’s responsibility to provide the modules
sequentially as per the functionality required.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 8 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
The main module of the tool calls all these modules. This main module is entry point for the
application. HexmodX tool has two entry points. One is an executable (called HexmodX.exe) and
another is DLL for INCA (called hpt_HexmodX.dll). Both are used for same functionalities, however,
INCA DLL is called by INCA.
2.1.1 Executable
HexmodX is a command line application which takes configuration file as command line parameter
and uses it to read the configuration settings which includes the functions/operations the tool
executes.
HexmodX also provides several other command line options for version check, help documentation.
The following is a list of command line options which serve to trigger various operations in the
application.
All command line parameter must begin with “/”, except “man”
However, if no parameter is supplied, user shall be prompted dos box for the configuration/command
file input as shown above.
The interface is provided by the DLL will be accessed by INCA tool to invoke HexmodX
functionalities.
On success TRUE is returned and on failure FALSE is returned.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 9 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
boolean HexPostTreatment
(
// path & fileName for hexfile
unsigned char *hexPath,
// path & fileName for a logfile
unsigned char *logPath,
// from asap2
unsigned char *cpuType,
// from asap2
unsigned char *parameter
);
The configuration file can be provided to this call through the fourth parameter. In this case, the
first two parameters (hexPath and logPath) are not used. This action is similar to executable.
If the BLK_Start address is provided as fourth parameter, then initial two parameters are necessary
to specify the hex file with path and log file with path.
e.g. BLK_Start = 0x80808080
This triggers the INFOBLK chain to be built based on the start address provided by fourth parameter.
The checksum is calculated for the blocks appear in the block chain and compatibility is verified.
This module is a main processing unit of HexmodX. This module is automatically loaded by either
executable or INCA DLL using a configuration file.
This configuration file is used as the main configuration file for the HexmodX application to load the
required functionalities.
Along with module names required to be loaded, this also defines the error handling settings and
other general settings. User should be aware of the module names to load for the functionality
required.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 10 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
Note: Descriptions of each tags and attributes are explained in table below.
Each XML file is validated against a schema. The main module XML file is validated against the
schema “rules.xsd”, a schema file is provided by the HexmodX.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 11 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
Note:
Keyword “ERRMOD” define the log file name to put the log message levels.
This error module settings can be defined in all modules configuration file. If not defined, this main
modules configuration settings are taken for error handling.
Base IO module is used for basic Input/Output operations on Intel hex and Motorola s19 files. This
module is used to read, modify and write them.
Either “INPUT” or “OUTPUT” can appear in side “BaseIO” tag. Base IO module needs to be called
twice in any HexmodX operations through Main Module. i.e., Once for reading input files and Later
for writing output files.
The INPUT tag is provided inside BASEIO tag to specify the settings for FILE read operations.
This input tag also has additional tag for Copy, Move and Delete functionality called “MEM”.
The output tag is provided inside BASEIO tag to specify the settings for the FILE writing back
operations.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 12 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
INPUT FILEIN INPUT tag specifies the file read operations. FILEIN tag will
VDS be used for normal reading and merging. VDS will be used
for variant coding purposes. Either one of these elements can
appear inside INPUT tag.
OUTPUT FILEOUT OUTPUT tag specifies the file write operations. FILEOUT tag
VDSBACK will be used for normal writing of modified hex file contents.
VDSBACK will be used for variant coding backwards
purposes. Either one of these elements can appear inside
OUTPUT tag.
Special data type is used for validating addresses provided in the XML file. It is "exhexBinary”.
This data type has particular size limit and pattern, which is as described below.
Characteristics Values
MinLength 3
MaxLength 10
Pattern [0]x[a-fA-F0-9]*
FILEIN keyword has TYPE, NAME, IGNORELINECKS, OVERWRITE, FROM, LEN attributes.
Multiple input files can be read one after the other. Multiple Files read operation results in data
merging. File data is stored in ascending order of address. If any duplicate address is found while
merging, application throws error. This can overridden by OVERWRITE attribute.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 13 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 14 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 15 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
FILEOUT
This XML tag specifies the output operations to be done by HexmodX application. This has TYPE,
NAME, FROM, LEN and LYT attributes.
FROM and LEN attributes can be used to write the output files for a range specified.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 16 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
</HEXMODX>
</CONF>
FROM This attribute is used to provide the start address for the
writing the data over the range. Data type is
exhexBinary.
LEN This attribute is used for the length of the range for
writing the data into output file. Data type is
exhexBinary.
LYT This attribute is used to configure the layout (byte length)
of each data records, while writing the output file.
This can be configured from “0x00” to “0xFF”.
IGNORE3OR5 This is a boolean attribute, used to ignore records of type
“03” or “05” while writing the output files.
FORMAT This attribute is optional and applies only when TYPE
attribute is “S19”. The possible values of this attribute are
S2 and S3. The value of this attribute specifies the format
of the S19 file while writing the output file. S3 format
means that the S19 file contains 4 byte address and S2
format means S19 file contains 3 byte address. By
default the value of this is S3.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 17 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 18 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
FROM This attribute is used to provide the start address for the
source data. Data type is exhexBinary.
LEN This attribute is used for the length of the range for
writing the data into output file. Data type is
exhexBinary.
TO This attribute is used to provide the destination address
for the writing the data. Data type is exhexBinary.
OVERWRITE This is an optional boolean attribute with default value
“false”
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 19 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
VDSIN tag is used for Variant Data coding operations. This operation is specified by its parent VDS
tag under INPUT keyword.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 20 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
During Variant Coding operation, three different information files will be written based on the request
by in the XML file.
VDSLOG report will be written to an output file specified by the configuration setting “VDSLOG”
Total free space in Data Set of Variant Coded file will be calculated and displayed in the report.
[HexmodX] [7.1.0]
#####################################################################
# Data sizes of variant files in VDS #
#####################################################################
Files Size(in bytes) %Occupation %Free
---------------------------------------------------------------------
refvariant_0.hex 48 4.17
refvariant_1.hex 100 8.68
refvariant_2.hex 12 1.04
refvariant_3.hex 160 13.89
refvariant_4.hex 12 1.04
refvariant_5.hex 12 1.04
refvariant_6.hex 272 23.61
---------------------------------------------------------------------
Total 616 53.47 46.53
---------------------------------------------------------------------
VCTRTABLELOG command will write the contents of the vector table into a log file. This will be
sometimes necessary for the user/developer to check the location of vector table and its contents.
[HexmodX] [7.1.0]
#####################################################################
# Vector Table Information #
#####################################################################
AREA: <DS> at 0x800058
[START]
0x8e064e
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 21 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
0x8e0656
……..
[END]
AREA: <VDS_1> at 0x880084
[START]
0x882dac
0x8e0656
0x8e065c
……..
[END]
Area: %VDS_%n% %ADDRESS%
[START]
0x8e064e
0x8e0656
0x8e065c
……..
[END]
VCTRINFOLOG command will write the contents of the vector Infoblock details into a log file. This
will be sometimes necessary for the user/developer to check the location of vector Infoblock and its
contents.
[HexmodX] [7.1.0]
#####################################################################
# Vector Info Table Details #
#####################################################################
Vector Table : 0x800058
CheckSumInfoBlock_1 : 0
DS Vector Table : 0x800058
DS Vector Table : 0x8004d8
VDS Vector Table : 0x880084
VDS Vector Table : 0x882dac
VDS Data Start : 0x882dac
VDS Data End : 0x8dff74
Data Skip Start : 0x1000000
Data Skip End : 0
Vector Entries : 8
Variant Coding Backwards is operation to get back original data sets from variant coded file. Original
data sets will be extracted from Variant coded file (VDS Area), and each individual file will be
created.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 22 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
Attributes
VDSBACK - VDSBACK is used for variant coding backwards. I.e.,
retrieval of variants from master file. This attribute is a
child element of OUTPUT tag.
TYPE This is a mandatory attribute.
0xA0001234 -------------
0xA0001234 -------------
0xA0001234 -------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 23 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
Infoblock module is required to perform the modification of infoblocks inside MDG1 software. This
Infoblock module performs linking of each blocks, modify blocks for checksum, compatibility, SWID,
TTNr update etc.
XML keywords for Infoblock operations are provided inside XML tag “IBMOD”. They are
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 24 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
IBBUILD has two child elements, they are “BLKBUILD” and “BLKLINK”.
BLKLINK: Linking the Infoblock depends on the start address provided in the BLKLINK element.
This start address can be provided by attribute START. Linking Infoblock depends on the NXTBLK
attribute value.
HexmodX application will pickup the START value and updates the Next Block field of the Infoblock
to the value specified by NXTBLK.
Caution: User must be careful while choosing the start address of the Infoblock. HexmodX
application updates NXTBLK value at offset 0x8 from START address location.
<IBBUILD>
<BLKLINK START="0x80808008" NXTBLK="0x80810000"/>
<BLKLINK START="0x80810000" NXTBLK="0x80820000"/>
<BLKLINK START="0x80820000" NXTBLK="0x0"/>
</IBBUILD>
LOGBEFORE tag can be used to trigger this operation before updating or validating Infoblock.
<LOGBEFORE>
<IBLOG FILE="ibbefore.txt"/>
<CKLOG FILE="cksbefore.txt"/>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 25 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
</LOGBEFORE>
LOGAFTER tag can be used to trigger this operation after updating or validating Infoblock.
<LOGAFTER>
<IBLOG FILE="ibafter.txt"/>
<CKLOG FILE="cksafter.txt"/>
</LOGAFTER>
This feature enables the user to detect whether blocks are marked as OTP are not. If the blocks are
marked as OTP then it logs information about the block like STARTADDRESS,ENDADDRESS and
Nutzdaten Checksum in the txt file or xml file specified in the <IBLOG> tag of InfoBlk.xml as shown
below.
<LOGBEFORE>
<IBLOG FILE="ibbefore.txt"/>
</LOGBEFORE>
Or
<LOGBEFORE>
<IBLOG FILE="ibbefore.xml"/>
</LOGBEFORE>
Validation needs to be done for SET or TEST operations on various features. SET operation will
update the values. TEST operation will check the values present for the actual value.
<VALIDATE>
<SWID VAL="12345678" FUNCTION = “SET”/>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 26 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 27 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
Balancing Infoblock
Balancing Infoblock is done by updating Checksum and Compatibility. These values can be tested or
modified depending on the values TEST/SET.
WRITECKS does the Checksum calculation and COMPATIBILITY does the calculation of
Compatibility.
If Only WRITECKS tag is provided, HexmodX “de-activate” the COMPATIBILITY i.e., it resets all
adBlkID field of every Infoblock.
If both tags are provided, WRITECKS & COMPATIBILITY are handled for every Infoblock based on
the Dependency link provided in the COMPATIBILITY list.
<VALIDATE>
<CHECKSUM>
<WRITECKS FUNCTION="SET"/>
<COMPATIBILITY FUNCTION="SET">
<IB BLKADDR ="0x80820000" BLKCKS="0" DEPBLKADDR="0x80810000" DEPCKS="0"/>
<IB BLKADDR ="0x80B00000" BLKCKS="0" DEPBLKADDR="0x80820000" DEPCKS="0"/>
<IB BLKADDR ="0x80C00000" BLKCKS="0" DEPBLKADDR="0x80B00000" DEPCKS="0"/>
</COMPATIBILITY>
</CHECKSUM>
</VALIDATE>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 28 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 29 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
As seen from the above picture, a command named DELETEBLOCK is given inside Infoblock.xml
This command takes care of deleting the complete Infoblock. The details about the attribute is as
follows
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 30 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 31 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
<HEXMODX>
<IBMOD>
<IBBUILD>
<BLKLINK START="0x80018000" NXTBLK="0x80014000" />
<BLKLINK START="0x80014000" NXTBLK="0x80000000" />
<BLKLINK START="0x80000000" NXTBLK="0x80080000" />
<BLKLINK START="0x80080000" NXTBLK="0x80004000" />
<BLKLINK START="0x80004000" NXTBLK="0x00000000" />
</IBBUILD>
<DETAILEDLOG FILE="AddressModel.xml" INFOBLOCK="ALL" REPORTINVALIDBLOCKS="true" />
</IBMOD>
</HEXMODX>
REPORTINVALIDBLOCKS ="true” specifies that UKNOWN blocks, if any, present in the Hex file should be printed.
Checksum modules are used to calculate the checksum over the range specified. This is triggered
by keyword CHKSUM. It also takes the initial and final values for Checksum calculations. Checksum
calculation depends on the chosen algorithm. This can be provided by Checksum algorithm names.
Possible types of algorithms are {CRC32, ADD32, CRCxx, IFXCRC, ADD16 and ADD8}
This checksum module is loaded by Infoblock module for the checksum over Infoblock and
Checksum Infoblock. Default CRC32 checksum algorithm will be used for the Checksum over
Infoblock.
For checksum over the checksum blocks, depending on the index in the hex file (checksum
Infoblock structure) the algorithm, respective algorithm will be invoked. The index for the selection of
the algorithm is as shown below.
Index Algorithm
0x1 ADD32
0x2 CRC32
0x10 ADD16
0x8 ADD8
Checksum algorithm can also be used to calculate the checksum over the hex data ranges and write
the checksum result to output hex file or pre-defined address. This is helpful for the user to cross
check the checksum results in the hex file. For this purposes, the user can use checksum module.
Checksum.xml should written by the user, and this has to be loaded in the main XML file. The
sample XML file for Checksum module usage is as shown below.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 32 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
Following table describes the checksum algorithms provided by the HexmodX tool.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 33 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 34 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 35 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
<CHKSUM OUTPUTFILE="Modulo256ChecksumOutput2.txt">
<MODULO256 DISPLAYADDRESSLENGTH="0x3"/>
<CKSRANGE FROM="0x80040000" LEN="0x161800"/>
</CHKSUM>
DISPLAYADDRESSLENGTH="0x3" specifies that the addresses written to the output file should be
3 bytes i.e. in this case the output file looks as below.
0x800400 , 0x801A17 , BB . Where BB is the calculated checksum.
0x800500 , 0x801A27 , CC Where CC is the calculated checksum
2.1.5.1.1 COMPENSATIONBYTES
This feature is used to calculate the checksum of a block and store the checksum in the hex file. The
checksum is written to an address with value 00 00 FF FF. The address to which the checksum is
written does always contains the value 00 00 FF FF. But whenever a new checksum value has to be
written to this address, the checksum value of 00 00 FF FF is preserved by writing the first two bytes
with the two bytes of the checksum. The value 00 00 is replaced by the checksum value and the
value FF FF is replaced by the value obtained by subtracting the obtained checksum value from FF
FF. For example, let’s assume we want to check from 0000 to 0200 and we want to write the result
in 0100. Then the checksum over this range would be different before and after writing the
checksum into 0100.
Example:
Before: 00 00 FF FF
Calculated checksum: 34 B1, subtracted checksum: CB 4E
After: 34 B1 CB 4E.
If we then build the checksum again over this range we get the same result as before.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 36 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
Following table describes XML tags for defining the data range for checksum calculations.
Elements Children or Description
Attributes
CKSRANGE Child element under CHKSUM tag for specifying the
checksum range.
ABM module is used to validate the Alternate Boot Mode (ABM) area in the Hex File. ABM can be
located at 4 different locations. They are PRIMARY, SECONDARY, EX_PRIMARY,
EX_SECONDARY.
All valid (ABMID being 0xDEADBEEF) ABM locations are processed for checksum using IFXCRC
algorithm and result is updated inside ABM.
These locations can be configured through the XML keywords. See below for more details.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 37 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
Error module is basically used by all the modules for error logging. Error module is used for
displaying messages to the users either on console window or in the log file. XML file is used for
configuring the settings.
These settings can be part of XML files provided for each module as shown in Main Module
Each module can have its own error module setting. If not provided, settings of Main Module will be
chosen.
Its not mandatory to have error module settings. By default following settings are chosen.
<ERRMOD>
<LOG FILE="HexmodX.log"/>
<MSGLOG LVL="1"/>
<MSGCONSOLE LVL="1"/>
<PROGABORT LVL="3"/>
</ERRMOD>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 38 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
PROGABORT User can choose this keyword to abort the program for
message level set.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 39 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
The compression module works similar to Checksum module. Currently only LZRB algorithm is
implemented.
The compression will be mainly based on FLASH and IMAGE types. FLASH compression types
writes the data in particular format in the hex files, while IMAGE type overwrites the hex file data at
specified location.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 40 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
HexComp module is used to compare the two ranges of data in hex files. HexComp also generates
a report in the log xml files, which describe the information about the comparison.
The address and the file information can be configured through the XML configuration files. Please
have a look at the sample xml file below.
You can also compare the two different ranges from the same file. In such cases, you have to just
specify the same file name in both RANGE attributes.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 41 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
PatchAndCheck module is used to patch/check/view hex data in the hex file. Individual operations
are explained as follows.
Patch operation is used for patching the hex file data with HEX or ASCII values at the specified
address given in the configuration xml. Check operation is used for checking the value in the hex
file with the value specified in the xml file for the specified address. View operation is used for
viewing the hex content at the specified address given.
PATCH action is used for patch the hex data with the
given value at the given location.
CHECK action is used for check the hex data with the
given value at the given location.
VIEW action is used for viewing the hex data with the
given length at the given location.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 42 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
PATCH Operation:
Sample for using REF type feature.
Here, pc module will fetch the data from 0x80008000 (address given in the VALUE tag) and use that
data as the VALUE for the specified ACTION.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 43 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
CHECK Operation:
Here, the data present at the source address 0x80008000 (value given in VALUE attribute) is
compared with data present at destination address 0x1C297600. If they are same, check result is SUCCESS
else FAILED.
GetAddress tag is used to locate an address at an offset specified from a pointer address. Sample
xml for GetAddress is as follows.
Since the level is specified as 3, HexmodX will iterate the 3 times to get the final address. Final
address is calculated as follows.Consider the sample hex data.
:020000048080FA
:1000000000AAAAAAAAAAAAAAAAAAAAA97
:1000100000000000000000000000000000000000E0
:1000200000000000808000600000000000000000D0
:1000300000000000000000000000000000000000C0
:1000400000000000000000000000000000000000B0
:1000500000000000000000000000000000000000A0
:100060008080009400000000000000000000000090
:100080000000000000000000000000000000000070
:1000900000000000808000A0000000000000000060
:1000A0000000000000000000000000000000000050
In first Iteration, pc module will fetch 4 bytes data at the given address, at 0x80800024, which is
0x80800060.In the second iteration pc module will fetch the data at 0x80800060, which is
0x80800094. In the third iteration, pc module will fetch the data at 0x80800094, which is
0x808000A0. Finally this data will be added to the offset given, i.e. 0x1000 and return the final
address, which is 0x808010A0.
GetInfoTableAddress tag is used to locate an address at given offsets. Here we need to specify
OFFSET’S to get the final address. The user can specify as many OFFSET’S as he wishes. In the
below example we have take 2 OFFSET’S .The Sample.xml for GetInfoTableAddress is as follows.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 44 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
In the first iteration, pc module adds the start address with the OFFSET1, i.e. 0x80800020 + 0x4,
which is 0x80800024, and fetches the data at that location, i.e. 0x80800060. In the second iteration,
new address will be added to the OFFSET2, 0x80800060+0x12, which is 0x80800072, and return as
the final address.
Patch check module generates xml file as the output information file, which has the information
about the NAME, ACTION, NEW_VAL, OLD_VALE, TYPE etc. Sample PatchInfo file for a VIEW
operation is as follows.
<LOG>
<PATCHCHECK>
<LABELS TYPE="ASCII">
<NAME> ACCD_DebExcTempDef_C</NAME>
<FILE>sample.hex</FILE>
<ADDRESS>0x80800068 </ADDRESS>
<OLD_VAL>0x80800094</OLD_VAL>
<NEW_VAL> </NEW_VAL>
<RESULT>SUCCESS</RESULT>
<INFO>VIEW</INFO>
<PHY-VAL/>
</LABELS>
</PATCHCHECK>
</LOG>
For the VIEW action, only OLD_VAL will be updated, and for the PATCH and CHECK operation,
both NEW_VAL as well as the OLD_VAL will be updated. In NEW_VAL, VALUE tag in the input file
will be written and in the OLD_VAL, actual value in the hex file will be written.
Cleanup module is created to erase the contents of TPROT (Tuning Protection) and CTPROT
(Customer Tuning Protection Block) out from Hex files. The main reason for doing thing is to protect
since both sections which are not to be read out.
After removing the TPROT and CTPROT from the hex file, the remaining hex file must be signable,
must be good to generate signatures. Therefore it is not sufficient to remove the TPROT and
CTPROT totally because in that case the remaining hex file can’t be trimmed (checksums) and
signatured.
Using the cleanup module, it is possible to do three kind of operation, Cleaning the TPROT and
CTPROT section, Merging the TPROT and CTPROT back to the hex file and Checking the Content
of the hex file to verify cleaned or not
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 45 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
The contents of tuning protection (TPROT) and customer tuning protection (CTPROT) sections are
confidential material. If Hex files are used outside Robert Bosch, the contents of TPROT and
CTPROT have to be removed using this HexmodX extension.
While cleaning the hex file, only cleaned blocks can be serialized into separate hex file along with
cleaned hex file. I.e. it contains all the blocks along with cleaned blocks.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 46 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
Encryption module encrypts the block of data using AES encryption mechanism.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 47 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
HexmodX has a new feature to support some basic functionality through command line.
Till date HexmodX supported only xml files as the input. Now we can specify commands to do
variant coding through command line. Example and the explanation of commands are given below
Some of the commands that HexmodX supports from 3.9.0.0 version onwards are
Example :
Please finds the steps below, explaining how arguments can be passed to bean shell script:
1. While invoking Hexmodx using BSH, arguments can be passed as shown below:
Please be noted that the parameter list is included within quotes(“”). The argument list is indexed from 1. You
can pass n number of arguments to the script. Each argument is separated by a semicolon(“;”).
2. Hexmodx adds these arguments to a list starting from index 1. The arguments can be accessed from BSh file.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 48 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
A method call getProperty(“index of argument”) can be used to fetch argument value as below:
And so on..
3.1 Introduction
3.1.1 General
MDG1TPROT is a java tool that can be used to calculate signature and certificate for a hex file. A middleware
(supplied from vendor ESCRYPT) component is available as a dll that performs the hash, signature and
certificate calculation for input data bytes. MDG1TPROT is a wrapper around the middleware component. It
provides interfaces to perform different operations on the middleware. This tool can be used along with
HexmodX for calculating and updating the signature and certificate for the infoblocks. The scenario is as
depicted below
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 49 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
3.2 Installation
The installation of MDG1TPROT is done in steps. Each step for installing different components those work together.
The installation comes with a complete package that contains MDG1TPROT.jar, middleware components as zip file and smart
card reader setup as zip file.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 50 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
To verify the successful installation of the smart card reader, follow the steps below.
1. Open Mozilla firefox.
2. Go to Tools Options Advanced Tab Encryption Security Devices
3. In the Device Manager window, click Load
4. In the Load PKCS#11 Device window, give a module name e.g. OpenSC.
5. Give the path to the Opensc_pkcs11.dll from the middleware installation folder in the module filename. The dll will be
available at middleware installation path\gnutls322\bin\opensc-pkcs11.dll
6. Click OK.
7. You’ll be able to see the option OpenSC Card(User PIN) under openSC. Kindly click on that to see a similar window as
shown below.
8. You can also login by clicking on login and providing the smart card PIN.
TPROT module is used for all TPROT related operations on hex files. This module is used for hash calculation,
signature generation and certificate generation.
The tprot module XML file is validated against the schema “mdg1tprot.xsd”, a schema file is provided by the
HexmodX.
This module is used to calculate the hash value of a hex file. Please find below the tprot.xml sample
used to calculate the HASH for INFOBLOCKS and RANGES.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 51 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 52 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
TYPE TYPE specifies the type of the input file specified. For eg.
IHEX, S19,bin file etc.
RANGES RANGE, OUTPUT RANGES tag provides provision to calculate HASH over a
range of data.
RANGE FROM, TO RANGE tag is used to specify the extremes of the range
via FROM and TO attributes.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 53 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
This is used to generate the signed hex file from the input hex file.
Please find below the tprot.xml sample used to generate the sign text file.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 54 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
TYPE TYPE specifies the type of the input file specified. For eg.
IHEX or S19 file.
This is used to generate the sign text file from the hash text file.
Please find below the tprot.xml sample used to generate the sign text file.
Children or Description
Attributes
KEYPATH KEYPATH attribute is used to define the public/private key
information.
MODE MODE tag provides options to perform Signature
INPUT_HASH calculation either “ONLINE” or “OFFLINE”
INPUT INPUT attribute specifies the path/name of the input hash
text file for which signatures are to be generated.
OUTPUT OUTPUT attribute specifies the path/name of the output
text file. The output text file contains the signatures for
each hash value from the input hash text file.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 55 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
This is used to generate the sign text file from the hash text file.
Please find below the tprot.xml sample used to generate the sign text file.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 56 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
TYPE TYPE specifies the type of the input file specified. For eg.
IHEX or S19 file.
This is used to generate the signed hex file from the input hex file.
Please find below the tprot.xml sample used to generate the sign text file. For TSW container
generation the PIN to login to smart card will be asked only once. The PIN is saved initially in the tool itself and
all further operations are performed with the saved PIN.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 57 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
TYPE TYPE specifies the type of the input file specified. For eg.
IHEX or S19 file.
This is used to generate the certificate for the input hex file.
Please find below the tprot.xml sample used to generate the certificate file.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 58 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
<CERTIFICATE>
<INPUT INFOBLKADDR=" " INPUT="header.hex" OUTPUT="header_out_cert.hex"
IGNORELINECKS="true" LYT="0x10"/>
</CERTIFICATE>
</MDG1TPROT>
</HEXMOD>
</CONF>
The certificate will be appended to the input file specified in the INPUT tag under the CERTIFICATE
element.
<MDG1TPROT>
<SIGNATURE MODE="OFFLINE" DUMMY="true">
<INPUT_HEX INFOBLKADDR="0x08FC0020" INPUTFILE="medc18_v9.hex"
IGNORELINECKS="true" TYPE="IHEX">
<OUTPUT FILENAME="./../../HEXMOD/_out/output.hex" TYPE="IHEX" LYT="0x20"/>
</INPUT_HEX>
</SIGNATURE>
</MDG1TPROT>
The attribute DUMMY in signature tag is used to generate dummy signature and certificate. DUMMY=”true” creates
dummy signed hex file, false would use middleware to sign the hex file.
To dummy sign a hex file using INPUT_HASH and INPUT_SIGN, example is shown below.
<MDG1TPROT>
<SIGNATURE MODE="OFFLINE" DUMMY="true">
<INPUT_HASH INPUT="hash.txt" OUTPUT="./../../HEXMOD/_out/sign.txt"/>
</SIGNATURE>
</MDG1TPROT>
This would generate a sign.txt file which contains dummy signature, used as below to path it to hex file:
<MDG1TPROT>
<SIGNATURE MODE="OFFLINE" DUMMY="true">
<INPUT_SIGN INPUTFILE="medc18_1.hex" INPUT_TXT="sign.txt" IGNORELINECKS="true"
TYPE="IHEX" MODE="LittleEndian" ID="tag1" INFOBLKADDR="0x80020000">
<OUTPUT FILENAME="./../../HEXMOD/_out/output1.hex" TYPE="IHEX" LYT="0x10"/>
</SIGNATURE>
</MDG1TPROT>
The sign.txt file containing dummy signature and certificate are patched to hex file.
In the case shown above DUMMY=”true” is used as discriminator for dummy signing and signing using middleware.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.
2
User Documentation Page: 59 / 59
HexModX Date: 17-11-2014
Version: 8.1.1
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All rights by BOSCH. We reserve all rights of disposal such as copying and passing on to third parties.