Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drunkbatya/python3 wrapper #88

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
205 commits
Select commit Hold shift + click to select a range
db33811
Initial SCons-powered build impl
hedger May 24, 2022
fa7e105
Using CPPDEFINES for definitions
hedger May 24, 2022
d33d1dc
Added SCons as submodule. Call `python3 scons/scripts/scons.py -j 8` …
hedger May 24, 2022
6ca5f1b
Removed duplicate target def
hedger May 24, 2022
b8b8bf8
Fixed quoting for bash
hedger May 24, 2022
5cfa236
Added hex + bin builders
hedger May 24, 2022
f5f82eb
Added dfu builder
hedger May 24, 2022
8e92738
Merge remote-tracking branch 'remotes/origin/dev' into hedger/sconsbuild
hedger May 24, 2022
6bf671a
Updates for latest dev; added compilation db
hedger May 24, 2022
65474a9
Added command line parsing & updater build
hedger May 24, 2022
ef5bbd2
Renamed output files to match configuration
hedger May 24, 2022
d29c552
Generation of version header
hedger May 26, 2022
1a4d7b0
Modular build wip
hedger Jun 2, 2022
e99f0d2
Add python3 wrapper
drunkbatya Jun 2, 2022
8313c0f
Moving python3 wrapper to Makefile, work logic changed - overriding P…
drunkbatya Jun 3, 2022
c98511c
Assets as module
hedger Jun 3, 2022
ffaedc3
functional out-of-tree build
hedger Jun 3, 2022
a59c7af
Core as a lib
hedger Jun 3, 2022
ecce495
Fixed version.inc.h generation on build
hedger Jun 4, 2022
d7c24b0
Smarter build dir naming
hedger Jun 4, 2022
11ee833
Fixed updater builds
hedger Jun 4, 2022
0426f84
Fixed hardcoded linker script path
hedger Jun 4, 2022
e586b08
Using ranlib from toolchain
hedger Jun 4, 2022
f64f20d
Removed scons from root
hedger Jun 4, 2022
d9c8762
Added scons to /lib
hedger Jun 4, 2022
23c5ed8
Formatting & cleanup
hedger Jun 4, 2022
6cd4fac
Using AddMethod for methods
hedger Jun 4, 2022
df5723b
Enabled implicit_deps_unchanged by default - experimental
hedger Jun 4, 2022
3da23dd
App manifests + manifest loader
hedger Jun 4, 2022
71c3938
Manifest fixes & filled missing entries
hedger Jun 5, 2022
26d7749
Added Insomnia to power settings
hedger Jun 5, 2022
4997764
Build: fbt entry point to scons and flash rule
skotopes Jun 5, 2022
85017ab
Changed flash target from builder to command
hedger Jun 5, 2022
8eabf82
Ported app deps from makefile; inital deps solver impl
hedger Jun 5, 2022
fc2e631
Added order values to apps; added app sorting
hedger Jun 5, 2022
b307211
Additional deps fixes
hedger Jun 5, 2022
71d267c
+Apps dump to console
hedger Jun 5, 2022
85e6cc0
Merge remote-tracking branch 'remotes/origin/dev' into hedger/sconsbuild
hedger Jun 5, 2022
c9ab2dc
Integrated upstream changes
hedger Jun 5, 2022
5e84676
Dynamic applications.c generation
hedger Jun 5, 2022
77a4ced
Build: Fixed RAM_EXEC processing & related flags
hedger Jun 5, 2022
e97c26d
Build: always regenerating apps.c
hedger Jun 5, 2022
1887bb2
Build: added missing c++-related flags; added optimization flag to mtar
hedger Jun 5, 2022
a9a6979
Build: Compile flags reorg
hedger Jun 6, 2022
ea5eb56
Build: lowercase libs; moved around more flags
hedger Jun 6, 2022
bc69d3e
Build: Added app metapackages
hedger Jun 6, 2022
09f3e2a
Build: Filtering metapackages from apps.c
hedger Jun 6, 2022
605926a
Build: better app banner formatting
hedger Jun 6, 2022
107de40
Build: skip empty banner categories
hedger Jun 6, 2022
26aa97c
Build: Added support for external applications; invoke with build "ap…
hedger Jun 6, 2022
320698f
Build: minor cleanup
hedger Jun 6, 2022
60f8b3b
Build: added missing app link script
hedger Jun 6, 2022
3ce8574
Merge branch 'dev' into drunkbatya/python3-wrapper
drunkbatya Jun 6, 2022
5f8818f
Add our protobuf to PATH
drunkbatya Jun 6, 2022
1acf139
Add out ImageMagick to PATH
drunkbatya Jun 6, 2022
c943d9e
FIX: Add out ImageMagick to PATH
drunkbatya Jun 6, 2022
d376f38
Build: external apps: direct jump to EP
hedger Jun 6, 2022
514e3e0
Build: dropped snake_game_ext; scons extapps now builds all PLUGINS a…
hedger Jun 6, 2022
7fac29d
Build: Added stripper :p for extapps
hedger Jun 6, 2022
2228be7
Build: added Windows entrypoint fbt.cmd
hedger Jun 6, 2022
743fd4a
Build: restored 'flash' command behavior; added path processing for o…
hedger Jun 6, 2022
b3b8c15
Build: reworked strip init; added compact build output (set VERBOSE=1…
hedger Jun 6, 2022
425fda8
Build: moved lib flags to csconscfg/cc.scons
hedger Jun 6, 2022
48261f1
Build: added generated version file to .gitignore
hedger Jun 6, 2022
db6d4cb
Scons: add INSTALLSTR override
skotopes Jun 7, 2022
61f01d8
Build: additional aliases and less verbose default build
hedger Jun 7, 2022
f242ccb
Replacing ImageMagick's convert call to out png2xmb
drunkbatya Jun 8, 2022
f25c347
png2xbm call fix
drunkbatya Jun 8, 2022
23bd0f0
fully replacing ImageMagick's convert call to our png2xmb
drunkbatya Jun 8, 2022
8dbc042
Scripts: changed open() calls to with ..: idiom
hedger Jun 8, 2022
4f6942a
Scripts: Added support for pillow + heatshrink in icon processing for…
hedger Jun 9, 2022
57d0f9c
Build: buider for icons; refactored basic builders to use plain Action()
hedger Jun 9, 2022
c9ca9fa
Scripts: removed duplicate image handling logic
hedger Jun 9, 2022
2923262
Build: assets tooling, initial impl
hedger Jun 9, 2022
5486650
UI: show Radio Stack version & type in about & desktop debug view
hedger Jun 9, 2022
2356f3c
Assets: fixed orange icon backgrounds to transparent/white
hedger Jun 9, 2022
4f8ece6
Build: constructing assets in variant dir & copying to compiled/
hedger Jun 9, 2022
546af66
Merge remote-tracking branch 'remotes/origin/dev' into hedger/sconsbuild
hedger Jun 9, 2022
aa06664
Build: added "resources" target for rebuilding SD card resources Mani…
hedger Jun 9, 2022
66e982a
Scripts: fixed ImportError handling for pillow/heatshrink2
hedger Jun 9, 2022
1d985f7
Build: better, faster & stronger GlobRecursive impl(); added FORCE fl…
hedger Jun 10, 2022
81395e5
UI: experimental radio stack display
hedger Jun 10, 2022
13c0635
Scripts: enforcing Unix newlines in FFF; not using multiprocessing if…
hedger Jun 10, 2022
ef158fd
Scripts: enforcing Unix line breaks across platforms
hedger Jun 10, 2022
c302f71
Merge remote-tracking branch 'remotes/origin/dev' into hedger/sconsbuild
hedger Jun 10, 2022
4c55f1a
Build: virtual object dependency for version.inc.h and applications.c…
hedger Jun 10, 2022
8d1e473
Merge remote-tracking branch 'remotes/origin/dev' into hedger/sconsbuild
hedger Jun 10, 2022
efba73e
Build: minor cleanup + comments
hedger Jun 10, 2022
069bc48
Build:
hedger Jun 11, 2022
b151423
Typo fix
hedger Jun 11, 2022
b793a58
Build: moved sconscfg->site_scons
hedger Jun 11, 2022
96e3678
Build: moved app manifest-related code to site_scons
hedger Jun 11, 2022
5a5e814
Build: moved python code fragments out of sconsipt files to site_scons
hedger Jun 11, 2022
f6b06bc
Build: cleaner *COMSTR setup respecting global VERBOSE=1
hedger Jun 11, 2022
785f673
Build: dumping app configuration post-link
hedger Jun 11, 2022
5f7660d
Start to develop universal UNIX/Windows toolchain downaload script
drunkbatya Jun 11, 2022
3348044
Build: reduced number of global variables; added per-lib optimization…
hedger Jun 11, 2022
6cd97cf
Build: comments in main SConstruct
hedger Jun 11, 2022
3528da2
Build: fixed typos
hedger Jun 11, 2022
e2cc0ce
Build: disabled progress indicator for speed-up
hedger Jun 11, 2022
8655ea5
Add windows toolchain download part
drunkbatya Jun 11, 2022
ab25ec0
restructuring toolchain scripts
drunkbatya Jun 11, 2022
ac27b03
Fix toolchain windows script path
drunkbatya Jun 11, 2022
1111503
Build: generating version.json with version.inc.h; removed hardware t…
hedger Jun 11, 2022
ff22b7f
Build: always copying version.json to build dir
hedger Jun 11, 2022
f2f34c1
Build: reverted broken firmware_extapps build
hedger Jun 11, 2022
928f703
Build: added version.json to firmware output targets; minor SConstruc…
hedger Jun 11, 2022
02c300f
Build: fixed updater configuration; moved external apps-related code …
hedger Jun 12, 2022
1a5cb39
Build: loading options from file; added sconsdist.py script
hedger Jun 12, 2022
38abd80
Build: Functional do_dist target
hedger Jun 12, 2022
f3fb264
Build: added dist wrappers; call ./fbt fw_dist for simple copy or ./f…
hedger Jun 12, 2022
d61220b
Build: added ./fbt copro_dist target for bundling c2 firmware for qFl…
hedger Jun 12, 2022
b414dda
CI: trying scons integration
hedger Jun 12, 2022
5aaf878
CI: calling pip with python
hedger Jun 12, 2022
7dab135
CI: removed pip calls; stripping f from target
hedger Jun 12, 2022
fbaba14
Build: comments cleanup
hedger Jun 12, 2022
a48e832
Build: respecting DIST_SUFFIX from OS environment
hedger Jun 13, 2022
fb14e13
Ble: fixed stack type string
hedger Jun 13, 2022
c2059cb
Merge remote-tracking branch 'remotes/origin/dev' into hedger/sconsbuild
hedger Jun 13, 2022
4f87860
Build: using WORKFLOW_BRANCH_OR_TAG from environment if present for b…
hedger Jun 13, 2022
07f6000
Build: debugging version.py environment on CI
hedger Jun 13, 2022
a6ecf92
Build: forwarding CI environment variable to child processed
hedger Jun 13, 2022
9716b1b
Add UNIX toolchain downloader script
drunkbatya Jun 13, 2022
a2b5eb9
UNIX toolchain downloader script fix
drunkbatya Jun 13, 2022
b3f31ec
Build: added initial fbt.md
hedger Jun 13, 2022
90049fa
Docker: added pip + pillow + heatshrink
hedger Jun 13, 2022
264e070
Docker: added libpython3-dev
hedger Jun 13, 2022
51cd7f3
Docker: removed unused tools
hedger Jun 13, 2022
926527d
CI: attempt to fix web updater links
hedger Jun 13, 2022
ce93298
triggering CI rebuild
hedger Jun 13, 2022
7a8ab4d
Build: fixed malformed dist dir in certain configurations; Github: fi…
hedger Jun 13, 2022
f2f2581
Build: migrating .scons files to proper tools
hedger Jun 13, 2022
d1a6594
Build: wrapped toolchain+python3 in separate tools
hedger Jun 13, 2022
7226f28
Build: eliminated fbt/builders; moved to site_tools
hedger Jun 13, 2022
078f2a5
Ble: typo fix in stack type enum
hedger Jun 13, 2022
94d9a3e
Build: dist tools refactoring
hedger Jun 13, 2022
700d4cd
Docs: moved fbt.md to documentation/fbt.md
hedger Jun 13, 2022
8051fa3
Scripts: fixed rare FS race on cleanup
hedger Jun 13, 2022
b9a0b9d
Build: added toolchain whitelist
hedger Jun 14, 2022
da7ff9b
Build: removed COPRO_MCU_FAMILY from configurable options
hedger Jun 14, 2022
abf4bd7
Merge remote-tracking branch 'remotes/origin/dev' into hedger/sconsbuild
hedger Jun 14, 2022
773c73d
Build: added FlipperAppType.EXTERNAL apps to firmware_extapps target
hedger Jun 14, 2022
a887a2a
Add real toolchain link from linux and win
drunkbatya Jun 16, 2022
2dcf03a
Fix toolchain archive name
drunkbatya Jun 16, 2022
c06dd09
Build: changed default target to fw_dist; renamed cdb file to compile…
hedger Jun 16, 2022
96f0d20
Fix conflicts before merge with hedger/sconsbuild
drunkbatya Jun 16, 2022
17f7e5c
Build: Added --extra-ext-apps argument for firmware_extapps target wi…
hedger Jun 16, 2022
6d9be36
Merge remote-tracking branch 'remotes/origin/dev' into hedger/sconsbuild
hedger Jun 16, 2022
1f2aa78
Start writing fbt.sh.bat
drunkbatya Jun 16, 2022
cadbe55
add windows part to fbt.sh.bat
drunkbatya Jun 16, 2022
3a6cca8
remove old fbt script
drunkbatya Jun 16, 2022
5a9a3b3
Build: Moved OpenOCD options to config file
hedger Jun 17, 2022
8312b56
Build: fixed fbt.md; added SVD file to options
hedger Jun 17, 2022
aea345b
bye bye universal entrypoint..
drunkbatya Jun 17, 2022
ba2af41
Merge remote-tracking branch 'remotes/origin/hedger/sconsbuild' into …
hedger Jun 17, 2022
819c4b8
Build: removed quotes for passed arguments
hedger Jun 17, 2022
234a230
Build: Fixed debugging information missing for libs; added toolchain …
hedger Jun 17, 2022
fc9591a
Build: added debug_other target requiring OTHER_ELF=blabla.elf to deb…
hedger Jun 17, 2022
0105fae
Build: fixed debug target without external elf specified
hedger Jun 17, 2022
2dbd97c
Build: temporarily disabled COMSTR for gdb
hedger Jun 17, 2022
e8c92a7
Build: added openocd target
hedger Jun 17, 2022
45d5115
Revert "Merge remote-tracking branch 'remotes/origin/hedger/sconsbuil…
hedger Jun 18, 2022
9c88b07
Build: added updater debug handling
hedger Jun 20, 2022
2e425c9
Make possible to have multiply toolchains
drunkbatya Jun 20, 2022
2f069b3
Merge remote-tracking branch 'remotes/origin/dev' into hedger/sconsbuild
hedger Jun 20, 2022
43aee63
Make possible to have multiply toolchains fix
drunkbatya Jun 21, 2022
2d45231
new toolchain achive naming
drunkbatya Jun 21, 2022
efd6fa4
win toolchain fix
drunkbatya Jun 21, 2022
76075bc
Build: check git submodules in fbt
skotopes Jun 21, 2022
c7e4512
[FL-2568] Infrared C port (#1326)
gsurkov Jun 21, 2022
94a18a4
[FL-2511] Updater: fixed long update descriptions overlapping UI elem…
hedger Jun 21, 2022
b25cdd1
SubGhz: frequency analyzer combined frequency detection method (#1321)
Skorpionm Jun 21, 2022
dad13b9
[FL-2588] RPC storage: Ignore incorrect file names #1318
nminaylov Jun 21, 2022
1e93be4
[FL-2556] Update complete screen (#1332)
hedger Jun 21, 2022
46b8fd8
[FL-2548] Infrared: show error if no SD card/databases (#1337)
gsurkov Jun 21, 2022
62b61e1
nfc: DESFire fixes (#1334)
kevinwallace Jun 21, 2022
d06e61f
nfc: NTAG21x complete emulation (#1313)
GMMan Jun 21, 2022
fc96fd4
Build: removed infrared_monitor/application.fam; fixed git branch id;…
hedger Jun 21, 2022
452514f
Build: better environment forward
hedger Jun 21, 2022
b8f9ff4
Merge branch 'dev' into hedger/sconsbuild
hedger Jun 21, 2022
b54a439
Merge branch 'hedger/sconsbuild' into drunkbatya/python3-wrapper
hedger Jun 21, 2022
1495a07
rstoring missed files, openocd fbt add
drunkbatya Jun 22, 2022
6b98e3b
make toolchain-download works on mac
drunkbatya Jun 28, 2022
f7b350d
Merge branch 'dev' into drunkbatya/python3-wrapper
DrZlo13 Jun 29, 2022
4ed92d1
change fbt naming, add MinGW crutch
drunkbatya Jun 29, 2022
28dd5d4
add checking .git directory
drunkbatya Jun 30, 2022
1bab50a
add full path to python and libs
drunkbatya Jun 30, 2022
43e8595
Merge remote-tracking branch 'remotes/origin/dev' into drunkbatya/pyt…
hedger Jun 30, 2022
2221e9f
Add progressbar while downloading and extracting toolchain
drunkbatya Jul 1, 2022
c9074a2
fix progressbar on MacOS
drunkbatya Jul 1, 2022
0ad49e9
fixed progressbar on MacOS againg
drunkbatya Jul 1, 2022
ba24425
add toolchain versioning
drunkbatya Jul 2, 2022
e84a6c4
fbt: added separate script for Windows env setup; moved flash targets…
hedger Jul 2, 2022
5ee5aa6
fbt: added networked BlackmagicResolver mode; added `get_blackmagic` …
hedger Jul 3, 2022
7f37c6b
fbt: BlackmagicResolver minor fixes
hedger Jul 3, 2022
07b9eee
fbt: wrapped exceptions and eliminated stacktrace leaks; added check …
hedger Jul 3, 2022
3abf2f3
fbt: fixed linking updater as latest build dir for "flash_usb"
hedger Jul 3, 2022
96710dd
Merge branch 'dev' into drunkbatya/python3-wrapper
hedger Jul 3, 2022
e033fbe
scripts: fbtenv.cmd: not setting env variables if already set
hedger Jul 4, 2022
08226f7
Merge branch 'dev' into drunkbatya/python3-wrapper
hedger Jul 4, 2022
bd94e6e
fbt: moved environment init to scripts/toolchain; skipping environmen…
hedger Jul 4, 2022
8818b6f
Merge remote-tracking branch 'remotes/origin/dev' into drunkbatya/pyt…
hedger Jul 4, 2022
714d0de
fix merge conflicts
drunkbatya Jul 5, 2022
69f9b83
Merge branch 'dev' into drunkbatya/python3-wrapper
drunkbatya Jul 5, 2022
b9375c9
Merge branch 'dev' into drunkbatya/python3-wrapper
drunkbatya Jul 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
* text=auto eol=lf
*.bat eol=crlf
*.ps1 eol=crlf
*.cmd eol=crlf
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ dist
build/

# Toolchain
toolchain*/
/toolchain

2 changes: 2 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import os

EnsurePythonVersion(3, 8)

DefaultEnvironment(tools=[])
# Progress(["OwO\r", "owo\r", "uwu\r", "owo\r"], interval=15)

Expand Down
2 changes: 1 addition & 1 deletion applications/about/about.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,4 @@ int32_t about_settings_app(void* p) {
furi_record_close("gui");

return 0;
}
}
1 change: 0 additions & 1 deletion applications/extapps.scons
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Import("ENV")

from fbt.appmanifest import FlipperAppType


appenv = ENV.Clone(tools=["fbt_extapps"])

appenv.Replace(
Expand Down
28 changes: 16 additions & 12 deletions fbt
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
#!/bin/bash
#!/bin/sh

set -e
# shellcheck disable=SC2086 source=/dev/null
# unofficial strict mode
set -eu;

SCRIPTDIR="$( dirname -- "$0"; )";
SCONS_EP=${SCRIPTDIR}/lib/scons/scripts/scons.py
SCONS_DEFAULT_FLAGS="-Q --warn=target-not-built";
SCRIPT_PATH="$(cd "$(dirname "$0")" && pwd -P)";

if [[ -z "${FBT_NO_SYNC:-}" ]] ; then
if [[ -d .git ]]; then
git submodule update --init
else
echo Not in a git repo, please clone with git clone --recursive
exit 1
if [ -z "${FBT_NOENV:-}" ]; then
. "$SCRIPT_PATH/scripts/toolchain/fbtenv.sh";
fi

if [ -z "${FBT_NO_SYNC:-}" ]; then
if [ ! -d "$SCRIPT_PATH/.git" ]; then
echo "\".git\" directory not found, please clone repo via \"git clone --recursive\"";
exit 1;
fi
git submodule update --init;
fi

SCONS_DEFAULT_FLAGS="-Q --warn=target-not-built"
python3 ${SCONS_EP} ${SCONS_DEFAULT_FLAGS} "$@"
python3 "$SCRIPT_PATH/lib/scons/scripts/scons.py" $SCONS_DEFAULT_FLAGS "$@"
16 changes: 9 additions & 7 deletions fbt.cmd
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
@echo off
call %~dp0scripts\toolchain\fbtenv.cmd env

set SCONS_EP=%~dp0\lib\scons\scripts\scons.py

if [%FBT_NO_SYNC%] == [] (
if exist ".git" (
git submodule update --init
) else (
echo Not in a git repo, please clone with git clone --recursive
exit /b 1
)
if exist ".git" (
git submodule update --init
) else (
echo Not in a git repo, please clone with git clone --recursive
exit /b 1
)
)
git submodule update --init

set "SCONS_DEFAULT_FLAGS=-Q --warn=target-not-built"
python %SCONS_EP% %SCONS_DEFAULT_FLAGS% %*
python lib\scons\scripts\scons.py %SCONS_DEFAULT_FLAGS% %*
8 changes: 4 additions & 4 deletions fbt_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
## Optimize for debugging experience
DEBUG = 1

# Suffix to add to files when building distribution.
# If OS environment has DIST_SUFFIX set, it will be used instead..
# Suffix to add to files when building distribution
# If OS environment has DIST_SUFFIX set, it will be used instead
DIST_SUFFIX = "local"

# Coprocessor firmware
Expand All @@ -27,7 +27,7 @@
# Firmware also supports "ble_full", but it might not fit into debug builds
COPRO_STACK_TYPE = "ble_light"

# Leave 0 to lets scripts automatically calculate it
# Leave 0 to let scripts automatically calculate it
COPRO_STACK_ADDR = "0x0"

# If you override COPRO_CUBE_DIR on commandline, override this aswell
Expand Down Expand Up @@ -56,7 +56,7 @@

SVD_FILE = "debug/STM32WB55_CM4.svd"

# Look for blackmagic probe on serial ports
# Look for blackmagic probe on serial ports and local network
BLACKMAGIC = "auto"

FIRMWARE_APPS = {
Expand Down
15 changes: 8 additions & 7 deletions firmware.scons
Original file line number Diff line number Diff line change
Expand Up @@ -207,19 +207,20 @@ def link_elf_dir_as_latest(env, elf_target):
# Ugly way to check if updater-related targets were requested
elf_dir = elf_target.Dir(".")
explicitly_building_updater = False
# print("BUILD_TARGETS:", ','.join(BUILD_TARGETS))
# print("BUILD_TARGETS:", ",".join(BUILD_TARGETS))
for build_target in BUILD_TARGETS:
# print(">>> ", str(build_target))
if "updater" in str(build_target):
explicitly_building_updater = True

latest_dir = env.Dir("#build/latest")

link_this_dir = True
if explicitly_building_updater:
# If updater is explicitly requested, link to the latest updater
# Otherwise, link to the latest firmware
link_this_dir = not env["IS_BASE_FIRMWARE"]
is_updater = not env["IS_BASE_FIRMWARE"]
# If updater is explicitly requested, link to the latest updater
# Otherwise, link to the latest firmware
link_this_dir = (is_updater and explicitly_building_updater) or (
not is_updater and not explicitly_building_updater
)

if link_this_dir:
print(f"Setting {elf_dir} as latest built dir")
Expand Down Expand Up @@ -261,7 +262,7 @@ artifacts = [
fwhex,
fwbin,
fwdfu,
env["FW_VERSION_JSON"],
fwenv["FW_VERSION_JSON"],
fwcdb,
]
fwenv["FW_ARTIFACTS"] = artifacts
Expand Down
45 changes: 45 additions & 0 deletions scripts/toolchain/fbtenv.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@echo off

if not [%FBT_ROOT%] == [] (
goto already_set
)

set "FBT_ROOT=%~dp0\..\..\"
pushd %FBT_ROOT%
set "FBT_ROOT=%cd%"
popd

if not [%FBT_NOENV%] == [] (
exit /b 0
)

set "FLIPPER_TOOLCHAIN_VERSION=2"
set "FBT_TOOLCHAIN_ROOT=%FBT_ROOT%\toolchain\i686-windows"


if not exist "%FBT_TOOLCHAIN_ROOT%" (
powershell -ExecutionPolicy Bypass -File %FBT_ROOT%\scripts\toolchain\windows-toolchain-download.ps1 "%flipper_toolchain_version%"
)
if not exist "%FBT_TOOLCHAIN_ROOT%\VERSION" (
powershell -ExecutionPolicy Bypass -File %FBT_ROOT%\scripts\toolchain\windows-toolchain-download.ps1 "%flipper_toolchain_version%"
)
set /p REAL_TOOLCHAIN_VERSION=<%FBT_TOOLCHAIN_ROOT%\VERSION
if not "%REAL_TOOLCHAIN_VERSION%" == "%FLIPPER_TOOLCHAIN_VERSION%" (
powershell -ExecutionPolicy Bypass -File %FBT_ROOT%\scripts\toolchain\windows-toolchain-download.ps1 "%flipper_toolchain_version%"
)


set "HOME=%USERPROFILE%"
set "PYTHONHOME=%FBT_TOOLCHAIN_ROOT%\python"
set "PATH=%FBT_TOOLCHAIN_ROOT%\python;%FBT_TOOLCHAIN_ROOT%\bin;%FBT_TOOLCHAIN_ROOT%\protoc\bin;%FBT_TOOLCHAIN_ROOT%\openocd\bin;%PATH%"
set "PROMPT=(fbt) %PROMPT%"

:already_set

if not "%1" == "env" (
echo *********************************
echo * fbt build environment *
echo *********************************
cd %FBT_ROOT%
cmd /k
)
54 changes: 54 additions & 0 deletions scripts/toolchain/fbtenv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/sh

# unofficial strict mode
set -eu;

FLIPPER_TOOLCHAIN_VERSION="2";

get_kernel_type()
{
SYS_TYPE="$(uname -s)"
if [ "$SYS_TYPE" = "Darwin" ]; then
TOOLCHAIN_PATH="toolchain/x86_64-darwin";
elif [ "$SYS_TYPE" = "Linux" ]; then
TOOLCHAIN_PATH="toolchain/x86_64-linux";
elif echo "$SYS_TYPE" | grep -q "MINGW"; then
echo "In MinGW shell use \"fbt.cmd\" instead of \"fbt\"";
exit 1;
else
echo "Your system is not supported. Sorry. Please report us your configuration.";
exit 1;
fi
}

check_download_toolchain()
{
if [ ! -d "$SCRIPT_PATH/$TOOLCHAIN_PATH" ]; then
download_toolchain;
elif [ ! -f "$SCRIPT_PATH/$TOOLCHAIN_PATH/VERSION" ]; then
download_toolchain;
elif [ "$(cat "$SCRIPT_PATH/$TOOLCHAIN_PATH/VERSION")" -ne "$FLIPPER_TOOLCHAIN_VERSION" ]; then
download_toolchain;
fi
}

download_toolchain()
{
chmod 755 "$SCRIPT_PATH/scripts/toolchain/unix-toolchain-download.sh";
"$SCRIPT_PATH/scripts/toolchain/unix-toolchain-download.sh" "$FLIPPER_TOOLCHAIN_VERSION" || exit 1;
}

main()
{
if [ -z "${SCRIPT_PATH:-}" ]; then
echo "Mannual running this script is now allowed.";
exit 1;
fi
get_kernel_type; # sets TOOLCHAIN_PATH
check_download_toolchain;
PATH="$SCRIPT_PATH/$TOOLCHAIN_PATH/python/bin:$PATH";
PATH="$SCRIPT_PATH/$TOOLCHAIN_PATH/bin:$PATH";
PATH="$SCRIPT_PATH/$TOOLCHAIN_PATH/protobuf/bin:$PATH";
PATH="$SCRIPT_PATH/$TOOLCHAIN_PATH/openocd/bin:$PATH";
}
main;
Loading