Implement bootloader #137 (#142)

* Boot: switch to DFU routines. Implements #132 part 1 of 2.

* Boot: boot to DFU shortcut, hard reset USB on each boot. Implements #132 part 2 of 2.

* Deploy scripts: fix path for deploy dfu.

* Bootloader: initial version. Target_f2: rebase, update deployment scripts.

* Bootloader: cleanup, refactor switch2 proc. Readme,wiki: document bootloader.

* Wiki: deploy symlinks as files, bootloader info.

* Target_f2: valid flash size in linker script.

* Github CI: bootloader build and artifacts.

* Bootloader: rename platforms to targets.

* Bootloader: change dfu/os colors.

* disable set -e

* lint code

* add bootloader testing page

Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
Co-authored-by: aanper <mail@s3f.ru>
This commit is contained in:
あく
2020-10-01 02:05:04 +03:00
committed by GitHub
parent 110a9efc3c
commit 805bb886c0
22 changed files with 691 additions and 16 deletions

37
wiki/Testing.md Normal file
View File

@@ -0,0 +1,37 @@
# Bootloader test
1. # Clean flash
2. `make -C bootloader flash` # Load bootloader
3. # reboot device
1. Press right
2. Press left
3. Wait 0.1 s
4. Release left
5. Release right
4. Wait 0.5 s
5. # Expect no FW
1. Expect: no uart welcome message
2. Expect: red led on
3. Expect: no USB
6. # reboot device and go to DFU
1. Press left
2. Press right
3. Wait 0.1 s
4. Release left
5. Wait 0.5 s
6. Release right
7. Wait 0.5 s
8. # Expect DFU
1. Expect: blue led on
2. Expect: USB: DFU
9. `target_f2/deploy-dfu.sh` # load FW
10. # reboot device
1. Press right
2. Press left
3. Wait 0.1 s
4. Release left
5. Release right
11. Wait 0.5 s
12. # Expect FW
1. Expect: uart welcome message
2. Expect: USB Flipper CDC

1
wiki/fw/Bootloader.md Symbolic link
View File

@@ -0,0 +1 @@
bootloader/ReadMe.md

View File

@@ -6,30 +6,31 @@ _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
├── applications # Flipper applications
│   └── furi_test # Test app for checking and demonstrating FURI func
├── bootloader # Firmware bootloader, used for `target_f2` and newer
├── 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
│   ├── 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
│   └── 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
└── wiki # Documentation (wiki) generates from this files
├── applications # info about separate features of flipper
├── fw # core, environment info about firmware
└── hw # info about hardware
├── fw # core, environment info about firmware
└── hw # info about hardware
```
# HAL
@@ -48,6 +49,21 @@ Some flipper-specific implementation of gpio/HAL:
Files location: `/app/app_hal.[ch]`
# Bootloader
For production targets('target_f2' and newer) bootloader must be flashed first.
Detailed instruction on how to compile and flash you can find in `bootloader` fodler.
Production version will have following features:
- Hardware initialization
- Firmware CRC check
- Firmware update
- Interactive UI
- Boot process LED indicators
- FS check
- Recovery mode
# OS
We use FreeRTOS 10.0.1 for sheduling. Documentation available on [freertos.org](https://www.freertos.org/a00106.html).