Export flash + option-byte internals to apps

Enable all furi_hal_flash_* functions: geometry, free-page info, raw
program/erase/dword-write, and option-byte read/set/apply. Lets an app
read and modify internal flash directly (research use). Guarded by
EXPORT_FLASH (default 1); build with EXPORT_FLASH=0 to leave disabled.
17 symbols exported; firmware links and the app builds.
This commit is contained in:
2026-06-12 00:49:15 +01:00
parent f12e9c196b
commit 142d47ad08
2 changed files with 14 additions and 0 deletions
+5
View File
@@ -182,6 +182,11 @@ symbol costs one API-table entry.
temperature, remaining/full/design capacity, health, charge state) are temperature, remaining/full/design capacity, health, charge state) are
already exported by stock firmware. This build also enables already exported by stock firmware. This build also enables
`furi_hal_power_insomnia_level`; `furi_hal_power_init` stays disabled. `furi_hal_power_insomnia_level`; `furi_hal_power_init` stays disabled.
* **Flash + option-byte internals** (`furi_hal_flash_*`): flash geometry,
free-page info, and raw program / erase / dword-write / option-byte access.
An app can read and modify internal flash directly. **This can brick the
device or wipe storage.** Enabled here for research; build with
`EXPORT_FLASH=0 ./build.sh` to leave these disabled.
`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
View File
@@ -119,6 +119,15 @@ EXPORT_ENABLE+='
EXPORT_ENABLE+=' EXPORT_ENABLE+='
^furi_hal_power_insomnia_level$ ^furi_hal_power_insomnia_level$
' '
# Flash + option-byte internals: geometry, free-page info, and raw program /
# erase / write / option-byte access. These let an app read and modify internal
# flash directly. WARNING: misuse can brick the device or wipe storage; enabled
# here for research. Set EXPORT_FLASH=0 before building to leave them disabled.
if [ "${EXPORT_FLASH:-1}" = "1" ]; then
EXPORT_ENABLE+='
^furi_hal_flash_
'
fi
export EXPORT_ENABLE export EXPORT_ENABLE
if grep -q "^Function,?," "$API_CSV" || ! grep -qE "^Header,\+,.*ble_hci_le\.h" "$API_CSV"; then if grep -q "^Function,?," "$API_CSV" || ! grep -qE "^Header,\+,.*ble_hci_le\.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.