Using the codeloader

Configuration files and command line options

Command line

usage: codeloader [-connect <connect>] [-connectdisplay] [-dryrun]
       [-execram] [-file <file:target>] [-forceUpload] [-help]
       [-invalidate] [-listen] [-listImotes] [-nocompress] [-noreboot]
       [-pid <product-id>] [-snr <serialnumber>] [-vid <vendor-id>]
       [-write <write>]
 -connect <connect>    Connect to a daemon specified by its network address
 -connectdisplay       Connect to a daemon specified by the DISPLAY environment variable
 -dryrun               Reads and Writes Config File(s) and exits then
 -execram              Loads the image into the ram and executes it there
 -file <file:target>   Adds a file to upload with its optional target address
 -forceUpload          Upload image even if it does not pass the validity check
 -help                 print this help message
 -invalidate           Invalidate default image Location
 -listen               Run in Listening mode
 -listImotes           List connected Imotes
 -nocompress           Do not compress uploads
 -noreboot             Does not reboot the device afterwards
 -pid <product-id>     Product ID of the Imote. Defaults to 0x1337
 -snr <serialnumber>   Serial Number of the Imote. Type '*' for any.
 -vid <vendor-id>      Vendor ID of the Imote. Defaults to 0x042b
 -write <write>        writes a new config file

Config files

An example for a configuration file, having node specific data and an image and is bound to a dedicated node looks like this:
VendorId = 0x042b
ProductId = 0x1337
SerialNumber = 07038766
Reboot = true
Requests = {
        {
                TargetAddress = 0x00400000
                FileName = image.out
        }
        {
                TargetAddress = 0x00040000
                FileName = nodedata
        }
}
This config file was generated by calling:
java -jar codeloader.jar -file image.out -snr 07038766 -dryrun -write config.cfg
java -jar codeloader.jar -file nodedata:0x40000 -dryrun -write config.cfg config.cfg
If you want to remove the binding to a specific node, you can simply write (output is written to stdout in this example):
java -jar codeloader.jar -dryrun config.cfg -snr '*' -write -

Restrictions

Due to the limitations of the Imote2 platform, it is only possible, to program adresses which divide by 64 (=0x40). Note also, one flash block has the size of 128kiB, and only whole blocks can be erased (programmed).
Best practise is to align your program / data to 128kiB blocks.

Memory locations on device

LocationDescription
0x0 - 0x3fffbbootloader location (fixed)
0x3fffcserial number - used for device identification (fixed)
0x40000  - 0x3fffffnode specific data (user programmable)
0x400000 - 0x2000000image location and individual data (user programmable)

Debug output and status codes

Led status codes during boot and flash process

The Imote2 contains 3 standard leds. While programming or boot some of these leds show current status.
If the Imote2 is USB powered, the following led signals are possible: