RFC: Switch between firmwares / product "personalities"

DrMickeyLauer
Posts: 168
Joined: Sun May 22, 2022 2:42 pm

RFC: Switch between firmwares / product "personalities"

Postby DrMickeyLauer » Mon Jan 29, 2024 8:17 pm

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?

MicroController
Posts: 1707
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

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

Postby MicroController » Tue Jan 30, 2024 12:12 am

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'.
Last edited by MicroController on Tue Jan 30, 2024 12:17 am, edited 1 time in total.

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

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

Postby ESP_Sprite » Tue Jan 30, 2024 12:15 am

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.

MicroController
Posts: 1707
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

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

Postby MicroController » Tue Jan 30, 2024 12:24 am

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... ;-)

MicroController
Posts: 1707
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

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

Postby MicroController » Tue Jan 30, 2024 8:26 am

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.

Who is online

Users browsing this forum: Baidu [Spider], Majestic-12 [Bot] and 137 guests