The nvmem_update sample application demonstrates the nonvolatile-memory update
functionality provided by the Indy RFID Reader Library and MAC firmware.
This application allows for the BootLoader firmware, MAC firmware and/or OEM 
configuration area on the attached radio module to be updated from a host.

The nvmem_update sample application is invoked as follows:

nvmem_update [-tm=st|to|tu] [-um=sf|dg|bl|uf] [-h|-?] config_file

The only required command-line option to the nvmem_update sample application is
config_file.  config_file specifies an XML-based file that controls the update.
The contents of the file are as follows:

<blocks>
    <block>
        <address>starting address</address>
        <file>NV memory file name</file>
    </block>
    [<block> ... </block>]*
</blocks>



The typical use of this tool is to load a new MAC Firmware image 
(eg. indy_v2_4_0_R1000.a79) which can be achieved with the following 
command line and configuration file:


	nvmem_update config.xml

where the config.xml would have the following contents:

	<blocks>
    	   <block>
	      <address>0x00104000</address>
	      <file>indy_v2_4_0_R1000.a79</file>
	   </block>
	</blocks>

Note that by providing multiple <block> tags, the application can update
multiple areas of the nonvolatile memory.  The <address> tag specifies the
starting address in nonvolatile memory.  The nonvolatile memory addresses of
interest are 0x00100000, which is the start of the RFID radio module's
BootLoader firmware image, 0x00104000, which is the start of the RFID radio
module's MAC firmware image, and 0x00137C00, which is the start of the RFID 
radio module's OEM configuration area.  For example, if you wish to update 
the BootLoader image using a file name indybl_v1_0_0.a79, the MAC firmware 
using a file named indy_v2_4_0_R1000.a79 and the OEM configuration area 
with a file named oemconfig.bin, your XML file would look like the following:

<blocks>
    <block>
        <address>0x00100000</address>
        <file>indybl_v1_0_0.a79.a79</file>
    </block>
    <block>
        <address>0x00104000</address>
        <file>indy_v2_4_0_R1000.a79</file>
    </block>
    <block>
        <address>0x00137C00</address>
        <file>oemconfig.bin</file>
    </block>
</blocks>


The optional command-line options are as follows:

-tm=       - specifies the test mode control.  
             By default -tm=tu (test and update), the nvmem_update sample 
             application will perform a test update, to verify it will succeed 
             and then will perform a destructive nonvolatile memory update.  
             If you wish to simply perform a nondestructive test update specify 
             -tm=to (test only).  If you wish to skip the nondestructive test 
             update specify -tm=st (skip test).
             
     st        - Skip test update, go straight to destructive update
     to        - Perform test update only, does not write nonvolatile memory
     tu        - (default) Perform test update and on success continue
                 to destructive update

-um=       - specifies the update mode control.
             By default -um=uf (unsafe), the nvmem_update sample 
             application will perform an unsafe in-place update of the 
             nonvolatile memory.  If you wish to perform a safe update 
             specify -um=sf (safe)and the BootLoader will be used to perform
             the update. If you wish to revert to an earlier (pre-BootLoader)
             version of MAC firmware specify -um=dg (downgrade) and the BootLoader
             sector will be unlocked to allow the old firmware to overwrite it.  If 
             you wish to update the BootLoader itself specify -um=bl (bootloader) and
             the BootLoader will be used to update itself.
             
     sf        - Safe Update, reset to BootLoader and update MAC firmware using
                 BootLoader
     dg        - Unsafe Downgrade, to load pre v2.4 MAC firmware.  Unlocks
                 BootLoader sector so it may be overwritten
     bl        - BootLoader Update, reset to BootLoader and update itself using
                 BootLoader.
                    NOTE: The BootLoader update is in theory unsafe, however the
                          window of vulnerability in this case is dramatically
                          narrowed by downloadig the entire BootLoader image to RAM
                          and validating it, before the BootLoader sector is modified
     uf        - (default) Unsafe Update, performs in place update of MAC firmware.

-h          - displays the help screen

-?          - displays the help screen
