mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 20:49:49 +04:00
Merge branch 'fz-dev' into dev
This commit is contained in:
5
.vscode/example/launch.json
vendored
5
.vscode/example/launch.json
vendored
@@ -11,9 +11,10 @@
|
|||||||
"args": {
|
"args": {
|
||||||
"useSingleResult": true,
|
"useSingleResult": true,
|
||||||
"env": {
|
"env": {
|
||||||
"PATH": "${workspaceFolder};${env:PATH}"
|
"PATH": "${workspaceFolder};${env:PATH}",
|
||||||
|
"FBT_QUIET": 1
|
||||||
},
|
},
|
||||||
"command": "./fbt get_blackmagic",
|
"command": "fbt get_blackmagic",
|
||||||
"description": "Get Blackmagic device",
|
"description": "Get Blackmagic device",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ static void nfc_cli_detect(Cli* cli, FuriString* args) {
|
|||||||
while(!cmd_exit) {
|
while(!cmd_exit) {
|
||||||
cmd_exit |= cli_cmd_interrupt_received(cli);
|
cmd_exit |= cli_cmd_interrupt_received(cli);
|
||||||
if(furi_hal_nfc_detect(&dev_data, 400)) {
|
if(furi_hal_nfc_detect(&dev_data, 400)) {
|
||||||
printf("found: %s ", nfc_get_dev_type(dev_data.type));
|
printf("Found: %s ", nfc_get_dev_type(dev_data.type));
|
||||||
printf("UID length: %d, UID:", dev_data.uid_len);
|
printf("UID length: %d, UID:", dev_data.uid_len);
|
||||||
for(size_t i = 0; i < dev_data.uid_len; i++) {
|
for(size_t i = 0; i < dev_data.uid_len; i++) {
|
||||||
printf("%02X", dev_data.uid[i]);
|
printf("%02X", dev_data.uid[i]);
|
||||||
|
|||||||
@@ -3,17 +3,27 @@
|
|||||||
FBT is the entry point for firmware-related commands and utilities.
|
FBT is the entry point for firmware-related commands and utilities.
|
||||||
It is invoked by `./fbt` in the firmware project root directory. Internally, it is a wrapper around [scons](https://scons.org/) build system.
|
It is invoked by `./fbt` in the firmware project root directory. Internally, it is a wrapper around [scons](https://scons.org/) build system.
|
||||||
|
|
||||||
## Requirements
|
## Environment
|
||||||
|
|
||||||
Install Python packages required by assets build scripts: `pip3 install -r scripts/requirements.txt`
|
To use `fbt`, you only need `git` installed in your system.
|
||||||
|
|
||||||
## NB
|
`fbt` by default downloads and unpacks a pre-built toolchain, and then modifies environment variables for itself to use it. It does not contaminate your global system's path with the toolchain.
|
||||||
|
> However, if you wish to use tools supplied with the toolchain outside `fbt`, you can open an *fbt shell*, with properly configured environment.
|
||||||
|
> - On Windows, simply run `scripts/toochain/fbtenv.cmd`.
|
||||||
|
> - On Linux & MacOS, run `source scripts/toochain/fbtenv.sh` in a new shell.
|
||||||
|
|
||||||
- `fbt` constructs all referenced environments and their targets' dependency trees on startup. So, to keep startup time as low as possible, we're hiding the construction of certain targets behind command-line options.
|
If your system is not supported by pre-built toolchain variants or you want to use custom versions of dependencies, you can `set FBT_NOENV=1`. `fbt` will skip toolchain & environment configuration and will expect all tools to be available on your system's `PATH`. *(this option is not available on Windows)*
|
||||||
- `fbt` always performs `git submodule update --init` on start, unless you set `FBT_NO_SYNC=1` in the environment:
|
|
||||||
|
If `FBT_TOOLCHAIN_PATH` variable is set, `fbt` will use that directory to unpack toolchain into. By default, it downloads toolchain into `toolchain` subdirectory repo's root.
|
||||||
|
|
||||||
|
If you want to enable extra debug output for `fbt` and toolchain management scripts, you can `set FBT_VERBOSE=1`.
|
||||||
|
|
||||||
|
`fbt` always performs `git submodule update --init` on start, unless you set `FBT_NO_SYNC=1` in the environment:
|
||||||
- On Windows, it's `set "FBT_NO_SYNC=1"` in the shell you're running `fbt` from
|
- On Windows, it's `set "FBT_NO_SYNC=1"` in the shell you're running `fbt` from
|
||||||
- On \*nix, it's `$ FBT_NO_SYNC=1 ./fbt ...`
|
- On \*nix, it's `$ FBT_NO_SYNC=1 ./fbt ...`
|
||||||
- `fbt` builds updater & firmware in separate subdirectories in `build`, and their names depend on optimization settings (`COMPACT` & `DEBUG` options). However, for ease of integration with IDEs, the latest built variant's directory is always linked as `built/latest`. Additionally, `compile_commands.json` is generated in that folder (used for code completion support in IDE).
|
|
||||||
|
> There are more variables controlling basic `fbt` behavior. See `fbt` & `fbtenv` scripts' sources for details.
|
||||||
|
|
||||||
|
|
||||||
## Invoking FBT
|
## Invoking FBT
|
||||||
|
|
||||||
@@ -23,6 +33,12 @@ To build with FBT, call it and specify configuration options & targets to build.
|
|||||||
|
|
||||||
To run cleanup (think of `make clean`) for specified targets, add the `-c` option.
|
To run cleanup (think of `make clean`) for specified targets, add the `-c` option.
|
||||||
|
|
||||||
|
## Build directories
|
||||||
|
|
||||||
|
`fbt` builds updater & firmware in separate subdirectories in `build`, and their names depend on optimization settings (`COMPACT` & `DEBUG` options). However, for ease of integration with IDEs, the latest built variant's directory is always linked as `built/latest`. Additionally, `compile_commands.json` is generated in that folder (it is used for code completion support in IDEs).
|
||||||
|
|
||||||
|
`build/latest` symlink & compilation database are only updated upon *firmware build targets* - that is, when you're re-building the firmware itself. Running other tasks, like firmware flashing or building update bundles *for a different debug/release configuration or hardware target*, does not update `built/latest` dir to point to that configuration.
|
||||||
|
|
||||||
## VSCode integration
|
## VSCode integration
|
||||||
|
|
||||||
`fbt` includes basic development environment configuration for VS Code. Run `./fbt vscode_dist` to deploy it. That will copy the initial environment configuration to the `.vscode` folder. After that, you can use that configuration by starting VS Code and choosing the firmware root folder in the "File > Open Folder" menu.
|
`fbt` includes basic development environment configuration for VS Code. Run `./fbt vscode_dist` to deploy it. That will copy the initial environment configuration to the `.vscode` folder. After that, you can use that configuration by starting VS Code and choosing the firmware root folder in the "File > Open Folder" menu.
|
||||||
|
|||||||
11
fbt
11
fbt
@@ -6,16 +6,21 @@ set -eu;
|
|||||||
|
|
||||||
# private variables
|
# private variables
|
||||||
SCRIPT_PATH="$(cd "$(dirname "$0")" && pwd -P)";
|
SCRIPT_PATH="$(cd "$(dirname "$0")" && pwd -P)";
|
||||||
SCONS_DEFAULT_FLAGS="-Q --warn=target-not-built";
|
SCONS_DEFAULT_FLAGS="--warn=target-not-built";
|
||||||
SCONS_EP="python3 -m SCons"
|
SCONS_EP="python3 -m SCons";
|
||||||
|
|
||||||
# public variables
|
# public variables
|
||||||
FBT_NOENV="${FBT_NOENV:-""}";
|
FBT_NOENV="${FBT_NOENV:-""}";
|
||||||
FBT_NO_SYNC="${FBT_NO_SYNC:-""}";
|
FBT_NO_SYNC="${FBT_NO_SYNC:-""}";
|
||||||
FBT_TOOLCHAIN_PATH="${FBT_TOOLCHAIN_PATH:-$SCRIPT_PATH}";
|
FBT_TOOLCHAIN_PATH="${FBT_TOOLCHAIN_PATH:-$SCRIPT_PATH}";
|
||||||
|
FBT_VERBOSE="${FBT_VERBOSE:-""}";
|
||||||
|
|
||||||
if [ -z "$FBT_NOENV" ]; then
|
if [ -z "$FBT_NOENV" ]; then
|
||||||
. "$SCRIPT_PATH/scripts/toolchain/fbtenv.sh";
|
FBT_VERBOSE="$FBT_VERBOSE" . "$SCRIPT_PATH/scripts/toolchain/fbtenv.sh";
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$FBT_VERBOSE" ]; then
|
||||||
|
SCONS_DEFAULT_FLAGS="$SCONS_DEFAULT_FLAGS -Q";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$FBT_NO_SYNC" ]; then
|
if [ -z "$FBT_NO_SYNC" ]; then
|
||||||
|
|||||||
7
fbt.cmd
7
fbt.cmd
@@ -12,5 +12,10 @@ if [%FBT_NO_SYNC%] == [] (
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
set "SCONS_DEFAULT_FLAGS=-Q --warn=target-not-built"
|
set "SCONS_DEFAULT_FLAGS=--warn=target-not-built"
|
||||||
|
|
||||||
|
if not defined FBT_VERBOSE (
|
||||||
|
set "SCONS_DEFAULT_FLAGS=%SCONS_DEFAULT_FLAGS% -Q"
|
||||||
|
)
|
||||||
|
|
||||||
%SCONS_EP% %SCONS_DEFAULT_FLAGS% %*
|
%SCONS_EP% %SCONS_DEFAULT_FLAGS% %*
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ if not ["%FBT_NOENV%"] == [""] (
|
|||||||
exit /b 0
|
exit /b 0
|
||||||
)
|
)
|
||||||
|
|
||||||
set "FLIPPER_TOOLCHAIN_VERSION=20"
|
set "FLIPPER_TOOLCHAIN_VERSION=19"
|
||||||
|
|
||||||
if ["%FBT_TOOLCHAIN_ROOT%"] == [""] (
|
if ["%FBT_TOOLCHAIN_ROOT%"] == [""] (
|
||||||
set "FBT_TOOLCHAIN_ROOT=%FBT_ROOT%\toolchain\x86_64-windows"
|
set "FBT_TOOLCHAIN_ROOT=%FBT_ROOT%\toolchain\x86_64-windows"
|
||||||
@@ -36,7 +36,10 @@ if not "%REAL_TOOLCHAIN_VERSION%" == "%FLIPPER_TOOLCHAIN_VERSION%" (
|
|||||||
set /p REAL_TOOLCHAIN_VERSION=<"%FBT_TOOLCHAIN_VERSION_FILE%"
|
set /p REAL_TOOLCHAIN_VERSION=<"%FBT_TOOLCHAIN_VERSION_FILE%"
|
||||||
)
|
)
|
||||||
|
|
||||||
echo FBT: using toolchain version %REAL_TOOLCHAIN_VERSION%
|
if defined FBT_VERBOSE (
|
||||||
|
echo FBT: using toolchain version %REAL_TOOLCHAIN_VERSION%
|
||||||
|
)
|
||||||
|
|
||||||
set "HOME=%USERPROFILE%"
|
set "HOME=%USERPROFILE%"
|
||||||
set "PYTHONHOME=%FBT_TOOLCHAIN_ROOT%\python"
|
set "PYTHONHOME=%FBT_TOOLCHAIN_ROOT%\python"
|
||||||
set "PYTHONPATH="
|
set "PYTHONPATH="
|
||||||
|
|||||||
@@ -5,15 +5,16 @@
|
|||||||
# public variables
|
# public variables
|
||||||
DEFAULT_SCRIPT_PATH="$(pwd -P)";
|
DEFAULT_SCRIPT_PATH="$(pwd -P)";
|
||||||
SCRIPT_PATH="${SCRIPT_PATH:-$DEFAULT_SCRIPT_PATH}";
|
SCRIPT_PATH="${SCRIPT_PATH:-$DEFAULT_SCRIPT_PATH}";
|
||||||
FBT_TOOLCHAIN_VERSION="${FBT_TOOLCHAIN_VERSION:-"20"}";
|
FBT_TOOLCHAIN_VERSION="${FBT_TOOLCHAIN_VERSION:-"19"}";
|
||||||
FBT_TOOLCHAIN_PATH="${FBT_TOOLCHAIN_PATH:-$SCRIPT_PATH}";
|
FBT_TOOLCHAIN_PATH="${FBT_TOOLCHAIN_PATH:-$SCRIPT_PATH}";
|
||||||
|
FBT_VERBOSE="${FBT_VERBOSE:-""}";
|
||||||
|
|
||||||
fbtenv_show_usage()
|
fbtenv_show_usage()
|
||||||
{
|
{
|
||||||
echo "Running this script manually is wrong, please source it";
|
echo "Running this script manually is wrong, please source it";
|
||||||
echo "Example:";
|
echo "Example:";
|
||||||
printf "\tsource scripts/toolchain/fbtenv.sh\n";
|
printf "\tsource scripts/toolchain/fbtenv.sh\n";
|
||||||
echo "To restore your environment source fbtenv.sh with '--restore'."
|
echo "To restore your environment, source fbtenv.sh with '--restore'."
|
||||||
echo "Example:";
|
echo "Example:";
|
||||||
printf "\tsource scripts/toolchain/fbtenv.sh --restore\n";
|
printf "\tsource scripts/toolchain/fbtenv.sh --restore\n";
|
||||||
}
|
}
|
||||||
@@ -42,9 +43,9 @@ fbtenv_restore_env()
|
|||||||
PROMPT="$(echo "$PROMPT" | sed 's/\[fbt\]//g')";
|
PROMPT="$(echo "$PROMPT" | sed 's/\[fbt\]//g')";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PYTHONNOUSERSITE="$SAVED_PYTHONNOUSERSITE";
|
export PYTHONNOUSERSITE="$SAVED_PYTHONNOUSERSITE";
|
||||||
PYTHONPATH="$SAVED_PYTHONPATH";
|
export PYTHONPATH="$SAVED_PYTHONPATH";
|
||||||
PYTHONHOME="$SAVED_PYTHONHOME";
|
export PYTHONHOME="$SAVED_PYTHONHOME";
|
||||||
|
|
||||||
unset SAVED_PYTHONNOUSERSITE;
|
unset SAVED_PYTHONNOUSERSITE;
|
||||||
unset SAVED_PYTHONPATH;
|
unset SAVED_PYTHONPATH;
|
||||||
@@ -132,7 +133,7 @@ fbtenv_get_kernel_type()
|
|||||||
TOOLCHAIN_URL=$FBT_TOOLS_CUSTOM_LINK;
|
TOOLCHAIN_URL=$FBT_TOOLS_CUSTOM_LINK;
|
||||||
fi
|
fi
|
||||||
elif echo "$SYS_TYPE" | grep -q "MINGW"; then
|
elif echo "$SYS_TYPE" | grep -q "MINGW"; then
|
||||||
echo "In MinGW shell use \"[u]fbt.cmd\" instead of \"[u]fbt\"";
|
echo "In MinGW shell, use \"[u]fbt.cmd\" instead of \"[u]fbt\"";
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
echo "Your system configuration is not supported. Sorry.. Please report us your configuration.";
|
echo "Your system configuration is not supported. Sorry.. Please report us your configuration.";
|
||||||
@@ -283,7 +284,9 @@ fbtenv_download_toolchain()
|
|||||||
|
|
||||||
fbtenv_print_version()
|
fbtenv_print_version()
|
||||||
{
|
{
|
||||||
echo "FBT: using toolchain version $(cat "$TOOLCHAIN_ARCH_DIR/VERSION")";
|
if [ -n "$FBT_VERBOSE" ]; then
|
||||||
|
echo "FBT: using toolchain version $(cat "$TOOLCHAIN_ARCH_DIR/VERSION")";
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
fbtenv_main()
|
fbtenv_main()
|
||||||
@@ -299,22 +302,20 @@ fbtenv_main()
|
|||||||
fbtenv_check_download_toolchain || return 1;
|
fbtenv_check_download_toolchain || return 1;
|
||||||
fbtenv_set_shell_prompt;
|
fbtenv_set_shell_prompt;
|
||||||
fbtenv_print_version;
|
fbtenv_print_version;
|
||||||
if [ "$SYS_TYPE" = "Linux" ]; then
|
|
||||||
export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
|
|
||||||
fi
|
|
||||||
PATH="$TOOLCHAIN_ARCH_DIR/python/bin:$PATH";
|
PATH="$TOOLCHAIN_ARCH_DIR/python/bin:$PATH";
|
||||||
PATH="$TOOLCHAIN_ARCH_DIR/bin:$PATH";
|
PATH="$TOOLCHAIN_ARCH_DIR/bin:$PATH";
|
||||||
PATH="$TOOLCHAIN_ARCH_DIR/protobuf/bin:$PATH";
|
PATH="$TOOLCHAIN_ARCH_DIR/protobuf/bin:$PATH";
|
||||||
PATH="$TOOLCHAIN_ARCH_DIR/openocd/bin:$PATH";
|
PATH="$TOOLCHAIN_ARCH_DIR/openocd/bin:$PATH";
|
||||||
PATH="$TOOLCHAIN_ARCH_DIR/openssl/bin:$PATH";
|
PATH="$TOOLCHAIN_ARCH_DIR/openssl/bin:$PATH";
|
||||||
|
export PATH;
|
||||||
|
|
||||||
SAVED_PYTHONNOUSERSITE="${PYTHONNOUSERSITE:-""}";
|
export SAVED_PYTHONNOUSERSITE="${PYTHONNOUSERSITE:-""}";
|
||||||
SAVED_PYTHONPATH="${PYTHONPATH:-""}";
|
export SAVED_PYTHONPATH="${PYTHONPATH:-""}";
|
||||||
SAVED_PYTHONHOME="${PYTHONHOME:-""}";
|
export SAVED_PYTHONHOME="${PYTHONHOME:-""}";
|
||||||
|
|
||||||
PYTHONNOUSERSITE=1;
|
export PYTHONNOUSERSITE=1;
|
||||||
PYTHONPATH=;
|
export PYTHONPATH=;
|
||||||
PYTHONHOME=;
|
export PYTHONHOME=;
|
||||||
}
|
}
|
||||||
|
|
||||||
fbtenv_main "${1:-""}";
|
fbtenv_main "${1:-""}";
|
||||||
|
|||||||
Reference in New Issue
Block a user