Buy(Cart) Contact NSDSP Home

nshex - remove

The remove command removes a part of a HEX image. The image part may be selected by memory type (such as code, configuration, EEPROM etc.), or as a range of addresses.


target = remove(source,type,from,to,units)

Argument Description
source The Source image.
type Memory to remove. May be one of the following:
  • code - code memory, including all boot and auxillary segments (if any).
  • config - configuration bits.
  • eeprom - EEPROM
  • uid - User Id
  • otp - OTP memory
  • special - Special purpose memory. Currently only FBOOT memory on dual-partition devices
  • junk - Memory outside of legally writable area. Such memory should not be present in the HEX file
  • range - A range of addresses. The "from" and "to" arguments specify the exact range
from May only be specified if the type is "range". Specifies the beginning of the range to be removed.
to May only be specified if the type is "range". Specifies the end of the range to be removed. This address itself is not included in the range.
units Optional. May only be specified if the type is "range". 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.


noeeprom = remove(raw,eeprom)

This command removes all the EEPROM data from the raw HEX image. The new image containing no EEPROM data is named "noeeprom".

# nootp.txt - Remove OTP Memory from HEX file

#read the HEX file
hex = read(%1.hex)

#remove OTP
hex = remove(hex,otp)

#write file back

This example shows an nshex command file designed to remove all OTP memory from the HEX file.

First, a HEX file is loaded. The name of the file must be specified on the command line.

Then the OTP memory is removed.

Finally, the file us written back, overwriting the original HEX file.

This command file could be used like this:

nshex -s nootp.txt -d dsPIC33EP128GS808 app

Here nshex is used to remove OTP memory from the "app.hex" file. The PIC name must be specified because different PICs have OTP memory at different addresses.

Northern Software Home NSDSP Contact Us Purchase/Vew Cart

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