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

[FL-2052] New build system based on scons #1269

Merged
merged 216 commits into from
Jun 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
216 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
2f069b3
Merge remote-tracking branch 'remotes/origin/dev' into hedger/sconsbuild
hedger Jun 20, 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
aaca300
Merge branch 'dev' into hedger/sconsbuild
skotopes Jun 22, 2022
275b785
Build: purged makefiles; updated readmes; forwarding global env to di…
hedger Jun 22, 2022
1f83670
Build: linter targets; dropped applications.c
hedger Jun 22, 2022
13c2778
Build: lint: removed freertos-glue
hedger Jun 22, 2022
cbd1014
Linter fixes
hedger Jun 22, 2022
7267cc8
Scripts: lint.py: printing bad file names; build: removed callback-co…
hedger Jun 22, 2022
2cc3d28
Scripts: removed legacy; docs: updated commands
hedger Jun 22, 2022
f4fcac8
Removed heatshrink + img from Brewfile; added stub AppManifests.md
hedger Jun 22, 2022
79d689c
Build: added mixed assembler+source listing generation
hedger Jun 23, 2022
3a1b22f
Build: added Makefile stub with warning
hedger Jun 24, 2022
77c399a
A little bit nicer makefile
skotopes Jun 24, 2022
11a15d5
Makefile: on more line
skotopes Jun 24, 2022
bce5a52
Build: added short "flash" alias for main firmware
hedger Jun 24, 2022
84c79ab
Build: force non-zero return code
hedger Jun 24, 2022
a3370ac
Capitalized letter
hedger Jun 24, 2022
e77b244
Removed explicit error
hedger Jun 24, 2022
36ffa4f
Version: drop legacy build system support
skotopes Jun 25, 2022
bb9c165
SCons: add ccache support, speedup rebuild
skotopes Jun 25, 2022
b5dfb0c
Format Sources
skotopes Jun 25, 2022
5ae8060
SCons: cleanup documentation, remove unneeded options for debug_other
skotopes Jun 25, 2022
98b0bb7
SCons: extra-int-apps option for including optional apps
skotopes Jun 25, 2022
d7e394f
SCons: update documentation for extra-int-apps
skotopes Jun 25, 2022
2addaee
Build: moved application sets to option file; added unittests build c…
hedger Jun 25, 2022
ba209f3
fbt: fixed extra apps internal variable naming
hedger Jun 25, 2022
173c461
fbt: fixed ccache on Windows
hedger Jun 25, 2022
13e040c
Unit tests: fix line end on fail
DrZlo13 Jun 25, 2022
129e03e
fbt: renamed unittests build configuration to unit_tests
hedger Jun 25, 2022
5674fb8
fbt: add single precision constants by default, add single to double …
DrZlo13 Jun 25, 2022
e4b4189
fbt: fix float printf
DrZlo13 Jun 25, 2022
bcc2065
Merge branch 'hedger/sconsbuild' of https://github.com/flipperdevices…
DrZlo13 Jun 25, 2022
87ecc73
fbt: switch from jlink to stlink
DrZlo13 Jun 25, 2022
78220c1
RPC tests: form expected data for storage_list command in the same wa…
DrZlo13 Jun 26, 2022
b3548ed
fbt: Removed assets/compiled
hedger Jun 26, 2022
6279f98
About: update certification icons. SCons,Protobuf: update used librar…
skotopes Jun 26, 2022
48e5cda
fbt: fixed assets path
hedger Jun 26, 2022
91439f3
fbt: fixed paths for libs
hedger Jun 26, 2022
e6ca636
About: optimize assets. Fbt: remove excessive env invocation and add …
skotopes Jun 26, 2022
f5d6966
Fbt: remove venv creation
skotopes Jun 26, 2022
ebf8b92
Fbt: less git invocation
skotopes Jun 26, 2022
695408f
fbt: force submodule update on run
hedger Jun 26, 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
24 changes: 4 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,14 @@ jobs:
run: |
tar czpf artifacts/flipper-z-any-scripts-${{steps.names.outputs.suffix}}.tgz scripts

- name: 'Rebuild Assets'
uses: ./.github/actions/docker
with:
run: |
set -e
make assets_rebuild assets_manifest
git diff --quiet || ( echo "Assets recompilation required."; exit 255 )

