nshex - shrink
The shrink command shrinks a HEX image by removing blank instructions, blank pages, or blank rows. This may reduce the size of the HEX file.
target = shrink(source,units)
|source||The Source image.|
|units||Optional. May be one of the following:
shrunk_code = shrink(original_code,word)
This command shrinks the original_code HEX image by removing all blank instructions or words. The new image is named "shrunk_code".
# shrink.txt - Shrink a HEX file
#read the HEX file
app = read(%1.hex)
#shrink the file and store it back
app = shrink(app,row)
This example shows a command file which can be used to shrink any HEX file.
First, the HEX file is loaded. The name of the HEX file must be supplied on the command line.
Then, the HEX image is shrunk and written back, overwriting the original file.
Such command file may be applied to the HEX file which has been read from the actual chip by nsprog. nsprog reads the whole programmable memory. Therefore, the HEX files created by nsprog will often contain blank areas. The shrink command removes all the blanks:
nsprog r -d PIC18F87J94 -o chip.hex
nshex -s shrink.txt chip
© 2007-2023 Northern Software Inc. All Rights Reserved.