Skip to main content
Konami
Senior
June 8, 2018
Solved

Firmware Update RAM requirements

  • June 8, 2018
  • 5 replies
  • 1876 views
Posted on June 08, 2018 at 16:22

I'm looking to do some firmware updates over CAN bus on an M0 based part (possibly F091) which it looks like will require a custom bootloader. Do I need to pick a part with enough RAM to store the entire firmware image so I can transfer the image to the bootloader and then write it to flash? Or I there a way to transfer directly to flash to eliminate the requirement of the RAM being able to hold the entire image?

#stm32-can-bootloader
This topic has been closed for replies.
Best answer by Tesla DeLorean
Posted on June 08, 2018 at 17:44

The more realistic approach is to have a small boot-loader than can update the larger application portion of the FLASH in the absence of more RAM, or off-chip memory to stage the new firmware image.

If you have enough memory to handle 1KB blocks, update the firmware in 1KB pieces, and create an update protocol that facilitates that.

You could also use a device that has twice as much FLASH than your app needs, or perhaps compress or delta images

5 replies

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
June 8, 2018
Posted on June 08, 2018 at 17:44

The more realistic approach is to have a small boot-loader than can update the larger application portion of the FLASH in the absence of more RAM, or off-chip memory to stage the new firmware image.

If you have enough memory to handle 1KB blocks, update the firmware in 1KB pieces, and create an update protocol that facilitates that.

You could also use a device that has twice as much FLASH than your app needs, or perhaps compress or delta images

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Konami
KonamiAuthor
Senior
June 8, 2018
Posted on June 08, 2018 at 19:16

I don't think the flash will be the issue since we should have more than twice the amount the app needs, but the RAM is limited to 16kB. So what you're suggesting is to make a bootloader that is able to accept the new fw image in chunks of maybe 1kB, buffer that in RAM, write it out to FLASH, and repeat until the whole image is transferred?

I suppose with the extra flash available we could keep the previous version check for a CRC or similar to validate the image before booting it as well.

Tesla DeLorean
Guru
June 8, 2018
Posted on June 08, 2018 at 19:47

Well hopefully your current loader is validating the app before running it. If the app is invalid it should fall back to a recovery/download mode, or be minimally functional. The idea being to create something robust that isn't going to brick itself. In most cases you shouldn't need to update the loader in the field.

CAN is somewhat constraining in it's packet size, but you should certainly be able to accumulate blocks of data in RAM and be able to write those out to areas of the FLASH

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..