- name: 'Build the firmware in docker'
uses: ./.github/actions/docker
with:
run: |
set -e
for TARGET in ${TARGETS}
do
make updater_package TARGET=${TARGET} ${{ startsWith(github.ref, 'refs/tags') && 'DEBUG=0 COMPACT=1' || '' }}
./fbt TARGET_HW=`echo ${TARGET} | sed 's/f//'` --with-updater updater_package ${{ startsWith(github.ref, 'refs/tags') && 'DEBUG=0 COMPACT=1' || '' }}
done

- name: 'Move upload files'
Expand All @@ -97,7 +89,7 @@ jobs:
set -e
for TARGET in ${TARGETS}
do
mv dist/${TARGET}/* artifacts/
mv dist/${TARGET}-*/* artifacts/
done

- name: 'Bundle self-update package'
Expand All @@ -124,7 +116,7 @@ jobs:
uses: ./.github/actions/docker
with:
run: |
make -C assets copro_bundle
./fbt copro_dist
tar czpf artifacts/flipper-z-any-core2_firmware-${{steps.names.outputs.suffix}}.tgz -C assets core2_firmware

- name: 'Upload artifacts to update server'
Expand Down Expand Up @@ -208,20 +200,12 @@ jobs:
echo "WORKFLOW_BRANCH_OR_TAG=${BRANCH_OR_TAG}" >> $GITHUB_ENV
echo "DIST_SUFFIX=${SUFFIX}" >> $GITHUB_ENV

- name: 'Rebuild Assets'
uses: ./.github/actions/docker
with:
run: |
set -e
make assets_rebuild assets_manifest
git diff --quiet || ( echo "Assets recompilation required."; exit 255 )

- name: 'Build the firmware in docker'
uses: ./.github/actions/docker
with:
run: |
set -e
for TARGET in ${TARGETS}
do
make TARGET=${TARGET} DEBUG=0 COMPACT=1
./fbt TARGET_HW=`echo ${TARGET} | sed 's/f//'` --with-updater updater_package DEBUG=0 COMPACT=1
done
2 changes: 1 addition & 1 deletion .github/workflows/lint_c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
id: syntax_check
uses: ./.github/actions/docker
with:
run: SET_GH_OUTPUT=1 make lint
run: SET_GH_OUTPUT=1 ./fbt lint

- name: Report code formatting errors
if: failure() && steps.syntax_check.outputs.errors && github.event.pull_request
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,11 @@ dist

# kde
.directory

# SCons
.sconsign.dblite
# SCons build dir
build/

# Toolchain
toolchain*/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@
[submodule "lib/microtar"]
path = lib/microtar
url = https://github.com/amachronic/microtar.git
[submodule "lib/scons"]
path = lib/scons
url = https://github.com/SCons/scons.git
2 changes: 0 additions & 2 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
cask "gcc-arm-embedded"
brew "protobuf"
brew "gdb"
brew "heatshrink"
brew "open-ocd"
brew "clang-format"
brew "dfu-util"
brew "imagemagick"
2 changes: 1 addition & 1 deletion CODING_STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Almost everything in flipper firmware is built around this concept.
# C coding style

- Tab is 4 spaces
- Use `make format` to reformat source code and check style guide before commit
- Use `fbt format` to reformat source code and check style guide before commit

## Naming

Expand Down
178 changes: 21 additions & 157 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,157 +1,21 @@
PROJECT_ROOT := $(abspath $(dir $(abspath $(firstword $(MAKEFILE_LIST)))))

include $(PROJECT_ROOT)/make/git.mk
include $(PROJECT_ROOT)/assets/copro.mk
include $(PROJECT_ROOT)/assets/splash.mk

PROJECT_SOURCE_DIRECTORIES := \
$(PROJECT_ROOT)/applications \
$(PROJECT_ROOT)/core \
$(PROJECT_ROOT)/firmware/targets \
$(PROJECT_ROOT)/lib/app-template \
$(PROJECT_ROOT)/lib/app-scened-template \
$(PROJECT_ROOT)/lib/common-api \
$(PROJECT_ROOT)/lib/drivers \
$(PROJECT_ROOT)/lib/flipper_file \
$(PROJECT_ROOT)/lib/infrared \
$(PROJECT_ROOT)/lib/nfc_protocols \
$(PROJECT_ROOT)/lib/ST25RFAL002 \
$(PROJECT_ROOT)/lib/onewire \
$(PROJECT_ROOT)/lib/qrcode \
$(PROJECT_ROOT)/lib/subghz \
$(PROJECT_ROOT)/lib/toolbox \
$(PROJECT_ROOT)/lib/u8g2

