Fix API export policy: enable added headers, not their functions

The RPC/loader commit added internal headers and relied on the "?" fallback
that enabled every newly-discovered symbol. That exported internal loader
helpers (loader_queue_*, loader_menu_alloc, ...) which are not in the
firmware API-table link, breaking the full firmware build; the earlier
per-app `fap` check did not link the table so it went unnoticed.

Change the api_symbols.csv editor so newly-discovered Headers stay enabled
(their declarations must reach the API table) but new Functions/Variables
default to disabled unless explicitly listed in EXPORT_ENABLE. Drop the
over-broad ^rpc_/^loader_ patterns (the public APIs are already exported by
stock firmware). Result: internal loader types are available to apps, the
internal helper functions stay unexported, and the full firmware links.
This commit is contained in:
2026-09-11 13:23:36 +01:00
parent b1efa9cd4e
commit bce03918b3
2 changed files with 20 additions and 14 deletions
+11 -7
View File
@@ -174,7 +174,10 @@ Three facts about the Flipper Zero drive the design:
Beyond the ST BLE commands, `build.sh` enables a set of firmware functions that Beyond the ST BLE commands, `build.sh` enables a set of firmware functions that
stock firmware keeps internal, so any `.fap` on this firmware can use them. The stock firmware keeps internal, so any `.fap` on this firmware can use them. The
set is a list of name patterns in `build.sh` (`EXPORT_ENABLE`); each enabled set is a list of name patterns in `build.sh` (`EXPORT_ENABLE`); each enabled
symbol costs one API-table entry. symbol costs one API-table entry. Only
symbols named in `EXPORT_ENABLE` (plus the selected ST BLE commands) are
exported; headers added for their types do not drag in every function they
declare.
* **BLE peripheral internals** (`gap_*`, safe `ble_glue_*`, `furi_hal_bt_init`): * **BLE peripheral internals** (`gap_*`, safe `ble_glue_*`, `furi_hal_bt_init`):
drive GAP directly, run a custom GATT server, change the advertised name and drive GAP directly, run a custom GATT server, change the advertised name and
@@ -194,12 +197,13 @@ symbol costs one API-table entry.
* **RPC + loader internals**: the public `rpc_*` and `loader_*` APIs (RPC * **RPC + loader internals**: the public `rpc_*` and `loader_*` APIs (RPC
session open/feed/close, app data exchange, launching and enqueuing apps, session open/feed/close, app data exchange, launching and enqueuing apps,
lock/unlock, showing the app menu) are already exported by stock firmware and lock/unlock, showing the app menu) are already exported by stock firmware and
are the supported way to script the Flipper from a host or launch other apps; are the supported way to script the Flipper from a host or launch other apps.
this build enables them explicitly and adds the internal loader headers This build also adds the internal loader headers (`loader_i.h`,
(`loader_i.h`, `loader_menu.h`, `loader_queue.h`, `loader_applications.h`) so `loader_menu.h`, `loader_queue.h`, `loader_applications.h`) so apps can use
the internal loader/menu/queue helpers are reachable too. `rpc_i.h` is not the internal Loader types. The internal helper *functions* stay unexported:
exported because it depends on the protobuf headers, which are not in the SDK; they are not in the firmware's API-table link, so exporting them would break
the public RPC API covers host scripting. the firmware build; only the public API is callable. `rpc_i.h` is not added
because it depends on the protobuf headers, which are not in the SDK.
`build.sh` also widens the GAP roles the firmware initialises `build.sh` also widens the GAP roles the firmware initialises
(`GAP_PERIPHERAL_ROLE | GAP_CENTRAL_ROLE | GAP_OBSERVER_ROLE`) in (`GAP_PERIPHERAL_ROLE | GAP_CENTRAL_ROLE | GAP_OBSERVER_ROLE`) in
+9 -7
View File
@@ -135,12 +135,10 @@ EXPORT_ENABLE+='
fi fi
# RPC + loader internals: the public rpc_* / loader_* APIs (session open/feed/ # RPC + loader internals: the public rpc_* / loader_* APIs (session open/feed/
# close, app data exchange, launch/enqueue/lock/menu) are already exported by # close, app data exchange, launch/enqueue/lock/menu) are already exported by
# stock firmware; enable them explicitly so they stay on, and add the internal # stock firmware, so nothing is force-enabled here; this build only adds the
# loader header set so apps can reach the internal Loader handle and helpers. # internal loader header set so apps can use the internal Loader types. The
EXPORT_ENABLE+=' # internal helper functions stay unexported (see the "?" policy below): they are
^rpc_ # not linked into the API table, and exporting them breaks the firmware link.
^loader_
'
export EXPORT_ENABLE export EXPORT_ENABLE
# Add the loader internal headers to the SDK (rpc_i.h is skipped: it pulls the # Add the loader internal headers to the SDK (rpc_i.h is skipped: it pulls the
@@ -199,7 +197,11 @@ for line in open(csv_path).read().splitlines():
n_fw += 1 n_fw += 1
parts[1] = "+" parts[1] = "+"
elif len(parts) >= 2 and parts[1] == "?": elif len(parts) >= 2 and parts[1] == "?":
parts[1] = "-" if parts[0] == "Variable" else "+" # Headers are always enabled (their declarations must be available to the
# API table). New functions/variables default to disabled: only the ones
# explicitly enabled (BLE commands, EXPORT_ENABLE) are exported, so
# internal helpers pulled in by added headers stay out of the table.
parts[1] = "+" if parts[0] == "Header" else "-"
out.append(",".join(parts)) out.append(",".join(parts))
open(csv_path, "w").write("\n".join(out) + "\n") open(csv_path, "w").write("\n".join(out) + "\n")
print(f">> BLE API export ({mode}): {n_on} of {len(owner)} aci_*/hci_* functions enabled") print(f">> BLE API export ({mode}): {n_on} of {len(owner)} aci_*/hci_* functions enabled")