Self-upgrading the Firmware/Application

On most (but not all) platforms, the fd. object provides several methods that allow your Tibbo BASIC/C application to self-upgrade TiOS firmware and itself.

Your application will achieve this by first receiving a TiOS binary and (optionally) a compiled application binary and storing them in the data area of your flash memory. The application has an option to store this data directly in flash sectors using direct sector access, or in a data file using file-based access. The way in which the data will be transmitted to your device depends on the application design. For example, you may choose to send the data via a TCP/IP connection, receive it through an HTTP request, or by some other means.

You also have a choice of receiving and storing uncompressed or LZO-compressed data. Receiving compressed data speeds up the transmission of the data required for the upgrade and also minimizes the amount of flash memory needed to temporarily store this data.

Once the data has been prepared, your application will call one of the methods listed below. Executing these methods will copy data from the data area of your flash into the TiOS and application area of your flash. After the data copying is finished, the device will reboot itself and start executing the updated version of TiOS and your application.

No matter what upgrade method you employ, your upgrade data must always include the TiOS firmware. This may be optionally followed by a compiled application binary. In other words, self-upgrades always rewrite TiOS, and may optionally rewrite your application as well.

Available self-upgrade methods

Methods that work with data stored in flash sectors:

Methods that work with data stored in a file:


BE VERY CAREFUL! Using these methods on incorrect data will "incapacitate" your device and further remote upgrades will become impossible. You will need to visit your device's site and upload correct firmware and/or application, possibly through its serial port. Scary, huh?