mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-04 22:33:36 -07:00
[FL-3285] Removed STM32CubeWB module (#2608)
* libs: removed STM32CubeWB module; split cube into 3 submodules * fixed f18 version * fbt: options: fixed expected stack version * pvs: updated for new paths * fbt: ep: multithreaded submodule update * libs: stm32cubewb: fixed duplicate include path; renamed to stm32wb; codeowners: updated paths; docs: updated paths * pvs: updated paths * libs: added cmsis_core from ARM sources, v.5.4.0, from https://github.com/ARM-software/CMSIS_5/tree/develop/CMSIS/Core/Include * Updated stm32wb_copro structure * PVS: exclude cmsis core from analysis --------- Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
+14
-11
@@ -60,7 +60,6 @@ class Main(App):
|
||||
)
|
||||
self.parser_copro.add_argument("cube_dir", help="Path to Cube folder")
|
||||
self.parser_copro.add_argument("output_dir", help="Path to output folder")
|
||||
self.parser_copro.add_argument("mcu", help="MCU series as in copro folder")
|
||||
self.parser_copro.add_argument(
|
||||
"--cube_ver", dest="cube_ver", help="Cube version", required=True
|
||||
)
|
||||
@@ -254,16 +253,20 @@ class Main(App):
|
||||
from flipper.assets.copro import Copro
|
||||
|
||||
self.logger.info("Bundling coprocessor binaries")
|
||||
copro = Copro(self.args.mcu)
|
||||
self.logger.info("Loading CUBE info")
|
||||
copro.loadCubeInfo(self.args.cube_dir, self.args.cube_ver)
|
||||
self.logger.info("Bundling")
|
||||
copro.bundle(
|
||||
self.args.output_dir,
|
||||
self.args.stack_file,
|
||||
self.args.stack_type,
|
||||
self.args.stack_addr,
|
||||
)
|
||||
copro = Copro()
|
||||
try:
|
||||
self.logger.info("Loading CUBE info")
|
||||
copro.loadCubeInfo(self.args.cube_dir, self.args.cube_ver)
|
||||
self.logger.info("Bundling")
|
||||
copro.bundle(
|
||||
self.args.output_dir,
|
||||
self.args.stack_file,
|
||||
self.args.stack_type,
|
||||
self.args.stack_addr,
|
||||
)
|
||||
except Exception as e:
|
||||
self.logger.error(f"Failed to bundle: {e}")
|
||||
return 1
|
||||
self.logger.info("Complete")
|
||||
|
||||
return 0
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
import logging
|
||||
import json
|
||||
from io import BytesIO
|
||||
import tarfile
|
||||
import xml.etree.ElementTree as ET
|
||||
import posixpath
|
||||
import logging
|
||||
import os
|
||||
import posixpath
|
||||
import tarfile
|
||||
from io import BytesIO
|
||||
|
||||
from flipper.utils import file_sha256, timestamp
|
||||
from flipper.assets.coprobin import CoproBinary, get_stack_type
|
||||
from flipper.utils import file_sha256, timestamp
|
||||
|
||||
|
||||
CUBE_COPRO_PATH = "Projects/STM32WB_Copro_Wireless_Binaries"
|
||||
CUBE_COPRO_PATH = "firmware"
|
||||
|
||||
MANIFEST_TEMPLATE = {
|
||||
"manifest": {"version": 0, "timestamp": 0},
|
||||
@@ -27,8 +25,7 @@ MANIFEST_TEMPLATE = {
|
||||
class Copro:
|
||||
COPRO_TAR_DIR = "core2_firmware"
|
||||
|
||||
def __init__(self, mcu):
|
||||
self.mcu = mcu
|
||||
def __init__(self):
|
||||
self.version = None
|
||||
self.cube_dir = None
|
||||
self.mcu_copro = None
|
||||
@@ -38,20 +35,24 @@ class Copro:
|
||||
if not os.path.isdir(cube_dir):
|
||||
raise Exception(f'"{cube_dir}" doesn\'t exists')
|
||||
self.cube_dir = cube_dir
|
||||
self.mcu_copro = os.path.join(self.cube_dir, CUBE_COPRO_PATH, self.mcu)
|
||||
self.mcu_copro = os.path.join(self.cube_dir, CUBE_COPRO_PATH)
|
||||
if not os.path.isdir(self.mcu_copro):
|
||||
raise Exception(f'"{self.mcu_copro}" doesn\'t exists')
|
||||
cube_manifest_file = os.path.join(self.cube_dir, "package.xml")
|
||||
cube_manifest = ET.parse(cube_manifest_file)
|
||||
cube_package = cube_manifest.find("PackDescription")
|
||||
if not cube_package:
|
||||
raise Exception("Unknown Cube manifest format")
|
||||
cube_version = cube_package.get("Patch") or cube_package.get("Release")
|
||||
if not cube_version or not cube_version.startswith("FW.WB"):
|
||||
raise Exception("Incorrect Cube package or version info")
|
||||
cube_version = cube_version.replace("FW.WB.", "", 1)
|
||||
try:
|
||||
cube_manifest_file = os.path.join(self.cube_dir, "VERSION")
|
||||
with open(cube_manifest_file, "r") as cube_manifest:
|
||||
cube_version = cube_manifest.read().strip()
|
||||
except IOError:
|
||||
raise Exception(f"Failed to read version from {cube_manifest_file}")
|
||||
|
||||
if not cube_version.startswith("v"):
|
||||
raise Exception(f"Invalid cube version: {cube_version}")
|
||||
cube_version = cube_version[1:]
|
||||
|
||||
if cube_version != reference_cube_version:
|
||||
raise Exception("Unsupported cube version")
|
||||
raise Exception(
|
||||
f"Unsupported cube version: {cube_version}, expecting {reference_cube_version}"
|
||||
)
|
||||
self.version = cube_version
|
||||
|
||||
def _getFileName(self, name):
|
||||
|
||||
@@ -5,7 +5,7 @@ import os.path
|
||||
import sys
|
||||
|
||||
|
||||
# From STM32CubeWB\Middlewares\ST\STM32_WPAN\interface\patterns\ble_thread\shci\shci.h
|
||||
# From lib/stm32wb_copro/wpan/interface/patterns/ble_thread/shci/shci.h
|
||||
__STACK_TYPE_CODES = {
|
||||
"BLE_FULL": 0x01,
|
||||
"BLE_HCI": 0x02,
|
||||
|
||||
Reference in New Issue
Block a user