Skip to content

Commit

Permalink
Merge branch 'release-candidate' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
skotopes committed Jul 13, 2022
2 parents fc15d5c + 577a4ba commit 3e5d499
Show file tree
Hide file tree
Showing 157 changed files with 7,265 additions and 1,308 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ jobs:
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: 'Install with web updater'
body-includes: 'Compiled firmware for commit'

- name: 'Create or update comment'
if: ${{ !github.event.pull_request.head.repo.fork && github.event.pull_request}}
Expand All @@ -153,7 +153,10 @@ jobs:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
[Install with web updater](https://my.flipp.dev/?url=https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.artifacts-path}}/flipper-z-${{steps.names.outputs.default-target}}-update-${{steps.names.outputs.suffix}}.tgz&channel=${{steps.names.outputs.artifacts-path}}&version=${{steps.names.outputs.short-hash}}).
**Compiled firmware for commit `${{steps.names.outputs.short-hash}}`:**
- [📦 Update package](https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.artifacts-path}}/flipper-z-${{steps.names.outputs.default-target}}-update-${{steps.names.outputs.suffix}}.tgz)
- [📥 DFU file](https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.artifacts-path}}/flipper-z-${{steps.names.outputs.default-target}}-full-${{steps.names.outputs.suffix}}.dfu)
- [☁️ Web updater](https://my.flipp.dev/?url=https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.artifacts-path}}/flipper-z-${{steps.names.outputs.default-target}}-update-${{steps.names.outputs.suffix}}.tgz&channel=${{steps.names.outputs.artifacts-path}}&version=${{steps.names.outputs.short-hash}})
edit-mode: replace

compact:
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@
[submodule "lib/scons"]
path = lib/scons
url = https://github.com/SCons/scons.git
[submodule "lib/mbedtls"]
path = lib/mbedtls
url = https://github.com/Mbed-TLS/mbedtls.git
8 changes: 7 additions & 1 deletion ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@ They both must be flashed in order described.

## With offline update package

With Flipper attached over USB:

`./fbt --with-updater flash_usb`

Just building the package:

`./fbt --with-updater updater_package`

Copy the resulting directory to Flipper's SD card and navigate to `update.fuf` file in Archive app.
To update, copy the resulting directory to Flipper's SD card and navigate to `update.fuf` file in Archive app.

## With STLink

Expand Down
185 changes: 119 additions & 66 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ fbt_variables = SConscript("site_scons/commandline.scons")
cmd_environment = Environment(tools=[], variables=fbt_variables)
Help(fbt_variables.GenerateHelpText(cmd_environment))


# Building basic environment - tools, utility methods, cross-compilation
# settings, gcc flags for Cortex-M4, basic builders and more
coreenv = SConscript(
Expand All @@ -29,24 +28,49 @@ SConscript("site_scons/cc.scons", exports={"ENV": coreenv})
# Store root dir in environment for certain tools
coreenv["ROOT_DIR"] = Dir(".")


# Create a separate "dist" environment and add construction envs to it
distenv = coreenv.Clone(
tools=["fbt_dist", "openocd"],
GDBOPTS="-ex 'target extended-remote | ${OPENOCD} -c \"gdb_port pipe\" ${OPENOCD_OPTS}' "
'-ex "set confirm off" ',
tools=["fbt_dist", "openocd", "blackmagic"],
OPENOCD_GDB_PIPE=["|openocd -c 'gdb_port pipe' ${[SINGLEQUOTEFUNC(OPENOCD_OPTS)]}"],
GDBOPTS_BASE=[
"-ex",
"target extended-remote ${GDBREMOTE}",
"-ex",
"set confirm off",
],
GDBOPTS_BLACKMAGIC=[
"-ex",
"monitor swdp_scan",
"-ex",
"monitor debug_bmp enable",
"-ex",
"attach 1",
"-ex",
"set mem inaccessible-by-default off",
],
GDBPYOPTS=[
"-ex",
"source debug/FreeRTOS/FreeRTOS.py",
"-ex",
"source debug/PyCortexMDebug/PyCortexMDebug.py",
"-ex",
"svd_load ${SVD_FILE}",
"-ex",
"compare-sections",
],
ENV=os.environ,
)

firmware_out = distenv.AddFwProject(
firmware_env = distenv.AddFwProject(
base_env=coreenv,
fw_type="firmware",
fw_env_key="FW_ENV",
)


# If enabled, initialize updater-related targets
if GetOption("fullenv"):
updater_out = distenv.AddFwProject(
updater_env = distenv.AddFwProject(
base_env=coreenv,
fw_type="updater",
fw_env_key="UPD_ENV",
Expand All @@ -71,91 +95,120 @@ if GetOption("fullenv"):
"--splash",
distenv.subst("assets/slideshow/$UPDATE_SPLASH"),
]
selfupdate_dist = distenv.DistBuilder(
"selfupdate.pseudo",
(distenv["DIST_DEPENDS"], firmware_out["FW_RESOURCES"]),

selfupdate_dist = distenv.DistCommand(
"updater_package",
(distenv["DIST_DEPENDS"], firmware_env["FW_RESOURCES"]),
DIST_EXTRA=dist_arguments,
)
distenv.Pseudo("selfupdate.pseudo")
AlwaysBuild(selfupdate_dist)
Alias("updater_package", selfupdate_dist)

# Updater debug
debug_updater_elf = distenv.AddDebugTarget(updater_out, False)
Alias("updater_debug", debug_updater_elf)
distenv.PhonyTarget(
"updater_debug",
"${GDBPYCOM}",
source=updater_env["FW_ELF"],
GDBREMOTE="${OPENOCD_GDB_PIPE}",
)

distenv.PhonyTarget(
"updater_blackmagic",
"${GDBPYCOM}",
source=updater_env["FW_ELF"],
GDBOPTS=distenv.subst("$GDBOPTS_BLACKMAGIC"),
GDBREMOTE="${BLACKMAGIC_ADDR}",
)

# Installation over USB & CLI
usb_update_package = distenv.UsbInstall(
"usbinstall.flag",
(distenv["DIST_DEPENDS"], firmware_out["FW_RESOURCES"], selfupdate_dist),
"#build/usbinstall.flag",
(
distenv["DIST_DEPENDS"],
firmware_env["FW_RESOURCES"],
selfupdate_dist,
),
)
if distenv["FORCE"]:
AlwaysBuild(usb_update_package)
Depends(usb_update_package, selfupdate_dist)
Alias("flash_usb", usb_update_package)

distenv.AlwaysBuild(usb_update_package)
distenv.Depends(usb_update_package, selfupdate_dist)
distenv.Alias("flash_usb", usb_update_package)

# Target for copying & renaming binaries to dist folder
basic_dist = distenv.DistBuilder("dist.pseudo", distenv["DIST_DEPENDS"])
distenv.Pseudo("dist.pseudo")
AlwaysBuild(basic_dist)
Alias("fw_dist", basic_dist)
Default(basic_dist)

basic_dist = distenv.DistCommand("fw_dist", distenv["DIST_DEPENDS"])
distenv.Default(basic_dist)

# Target for bundling core2 package for qFlipper
copro_dist = distenv.CoproBuilder(
Dir("assets/core2_firmware"),
distenv.Dir("assets/core2_firmware"),
[],
)
AlwaysBuild(copro_dist)
Alias("copro_dist", copro_dist)

distenv.Alias("copro_dist", copro_dist)

firmware_flash = distenv.AddOpenOCDFlashTarget(firmware_env)
distenv.Alias("flash", firmware_flash)

firmware_bm_flash = distenv.PhonyTarget(
"flash_blackmagic",
"$GDB $GDBOPTS $SOURCES $GDBFLASH",
source=firmware_env["FW_ELF"],
GDBOPTS="${GDBOPTS_BASE} ${GDBOPTS_BLACKMAGIC}",
GDBREMOTE="${BLACKMAGIC_ADDR}",
GDBFLASH=[
"-ex",
"load",
"-ex",
"quit",
],
)

# Debugging firmware

debug_fw_elf = distenv.AddDebugTarget(firmware_out)
Alias("debug", debug_fw_elf)

firmware_debug = distenv.PhonyTarget(
"debug",
"${GDBPYCOM}",
source=firmware_env["FW_ELF"],
GDBOPTS="${GDBOPTS_BASE}",
GDBREMOTE="${OPENOCD_GDB_PIPE}",
)
distenv.Depends(firmware_debug, firmware_flash)

distenv.PhonyTarget(
"blackmagic",
"${GDBPYCOM}",
source=firmware_env["FW_ELF"],
GDBOPTS="${GDBOPTS_BASE} ${GDBOPTS_BLACKMAGIC}",
GDBREMOTE="${BLACKMAGIC_ADDR}",
)

# Debug alien elf
debug_other = distenv.GDBPy(
"debugother.pseudo",
None,
GDBPYOPTS=
# '-ex "source ${ROOT_DIR.abspath}/debug/FreeRTOS/FreeRTOS.py" '
'-ex "source debug/PyCortexMDebug/PyCortexMDebug.py" ',
distenv.PhonyTarget(
"debug_other",
"${GDBPYCOM}",
GDBPYOPTS='-ex "source debug/PyCortexMDebug/PyCortexMDebug.py" ',
GDBREMOTE="${OPENOCD_GDB_PIPE}",
)
distenv.Pseudo("debugother.pseudo")
AlwaysBuild(debug_other)
Alias("debug_other", debug_other)


# Just start OpenOCD
openocd = distenv.OOCDCommand("openocd.pseudo", [])
distenv.Pseudo("openocd.pseudo")
AlwaysBuild(openocd)
Alias("openocd", openocd)

distenv.PhonyTarget(
"openocd",
"${OPENOCDCOM}",
)

# Linter
lint_check = distenv.Command(
"lint.check.pseudo",
[],
"${PYTHON3} scripts/lint.py check $LINT_SOURCES",
LINT_SOURCES=firmware_out["LINT_SOURCES"],
distenv.PhonyTarget(
"lint",
"${PYTHON3} scripts/lint.py check ${LINT_SOURCES}",
LINT_SOURCES=firmware_env["LINT_SOURCES"],
)
distenv.Pseudo("lint.check.pseudo")
AlwaysBuild(lint_check)
Alias("lint", lint_check)

distenv.PhonyTarget(
"format",
"${PYTHON3} scripts/lint.py format ${LINT_SOURCES}",
LINT_SOURCES=firmware_env["LINT_SOURCES"],
)

lint_format = distenv.Command(
"lint.format.pseudo",
[],
"${PYTHON3} scripts/lint.py format $LINT_SOURCES",
LINT_SOURCES=firmware_out["LINT_SOURCES"],

# Find blackmagic probe

distenv.PhonyTarget(
"get_blackmagic",
"@echo $( ${BLACKMAGIC_ADDR} $)",
)
distenv.Pseudo("lint.format.pseudo")
AlwaysBuild(lint_format)
Alias("format", lint_format)
33 changes: 27 additions & 6 deletions applications/archive/helpers/archive_browser.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ static void

int32_t load_offset = 0;
browser->is_root = is_root;
ArchiveTabEnum tab = archive_get_tab(browser);

if((item_cnt == 0) && (archive_is_home(browser))) {
if((item_cnt == 0) && (archive_is_home(browser)) && (tab != ArchiveTabBrowser)) {
archive_switch_tab(browser, browser->last_tab_switch_dir);
} else if(!string_start_with_str_p(browser->path, "/app:")) {
with_view_model(
Expand Down Expand Up @@ -389,6 +390,22 @@ void archive_favorites_move_mode(ArchiveBrowserView* browser, bool active) {
});
}

static bool archive_is_dir_exists(string_t path) {
if(string_equal_str_p(path, "/any")) {
return true;
}
bool state = false;
FileInfo file_info;
Storage* storage = furi_record_open("storage");
if(storage_common_stat(storage, string_get_cstr(path), &file_info) == FSE_OK) {
if(file_info.flags & FSF_DIRECTORY) {
state = true;
}
}
furi_record_close("storage");
return state;
}

void archive_switch_tab(ArchiveBrowserView* browser, InputKey key) {
furi_assert(browser);
ArchiveTabEnum tab = archive_get_tab(browser);
Expand Down Expand Up @@ -418,11 +435,15 @@ void archive_switch_tab(ArchiveBrowserView* browser, InputKey key) {
}
}
} else {
ArchiveTabEnum tab = archive_get_tab(browser);
bool skip_assets = (strcmp(archive_get_tab_ext(tab), "*") == 0) ? false : true;
file_browser_worker_set_config(
browser->worker, browser->path, archive_get_tab_ext(tab), skip_assets);
tab_empty = false; // Empty check will be performed later
tab = archive_get_tab(browser);
if(archive_is_dir_exists(browser->path)) {
bool skip_assets = (strcmp(archive_get_tab_ext(tab), "*") == 0) ? false : true;
file_browser_worker_set_config(
browser->worker, browser->path, archive_get_tab_ext(tab), skip_assets);
tab_empty = false; // Empty check will be performed later
} else {
tab_empty = true;
}
}

if((tab_empty) && (tab != ArchiveTabBrowser)) {
Expand Down
Loading

0 comments on commit 3e5d499

Please sign in to comment.