Merge branch 'fz-dev' into dev

This commit is contained in:
MX 2023-04-10 18:41:51 +03:00
commit 93035f07aa
No known key found for this signature in database
GPG key ID: 7CCC66B7DBDD1C83
12 changed files with 88 additions and 60 deletions

2
.gitignore vendored
View file

@ -30,7 +30,7 @@ bindings/
Brewfile.lock.json Brewfile.lock.json
# Visual Studio Code # Visual Studio Code
.vscode/ /.vscode/
# Kate # Kate
.kateproject .kateproject

View file

@ -152,6 +152,7 @@ bool avr_isp_auto_set_spi_speed_start_pmode(AvrIsp* instance) {
} }
} }
} }
if(instance->spi) avr_isp_spi_sw_free(instance->spi);
return false; return false;
} }

View file

@ -198,9 +198,10 @@ bool avr_isp_worker_rw_detect_chip(AvrIspWorkerRW* instance) {
} }
avr_isp_end_pmode(instance->avr_isp); avr_isp_end_pmode(instance->avr_isp);
furi_hal_pwm_stop(FuriHalPwmOutputIdLptim2PA4);
} while(0); } while(0);
furi_hal_pwm_stop(FuriHalPwmOutputIdLptim2PA4);
if(instance->callback) { if(instance->callback) {
if(instance->chip_arr_ind > avr_isp_chip_arr_size) { if(instance->chip_arr_ind > avr_isp_chip_arr_size) {
instance->callback(instance->context, "No detect", instance->chip_detect, 0); instance->callback(instance->context, "No detect", instance->chip_detect, 0);

View file

@ -317,6 +317,7 @@ static bool avr_isp_prog_auto_set_spi_speed_start_pmode(AvrIspProg* instance) {
} }
} }
} }
if(instance->spi) avr_isp_spi_sw_free(instance->spi);
return false; return false;
} }

View file

@ -18,7 +18,6 @@ struct AvrIspSpiSw {
AvrIspSpiSw* avr_isp_spi_sw_init(AvrIspSpiSwSpeed speed) { AvrIspSpiSw* avr_isp_spi_sw_init(AvrIspSpiSwSpeed speed) {
AvrIspSpiSw* instance = malloc(sizeof(AvrIspSpiSw)); AvrIspSpiSw* instance = malloc(sizeof(AvrIspSpiSw));
instance->speed_wait_time = speed; instance->speed_wait_time = speed;
instance->miso = AVR_ISP_SPI_SW_MISO; instance->miso = AVR_ISP_SPI_SW_MISO;
instance->mosi = AVR_ISP_SPI_SW_MOSI; instance->mosi = AVR_ISP_SPI_SW_MOSI;
instance->sck = AVR_ISP_SPI_SW_SCK; instance->sck = AVR_ISP_SPI_SW_SCK;
@ -40,7 +39,6 @@ void avr_isp_spi_sw_free(AvrIspSpiSw* instance) {
furi_hal_gpio_init(instance->miso, GpioModeAnalog, GpioPullNo, GpioSpeedLow); furi_hal_gpio_init(instance->miso, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
furi_hal_gpio_init(instance->mosi, GpioModeAnalog, GpioPullNo, GpioSpeedLow); furi_hal_gpio_init(instance->mosi, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
furi_hal_gpio_init(instance->sck, GpioModeAnalog, GpioPullNo, GpioSpeedLow); furi_hal_gpio_init(instance->sck, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
free(instance); free(instance);
} }

View file

@ -181,9 +181,9 @@ class Main(App):
) as zf: ) as zf:
for component_key in sdk_components_keys: for component_key in sdk_components_keys:
component_path = self._dist_components.get(component_key) component_path = self._dist_components.get(component_key)
components_paths[component_key] = basename(component_path)
if component_key.endswith(".dir"): if component_key.endswith(".dir"):
components_paths[component_key] = basename(component_path)
for root, dirnames, files in walk(component_path): for root, dirnames, files in walk(component_path):
if "__pycache__" in dirnames: if "__pycache__" in dirnames:
dirnames.remove("__pycache__") dirnames.remove("__pycache__")
@ -199,7 +199,9 @@ class Main(App):
), ),
) )
else: 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( zf.writestr(
"components.json", "components.json",

View file

@ -163,6 +163,18 @@ dist_env.Alias("flash", openocd_target)
if env["FORCE"]: if env["FORCE"]:
env.AlwaysBuild(openocd_target) 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( firmware_debug = dist_env.PhonyTarget(
"debug", "debug",
"${GDBPYCOM}", "${GDBPYCOM}",
@ -391,3 +403,13 @@ AddPostAction(
dist_env.Precious(app_template_dist) dist_env.Precious(app_template_dist)
dist_env.NoClean(app_template_dist) dist_env.NoClean(app_template_dist)
dist_env.Alias("create", 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} $)",
)

View file

@ -2,19 +2,16 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0", "version": "0.2.0",
"inputs": [ "inputs": [
// { {
// "id": "BLACKMAGIC", "id": "BLACKMAGIC",
// "type": "command", "type": "command",
// "command": "shellCommand.execute", "command": "shellCommand.execute",
// "args": { "args": {
// "useSingleResult": true, "description": "Get Blackmagic device",
// "env": { "useSingleResult": true,
// "PATH": "${workspaceFolder};${env:PATH}" "command": "ufbt -s get_blackmagic",
// }, }
// "command": "./fbt get_blackmagic", },
// "description": "Get Blackmagic device",
// }
// },
], ],
"configurations": [ "configurations": [
{ {
@ -57,26 +54,26 @@
], ],
// "showDevDebugOutput": "raw", // "showDevDebugOutput": "raw",
}, },
// { {
// "name": "Attach FW (blackmagic)", "name": "Attach FW (blackmagic)",
// "cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",
// "executable": "@UFBT_FIRMWARE_ELF@", "executable": "@UFBT_FIRMWARE_ELF@",
// "request": "attach", "request": "attach",
// "type": "cortex-debug", "type": "cortex-debug",
// "servertype": "external", "servertype": "external",
// "gdbTarget": "${input:BLACKMAGIC}", "gdbTarget": "${input:BLACKMAGIC}",
// "svdFile": "@UFBT_DEBUG_DIR@/STM32WB55_CM4.svd", "svdFile": "@UFBT_DEBUG_DIR@/STM32WB55_CM4.svd",
// "rtos": "FreeRTOS", "rtos": "FreeRTOS",
// "postAttachCommands": [ "postAttachCommands": [
// "monitor swdp_scan", "monitor swdp_scan",
// "attach 1", "attach 1",
// "set confirm off", "set confirm off",
// "set mem inaccessible-by-default off", "set mem inaccessible-by-default off",
// "source @UFBT_DEBUG_DIR@/flipperapps.py", "source @UFBT_DEBUG_DIR@/flipperapps.py",
// "fap-set-debug-elf-root @UFBT_DEBUG_ELF_DIR@" "fap-set-debug-elf-root @UFBT_DEBUG_ELF_DIR@"
// ] ]
// // "showDevDebugOutput": "raw", // "showDevDebugOutput": "raw",
// }, },
{ {
"name": "Attach FW (JLink)", "name": "Attach FW (JLink)",
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",

View file

@ -20,24 +20,30 @@
"type": "shell", "type": "shell",
"command": "ufbt" "command": "ufbt"
}, },
{
"label": "Clean",
"group": "build",
"type": "shell",
"command": "ufbt -c"
},
{ {
"label": "Flash FW (ST-Link)", "label": "Flash FW (ST-Link)",
"group": "build", "group": "build",
"type": "shell", "type": "shell",
"command": "ufbt FORCE=1 flash" "command": "ufbt FORCE=1 flash"
}, },
// { {
// "label": "[NOTIMPL] Flash FW (blackmagic)", "label": "Flash FW (blackmagic)",
// "group": "build", "group": "build",
// "type": "shell", "type": "shell",
// "command": "ufbt flash_blackmagic" "command": "ufbt flash_blackmagic"
// }, },
// { {
// "label": "[NOTIMPL] Flash FW (JLink)", "label": "Flash FW (JLink)",
// "group": "build", "group": "build",
// "type": "shell", "type": "shell",
// "command": "ufbt FORCE=1 jflash" "command": "ufbt FORCE=1 jflash"
// }, },
{ {
"label": "Flash FW (USB, with resources)", "label": "Flash FW (USB, with resources)",
"group": "build", "group": "build",
@ -49,6 +55,12 @@
"group": "build", "group": "build",
"type": "shell", "type": "shell",
"command": "ufbt update" "command": "ufbt update"
},
{
"label": "Update VSCode config for current SDK",
"group": "build",
"type": "shell",
"command": "ufbt vscode_dist"
} }
] ]
} }

