mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-04 22:33:36 -07:00
Merge branch 'ul-dev' into xfw-dev
This commit is contained in:
@@ -112,6 +112,8 @@ def DistCommand(env, name, source, **kw):
|
||||
|
||||
|
||||
def generate(env):
|
||||
if not env["VERBOSE"]:
|
||||
env.SetDefault(COPROCOMSTR="\tCOPRO\t${TARGET}")
|
||||
env.AddMethod(AddFwProject)
|
||||
env.AddMethod(DistCommand)
|
||||
env.AddMethod(AddOpenOCDFlashTarget)
|
||||
@@ -147,7 +149,7 @@ def generate(env):
|
||||
'--stack_file="${COPRO_STACK_BIN}" '
|
||||
"--stack_addr=${COPRO_STACK_ADDR} ",
|
||||
],
|
||||
"\tCOPRO\t${TARGET}",
|
||||
"$COPROCOMSTR",
|
||||
)
|
||||
),
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class Copro:
|
||||
self.mcu_copro = None
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
|
||||
def loadCubeInfo(self, cube_dir, cube_version):
|
||||
def loadCubeInfo(self, cube_dir, reference_cube_version):
|
||||
if not os.path.isdir(cube_dir):
|
||||
raise Exception(f'"{cube_dir}" doesn\'t exists')
|
||||
self.cube_dir = cube_dir
|
||||
@@ -50,7 +50,7 @@ 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 != cube_version:
|
||||
if cube_version != reference_cube_version:
|
||||
raise Exception(f"Unsupported cube version")
|
||||
self.version = cube_version
|
||||
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@ IWDGSTOP:0x1:rw
|
||||
IWDGSW:0x1:rw
|
||||
IPCCDBA:0x0:rw
|
||||
ESE:0x1:r
|
||||
SFSA:0xD7:r
|
||||
SFSA:0xD5:r
|
||||
FSD:0x0:r
|
||||
DDS:0x1:r
|
||||
C2OPT:0x1:r
|
||||
@@ -22,7 +22,7 @@ NBRSD:0x0:r
|
||||
SNBRSA:0xD:r
|
||||
BRSD:0x0:r
|
||||
SBRSA:0x12:r
|
||||
SBRV:0x35C00:r
|
||||
SBRV:0x35400:r
|
||||
PCROP1A_STRT:0x1FF:r
|
||||
PCROP1A_END:0x0:r
|
||||
PCROP_RDP:0x1:rw
|
||||
|
||||
@@ -181,9 +181,9 @@ class Main(App):
|
||||
) as zf:
|
||||
for component_key in sdk_components_keys:
|
||||
component_path = self._dist_components.get(component_key)
|
||||
components_paths[component_key] = basename(component_path)
|
||||
|
||||
if component_key.endswith(".dir"):
|
||||
components_paths[component_key] = basename(component_path)
|
||||
for root, dirnames, files in walk(component_path):
|
||||
if "__pycache__" in dirnames:
|
||||
dirnames.remove("__pycache__")
|
||||
@@ -199,7 +199,9 @@ class Main(App):
|
||||
),
|
||||
)
|
||||
else:
|
||||
zf.write(component_path, basename(component_path))
|
||||
# We use fixed names for files to avoid having to regenerate VSCode project
|
||||
components_paths[component_key] = component_key
|
||||
zf.write(component_path, component_key)
|
||||
|
||||
zf.writestr(
|
||||
"components.json",
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
from SCons.Platform import TempFileMunge
|
||||
from SCons.Node import FS
|
||||
from SCons.Errors import UserError
|
||||
from SCons.Warnings import warn, WarningOnByDefault
|
||||
|
||||
|
||||
import os
|
||||
import multiprocessing
|
||||
@@ -163,6 +165,18 @@ dist_env.Alias("flash", openocd_target)
|
||||
if env["FORCE"]:
|
||||
env.AlwaysBuild(openocd_target)
|
||||
|
||||
|
||||
firmware_jflash = dist_env.JFlash(
|
||||
dist_env["UFBT_STATE_DIR"].File("jflash"),
|
||||
dist_env["FW_BIN"],
|
||||
JFLASHADDR="0x20000000",
|
||||
)
|
||||
dist_env.Alias("firmware_jflash", firmware_jflash)
|
||||
dist_env.Alias("jflash", firmware_jflash)
|
||||
if env["FORCE"]:
|
||||
env.AlwaysBuild(firmware_jflash)
|
||||
|
||||
|
||||
firmware_debug = dist_env.PhonyTarget(
|
||||
"debug",
|
||||
"${GDBPYCOM}",
|
||||
@@ -234,7 +248,12 @@ known_extapps = [
|
||||
for apptype in apps_to_build_as_faps
|
||||
for app in appenv["APPBUILD"].get_apps_of_type(apptype, True)
|
||||
]
|
||||
incompatible_apps = []
|
||||
for app in known_extapps:
|
||||
if not app.supports_hardware_target(appenv.subst("f${TARGET_HW}")):
|
||||
incompatible_apps.append(app)
|
||||
continue
|
||||
|
||||
app_artifacts = appenv.BuildAppElf(app)
|
||||
app_src_dir = extract_abs_dir(app_artifacts.app._appdir)
|
||||
app_artifacts.installer = [
|
||||
@@ -242,6 +261,13 @@ for app in known_extapps:
|
||||
appenv.Install(app_src_dir.Dir("dist").Dir("debug"), app_artifacts.debug),
|
||||
]
|
||||
|
||||
if len(incompatible_apps):
|
||||
print(
|
||||
"WARNING: The following apps are not compatible with the current target hardware and will not be built: {}".format(
|
||||
", ".join([app.name for app in incompatible_apps])
|
||||
)
|
||||
)
|
||||
|
||||
if appenv["FORCE"]:
|
||||
appenv.AlwaysBuild([extapp.compact for extapp in apps_artifacts.values()])
|
||||
|
||||
@@ -391,3 +417,13 @@ AddPostAction(
|
||||
dist_env.Precious(app_template_dist)
|
||||
dist_env.NoClean(app_template_dist)
|
||||
dist_env.Alias("create", app_template_dist)
|
||||
|
||||
dist_env.PhonyTarget(
|
||||
"get_blackmagic",
|
||||
"@echo $( ${BLACKMAGIC_ADDR} $)",
|
||||
)
|
||||
|
||||
dist_env.PhonyTarget(
|
||||
"get_apiversion",
|
||||
"@echo $( ${UFBT_API_VERSION} $)",
|
||||
)
|
||||
|
||||
+30
-33
@@ -2,19 +2,16 @@
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"inputs": [
|
||||
// {
|
||||
// "id": "BLACKMAGIC",
|
||||
// "type": "command",
|
||||
// "command": "shellCommand.execute",
|
||||
// "args": {
|
||||
// "useSingleResult": true,
|
||||
// "env": {
|
||||
// "PATH": "${workspaceFolder};${env:PATH}"
|
||||
// },
|
||||
// "command": "./fbt get_blackmagic",
|
||||
// "description": "Get Blackmagic device",
|
||||
// }
|
||||
// },
|
||||
{
|
||||
"id": "BLACKMAGIC",
|
||||
"type": "command",
|
||||
"command": "shellCommand.execute",
|
||||
"args": {
|
||||
"description": "Get Blackmagic device",
|
||||
"useSingleResult": true,
|
||||
"command": "ufbt -s get_blackmagic",
|
||||
}
|
||||
},
|
||||
],
|
||||
"configurations": [
|
||||
{
|
||||
@@ -57,26 +54,26 @@
|
||||
],
|
||||
// "showDevDebugOutput": "raw",
|
||||
},
|
||||
// {
|
||||
// "name": "Attach FW (blackmagic)",
|
||||
// "cwd": "${workspaceFolder}",
|
||||
// "executable": "@UFBT_FIRMWARE_ELF@",
|
||||
// "request": "attach",
|
||||
// "type": "cortex-debug",
|
||||
// "servertype": "external",
|
||||
// "gdbTarget": "${input:BLACKMAGIC}",
|
||||
// "svdFile": "@UFBT_DEBUG_DIR@/STM32WB55_CM4.svd",
|
||||
// "rtos": "FreeRTOS",
|
||||
// "postAttachCommands": [
|
||||
// "monitor swdp_scan",
|
||||
// "attach 1",
|
||||
// "set confirm off",
|
||||
// "set mem inaccessible-by-default off",
|
||||
// "source @UFBT_DEBUG_DIR@/flipperapps.py",
|
||||
// "fap-set-debug-elf-root @UFBT_DEBUG_ELF_DIR@"
|
||||
// ]
|
||||
// // "showDevDebugOutput": "raw",
|
||||
// },
|
||||
{
|
||||
"name": "Attach FW (blackmagic)",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"executable": "@UFBT_FIRMWARE_ELF@",
|
||||
"request": "attach",
|
||||
"type": "cortex-debug",
|
||||
"servertype": "external",
|
||||
"gdbTarget": "${input:BLACKMAGIC}",
|
||||
"svdFile": "@UFBT_DEBUG_DIR@/STM32WB55_CM4.svd",
|
||||
"rtos": "FreeRTOS",
|
||||
"postAttachCommands": [
|
||||
"monitor swdp_scan",
|
||||
"attach 1",
|
||||
"set confirm off",
|
||||
"set mem inaccessible-by-default off",
|
||||
"source @UFBT_DEBUG_DIR@/flipperapps.py",
|
||||
"fap-set-debug-elf-root @UFBT_DEBUG_ELF_DIR@"
|
||||
]
|
||||
// "showDevDebugOutput": "raw",
|
||||
},
|
||||
{
|
||||
"name": "Attach FW (JLink)",
|
||||
"cwd": "${workspaceFolder}",
|
||||
|
||||
+24
-12
@@ -20,24 +20,30 @@
|
||||
"type": "shell",
|
||||
"command": "ufbt"
|
||||
},
|
||||
{
|
||||
"label": "Clean",
|
||||
"group": "build",
|
||||
"type": "shell",
|
||||
"command": "ufbt -c"
|
||||
},
|
||||
{
|
||||
"label": "Flash FW (ST-Link)",
|
||||
"group": "build",
|
||||
"type": "shell",
|
||||
"command": "ufbt FORCE=1 flash"
|
||||
},
|
||||
// {
|
||||
// "label": "[NOTIMPL] Flash FW (blackmagic)",
|
||||
// "group": "build",
|
||||
// "type": "shell",
|
||||
// "command": "ufbt flash_blackmagic"
|
||||
// },
|
||||
// {
|
||||
// "label": "[NOTIMPL] Flash FW (JLink)",
|
||||
// "group": "build",
|
||||
// "type": "shell",
|
||||
// "command": "ufbt FORCE=1 jflash"
|
||||
// },
|
||||
{
|
||||
"label": "Flash FW (blackmagic)",
|
||||
"group": "build",
|
||||
"type": "shell",
|
||||
"command": "ufbt flash_blackmagic"
|
||||
},
|
||||
{
|
||||
"label": "Flash FW (JLink)",
|
||||
"group": "build",
|
||||
"type": "shell",
|
||||
"command": "ufbt FORCE=1 jflash"
|
||||
},
|
||||
{
|
||||
"label": "Flash FW (USB, with resources)",
|
||||
"group": "build",
|
||||
@@ -49,6 +55,12 @@
|
||||
"group": "build",
|
||||
"type": "shell",
|
||||
"command": "ufbt update"
|
||||
},
|
||||
{
|
||||
"label": "Update VSCode config for current SDK",
|
||||
"group": "build",
|
||||
"type": "shell",
|
||||
"command": "ufbt vscode_dist"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -6,7 +6,7 @@ App(
|
||||
apptype=FlipperAppType.EXTERNAL,
|
||||
entry_point="@FBT_APPID@_app",
|
||||
stack_size=2 * 1024,
|
||||
fap_category="Misc",
|
||||
fap_category="Examples",
|
||||
# Optional values
|
||||
# fap_version=(0, 1), # (major, minor)
|
||||
fap_icon="@FBT_APPID@.png", # 10x10 1-bit PNG
|
||||
|
||||
@@ -75,12 +75,6 @@ def generate(env, **kw):
|
||||
if not sdk_state["meta"]["hw_target"].endswith(sdk_data["hardware"]):
|
||||
raise StopError("SDK state file doesn't match hardware target")
|
||||
|
||||
if sdk_state["meta"]["version"] != ufbt_state["version"]:
|
||||
warn(
|
||||
WarningOnByDefault,
|
||||
f"Version mismatch: SDK state vs uFBT: {sdk_state['meta']['version']} vs {ufbt_state['version']}",
|
||||
)
|
||||
|
||||
scripts_dir = sdk_current_sdk_dir_node.Dir(sdk_components["scripts.dir"])
|
||||
env.SetDefault(
|
||||
# Paths
|
||||
|
||||
@@ -152,6 +152,7 @@ class Main(App):
|
||||
"firmware_commit": current_info["GIT_COMMIT"],
|
||||
"firmware_branch": current_info["GIT_BRANCH"],
|
||||
"firmware_target": current_info["TARGET"],
|
||||
"firmware_version": current_info["VERSION"],
|
||||
}
|
||||
with open(version_json_name, "w", newline="\n") as file:
|
||||
json.dump(version_json, file, indent=4)
|
||||
|
||||
Reference in New Issue
Block a user