mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 04:34:43 +04:00
[FL-2554] Embedded arm-none-eabi toolchain (#1351)
This commit is contained in:
54
scripts/toolchain/fbtenv.sh
Executable file
54
scripts/toolchain/fbtenv.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/bin/sh
|
||||
|
||||
# unofficial strict mode
|
||||
set -eu;
|
||||
|
||||
FLIPPER_TOOLCHAIN_VERSION="3";
|
||||
|
||||
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;
|
||||
Reference in New Issue
Block a user