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

This commit is contained in:
hedger
2022-06-26 15:00:03 +03:00
committed by GitHub
parent c79fb61909
commit f3b1475ede
179 changed files with 3986 additions and 5196 deletions

View File

@@ -0,0 +1,3 @@
# Flipper Application Manifests (.fam)
TBD

View File

@@ -110,15 +110,15 @@ Even if something goes wrong, Updater gives you an option to retry failed operat
## Full package
To build a basic update package, run `make COMPACT=1 DEBUG=0 updater_package`
To build a basic update package, run `./fbt --with-updater COMPACT=1 DEBUG=0 updater_package`
## Customizing update bundles
Default update packages are built with Bluetooth Light stack.
You can pick a different stack, if your firmware version supports it, and build a bundle with it passing stack type and binary name to `make`:
You can pick a different stack, if your firmware version supports it, and build a bundle with it passing stack type and binary name to `fbt`:
`make updater_package COMPACT=1 DEBUG=0 COPRO_OB_DATA=ob_custradio.data COPRO_STACK_BIN=stm32wb5x_BLE_Stack_full_fw.bin COPRO_STACK_TYPE=ble_full`
`./fbt --with-updater updater_package COMPACT=1 DEBUG=0 COPRO_OB_DATA=scripts/ob_custradio.data COPRO_STACK_BIN=stm32wb5x_BLE_Stack_full_fw.bin COPRO_STACK_TYPE=ble_full`
Note that `COPRO_OB_DATA` must point to a valid file in `scripts` folder containing reference Option Byte data matching to your radio stack type.

77
documentation/fbt.md Normal file
View File

@@ -0,0 +1,77 @@
# Flipper Build Tool
FBT is the entry point for most firmware-related commands and utilities.
It is invoked by `./fbt` in firmware project root directory. Internally, it is a wrapper around [scons](https://scons.org/) build system.
## Requirements
Please install Python packages required by assets build scripts: `pip3 install -r scripts/requirements.txt`
## NB
FBT constructs all referenced environments & their targets' dependency trees on startup. So, to keep startup time as low as possible, we're hiding construction of certain targets behind command-line options.
## Invoking FBT
To build with FBT, call it specifying configuration options & targets to build. For example,
`./fbt --with-updater COMPACT=1 DEBUG=0 VERBOSE=1 updater_package copro_dist`
To run cleanup (think of `make clean`) for specified targets, all `-c` option.
## FBT targets
FBT keeps track of internal dependencies, so you only need to build the highest-level target you need, and FBT will make sure everything it needs is up-to-date.
### High-level (what you most likely need)
- `fw_dist` - build & publish firmware to `dist` folder
- `updater_package` - build self-update package. _Requires `--with-updater` option_
- `copro_dist` - bundle Core2 FUS+stack binaries for qFlipper
- `debug` - build and flash firmware, then attach with gdb with firmware's .elf loaded
- `debug_updater` - attach gdb with updater's .elf loaded. _Requires `--with-updater` option_
- `debug_other` - attach gdb without loading built elf. Allows to manually add external elf files with `add-symbol-file` in gdb.
- `openocd` - just start OpenOCD
### Firmware targets
- `firmware_extapps` - build all plug-ins as separate .elf files
- `firmware_snake_game`, etc - build single plug-in as .elf by its name
- Check out `--extra-ext-apps` for force adding extra apps to external build
- `firmware_snake_game_list`, etc - generate source + assembler listing for app's .elf
- `firmware_flash` - flash current version to attached device with OpenOCD
- `firmware_cdb` - generate compilation database
- `firmware_all`, `updater_all` - build basic set of binaries
- `firmware_list`, `updater_list` - generate source + assembler listing
### Assets
- `resources` - build resources and their Manifest
- `dolphin_ext` - process dolphin animations for SD card
- `icons` - generate .c+.h for icons from png assets
- `proto` - generate .pb.c+.pb.h for .proto sources
- `proto_ver` - generate .h with protobuf version
- `dolphin_internal`, `dolphin_blocking` - generate .c+.h for corresponding dolphin assets
## Command-line parameters
- `--options optionfile.py` (default value `fbt_options.py`) - load file with multiple configuration values
- `--with-updater` - enables updater-related targets and dependency tracking. Enabling this options introduces extra startup time costs, so use it when bundling update packages. Or if you have a fast computer and don't care about a few extra seconds of startup time
- `--extra-int-apps=app1,app2,appN` - forces listed apps to be built as internal with `firmware` target
- `--extra-ext-apps=app1,app2,appN` - forces listed apps to be built as external with `firmware_extapps` target
## Configuration
Default configuration variables are set in configuration file `fbt_options.py`.
Values set on command-line have higher precedence over configuration file.
You can find out available options with `./fbt -h`.
### Firmware application set
You can create customized firmware builds by modifying application list to be included in the build. Application presets are configured with `FIRMWARE_APPS` option, which is a map(configuration_name:str -> application_list:tuple(str)). To specify application set to use in a build, set `FIRMWARE_APP_SET` to its name.
For example, to build firmware image with unit tests, run `./fbt FIRMWARE_APP_SET=unit_tests`.
Check out `fbt_options.py` for details.