NPROCS := 3
OS := $(shell uname -s)

ifeq ($(OS), Linux)
NPROCS := $(shell grep -c ^processor /proc/cpuinfo)
else ifeq ($(OS), Darwin)
NPROCS := $(shell sysctl -n hw.ncpu)
endif

include $(PROJECT_ROOT)/make/defaults.mk

.PHONY: all
all: firmware_all
@$(PROJECT_ROOT)/scripts/dist.py copy -t $(TARGET) -p firmware -s $(DIST_SUFFIX)

.PHONY: whole
whole: flash_radio firmware_flash

.PHONY: clean
clean: firmware_clean updater_clean
@rm -rf $(PROJECT_ROOT)/dist/$(TARGET)

.PHONY: flash
flash: firmware_flash

.PHONY: debug
debug:
@$(MAKE) -C firmware -j$(NPROCS) debug

.PHONY: debug_other
debug_other:
@$(MAKE) -C firmware -j$(NPROCS) debug_other

.PHONY: blackmagic
blackmagic:
@$(MAKE) -C firmware -j$(NPROCS) blackmagic

.PHONY: wipe
wipe:
@$(PROJECT_ROOT)/scripts/flash.py wipe
@$(PROJECT_ROOT)/scripts/ob.py set

.PHONY: firmware_all
firmware_all:
@$(MAKE) -C $(PROJECT_ROOT)/firmware -j$(NPROCS) all

.PHONY: firmware_clean
firmware_clean:
@$(MAKE) -C $(PROJECT_ROOT)/firmware -j$(NPROCS) clean

.PHONY: firmware_flash
firmware_flash:
ifeq ($(FORCE), 1)
@rm $(PROJECT_ROOT)/firmware/.obj/f*-firmware/flash || true
endif
@$(MAKE) -C $(PROJECT_ROOT)/firmware -j$(NPROCS) flash

.PHONY: updater
updater:
@$(MAKE) -C $(PROJECT_ROOT)/firmware -j$(NPROCS) RAM_EXEC=1 all

.PHONY: updater_clean
updater_clean:
@$(MAKE) -C $(PROJECT_ROOT)/firmware -j$(NPROCS) RAM_EXEC=1 clean

.PHONY: updater_debug
updater_debug:
@$(MAKE) -C $(PROJECT_ROOT)/firmware -j$(NPROCS) RAM_EXEC=1 debug

.PHONY: updater_package_bin
updater_package_bin: firmware_all updater
@$(PROJECT_ROOT)/scripts/dist.py copy -t $(TARGET) -p firmware updater -s $(DIST_SUFFIX) --bundlever "$(VERSION_STRING)"

.PHONY: updater_package
updater_package: firmware_all updater assets_manifest
@$(PROJECT_ROOT)/scripts/dist.py copy \
-t $(TARGET) -p firmware updater \
-s $(DIST_SUFFIX) -r $(PROJECT_ROOT)/assets/resources \
--bundlever "$(VERSION_STRING)" \
--radio $(COPRO_STACK_BIN_PATH) \
--radiotype $(COPRO_STACK_TYPE) \
$(COPRO_DISCLAIMER) \
--obdata $(PROJECT_ROOT)/scripts/$(COPRO_OB_DATA) \
--splash $(UPDATER_SPLASH_DIR)

.PHONY: assets_manifest
assets_manifest:
@$(MAKE) -C $(PROJECT_ROOT)/assets manifest

.PHONY: assets_rebuild
assets_rebuild:
@$(MAKE) -C $(PROJECT_ROOT)/assets clean all

.PHONY: flash_radio
flash_radio:
@$(PROJECT_ROOT)/scripts/flash.py core2radio $(COPRO_STACK_BIN_PATH) --addr=$(COPRO_STACK_ADDR)
@$(PROJECT_ROOT)/scripts/ob.py set

.PHONY: flash_radio_fus
flash_radio_fus:
@echo
@echo "================ DON'T DO IT ================"
@echo "= Flashing FUS is going to erase secure enclave ="
@echo "= You will lose ability to use encrypted assets ="
@echo "= type 'find / -exec rm -rf {} \;' ="
@echo "= In case if you still want to continue ="
@echo "================ JUST DON'T ================"
@echo

