1
mirror of https://github.com/flipperdevices/flipperzero-firmware.git synced 2025-12-12 12:51:22 +04:00

[FL-3174] Dolphin builder in ufbt; minor ufbt/fbt improvements (#2601)

* ufbt: added "dolphin_ext" target (expects "external" subfolder in cwd with dolphin assets); cleaned up unused code
* ufbt: codestyle fixes
* scripts: fixed style according to ruff linter
* scripts: additional cleanup & codestyle fixes
* github: pass target hw code when installing local SDK with ufbt
* ufbt: added error message for missing folder in dolphin builder
* scripts: more linter fixes
* sdk: added flipper_format_stream; ufbt: support for --extra-define
* fbt: reduced amount of global defines
* scripts, fbt: rearranged imports

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
hedger
2023-05-03 08:48:49 +03:00
committed by GitHub
parent 015ab4a024
commit c3ececcf96
73 changed files with 311 additions and 382 deletions

View File

@@ -1,13 +1,9 @@
#!/usr/bin/env python3
import logging
import argparse
import sys
import os
from flipper.app import App
from flipper.cube import CubeProgrammer
from flipper.assets.coprobin import CoproBinary
from flipper.cube import CubeProgrammer
STATEMENT = "AGREE_TO_LOSE_FLIPPER_FEATURES_THAT_USE_CRYPTO_ENCLAVE"
@@ -94,59 +90,59 @@ class Main(App):
}
def wipe(self):
self.logger.info(f"Wiping flash")
self.logger.info("Wiping flash")
cp = CubeProgrammer(self._getCubeParams())
self.logger.info(f"Setting RDP to 0xBB")
self.logger.info("Setting RDP to 0xBB")
cp.setOptionBytes({"RDP": ("0xBB", "rw")})
self.logger.info(f"Verifying RDP")
self.logger.info("Verifying RDP")
r = cp.checkOptionBytes({"RDP": ("0xBB", "rw")})
assert r == True
assert r is True
self.logger.info(f"Result: {r}")
self.logger.info(f"Setting RDP to 0xAA")
self.logger.info("Setting RDP to 0xAA")
cp.setOptionBytes({"RDP": ("0xAA", "rw")})
self.logger.info(f"Verifying RDP")
self.logger.info("Verifying RDP")
r = cp.checkOptionBytes({"RDP": ("0xAA", "rw")})
assert r == True
assert r is True
self.logger.info(f"Result: {r}")
self.logger.info(f"Complete")
self.logger.info("Complete")
return 0
def core1bootloader(self):
self.logger.info(f"Flashing bootloader")
self.logger.info("Flashing bootloader")
cp = CubeProgrammer(self._getCubeParams())
cp.flashBin("0x08000000", self.args.bootloader)
self.logger.info(f"Complete")
self.logger.info("Complete")
cp.resetTarget()
return 0
def core1firmware(self):
self.logger.info(f"Flashing firmware")
self.logger.info("Flashing firmware")
cp = CubeProgrammer(self._getCubeParams())
cp.flashBin("0x08008000", self.args.firmware)
self.logger.info(f"Complete")
self.logger.info("Complete")
cp.resetTarget()
return 0
def core1(self):
self.logger.info(f"Flashing bootloader")
self.logger.info("Flashing bootloader")
cp = CubeProgrammer(self._getCubeParams())
cp.flashBin("0x08000000", self.args.bootloader)
self.logger.info(f"Flashing firmware")
self.logger.info("Flashing firmware")
cp.flashBin("0x08008000", self.args.firmware)
cp.resetTarget()
self.logger.info(f"Complete")
self.logger.info("Complete")
return 0
def core2fus(self):
if self.args.statement != STATEMENT:
self.logger.error(
f"PLEASE DON'T. THIS FEATURE INTENDED ONLY FOR FACTORY FLASHING"
"PLEASE DON'T. THIS FEATURE INTENDED ONLY FOR FACTORY FLASHING"
)
return 1
self.logger.info(f"Flashing Firmware Update Service")
self.logger.info("Flashing Firmware Update Service")
cp = CubeProgrammer(self._getCubeParams())
cp.flashCore2(self.args.fus_address, self.args.fus)
self.logger.info(f"Complete")
self.logger.info("Complete")
return 0
def core2radio(self):
@@ -163,15 +159,15 @@ class Main(App):
f"Radio address not provided, guessed as 0x{radio_address:X}"
)
if radio_address > 0x080E0000:
self.logger.error(f"I KNOW WHAT YOU DID LAST SUMMER")
self.logger.error("I KNOW WHAT YOU DID LAST SUMMER")
return 1
cp = CubeProgrammer(self._getCubeParams())
self.logger.info(f"Removing Current Radio Stack")
self.logger.info("Removing Current Radio Stack")
cp.deleteCore2RadioStack()
self.logger.info(f"Flashing Radio Stack")
self.logger.info("Flashing Radio Stack")
cp.flashCore2(radio_address, self.args.radio)
self.logger.info(f"Complete")
self.logger.info("Complete")
return 0