Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

Commit

Permalink
Merge branch 'hedger/toochain_29' of https://github.com/flipperdevice…
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed Feb 16, 2024
2 parents 9708016 + d19f8f5 commit 0a84645
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 12 deletions.
2 changes: 1 addition & 1 deletion fbt.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo off
call "%~dp0scripts\toolchain\fbtenv.cmd" env
call "%~dp0scripts\toolchain\fbtenv.cmd" env || exit /b

set SCONS_EP=python -m SCons

Expand Down
17 changes: 12 additions & 5 deletions scripts/debug/41-udev.rules → scripts/debug/41-flipper.rules
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
#Flipper Zero serial port
# Flipper Zero serial port
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", ATTRS{manufacturer}=="Flipper Devices Inc.", TAG+="uaccess", GROUP="dialout"
#Flipper Zero DFU

# Flipper Zero DFU
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", ATTRS{manufacturer}=="STMicroelectronics", TAG+="uaccess", GROUP="dialout"
#Flipper ESP32s2 BlackMagic

# Flipper ESP32s2 BlackMagic
SUBSYSTEMS=="usb", ATTRS{idVendor}=="303a", ATTRS{idProduct}=="40??", ATTRS{manufacturer}=="Flipper Devices Inc.", TAG+="uaccess", GROUP="dialout"
#Flipper U2F

# Flipper ESP32s2 in DAP mode
SUBSYSTEMS=="usb", ATTRS{idVendor}=="303a", ATTRS{idProduct}=="40??", ATTRS{manufacturer}=="CMSIS-DAP", TAG+="uaccess", GROUP="dialout"

# Flipper U2F
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5741", ATTRS{manufacturer}=="Flipper Devices Inc.", ENV{ID_SECURITY_TOKEN}="1"
#ST-Link-V3

# ST-Link-V3
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="37??", ATTRS{manufacturer}=="STMicroelectronics", TAG+="uaccess", GROUP="dialout"
19 changes: 19 additions & 0 deletions scripts/debug/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Installing udev rules

On Linux, unprivileged users need to be in the `dialout` group to access serial ports and other USB devices.

To add your user to the `dialout` group, run the following command:

```bash
sudo usermod -a -G dialout $USER
```

To install the udev rules needed for debugging & CLI access to Flipper, run the following command:

```bash
sudo cp 41-flipper.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger
```

Note that not all possible debug interfaces are listed the `41-flipper.rules` file. If your interface is not supported out of the box, you may need to add a a rule for it. You can do so by adding a new line to the file according to udev rules syntax. Use `lsusb -v` to find the vendor and product IDs of your device.
2 changes: 1 addition & 1 deletion scripts/toolchain/fbtenv.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if not ["%FBT_NOENV%"] == [""] (
exit /b 0
)

set "FLIPPER_TOOLCHAIN_VERSION=28"
set "FLIPPER_TOOLCHAIN_VERSION=31"

if ["%FBT_TOOLCHAIN_PATH%"] == [""] (
set "FBT_TOOLCHAIN_PATH=%FBT_ROOT%"
Expand Down
6 changes: 4 additions & 2 deletions scripts/toolchain/fbtenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# public variables
DEFAULT_SCRIPT_PATH="$(pwd -P)";
FBT_TOOLCHAIN_VERSION="${FBT_TOOLCHAIN_VERSION:-"28"}";
FBT_TOOLCHAIN_VERSION="${FBT_TOOLCHAIN_VERSION:-"31"}";

if [ -z ${FBT_TOOLCHAIN_PATH+x} ] ; then
FBT_TOOLCHAIN_PATH_WAS_SET=0;
Expand Down Expand Up @@ -208,7 +208,9 @@ fbtenv_show_unpack_percentage()
fbtenv_unpack_toolchain()
{
echo "Unpacking toolchain to '$FBT_TOOLCHAIN_PATH/toolchain':";
rm $FBT_TOOLCHAIN_PATH/toolchain/current || true;
if [ -L "$FBT_TOOLCHAIN_PATH/toolchain/current" ]; then
rm "$FBT_TOOLCHAIN_PATH/toolchain/current";
fi
tar -xvf "$FBT_TOOLCHAIN_PATH/toolchain/$TOOLCHAIN_TAR" -C "$FBT_TOOLCHAIN_PATH/toolchain" 2>&1 | fbtenv_show_unpack_percentage;
mkdir -p "$FBT_TOOLCHAIN_PATH/toolchain" || return 1;
mv "$FBT_TOOLCHAIN_PATH/toolchain/$TOOLCHAIN_DIR" "$TOOLCHAIN_ARCH_DIR" || return 1;
Expand Down
14 changes: 11 additions & 3 deletions scripts/toolchain/windows-toolchain-download.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,21 @@ $toolchain_zip = "$toolchain_dist_folder-$toolchain_version.zip"
$toolchain_zip_temp_path = "$download_dir\$toolchain_zip"
$toolchain_dist_temp_path = "$download_dir\$toolchain_dist_folder"

try {

if (Test-Path -LiteralPath "$toolchain_target_path") {
Write-Host -NoNewline "Removing old Windows toolchain.."
Remove-Item -LiteralPath "$toolchain_target_path" -Force -Recurse
Write-Host "done!"
}

if (Test-path -Path "$toolchain_target_path\..\current") {
if (Test-path -LiteralPath "$toolchain_target_path\..\current") {
Write-Host -NoNewline "Unlinking 'current'.."
Remove-Item -LiteralPath "$toolchain_target_path\..\current" -Force
Write-Host "done!"
}

if (!(Test-Path -Path "$toolchain_zip_temp_path" -PathType Leaf)) {
if (!(Test-Path -LiteralPath "$toolchain_zip_temp_path" -PathType Leaf)) {
Write-Host -NoNewline "Downloading Windows toolchain.."
$wc = New-Object net.webclient
$wc.Downloadfile("$toolchain_url", "$toolchain_zip_temp_path")
Expand Down Expand Up @@ -57,4 +59,10 @@ Write-Host -NoNewline "Cleaning up temporary files.."
Remove-Item -LiteralPath "$toolchain_zip_temp_path" -Force
Write-Host "done!"

# dasdasd
} catch {
Write-Host "An error occurred"
Write-Host $_
Write-Host "Please close VSCode and any other programs that may be using the toolchain and try again."
$host.SetShouldExit(1)
Exit 1
}

0 comments on commit 0a84645

Please sign in to comment.