Using the codeloader
- Upload a simple image to the new bootloader. Consider you want to flash
image.out
:
java -jar codeloader.jar -file image.out
- Upload by using a config file
config.cfg
:
java -jar codeloader.jar config.cfg
- If you want to use config files, a simple call to get a config file
config.cfg
which would upload image.out
is:
java -jar codeloader.jar -dryrun -file image.out -write config.cfg
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
Location | Description |
0x0 - 0x3fffb | bootloader location (fixed) |
0x3fffc | serial number - used for device identification (fixed) |
0x40000 - 0x3fffff | node specific data (user programmable) |
0x400000 - 0x2000000 | image 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:
- Blue led
- led flashing - the device is waiting for USB configuration data from pc
- led on - the device received a usb configuration data from pc
- led off - device battery powered, no programming
- Red led
- led on - image validation has failed (the image was not transferred correctly, some data is missing or incorrect)
- Green led
- led flashing - indicates USB activity during the transfer
- External led
- fading from bright to dark (2 times) - first fade indicates the erase progress, second fade indicates the programming progress.