View file

@ -6,7 +6,7 @@ App(
apptype=FlipperAppType.EXTERNAL, apptype=FlipperAppType.EXTERNAL,
entry_point="@FBT_APPID@_app", entry_point="@FBT_APPID@_app",
stack_size=2 * 1024, stack_size=2 * 1024,
fap_category="Misc", fap_category="Examples",
# Optional values # Optional values
# fap_version=(0, 1), # (major, minor) # fap_version=(0, 1), # (major, minor)
fap_icon="@FBT_APPID@.png", # 10x10 1-bit PNG fap_icon="@FBT_APPID@.png", # 10x10 1-bit PNG

View file

@ -75,12 +75,6 @@ def generate(env, **kw):
if not sdk_state["meta"]["hw_target"].endswith(sdk_data["hardware"]): if not sdk_state["meta"]["hw_target"].endswith(sdk_data["hardware"]):
raise StopError("SDK state file doesn't match hardware target") 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"]) scripts_dir = sdk_current_sdk_dir_node.Dir(sdk_components["scripts.dir"])
env.SetDefault( env.SetDefault(
# Paths # Paths

View file

@ -1,5 +1,4 @@
from dataclasses import dataclass, field from dataclasses import dataclass, field
from os.path import dirname
from SCons.Node import NodeList from SCons.Node import NodeList
from SCons.Warnings import warn, WarningOnByDefault from SCons.Warnings import warn, WarningOnByDefault
@ -131,6 +130,7 @@ Depends(sdk_source, appenv.ProcessSdkDepends(f"{amalgamated_api}.d"))
appenv["SDK_DIR"] = appenv.Dir("${BUILD_DIR}/sdk_headers") appenv["SDK_DIR"] = appenv.Dir("${BUILD_DIR}/sdk_headers")
sdk_header_tree = appenv.SDKHeaderTreeExtractor(appenv["SDK_DIR"], amalgamated_api) sdk_header_tree = appenv.SDKHeaderTreeExtractor(appenv["SDK_DIR"], amalgamated_api)
Depends(sdk_header_tree, appenv["SDK_DEFINITION"])
# AlwaysBuild(sdk_tree) # AlwaysBuild(sdk_tree)
Alias("sdk_tree", sdk_header_tree) Alias("sdk_tree", sdk_header_tree)
extapps.sdk_tree = sdk_header_tree extapps.sdk_tree = sdk_header_tree