Overview of Flipper firmware architecture:
.
├── applications # Flipper applications
│ └── furi_test # Test app for checking and demonstrating FURI func
├── core # Main feature like OS, HAL (target-independed)
├── target_f1 # Target-depended code for target F1
│ ├── Drivers # STM HAL drivers
│ │ ├── CMSIS
│ │ └── STM32L4xx_HAL_Driver
│ │ ├── Inc
│ │ │ └── Legacy
│ │ └── Src
│ ├── Inc # Autogenerated CubeMX code and target-depended includes
│ ├── Middlewares
│ │ ├── ST
│ │ │ └── STM32_USB_Device_Library
│ │ └── Third_Party
│ │ └── FreeRTOS
│ └── Src # Autogenerated CubeMX code and target-depended sources
├── target_lo # Target-depended code for local linux target
│ ├── Inc
│ └── Src
└── wiki # Documentation (wiki) generates from this files
├── applications # info about separate features of flipper
├── fw # core, environment info about firmware
└── hw # info about hardware
We use STM32 HAL/LL. Description available here: dm00105879.pdf
Some flipper-specific implementation of gpio/HAL:
app_gpio_initapp_gpio_writeapp_gpio_readdelay_uspwm_setFiles location: /app/app_hal.[ch]
We use FreeRTOS 10.0.1 for sheduling. Documentation available on freertos.org.
Files location for L476 version: /target_prod/Middlewares/Third_Party/FreeRTOS
CMSIS, Freertos and HAL files are generated by CubeMX.
You can find platform code for L476 version in target_prod folder:
Drivers/STM32L4xx_HAL_Driver – hardware abstraction layerDrivers/CMSIS — ARM specific codeInc Src — CubeMX generated headers & codeMiddlewares/Third_Party/FreeRTOS/Source — freeRTOSdeploy.sh — flash firmware to deviceSTM32L476RGTx_FLASH.ld — linker scriptstartup_stm32l476xx.s — board startup/initialization assembler codeflipperzero_l476.ioc — CubeMX project fileYou can regenerate platform code:
*.ioc filegenerate codeThere are some arduino-style defines (digitalWrite, delay, etc.). Include Arduino.h from /app/Arduino.h
You can use pintf to write any message to debug UART. UART specify in Makefile as -DDEBUG_UART=<>.
Implementation of write method located at /app/write.c
FURI is used to:
Read more at FURI page
File system is used to volaile storage some files (config, application data, etc.). There are some folders mounted to different volumes:
/usr for store static data like assets, menu items. Build system add files to usr while building. It can be useful for exchange some static data between application. For example, your app can add link to itself to Plugins menu items file, user will see your app and can call it from this menu./usr/etc-default folder contains default configs for apps. Bootloader has factory default options to reset applications config. Also when new app is bootstapping, system copy files from default config folder to /etc./etc for store configs of application. This volume not overwrite during flashing./var for store some application data (saved keys, application database, logs). This volume also not overwrite during flashing./media/* mounted if SD card is inserted.Each flipper functionality except OS/HAL/FURI doing by Flipper application. Some application are called at startup, the rest are called by the user (for example, from menu).
For exchange data between application each app expose own record in FURI. You can subscribe on/read record to get data from application and write to record to send data to application.
Unlike applications that run after startup, libraries are a collection of constants, types, or functions that the user can call from within the application.
After start, bootloader run first. It can:
/etc volumedocker-compose up -d to run the container.docker-compose exec dev make -C <target_dir> to build application.If Dockerfile is changed you should run docker-compose down and docker-compose build for rebuild the image.
You can run firmware locally (with HAL stub).
docker-compose exec dev make -C target_lo for builddocker-compose exec dev target_lo/build/target_lo for rundocker-compose exec dev make -C target_lo test for running tests