Skip to content

feat: store wolfboot version in named section - #966

Open
vhdirk wants to merge 2 commits into
wolfSSL:masterfrom
vhdirk:named-version-section
Open

vhdirk wants to merge 2 commits into
wolfSSL:masterfrom
vhdirk:named-version-section

Conversation

@vhdirk

@vhdirk vhdirk commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

We've been using wolfboot for quite some time. From what I can tell, way before WOLFBOOT_SELF_HEADER was introduced.
To query the bootloader version, we keep the version in a named linker section.
At some point we would like to migrate to using the self header, but we'll always need to support older bootloaders that do not have a self header as well.

Together with #958, this commit enables us to provide the section name externally, limiting the number of patches we have to carry forward

Copilot AI balanced review requested due to automatic review settings November 2, 2026 15:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical issues prevent custom version-section settings from reaching the compiler correctly and leave the section attribute undefined in update_flash.c, breaking standalone RAM_CODE builds.

2 open issues
What changed in this PR

This PR introduces configurable linker-section placement for the wolfBoot version number, supporting version queries on bootloaders without a self header. It complements #958’s custom linker-script support.

Changes:

  • Adds a configurable section attribute to the version declarations.
  • Introduces shared stringification helpers.
  • Adds build-flag handling for the section-name setting.
File Description
src/​update_flash.c Applies the section macro to the version declaration.
src/​loader.c Defines the section attribute and applies it to the version declaration.
include/​wolfboot/​wolfboot.h Adds two-level stringification helpers.
arch.mk Adds compiler-flag handling for the version-section option.

Review effort: Balanced

Comment thread arch.mk Resolved
Comment thread src/update_flash.c Resolved
@vhdirk
vhdirk force-pushed the named-version-section branch from 060ec96 to e608555 Compare November 2, 2026 15:13
@dgarske

dgarske commented Nov 2, 2026

Copy link
Copy Markdown
Member

Okay to test. Company contributor agreement on file.

@dgarske dgarske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Over to @danielinux

@dgarske dgarske assigned danielinux and wolfSSL-Bot and unassigned vhdirk and dgarske Nov 4, 2026
@dgarske
dgarske requested a review from danielinux November 4, 2026 17:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

WOLFBOOT_VERSION_SECTION is missing from CONFIG_VARS in tools/config.mk, so make config silently removes the setting and subsequent builds lose the named version section required by external readers.

1 open issue
2 resolved since last review

Review effort: Balanced

Comment thread arch.mk Resolved

@dgarske dgarske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more copilot finding #966 (review)

@vhdirk
vhdirk force-pushed the named-version-section branch from 1a17efa to 2a297c1 Compare November 5, 2026 10:57

@danielinux danielinux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IAR compatibility: please guard your gcc dialect attribute as follow:

#if defined(__IAR_SYSTEMS_ICC__)
#define WB_SECTION(name) __section(name)
#else
#define WB_SECTION(name) __attribute__((section(name)))
#endif

Also please rebase on latest master, resolve conflicts

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.

5 participants