refactor(parameters): merge Param<> constructor calls to save flash

Every Param<> constructor inlines param_set_used(handle()) followed by
param_get(handle(), &_val), materialising the handle constant twice at
each of the ~2000 instantiation sites. Fold both into a single
out-of-line param_get_mark_used() so each constructor emits one call.

The failsafe_web build stubs the param API itself, so it gets a matching
stub. The smaller constructors let the compiler fully inline the
defaulted FlightTaskDescend constructor on the ITCM boards, so its entry
is dropped from their linker scripts.

Saves 7232 B of .text on px4_fmu-v6x_default.

Co-authored-by: Balduin <balduin@auterion.com>
Assisted-by: Claude:claude-fable-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
(cherry picked from commit d3a2f02758)
Assisted-by: GitHub Copilot:gpt-6-astra
Backport-note: Use the original #28320 PR commit to retain its three ITCM linker cleanups, already supplied by #28321 before the main-branch squash.
This commit is contained in:
Jacob Dahl authored and Ramon Roche committed 2026-09-10 11:32:28 -07:00
1 parent 2916b4f822
commit 759b04f1ee
7 files changed
+34 -13

No files matched your search

@@ -118,8 +118,7 @@ public:
Param()
{
param_set_used(handle());
update();
param_get_mark_used(handle(), &_val);
}
float get() const { return _val; }
@@ -170,8 +169,7 @@ public:
Param(float &external_val)
: _val(external_val)
{
param_set_used(handle());
update();
param_get_mark_used(handle(), &_val);
}
float get() const { return _val; }
@@ -220,8 +218,7 @@ public:
Param()
{
param_set_used(handle());
update();
param_get_mark_used(handle(), &_val);
}
int32_t get() const { return _val; }
@@ -272,8 +269,7 @@ public:
Param(int32_t &external_val)
: _val(external_val)
{
param_set_used(handle());
update();
param_get_mark_used(handle(), &_val);
}
int32_t get() const { return _val; }
@@ -322,8 +318,11 @@ public:
Param()
{
param_set_used(handle());
update();
int32_t value_int;
if (param_get_mark_used(handle(), &value_int) == 0) {
_val = value_int != 0;
}
}
bool get() const { return _val; }