Page 1 of 1

RFC: Switch between firmwares / product "personalities"

Posted: Mon Jan 29, 2024 8:17 pm
by DrMickeyLauer
I'm working on an ESP32S3-based CAN-Bus adapter that will be sold with (at least) three functions:
  • ECU reprogramming firmware
  • OBD2 diagnosis firmware
  • CAN-logger firmware
While all of these firmwares have a lot of code in common, I'm thinking of these as three distinct products. Now I wonder how the customer can change between these three functions. I have a button and four LEDs on the device that I would use to indicate the change of "personality" -- how to do that is simple. But:

What's the best way to technically tackle this? The most simple approach is to have a big firmware which contains all the personalities and upon using the button to choose the personality, a special key gets written in NVS and the device gets rebooted and after boot configures itself to do the right thing.

This means I can't update one firmware incrementally though. Would it perhaps be better to use three partitions with different app firmwares and then leverage the bootloader to choose which partition to boot from?

Or is there another good option which I have overlooked?

Re: RFC: Switch between firmwares / product "personalities"

Posted: Tue Jan 30, 2024 12:12 am
by MicroController
DrMickeyLauer wrote:
Mon Jan 29, 2024 8:17 pm
Would it perhaps be better to use three partitions with different app firmwares and then leverage the bootloader to choose which partition to boot from?
In this case, you'd also have three copies of FreeRTOS and the IDF stored in flash... And a 'full' update would require about 3x the amount of data and time relative to one application with, say, three different tasks.
To me, what you describe sounds more like three different 'front-ends' for the same main software, as in 90% of the work is done by the common core, and 10% is coordination logic specific to each 'personality'.

Re: RFC: Switch between firmwares / product "personalities"

Posted: Tue Jan 30, 2024 12:15 am
by ESP_Sprite
Why not simply include all functionality in one firmware regardless? Even if to the customer they're three different functions, that doesn't necessary have to translate to three different firmwares.

Re: RFC: Switch between firmwares / product "personalities"

Posted: Tue Jan 30, 2024 12:24 am
by MicroController
Btw, my BT-OBD2 adaptor recently got bricked when its FW update failed. - If you'd need someone to 'test' your device I might happen to know someone... ;-)

Re: RFC: Switch between firmwares / product "personalities"

Posted: Tue Jan 30, 2024 8:26 am
by MicroController
Forgot to mention: You can also achieve maximum decoupling of high-level application logic and system/core functionality by using an interpreted language for the high-level logic, like MicroPython or Lua. To that end, Microvium (JavaScript) looks very interesting.