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-06-30 00:50:17 +01:00
parent 142d47ad08
commit 54be3a041f
2 changed files with 39 additions and 1 deletions
+30 -1
View File
@@ -128,8 +128,37 @@ EXPORT_ENABLE+='
^furi_hal_flash_
'
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
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.
echo ">> syncing API symbol table (expected to stop once)"
./fbt -j"${JOBS:-4}" "${FBT_ARGS[@]}" api_check || true