[FL-2269] Core2 OTA (#1144)
* C2OTA: wip * Update Cube to 1.13.3 * Fixed prio * Functional Core2 updater * Removed hardware CRC usage; code cleanup & linter fixes * Moved hardcoded stack params to copro.mk * Fixing CI bundling of core2 fw * Removed last traces of hardcoded radio stack * OB processing draft * Python scripts cleanup * Support for comments in ob data * Sacrificed SD card icon in favor of faster update. Waiting for Storage fix * Additional handling for OB mismatched values * Description for new furi_hal apis; spelling fixes * Rework of OB write, WIP * Properly restarting OB verification loop * Split update_task_workers.c * Checking OBs after enabling post-update mode * Moved OB verification before flashing * Removed ob.data for custom stacks * Fixed progress calculation for OB * Removed unnecessary OB mask cast Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -2,9 +2,12 @@ import logging
|
||||
import datetime
|
||||
import shutil
|
||||
import json
|
||||
from os.path import basename
|
||||
|
||||
import xml.etree.ElementTree as ET
|
||||
from flipper.utils import *
|
||||
from flipper.assets.coprobin import CoproBinary, get_stack_type
|
||||
|
||||
|
||||
CUBE_COPRO_PATH = "Projects/STM32WB_Copro_Wireless_Binaries"
|
||||
|
||||
@@ -13,14 +16,7 @@ MANIFEST_TEMPLATE = {
|
||||
"copro": {
|
||||
"fus": {"version": {"major": 1, "minor": 2, "sub": 0}, "files": []},
|
||||
"radio": {
|
||||
"version": {
|
||||
"type": 3,
|
||||
"major": 1,
|
||||
"minor": 13,
|
||||
"sub": 0,
|
||||
"branch": 0,
|
||||
"release": 5,
|
||||
},
|
||||
"version": {},
|
||||
"files": [],
|
||||
},
|
||||
},
|
||||
@@ -35,7 +31,7 @@ class Copro:
|
||||
self.mcu_copro = None
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
|
||||
def loadCubeInfo(self, cube_dir):
|
||||
def loadCubeInfo(self, cube_dir, cube_version):
|
||||
if not os.path.isdir(cube_dir):
|
||||
raise Exception(f'"{cube_dir}" doesn\'t exists')
|
||||
self.cube_dir = cube_dir
|
||||
@@ -51,8 +47,8 @@ class Copro:
|
||||
if not cube_version or not cube_version.startswith("FW.WB"):
|
||||
raise Exception(f"Incorrect Cube package or version info")
|
||||
cube_version = cube_version.replace("FW.WB.", "", 1)
|
||||
if cube_version != "1.13.1":
|
||||
raise Exception(f"Unknonwn cube version")
|
||||
if cube_version != cube_version:
|
||||
raise Exception(f"Unsupported cube version")
|
||||
self.version = cube_version
|
||||
|
||||
def addFile(self, array, filename, **kwargs):
|
||||
@@ -63,14 +59,32 @@ class Copro:
|
||||
{"name": filename, "sha256": file_sha256(destination_file), **kwargs}
|
||||
)
|
||||
|
||||
def bundle(self, output_dir):
|
||||
def bundle(self, output_dir, stack_file_name, stack_type, stack_addr=None):
|
||||
if not os.path.isdir(output_dir):
|
||||
raise Exception(f'"{output_dir}" doesn\'t exists')
|
||||
self.output_dir = output_dir
|
||||
stack_file = os.path.join(self.mcu_copro, stack_file_name)
|
||||
manifest_file = os.path.join(self.output_dir, "Manifest.json")
|
||||
# Form Manifest
|
||||
manifest = dict(MANIFEST_TEMPLATE)
|
||||
manifest["manifest"]["timestamp"] = timestamp()
|
||||
copro_bin = CoproBinary(stack_file)
|
||||
self.logger.info(f"Bundling {copro_bin.img_sig.get_version()}")
|
||||
stack_type_code = get_stack_type(stack_type)
|
||||
manifest["copro"]["radio"]["version"].update(
|
||||
{
|
||||
"type": stack_type_code,
|
||||
"major": copro_bin.img_sig.version_major,
|
||||
"minor": copro_bin.img_sig.version_minor,
|
||||
"sub": copro_bin.img_sig.version_sub,
|
||||
"branch": copro_bin.img_sig.version_branch,
|
||||
"release": copro_bin.img_sig.version_build,
|
||||
}
|
||||
)
|
||||
if not stack_addr:
|
||||
stack_addr = copro_bin.get_flash_load_addr()
|
||||
self.logger.info(f"Using guessed flash address 0x{stack_addr:x}")
|
||||
|
||||
# Old FUS Update
|
||||
self.addFile(
|
||||
manifest["copro"]["fus"]["files"],
|
||||
@@ -88,8 +102,8 @@ class Copro:
|
||||
# BLE Full Stack
|
||||
self.addFile(
|
||||
manifest["copro"]["radio"]["files"],
|
||||
"stm32wb5x_BLE_Stack_light_fw.bin",
|
||||
address="0x080D7000",
|
||||
stack_file_name,
|
||||
address=f"0x{stack_addr:X}",
|
||||
)
|
||||
# Save manifest to
|
||||
json.dump(manifest, open(manifest_file, "w"))
|
||||
|
Reference in New Issue
Block a user