Categories
Torrox News

Updating the Bootloader

Once in a while a customer asks how we would update the bootloader itself, if needed? Well, the short answer is: Usually you don’t.

Torrox provides bootloaders off-the-shelf for STM32 and C2000 microcontrollers. These bootloaders are flashed onto the device during production and then sit there for the rest of the device’s life to enable the update of the firmware.

Longer answer: But if you really, really need to, I would write a small firmware that has the new bootloader embedded and that would then erase the old bootloader and install the new bootloader that was embedded in that small firmware.

Step by Step

Initially, we have a firmware (version 2.2) on a device with bootloader version 1.0 and we want (for whatever reason) to update this bootloader to version 1.1.

The initial situation is depicted as a memory layout, where at the start of the flash memory, a bootloader with version 1.0. is located. At the start of the application flash memory, a firmware version 2.2. is located.
Initial Situation

We build a firmware, a bootloader updater, and give it version V99.99 to clearly mark this version as something that is something special. Any firmware update process could use this version information to see that the bootloader updater is correctly installed.

That firmware contains the new version of the bootloader:

After installing the firmware updater, at the start of the the flash memory, the bootloader V1.0 is installed. At the start of the application flash memory, the updater with version 99.99 and the embedded bootloader is located.
After Installing the Updater

Once firmware V99.99 has been correctly installed by bootloader V1.0, it compares the embedded bootloader binary with the installed bootloader at “Start of Flash Memory”. If there are differences, that firmware (the bootloader updater) erases the bootloader and flashes the embedded bootloader:

At the start of the flash memory, bootloader version 1.1 is located, at the start of the application flash memory, the updater with version 99.99 and the embedded bootloader is located.
New Bootloader Version is installed

Once the new bootloader is installed, the new bootloader can be used to install the regular firmware again:

After installing firmware V2.2, the start of the flash memory contains the bootloader version V1.1 and the firmware at the firmware start location is version 2.2.
After Update Procedure

When Does Updating a Bootloader Make Sense?

We, and I guess all other authors of bootloaders as well, do our best to not have any bug in our bootloaders. However, should a bootloader have a bug that needs to be fixed, it’s good to have a plan for how to handle such situation.

There might be other reasons, such as adding a nice-to-have feature or supporting a new interface.

Caveats

When the bootloader updater installs the new bootloader, the old bootloader gets erased from flash memory and the new bootloader gets flashed. If that sequence is somehow interrupted, the device will be bricked.

Good News for our Customers

We are starting to add this bootloader updater to our standard deliveries with all new versions of our bootloaders! That means that customers do not only get new bootloader binaries with a new version, but also an updater to install the new bootloader on devices that already run our bootloader.

Categories
Torrox News

Bootloader in Production

Bootloader in Production

A customer approached us with the question of how he could build a single hex file that contains the Torrox bootloader and the customers application.

A simple post production approach would be to flash the bootloader on the micro controller of the freshly produced product using JTAG or SWD. In a second step, the installed bootloader could then be used to install the first firmware version via the CAN bus. While most hardware / PCB assembly facilities are most likely well prepared to install an initial firmware on microcontrollers, running an additional step to install the firmware via CAN bus might be quite an effort. Not only has the freshly produced PCB to be connected to the CAN bus, the bootloader client would have to be invoked and the result (in case, that an error occurred) of the client would have to be evaluated.

So, the customers request is totally reasonable. Merging the firmware and the bootloader would make the second post production step superfluous. Just appending the application to the bootloader would not be sufficient. The bootloader uses a tiny bit of flash memory to keep track of some meta data associated with the installed firmware. This meta data also contains the CRC over the application binary, used by the bootloader to verify the correctness of the firmware to prevent corrupted firmware to be started. If the bootloader does not find the correct CRC in the meta data, the bootloader will not start the application!

The layout of the meta data block used by the bootloader is not a secret and is shared with interested customers. With the layout information, the customer could build a tool to merge the bootloader with the application and reconstruct the meta data block from the applications binary (basically calculate the CRC over the firmware).

However, we found this requirement so interesting, that we wrote this tool and added it to the tools that are accompanied with the Torrox bootloader. This hopefully makes our customers more satisfied with our product and leaves us the freedom to change the layout of the meta data block without breaking our customers build processes.

Categories
Torrox News

Support for Texas Instruments Dual Core C2000 Microcontrollers added

We recently added support for the Dual Core versions TMS320F2837xD of the microcontroller provided my TI to our C2000 Bootloader. The bootloader protocol was extended by support for multiple banks, as both cores have separated address spaces.

During startup, the bootloader will check the integrity of the flash content for both cores and will only start the application, if both cores report correct flash memory checksums and the very same application version.

This way, the bootloader will only activate applications that has been flash correctly and which are known to work together correctly.

The size of the bootloader is less than 32kByte and thus consumes just a small fraction of the available flash memory.

The bootloader can be licensed by our customers for their own projects or can be customized by us to suit our customers needs. Get in touch, if you are interested in more details.

Categories
Torrox News

Support for f2806x added

The range of devices, supported by our Bootloader for the Texas Instruments C2000 DSP family, was extended by the mid performance TMS320F2806x devices. The bootloader allows reliable firmware update over the CAN bus. The size of the bootloader is less than 32kByte and thus consumes just a small fraction of the available flash memory.

The bootloader can be licensed by our customers for their own projects or can be customized by us to suit our customers needs. Just get in touch, if you are interested in more details.

Categories
Torrox News

C2000 Bootloader

Torrox developed a Bootloader that supports the TMS320F28379S and TMS320F28377D from Texas Instruments C2000 DSP family. The bootloader allows reliable firmware update over the CAN bus. The size of the bootloader is less than 32kByte and thus consumes just a small fraction of the available flash memory. With a default CAN speed of 500,000kbit/s, the installation of new firmware on a device is much faster than by using the original debug probes (like XDS100, XDS200) from TI. This makes the usage of the bootloader even beneficial during the development phase of a project, as it speeds up the usual development cycles by quite a margin. 

The bootloader can be licensed by our customers for their own projects or can be customized by us to suit our customers needs. Just get in touch, if you are interested in more details.