When a company updates a product's embedded C code application firmware (via a bootloader on the microcontroller, or JTAG, etc.), do they normally flash a whole new .hex/.bin file that contains the new features old software? Therefore, wiping out the old program entirely? Or is it standard to make partial application updates via separate .hex/.bin files?
I am asking this question because I want to know the best industry practice for releasing different embedded software packages. Ideally it would be nice to be able to flash specific updates for a feature of a project without updating the entire program memory.
For example: Lets say your project's embedded C software has 3 features:
- user input handling
- displaying an output
- Power supply management
If you had many software versions of each feature and wanted to test combinations of different versions, can you have separate .hex/.bin for each feature that gets flashed onto the MCU?
CodePudding user response:
It depend on the OS, architecture and the need of your system.
- If all parts are always independent, it is possible to update partially. This would help to reduce the time for update firmware/software.
- If the interface between component might change: it is not recommend to use partial update since it might lead to undefine behavior when the interface change. If required, special check need to implement for consistency of interface.
CodePudding user response:
You can't really update the program partially unless you have designed certain parts of it as position-independent code and then linked those parts starting at fixed addresses. It can be done, but adds extra complexity during design.
Otherwise if you haven't designed your program like this, the machine code will be full of absolute addresses and jump to the wrong places.
The normal way is to update the whole program at once (perhaps minus any bootloader parts present). And optionally update data flash/eeprom separately.
CodePudding user response:
Partial update is used very commonly, but in a different way than the one you have described.
The most common used case is where you have a bootloade application and only the application is updated.
This approach is suitable when the applications are completely separate from each other.
The case that you are describing implies that each feature need to communicate with each other or with the main application. In this case, it would be way too much trouble to try and separate the features into separate flash regions.
You'd have to give a separate flash segment for each "feature", resulting in gaps (wasted space), while hoping that your feature does not outgrow the allocated space. Additionally, you'd have to worry about how to implement communication between different features, maintaining compatibility etc...
Just link everything together and update everything at once.