nshex - expand
The expand command adds blank data to a HEX image to make
sure the image only contains whole words, whole rows, or whole pages. It is also possible
to wholly expand the image so that it includes all the writable memory on the
specified chip.
This command is designed to produce HEX files which are easier
to parse by bootloaders and other tools.
Syntax
target = expand(source,units)
Argument |
Description |
source |
The Source image. |
units |
Optional. Expansion units. May be one of the following:
- word - Default. The unit of expansion is the instruction word. All the fragments
of the source image which are smaller than the instruction are replaced with
whole instructions. Usually, HEX files do not contain any fragments smaller
than the instruction word, so the expansion rarely changes anything.
- row - The unit of expansion is the flash row. Blank instructions are
added to make sure the HEX image contains only whole rows. Rows only apply
to code memory. Other types of memory (UID,OTP,EEPROM etc.) are only expanded
to whole words. The configuration bits are expanded to whole rows only if they
are located within code memory. If configuration bits have a special
location (such as on PIC16, PIC18 and some PIC24), they are only expanded to
whole words.
- page - The unit of expansion is the flash erase page. Blank instructions are
added to make sure the HEX image contains only whole pages. Pages only apply
to code memory. Other types of memory (UID,OTP,EEPROM etc.) are only expanded
to whole words. The configuration bits are expanded to whole pages only if they
are located within code memory. If configuration bits have a special
location (such as on PIC16, PIC18 and some PIC24), they are only expanded to
whole words.
- full - Blank instructions are
added to make sure the HEX image covers the entire legally writable memory of the device.
If the HEX image contains data outside of the writable memory, they are deleted. Such treatment
makes sure that all the HEX images expanded using the "full" option have the
same size and composition.
|
Example
expanded_code = expand(raw_code,row)
This command expands the raw_code HEX image so that
it only contains whole rows. The new expanded image is
named "expanded_code".