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.

Leave a Reply

Your email address will not be published. Required fields are marked *