Skip to content

Firmware SAL: the banks (count, running bank, info, verify, select) - #343

Merged
JohnAmadis merged 1 commit into
developfrom
feat/firmware-bank-sal
Oct 28, 2026
Merged

JohnAmadis merged 1 commit into
developfrom
feat/firmware-bank-sal

Conversation

@JaxCalder

Copy link
Copy Markdown
Contributor

What

The banks in the firmware SAL (#341 added Dmod_FirmwareReady and the persistency):

  • int Dmod_FirmwareGetBankCount(void), int Dmod_FirmwareGetRunningBank(void)
  • int Dmod_FirmwareGetBankInfo(int Bank, Dmod_FirmwareBankInfo_t* Info) – state (Empty/Invalid/Valid/Trial/Confirmed), version, size, tries, address, capacity; StructSize makes the structure extensible
  • int Dmod_FirmwareVerifyBank(int Bank) – the platform verifies the image the way it does before a start
  • int Dmod_FirmwareSelectBank(int Bank, bool Trial) – the bank for the next start; on trial it stays only if it calls Dmod_FirmwareReady()

A module that updates the firmware (writes an image with the flash driver, verifies, selects, Dmod_Reboot()) needs these and only the platform can answer them. Defaults (weak): -ENOSYS. Layout of the structure is fixed (40 bytes, no padding) and tested.

Merging this is what makes the next rebuild of the chocotechnologies/dmod image the last one for the dual-bank work.

🤖 Generated with Claude Code

A tool that updates a platform with firmware banks (A and B) has to ask the platform which
bank runs, what is in the others, whether an image that it has written is good, and
to choose the bank for the next start; the platform's boot loader is the only one that
knows. Added to the firmware group, beside Dmod_FirmwareReady and the persistency:

* Dmod_FirmwareGetBankCount, Dmod_FirmwareGetRunningBank
* Dmod_FirmwareGetBankInfo (state, version, size, address, capacity; StructSize in the structure
  lets it grow without a new function)
* Dmod_FirmwareVerifyBank (the platform verifies the image the way it does before a start)
* Dmod_FirmwareSelectBank(Bank, Trial): on trial it stays only if it confirms with
  Dmod_FirmwareReady, otherwise the platform falls back

The writing of an image stays with the flash driver. Default (weak) implementations return
-ENOSYS. Together with the earlier firmware SAL this is the whole interface, so that the image
of the tools has to be built once more only.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@JohnAmadis
JohnAmadis merged commit 1d2bb69 into develop Oct 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants