Initial version of the ota module

This module allows over-the-air upgrading other scouts. To use it, run
"scout.otaboot" on the other scout to reboot it in OTA mode (it will
stay in OTA mode for 10 seconds, or indefinitely if it receives any
valid packet).

Then, on another scout with this commit, enable the "ota" module and run
the ota commands:

	> module.enable("ota")
	> ota.ping(0xffff)
	>
	PONG {'short_addr':0x0005, 'status':0x00, 'errno':0x0000,'appname': 'wibo', 'boardname':'pinoccio', 'version':0x05, 'crc':0x0000}

	> ota.ping(5)
	> No ping reply

	> ota.ping(5)
	>
	PONG {'short_addr':0x0005, 'status':0x00, 'errno':0x0000,'appname': 'wibo', 'boardname':'pinoccio', 'version':0x05, 'crc':0x0000}

ota.ping just tries a single pin, without retries, all other command
retry a few times. Ping either accepts a target address, or 0xffff to do
a broadcast.

To actually flash something, use a sequence of ota.start to select the target, any number of
ota.block to send data and ota.end to reboot the target again.

	> ota.start(5, 1)
	>
	OK

	> ota.block(0, "DEADBEEF")
	>
	OK

	> ota.end
	>
	OK

ota.start takes the address of a target and 0 for normal flashing and 1 for a
dry run (everything is sent over, but the target doesn't do the actual
flashing).

ota.block preferably needs data in multiples of the flash page size (256
bytes). If shorter blocks are passed, they are padded with 0xff bytes (so the
padding actually overwrites data!). Normally, this padding should only be
needed for the final block.

ota.block also supports passing a size instead of a hex string, then it will
read a NUL byte followed by size bytes from serial directly (in binary, not hex
encoded).

All ota commands are coded so they eventually always print either "OK" or
"FAIL" (on a line by itself), allowing a script to easily parse the result
(since the bitlash command returns before the operation is completed).
ota: Actually send the address in send_set_address

Without this, every set address packet resets to address 0, causing
retries to break the flash.
ota: Add ota.clone command

This replaces a series of ota.block commands by sending the flash
contents of the scout running it (excluding bootloader) to the target.
To use it, use ota.start, ota.clone and ota.end.

This also sends over all trailing 0xff bytes in the flash, since the
code does not know where the sketch code ends. Skipping all trailling
0xff bytes is also not possible, since the sketch might actually contain
some trailing 0xff bytes (e.g. some data). For this reason, we just
always send over _all_ flash contents.
ota: Add delay between data packets

It seems that when the target is flashing a page, it is too busy to
receive further pages. Adding this delay fixes this for now, but this
needs something better.
ota: Better tune the delay between data packets

In practice, the delay is nearly the same, so the effective flash time
of a complete clone drops only from around 36 to around 26 seconds.
However, because the delay is less uniformly spread, there should be
less chance of unrelated radio packets (from other pinoccios) messing up
the flashing process.
ota: Fix address argument of ota.block

There was a typo that caused it use argument 2 instead of 1 for the
address.
ota: Increase MAX_TRIES to 5

This seems to make things a bit more resilient.
ota: Add a small delay between retries of the same packet

It seems sometimes multiple packets fail in a burst, hopefully this
helps prevent a failed flash in those cases.
ota: Support 0xffff in ota.start

Previously, this would send all packets to the broadcast address,
causing mayhem when multiple scouts were in ota mode (random ones would
reply to the ping packets). Now, it broadcasts the initial ping, but
then saves the id of the scout that responded and directs further
traffic there.
ota: Remember the memory address sent to the target

Without this, a new set address command  is sent for every block again.
Now, it is only sent when needed.
ota: Resend the right data on tx retry

Previously, when a data command didn't get ack'd, the code would "retry"
with the next chunk of data, making the retry essentially useless. This
commit waits with updating the counters until the packet is ack'd, so
the right data is resent on tx failure.

Note that in practice, it seems that a missing ack and retry is often
followed by a crc error, so it might be that the data packet is received
ok and it's just the ack that gets missing. This needs some further
testing to find the best strategy.
Merge pull request #203 from Pinoccio/ota

Initial version of the ota module