.PHONY: flash_radio_fus_please_i_m_not_going_to_complain
flash_radio_fus_please_i_m_not_going_to_complain:
@$(PROJECT_ROOT)/scripts/flash.py core2fus 0x080EC000 --statement=AGREE_TO_LOSE_FLIPPER_FEATURES_THAT_USE_CRYPTO_ENCLAVE $(COPRO_FIRMWARE_DIR)/stm32wb5x_FUS_fw_for_fus_0_5_3.bin
@$(PROJECT_ROOT)/scripts/flash.py core2fus 0x080EC000 --statement=AGREE_TO_LOSE_FLIPPER_FEATURES_THAT_USE_CRYPTO_ENCLAVE $(COPRO_FIRMWARE_DIR)/stm32wb5x_FUS_fw.bin
@$(PROJECT_ROOT)/scripts/ob.py set

.PHONY: lint
lint:
@echo "Checking source code formatting"
@$(PROJECT_ROOT)/scripts/lint.py check $(PROJECT_SOURCE_DIRECTORIES)

.PHONY: format
format:
@echo "Reformating sources code"
@$(PROJECT_ROOT)/scripts/lint.py format $(PROJECT_SOURCE_DIRECTORIES)

.PHONY: guruguru
guruguru:
@echo "ぐるぐる回る"
@$(PROJECT_ROOT)/scripts/guruguru.py $(PROJECT_ROOT)

.PHONY: generate_compile_db
generate_compile_db:
@$(MAKE) -C $(PROJECT_ROOT)/firmware -j$(NPROCS) generate_compile_db
$(info +-------------------------------------------------+)
$(info | |)
$(info | Hello, this is Flipper team speaking! |)
$(info | |)
$(info | We've migrated to new build system |)
$(info | It's nice and based on scons |)
$(info | |)
$(info | Crash course: |)
$(info | |)
$(info | `./fbt` |)
$(info | `./fbt flash` |)
$(info | `./fbt debug` |)
$(info | |)
$(info | More details in documentation/fbt.md |)
$(info | |)
$(info | Also Please leave your feedback here: |)
$(info | https://flipp.dev/4RDu |)
$(info | or |)
$(info | https://flipp.dev/2XM8 |)
$(info | |)
$(info +-------------------------------------------------+)
28 changes: 12 additions & 16 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ Flipper Zero's firmware consists of two components:

They both must be flashed in order described.

## With offline update package

`./fbt --with-updater updater_package`

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

## With STLink

### Core1 Firmware
Expand All @@ -36,17 +42,7 @@ Prerequisites:
- [arm-gcc-none-eabi](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads)
- openocd

One liner: `make flash`

### Core2 flashing procedures

Prerequisites:

- Linux / macOS
- Terminal
- STM32_Programmer_CLI (v2.5.0) added to $PATH

One liner: `make flash_radio`
One liner: `./fbt firmware_flash`

## With USB DFU

Expand All @@ -56,7 +52,6 @@ One liner: `make flash_radio`
- Press and hold `← Left` + `↩ Back` for reset
- Release `↩ Back` and keep holding `← Left` until blue LED lights up
- Release `← Left`
<!-- ![Switch to DFU sequence](https://habrastorage.org/webt/uu/c3/g2/uuc3g2n36f2sju19rskcvjzjf6w.png) -->

3. Run `dfu-util -D full.dfu -a 0`

Expand All @@ -74,7 +69,7 @@ One liner: `make flash_radio`
## Compile everything

```sh
docker-compose exec dev make
docker-compose exec dev ./fbt
```

Check `dist/` for build outputs.
Expand All @@ -85,6 +80,8 @@ If compilation fails, make sure all submodules are all initialized. Either clone

# Build on Linux/macOS

Check out `documentation/fbt.md` for details on building and flashing firmware.

## macOS Prerequisites

Make sure you have [brew](https://brew.sh) and install all the dependencies:
Expand Down Expand Up @@ -127,7 +124,7 @@ heatshrink has to be compiled [from sources](https://github.com/atomicobject/hea
## Compile everything

```sh
make
./fbt
```

Check `dist/` for build outputs.
Expand All @@ -138,7 +135,7 @@ Use **`flipper-z-{target}-full-{suffix}.dfu`** to flash your device.

Connect your device via ST-Link and run:
```sh
make whole
./fbt firmware_flash
```

# Links
Expand All @@ -158,7 +155,6 @@ make whole
- `documentation` - Documentation generation system configs and input files
- `firmware` - Firmware source code
- `lib` - Our and 3rd party libraries, drivers and etc...
- `make` - Make helpers
- `scripts` - Supplementary scripts and python libraries home

Also pay attention to `ReadMe.md` files inside of those directories.
Loading