mergeNSZ partition read remove shift shrink write Download
nshex - merge
The merge command merges two HEX images.
If the source images have common areas then such areas are filled with data from the second image.
target = merge(source1,source2)
|source1||The first Source image.|
|source2||The second Source image.|
mix = merge(app,boot)
This command merges two HEX images named "app" and "boot". The new combined image is named "mix".
# build.txt - Building Production Image
#read the application HEX file
app = read(app.hex)
#read the calibration data
calibration = read(calibration.hex)
#obtain unique serial number
serial = NSZ(serial.nsz)
#combine everything together
app = merge(app,calibration)
app = merge(app,serial)
This example shows how nshex may be used to combine application, calibration and unique serial number together so that they could be programmed onto the chip in a single pass.
First, the application HEX file and HEX file containing the calibration data is loaded.
Then the unique serial number is obtained from an NSZ file using the NSZ command.
Finally, the pieces are mixed together with the merge command and saved as "production.hex". The file is ready to be programmed on the chip
# merge.txt - Merging Two HEX Files
#read the files
hex1 = read(%1.hex)
hex2 = read(%2.hex)
mix = merge(hex1,hex2)
This example shows a general purpose nshex command file which can be used to combine any two hex files. The names of the hex files are passed on the command line.
nsread 7fc000 800000 -d dsPIC33EP512MU810 -f hex > aux.hex
nshex -s merge.txt -d dsPIC33EP512MU810 app aux production
nsprog p -i production.hex
Here nsread is used to read auxiliary flash memory from the chip (the range 0x7fc000 to 0x800000 holds the auxiliary flash). Then nshex merges the resulting hex file with the "app.hex" file and saves the result as "production.hex". Finally, nsprog programs the file onto the target device. Note that you don't need to specify the device name for nsprog because nshex embedded the name of the device into the HEX file.
The overall result of this operation is that dsPIC33EP512MU810 is re-programmed with new application, but the auxiliary flash is preserved.
© 2007-2023 Northern Software Inc. All Rights Reserved.