Export RPC + loader internals to apps

The public rpc_* and loader_* APIs are already exported by stock firmware
(RPC sessions, app data exchange, launch/enqueue/lock/menu); enable them
explicitly via EXPORT_ENABLE so they stay on. Add the internal loader
header set (loader_i.h, loader_menu.h, loader_queue.h, loader_applications.h)
to the SDK so the internal Loader handle and the menu/queue helpers are
reachable from apps. rpc_i.h is skipped: it depends on the protobuf headers
which are not part of the app SDK. API version -> 87.3; firmware links.
This commit is contained in:
2026-09-11 13:10:25 +01:00
parent 613848eddf
commit 4b887b1ffb
2 changed files with 39 additions and 1 deletions
+9
View File
@@ -187,6 +187,15 @@ symbol costs one API-table entry.
An app can read and modify internal flash directly. **This can brick the An app can read and modify internal flash directly. **This can brick the
device or wipe storage.** Enabled here for research; build with device or wipe storage.** Enabled here for research; build with
`EXPORT_FLASH=0 ./build.sh` to leave these disabled. `EXPORT_FLASH=0 ./build.sh` to leave these disabled.
* **RPC + loader internals**: the public `rpc_*` and `loader_*` APIs (RPC
session open/feed/close, app data exchange, launching and enqueuing apps,
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;
this build enables them explicitly and adds the internal loader headers
(`loader_i.h`, `loader_menu.h`, `loader_queue.h`, `loader_applications.h`) so
the internal loader/menu/queue helpers are reachable too. `rpc_i.h` is not
exported because it depends on the protobuf headers, which are not in the SDK;
the public RPC API covers host scripting.
`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
+30 -1
View File
@@ -128,8 +128,37 @@ EXPORT_ENABLE+='
^furi_hal_flash_ ^furi_hal_flash_
' '
fi fi
# RPC + loader internals: the public rpc_* / loader_* APIs (session open/feed/
# 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
# loader header set so apps can reach the internal Loader handle and helpers.
EXPORT_ENABLE+='
^rpc_
^loader_
'
export EXPORT_ENABLE export EXPORT_ENABLE
if grep -q "^Function,?," "$API_CSV" || ! grep -qE "^Header,\+,.*ble_hci_le\.h" "$API_CSV"; then
# Add the loader internal headers to the SDK (rpc_i.h is skipped: it pulls the
# protobuf headers, which are not part of the app SDK).
python3 - applications/services/loader/application.fam <<'PY'
import sys
p = sys.argv[1]
s = open(p).read()
want = ''' "loader.h",
"loader_i.h",
"loader_menu.h",
"loader_queue.h",
"loader_applications.h",
"firmware_api/firmware_api.h",'''
have = ''' "loader.h",
"firmware_api/firmware_api.h",'''
if "loader_i.h" not in s:
s = s.replace(have, want, 1)
open(p, "w").write(s)
print(">> patched " + p + ": loader internal headers added to SDK")
PY
if grep -q "^Function,?," "$API_CSV" || ! grep -qE "^Header,\+,.*ble_hci_le\.h" "$API_CSV" \
|| ! grep -qE "^Header,\+,.*loader_i\.h" "$API_CSV"; then
# fbt notices the new headers, rewrites the csv with '?' entries and stops. # fbt notices the new headers, rewrites the csv with '?' entries and stops.
echo ">> syncing API symbol table (expected to stop once)" echo ">> syncing API symbol table (expected to stop once)"
./fbt -j"${JOBS:-4}" "${FBT_ARGS[@]}" api_check || true ./fbt -j"${JOBS:-4}" "${FBT_ARGS[@]}" api_check || true