Buy(Cart) Contact NSDSP Home

nshex - shift

The shift command shifts a HEX image up or down in memory space.

If the code of a compiled program is shifted, it is most likely will not work. Therefore the shift command can only be used in special cases where the shift doesn't destroy functionality



target = shift(source,amount,units)

Argument Description
source The Source image.
amount The amount of the shift. May be negative.
units Optional. Specifies the addresses to be used. For PIC18 and PIC32, there is no difference between units. For PIC16, PIC24,and dsPIC33, the "hex" units are the device units multiplied by two. If the device is unknown, only "hex" units may be used. May be one of the following:
  • hex - Default. The addresses are specified in HEX file units.
  • dev - The addresses are specified in device units.



shifted = shift(original,0x200,dev)

This command shifts the "eeprom" HEX image up by 0x200 and stores it as a new image named "shifted".


# Merge two applications in two different partitions

#specify device name and request partitioning
device PIC24FJ1024GA610

#read the application HEX files
app1 = read(%1.hex)
app2 = read(%2.hex)

#shift app2 into the second partition
app2 = shift(app2,0x400000,dev)

#combine everything together
mix = merge(app1,app2)

This example shows how two shift command can be used to shift the application into the second partition on dual-boot PIC24FJ1024GA610. This allows combining two applications together (each in its own partition)

First, the HEX files for both applications are loaded. The names of the HEX files must be supplied on the command line.

Then, one of the applications is shifted to the second partition with the shift command (second partition starts at address 0x400000).

Finally, the partitions are mixed together with the merge command and saved as "production.hex". The file is ready to be programmed on the chip

Northern Software Home NSDSP Contact Us Purchase/Vew Cart

© 2007-2021 Northern Software Inc. All Rights Reserved.