Embedded systems have become extremely complex as systems have moved from disconnected, simple devices to smart and complex internet connected devices. Development teams need a way to remotely fix bugs and also add new features to their products once it has been deployed into the field. In order perform software updates, developers using the Renesas Synergy™ Platform can use the Synergy Software Flashloader Framework.

 

The Synergy Software Flashloader Framework requires developers to create two different software applications, a bootloader and a downloader / user application. The bootloader is software that initializes the microcontroller and then checks to see if there is a new application image available and if there is, it will take that image and write it to memory. In most cases, a new firmware image will not be available and in those cases the bootloader will verify that the application already stored internally on the microcontroller is valid by performing a checksum verification. Once the checksum has been verified, the bootloader jumps to application code.

 

The application code serves two different purposes. First, the application must be able to run the application code specific to the product that was developed. Second, the application must have the ability to download and verify a new application image that the bootloader will then write to memory. The application code with the downloader code exists in one flash memory location as a single application while the bootloader application exists in a separate flash memory location as a separate application project. The two applications communicate with each other through image records that are stored in internal flash at a predefined memory location. The activity diagram for how the flashloader solution behaves from a generic standpoint can be seen below.  

 

The Flashloader Framework was written so that it can be easily customized by developers to meet their own firmware update needs. There are two general solutions that are employed in the framework to download and update images, blocking and non-blocking modes. The non-blocking solution allows the product’s application code to continue to execute while a new software image is being downloaded. Once downloaded, the application code can decide when to restart the system and complete the firmware update process. A non-blocking solution stores the new image either on an external memory device such as an SD card or it can also write the application directly to the microcontrollers flash in a separate memory application slot. The blocking downloader on the other hand is designed for devices that are memory constrained and may need to stop the current application, erase it and write the new application to memory. For these updates the application code must stop running in order to receive the new application image.

 

The flashloader framework is very flexible and allows a developer to customize exactly how the bootloader and downloader behave. Developers can easily update their firmware through communication interfaces such as UART or USB-CDC. The Synergy Platform configurator provides a general communication interface that will allow additional communication protocols such as USB-MSC, USB-HID, TCP/IP and CAN to be added in the near future. Initially the framework is supporting traditional serial communication.

 

Developers can control the firmware update process with their microcontroller by using two different Python scripts. The first, takes the s-records that are generated by the Synergy toolchain when a developer compiles their code and converts it into a binary image known as a BCH file. The flashloader solution is able to interpret the BCH file directly and depending on the flashloader requirements these images can be stored on an SD card or they can be written directly to flash. Once the compiled s-record has been converted to a BCH file, a second Python script is used to select the communication interface and image slot before managing the firmware update process.   

 

The ability to update application software in the field is a critical component to any connected device. The Flashloader Framework provides developers with a great leaping off point to develop and customize their own solution. Example projects and application notes exist (see Tip of the Week) that Synergy developers should check out. In the meantime,

 

Live long and profit!

 

Professor_IoT