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,10 +1,10 @@
#!/usr/bin/env python3
import os
from flipper.app import App
from flipper.assets.icon import file2image
import os
ICONS_SUPPORTED_FORMATS = ["png"]
ICONS_TEMPLATE_H_HEADER = """#pragma once
@@ -127,7 +127,7 @@ class Main(App):
if not filenames:
continue
if "frame_rate" in filenames:
self.logger.debug(f"Folder contains animation")
self.logger.debug("Folder contains animation")
icon_name = "A_" + os.path.split(dirpath)[1].replace("-", "_")
width = height = None
frame_count = 0
@@ -186,7 +186,7 @@ class Main(App):
icons_c.write("\n")
icons.append((icon_name, width, height, 0, 1))
# Create array of images:
self.logger.debug(f"Finalizing source file")
self.logger.debug("Finalizing source file")
for name, width, height, frame_rate, frame_count in icons:
icons_c.write(
ICONS_TEMPLATE_C_ICONS.format(
@@ -201,7 +201,7 @@ class Main(App):
icons_c.close()
# Create Public Header
self.logger.debug(f"Creating header")
self.logger.debug("Creating header")
icons_h = open(
os.path.join(self.args.output_directory, f"{self.args.filename}.h"),
"w",
@@ -211,7 +211,7 @@ class Main(App):
for name, width, height, frame_rate, frame_count in icons:
icons_h.write(ICONS_TEMPLATE_H_ICON_NAME.format(name=name))
icons_h.close()
self.logger.debug(f"Done")
self.logger.debug("Done")
return 0
def manifest(self):
@@ -232,7 +232,7 @@ class Main(App):
new_manifest = Manifest(self.args.timestamp)
new_manifest.create(directory_path)
self.logger.info(f"Comparing new manifest with existing")
self.logger.info("Comparing new manifest with existing")
only_in_old, changed, only_in_new = Manifest.compare(old_manifest, new_manifest)
for record in only_in_old:
self.logger.info(f"Only in old: {record}")
@@ -246,38 +246,38 @@ class Main(App):
else:
self.logger.info("Manifest is up-to-date!")
self.logger.info(f"Complete")
self.logger.info("Complete")
return 0
def copro(self):
from flipper.assets.copro import Copro
self.logger.info(f"Bundling coprocessor binaries")
self.logger.info("Bundling coprocessor binaries")
copro = Copro(self.args.mcu)
self.logger.info(f"Loading CUBE info")
self.logger.info("Loading CUBE info")
copro.loadCubeInfo(self.args.cube_dir, self.args.cube_ver)
self.logger.info(f"Bundling")
self.logger.info("Bundling")
copro.bundle(
self.args.output_dir,
self.args.stack_file,
self.args.stack_type,
self.args.stack_addr,
)
self.logger.info(f"Complete")
self.logger.info("Complete")
return 0
def dolphin(self):
from flipper.assets.dolphin import Dolphin
self.logger.info(f"Processing Dolphin sources")
self.logger.info("Processing Dolphin sources")
dolphin = Dolphin()
self.logger.info(f"Loading data")
self.logger.info("Loading data")
dolphin.load(self.args.input_directory)
self.logger.info(f"Packing")
self.logger.info("Packing")
dolphin.pack(self.args.output_directory, self.args.symbol_name)
self.logger.info(f"Complete")
self.logger.info("Complete")
return 0