2021-08-16 23:22:30 +03:00
|
|
|
# Flipper Zero Firmware
|
2020-09-17 10:43:04 +03:00
|
|
|
|
|
|
|
[![Discord](https://img.shields.io/discord/740930220399525928.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](http://flipperzero.one/discord)
|
2020-08-18 01:10:34 +03:00
|
|
|
|
2021-08-17 13:38:47 +03:00
|
|
|
![Show me the code](https://habrastorage.org/webt/eo/m0/e4/eom0e4btudte7nrhnyic-laiog0.png)
|
2020-08-01 22:54:58 +03:00
|
|
|
|
2021-01-29 14:18:10 +03:00
|
|
|
Welcome to [Flipper Zero](https://flipperzero.one/)'s Firmware repo!
|
2021-08-16 23:22:30 +03:00
|
|
|
Our goal is to create nice and clean code with good documentation, to make it a pleasure for everyone to work with.
|
2020-08-01 22:47:07 +03:00
|
|
|
|
2022-05-23 21:19:41 +03:00
|
|
|
# Clone the Repository
|
|
|
|
|
|
|
|
You should clone with
|
|
|
|
```shell
|
|
|
|
$ git clone --recursive https://github.com/flipperdevices/flipperzero-firmware.git
|
|
|
|
```
|
|
|
|
|
2020-11-04 12:49:35 +03:00
|
|
|
# Update firmware
|
2020-08-07 09:51:41 +03:00
|
|
|
|
2021-08-17 13:38:47 +03:00
|
|
|
[Get Latest Firmware from Update Server](https://update.flipperzero.one/)
|
2020-08-07 09:51:41 +03:00
|
|
|
|
2022-04-13 23:50:25 +03:00
|
|
|
Flipper Zero's firmware consists of two components:
|
2021-01-29 14:18:10 +03:00
|
|
|
|
2021-12-05 14:47:02 +03:00
|
|
|
- Core2 firmware set - proprietary components by ST: FUS + radio stack. FUS is flashed at factory and you should never update it.
|
|
|
|
- Core1 Firmware - HAL + OS + Drivers + Applications.
|
2021-01-29 14:18:10 +03:00
|
|
|
|
2022-04-15 20:26:23 +03:00
|
|
|
They both must be flashed in order described.
|
2021-01-29 14:18:10 +03:00
|
|
|
|
2022-06-26 15:00:03 +03:00
|
|
|
## With offline update package
|
|
|
|
|
2022-06-30 19:06:12 +03:00
|
|
|
With Flipper attached over USB:
|
|
|
|
|
|
|
|
`./fbt --with-updater flash_usb`
|
|
|
|
|
|
|
|
Just building the package:
|
|
|
|
|
2022-06-26 15:00:03 +03:00
|
|
|
`./fbt --with-updater updater_package`
|
|
|
|
|
2022-06-30 19:06:12 +03:00
|
|
|
To update, copy the resulting directory to Flipper's SD card and navigate to `update.fuf` file in Archive app.
|
2022-06-26 15:00:03 +03:00
|
|
|
|
2021-01-29 14:18:10 +03:00
|
|
|
## With STLink
|
|
|
|
|
2022-04-13 23:50:25 +03:00
|
|
|
### Core1 Firmware
|
2021-01-29 14:18:10 +03:00
|
|
|
|
|
|
|
Prerequisites:
|
|
|
|
|
2021-08-16 23:22:30 +03:00
|
|
|
- Linux / macOS
|
2021-01-29 14:18:10 +03:00
|
|
|
- Terminal
|
2021-12-05 14:47:02 +03:00
|
|
|
- [arm-gcc-none-eabi](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads)
|
|
|
|
- openocd
|
2021-01-29 14:18:10 +03:00
|
|
|
|
2022-06-26 15:00:03 +03:00
|
|
|
One liner: `./fbt firmware_flash`
|
2021-01-29 14:18:10 +03:00
|
|
|
|
|
|
|
## With USB DFU
|
2020-10-23 11:42:53 +03:00
|
|
|
|
2021-07-24 16:53:02 +03:00
|
|
|
1. Download latest [Firmware](https://update.flipperzero.one)
|
2020-10-23 11:42:53 +03:00
|
|
|
|
2021-12-05 14:47:02 +03:00
|
|
|
2. Reboot Flipper to Bootloader
|
2020-11-04 12:49:35 +03:00
|
|
|
- Press and hold `← Left` + `↩ Back` for reset
|
2021-10-21 15:52:06 +03:00
|
|
|
- Release `↩ Back` and keep holding `← Left` until blue LED lights up
|
|
|
|
- Release `← Left`
|
2020-10-23 11:42:53 +03:00
|
|
|
|
2021-10-21 15:52:06 +03:00
|
|
|
3. Run `dfu-util -D full.dfu -a 0`
|
2020-10-23 11:42:53 +03:00
|
|
|
|
2021-11-18 11:46:47 +03:00
|
|
|
# Build with Docker
|
2020-08-18 20:18:09 +03:00
|
|
|
|
2021-08-16 23:22:30 +03:00
|
|
|
## Prerequisites
|
|
|
|
|
|
|
|
1. Install [Docker Engine and Docker Compose](https://www.docker.com/get-started)
|
2021-11-18 11:46:47 +03:00
|
|
|
2. Prepare the container:
|
2021-12-05 14:47:02 +03:00
|
|
|
|
|
|
|
```sh
|
|
|
|
docker-compose up -d
|
|
|
|
```
|
2021-08-16 23:22:30 +03:00
|
|
|
|
2021-10-21 15:24:34 +03:00
|
|
|
## Compile everything
|
|
|
|
|
|
|
|
```sh
|
2022-06-26 15:00:03 +03:00
|
|
|
docker-compose exec dev ./fbt
|
2021-10-21 15:24:34 +03:00
|
|
|
```
|
|
|
|
|
2021-11-18 11:46:47 +03:00
|
|
|
Check `dist/` for build outputs.
|
|
|
|
|
|
|
|
Use **`flipper-z-{target}-full-{suffix}.dfu`** to flash your device.
|
|
|
|
|
2022-05-23 21:19:41 +03:00
|
|
|
If compilation fails, make sure all submodules are all initialized. Either clone with `--recursive` or use `git submodule update --init --recursive`.
|
|
|
|
|
2021-11-18 11:46:47 +03:00
|
|
|
# Build on Linux/macOS
|
|
|
|
|
2022-06-26 15:00:03 +03:00
|
|
|
Check out `documentation/fbt.md` for details on building and flashing firmware.
|
|
|
|
|
2021-11-18 11:46:47 +03:00
|
|
|
## macOS Prerequisites
|
2021-10-21 15:24:34 +03:00
|
|
|
|
2021-11-18 11:46:47 +03:00
|
|
|
Make sure you have [brew](https://brew.sh) and install all the dependencies:
|
2021-10-21 15:24:34 +03:00
|
|
|
```sh
|
2021-11-18 11:46:47 +03:00
|
|
|
brew bundle --verbose
|
2021-10-21 15:24:34 +03:00
|
|
|
```
|
|
|
|
|
2021-11-18 11:46:47 +03:00
|
|
|
## Linux Prerequisites
|
|
|
|
|
|
|
|
### gcc-arm-none-eabi
|
2021-08-16 23:22:30 +03:00
|
|
|
|
|
|
|
```sh
|
2021-11-18 11:46:47 +03:00
|
|
|
toolchain="gcc-arm-none-eabi-10.3-2021.10"
|
|
|
|
toolchain_package="$toolchain-$(uname -m)-linux"
|
|
|
|
|
|
|
|
wget -P /opt "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/$toolchain_package.tar.bz2"
|
|
|
|
|
|
|
|
tar xjf /opt/$toolchain_package.tar.bz2 -C /opt
|
|
|
|
rm /opt/$toolchain_package.tar.bz2
|
|
|
|
|
|
|
|
for file in /opt/$toolchain/bin/* ; do ln -s "${file}" "/usr/bin/$(basename ${file})" ; done
|
2021-08-16 23:22:30 +03:00
|
|
|
```
|
|
|
|
|
2021-11-18 11:46:47 +03:00
|
|
|
### Optional dependencies
|
2021-08-16 23:22:30 +03:00
|
|
|
|
2021-11-18 11:46:47 +03:00
|
|
|
- openocd (debugging/flashing over SWD)
|
|
|
|
- heatshrink (compiling image assets)
|
|
|
|
- clang-format (code formatting)
|
|
|
|
- dfu-util (flashing over USB DFU)
|
|
|
|
- protobuf (compiling proto sources)
|
2021-08-16 23:22:30 +03:00
|
|
|
|
2021-11-18 11:46:47 +03:00
|
|
|
For example, to install them on Debian, use:
|
2021-08-16 23:22:30 +03:00
|
|
|
```sh
|
2021-11-18 11:46:47 +03:00
|
|
|
apt update
|
|
|
|
apt install openocd clang-format-13 dfu-util protobuf-compiler
|
2021-08-16 23:22:30 +03:00
|
|
|
```
|
|
|
|
|
2021-11-18 11:46:47 +03:00
|
|
|
heatshrink has to be compiled [from sources](https://github.com/atomicobject/heatshrink).
|
2021-08-16 23:22:30 +03:00
|
|
|
|
2021-11-18 11:46:47 +03:00
|
|
|
## Compile everything
|
2021-08-16 23:22:30 +03:00
|
|
|
|
2021-11-18 11:46:47 +03:00
|
|
|
```sh
|
2022-06-26 15:00:03 +03:00
|
|
|
./fbt
|
2021-11-18 11:46:47 +03:00
|
|
|
```
|
2021-08-16 23:22:30 +03:00
|
|
|
|
2021-11-18 11:46:47 +03:00
|
|
|
Check `dist/` for build outputs.
|
2021-08-16 23:22:30 +03:00
|
|
|
|
2021-11-18 11:46:47 +03:00
|
|
|
Use **`flipper-z-{target}-full-{suffix}.dfu`** to flash your device.
|
|
|
|
|
|
|
|
## Flash everything
|
2021-08-16 23:22:30 +03:00
|
|
|
|
2021-11-18 11:46:47 +03:00
|
|
|
Connect your device via ST-Link and run:
|
|
|
|
```sh
|
2022-06-26 15:00:03 +03:00
|
|
|
./fbt firmware_flash
|
2021-11-18 11:46:47 +03:00
|
|
|
```
|
2020-08-18 20:18:09 +03:00
|
|
|
|
2020-08-15 09:59:22 +03:00
|
|
|
# Links
|
2022-01-05 19:10:18 +03:00
|
|
|
|
2021-08-16 23:22:30 +03:00
|
|
|
* Discord: [flipp.dev/discord](https://flipp.dev/discord)
|
|
|
|
* Website: [flipperzero.one](https://flipperzero.one)
|
2020-08-15 09:59:22 +03:00
|
|
|
* Kickstarter page: [kickstarter.com](https://www.kickstarter.com/projects/flipper-devices/flipper-zero-tamagochi-for-hackers)
|
2020-08-17 12:02:31 +03:00
|
|
|
* Forum: [forum.flipperzero.one](https://forum.flipperzero.one/)
|
2021-08-08 21:03:25 +03:00
|
|
|
|
2022-01-10 22:46:20 +03:00
|
|
|
# Project structure
|
|
|
|
|
|
|
|
- `applications` - Applications and services used in firmware
|
|
|
|
- `assets` - Assets used by applications and services
|
|
|
|
- `core` - Furi Core: os level primitives and helpers
|
|
|
|
- `debug` - Debug tool: GDB-plugins, SVD-file and etc
|
|
|
|
- `docker` - Docker image sources (used for firmware build automation)
|
|
|
|
- `documentation` - Documentation generation system configs and input files
|
|
|
|
- `firmware` - Firmware source code
|
|
|
|
- `lib` - Our and 3rd party libraries, drivers and etc...
|
|
|
|
- `scripts` - Supplementary scripts and python libraries home
|
|
|
|
|
|
|
|
Also pay attention to `ReadMe.md` files inside of those directories.
|