Skip to main content
The BOOM
Associate III
April 20, 2022
Question

Update Code Without Flashing?

  • April 20, 2022
  • 4 replies
  • 1798 views

Is it possible to update executable code without reflashing the entire device, and without overwriting the entire codebase?

Ie,multiple applications, such that individual applications can be separately installed, updated, and uninstalled?

We don’t want to load “all�? the apps at once. Just one (or two). And we don’t want the available execution resources to get reduced the more (non--running) applications there are.

We want to update individual apps independently. something like apps on a smartphone.

STM32F411

This topic has been closed for replies.

4 replies

KnarfB
Super User
April 20, 2022

This is clearly possible by logically partitioning the flash for the individual apps and writing a boot loader which starts an app from its non-default offset in flash memory.

hth

KnarfB

TDK
Super User
April 20, 2022

You're going to be limited by the number and size of available sectors, but if each application lives in different sectors, no reason why this can't work. CubeIDE will only erase the sectors it uses by default.

"If you feel a post has answered your question, please click ""Accept as Solution""."
The BOOM
The BOOMAuthor
Associate III
April 22, 2022

Would it be necessary to create all the empty partitions you’d ever need and burn them to the device?

Or can partitions be added/removed on the fly without re-burning? In that case, would it be necessary to restart the uC after creating/removing a partition?

Thx!

TDK
Super User
April 22, 2022

The flash is divided into sectors, see the reference manual for the sizes of these. You can't change or resize these in any way. The fundamental limitation here is that you can erase each sector independently, but you cannot erase only part of a sector. You need to choose which sectors each application will live at and build each app to live within that sector. Updating the app would then be erasing the sector, and programming the new app in its place. You won't be able to move apps between sectors at will.

The flash doesn't work like a hard disk where you can create/resize partitions at will.

"If you feel a post has answered your question, please click ""Accept as Solution""."
The BOOM
The BOOMAuthor
Associate III
April 22, 2022