Skip to content

Commit

Permalink
Merge branch 'dev' into release-candidate
Browse files Browse the repository at this point in the history
  • Loading branch information
skotopes committed Oct 25, 2021
2 parents 55692ee + 88cee46 commit 7b730dd
Show file tree
Hide file tree
Showing 302 changed files with 47,946 additions and 49,990 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* text=auto

10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ jobs:
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
REF=${{ github.head_ref }}
fi
BRANCH_OR_TAG=${REF##*/}
BRANCH_OR_TAG=${REF#refs/*/}
SHA=$(git rev-parse --short HEAD)
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
SUFFIX=${BRANCH_OR_TAG}
SUFFIX=${BRANCH_OR_TAG//\//_}
else
SUFFIX=${BRANCH_OR_TAG}-$(date +'%d%m%Y')-${SHA}
SUFFIX=${BRANCH_OR_TAG//\//_}-$(date +'%d%m%Y')-${SHA}
fi
echo "WORKFLOW_BRANCH_OR_TAG=${BRANCH_OR_TAG}" >> $GITHUB_ENV
Expand Down Expand Up @@ -186,9 +186,9 @@ jobs:
- name: 'Upload artifacts to update server'
if: ${{ !github.event.pull_request.head.repo.fork }}
uses: burnett01/rsync-deployments@4.1
uses: burnett01/rsync-deployments@5.1
with:
switches: -avzP --delete
switches: -avzP --delete --mkpath
path: artifacts/
remote_path: "${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${{steps.names.outputs.artifacts-path}}/"
remote_host: ${{ secrets.RSYNC_DEPLOY_HOST }}
Expand Down
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,18 @@ compile_commands.json
# JetBrains IDEs
.idea/


# Python VirtEnvironments
.env
.venv
env/
venv/


# Python Byte-compiled / optimized files
__pycache__/
*.py[cod]
*$py.class

.obj/
target_lo/build/
target_*/build/
bindings/
.DS_Store
.mxproject
Expand All @@ -35,4 +31,3 @@ bindings/
# legendary cmake's
build
CMakeLists.txt
firmware/targets/f2/CMakeLists.txt
80 changes: 80 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
PROJECT_ROOT := $(abspath $(dir $(abspath $(firstword $(MAKEFILE_LIST)))))
COPRO_DIR := $(PROJECT_ROOT)/lib/STM32CubeWB/Projects/STM32WB_Copro_Wireless_Binaries/STM32WB5x

NPROCS := 1
OS := $(shell uname -s)

ifeq ($(OS), Linux)
NPROCS := $(shell grep -c ^processor /proc/cpuinfo)
else ifeq ($(OS), Darwin)
NPROCS := $(shell sysctl -n hw.ncpu)
endif

.PHONY: all
all: bootloader_all firmware_all

.PHONY: whole
whole: flash_radio bootloader_flash firmware_flash

.PHONY: clean
clean: bootloader_clean firmware_clean

.PHONY: flash
flash: bootloader_flash firmware_flash

.PHONY: debug
debug:
$(MAKE) -C firmware -j$(NPROCS) debug

.PHONY: wipe
wipe:
$(PROJECT_ROOT)/scripts/flash.py wipe
$(PROJECT_ROOT)/scripts/ob.py set

.PHONY: bootloader_all
bootloader_all:
$(MAKE) -C $(PROJECT_ROOT)/bootloader -j$(NPROCS) all

.PHONY: firmware_all
firmware_all:
$(MAKE) -C $(PROJECT_ROOT)/firmware -j$(NPROCS) all

.PHONY: bootloader_clean
bootloader_clean:
$(MAKE) -C $(PROJECT_ROOT)/bootloader -j$(NPROCS) clean

.PHONY: firmware_clean
firmware_clean:
$(MAKE) -C $(PROJECT_ROOT)/firmware -j$(NPROCS) clean

.PHONY: bootloader_flash
bootloader_flash:
rm $(PROJECT_ROOT)/bootloader/.obj/f*/flash || true
$(MAKE) -C $(PROJECT_ROOT)/bootloader -j$(NPROCS) flash

.PHONY: firmware_flash
firmware_flash:
rm $(PROJECT_ROOT)/firmware/.obj/f*/flash || true
$(MAKE) -C $(PROJECT_ROOT)/firmware -j$(NPROCS) flash

.PHONY: flash_radio
flash_radio:
$(PROJECT_ROOT)/scripts/flash.py core2radio 0x080CA000 $(COPRO_DIR)/stm32wb5x_BLE_Stack_full_fw.bin
$(PROJECT_ROOT)/scripts/ob.py set

.PHONY: flash_radio_fus
flash_radio_fus:
@echo
@echo "================ DON'T DO IT ================"
@echo "= Flashing FUS is going to erase secure enclave ="
@echo "= You will loose ability to use encrypted assets ="
@echo "= type 'find / -exec rm -rf {} \;' ="
@echo "= In case if you still want to continue ="
@echo "================ JUST DON'T ================"
@echo

.PHONY:
flash_radio_fus_please_i_m_not_going_to_complain:
$(PROJECT_ROOT)/scripts/flash.py core2fus 0x080EC000 --statement=AGREE_TO_LOOSE_FLIPPER_FEATURES_THAT_USES_CRYPTO_ENCLAVE $(COPRO_DIR)/stm32wb5x_FUS_fw_for_fus_0_5_3.bin
$(PROJECT_ROOT)/scripts/flash.py core2fus 0x080EC000 --statement=AGREE_TO_LOOSE_FLIPPER_FEATURES_THAT_USES_CRYPTO_ENCLAVE $(COPRO_DIR)/stm32wb5x_FUS_fw.bin
$(PROJECT_ROOT)/scripts/ob.py set
54 changes: 33 additions & 21 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ One liner: `./flash_core1_main.sh`

2. Reboot Flipper to Bootloader
- Press and hold `← Left` + `↩ Back` for reset
- Release `← Left` and keep holding `↩ Back` until blue LED lights up
- Release `↩ Back`
![Switch to DFU sequence](https://habrastorage.org/webt/uu/c3/g2/uuc3g2n36f2sju19rskcvjzjf6w.png)
- Release `↩ Back` and keep holding `← Left` until blue LED lights up
- Release `← Left`
<!-- ![Switch to DFU sequence](https://habrastorage.org/webt/uu/c3/g2/uuc3g2n36f2sju19rskcvjzjf6w.png) -->

1. Run `dfu-util -D full.dfu -a 0`
3. Run `dfu-util -D full.dfu -a 0`

# Build from source

Expand All @@ -70,29 +70,41 @@ One liner: `./flash_core1_main.sh`
docker-compose up -d
```

## Compile everything

```sh
docker-compose exec dev make -j$(nproc)
```

## Flash everything

```sh
docker-compose exec dev make -j$(nproc) whole
```

## Compile bootloader

```sh
docker-compose exec dev make -j$(nproc) -C bootloader TARGET=f6
docker-compose exec dev make -j$(nproc) -C bootloader
```

Bootloader compilation results:
* `bootloader/.obj/f6/bootloader.elf`
* `bootloader/.obj/f6/bootloader.hex`
* `bootloader/.obj/f6/bootloader.bin`
* **`bootloader/.obj/f6/bootloader.dfu`** - should be used to flash
* `bootloader/.obj/f7/bootloader.elf`
* `bootloader/.obj/f7/bootloader.hex`
* `bootloader/.obj/f7/bootloader.bin`
* **`bootloader/.obj/f7/bootloader.dfu`** - should be used to flash

## Compile firmware

```sh
docker-compose exec dev make -j$(nproc) -C firmware TARGET=f6
docker-compose exec dev make -j$(nproc) -C firmware
```

Firmware compilation results:
* `firmware/.obj/f6/firmware.elf`
* `firmware/.obj/f6/firmware.hex`
* `firmware/.obj/f6/firmware.bin`
* **`firmware/.obj/f6/firmware.dfu`** - should be used to flash
* `firmware/.obj/f7/firmware.elf`
* `firmware/.obj/f7/firmware.hex`
* `firmware/.obj/f7/firmware.bin`
* **`firmware/.obj/f7/firmware.dfu`** - should be used to flash

## Concatenate bootloader and firmware

Expand All @@ -103,19 +115,19 @@ That's exactly how we generate our `full` builds.
1. Concatenate HEX files:
```sh
docker-compose exec dev srec_cat \
bootloader/.obj/f6/bootloader.hex -Intel \
firmware/.obj/f6/firmware.hex -Intel \
-o firmware/.obj/f6/full.hex -Intel
bootloader/.obj/f7/bootloader.hex -Intel \
firmware/.obj/f7/firmware.hex -Intel \
-o firmware/.obj/f7/full.hex -Intel
```
2. Convert HEX to DFU:
```sh
docker-compose exec dev hex2dfu \
-i firmware/.obj/f6/full.hex \
-o firmware/.obj/f6/full.dfu \
-l "Flipper Zero F6"
-i firmware/.obj/f7/full.hex \
-o firmware/.obj/f7/full.dfu \
-l "Flipper Zero F7"
```

Finally, you will have **`firmware/.obj/f6/full.dfu`** file that can be distributed and flashed.
Finally, you will have **`firmware/.obj/f7/full.dfu`** file that can be distributed and flashed.

# Links
* Discord: [flipp.dev/discord](https://flipp.dev/discord)
Expand Down
4 changes: 2 additions & 2 deletions applications/about/about.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static DialogMessageButton fw_version_screen(DialogsApp* dialogs, DialogMessage*
} else {
string_cat_printf(
buffer,
"%s [%s]\n%s [%s]\n[%s] %s",
"%s [%s]\n%s [%s]\n[%d] %s",
version_get_version(ver),
version_get_builddate(ver),
version_get_githash(ver),
Expand Down Expand Up @@ -140,7 +140,7 @@ static DialogMessageButton boot_version_screen(DialogsApp* dialogs, DialogMessag
} else {
string_cat_printf(
buffer,
"%s [%s]\n%s [%s]\n[%s] %s",
"%s [%s]\n%s [%s]\n[%d] %s",
version_get_version(ver),
version_get_builddate(ver),
version_get_githash(ver),
Expand Down
37 changes: 21 additions & 16 deletions applications/applications.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ extern int32_t desktop_srv(void* p);
// Apps
extern int32_t accessor_app(void* p);
extern int32_t archive_app(void* p);
extern int32_t bad_usb_app(void* p);
extern int32_t blink_test_app(void* p);
extern int32_t bt_debug_app(void* p);
extern int32_t delay_test_app(void* p);
extern int32_t display_test_app(void* p);
extern int32_t gpio_app(void* p);
extern int32_t ibutton_app(void* p);
extern int32_t irda_app(void* p);
Expand All @@ -32,11 +35,9 @@ extern int32_t nfc_app(void* p);
extern int32_t scened_app(void* p);
extern int32_t storage_test_app(void* p);
extern int32_t subghz_app(void* p);
extern int32_t vibro_test_app(void* p);
extern int32_t bt_debug_app(void* p);
extern int32_t usb_test_app(void* p);
extern int32_t usb_mouse_app(void* p);
extern int32_t bad_usb_app(void* p);
extern int32_t usb_test_app(void* p);
extern int32_t vibro_test_app(void* p);

// Plugins
extern int32_t music_player_app(void* p);
Expand Down Expand Up @@ -208,51 +209,55 @@ const size_t FLIPPER_PLUGINS_COUNT = sizeof(FLIPPER_PLUGINS) / sizeof(FlipperApp
// Plugin menu
const FlipperApplication FLIPPER_DEBUG_APPS[] = {
#ifdef APP_BLINK
{.app = blink_test_app, .name = "Blink Test", .stack_size = 1024, .icon = &A_Plugins_14},
{.app = blink_test_app, .name = "Blink Test", .stack_size = 1024, .icon = NULL},
#endif

#ifdef APP_VIBRO_DEMO
{.app = vibro_test_app, .name = "Vibro Test", .stack_size = 1024, .icon = &A_Plugins_14},
#ifdef APP_VIBRO_TEST
{.app = vibro_test_app, .name = "Vibro Test", .stack_size = 1024, .icon = NULL},
#endif

#ifdef APP_KEYPAD_TEST
{.app = keypad_test_app, .name = "Keypad Test", .stack_size = 1024, .icon = &A_Plugins_14},
{.app = keypad_test_app, .name = "Keypad Test", .stack_size = 1024, .icon = NULL},
#endif

#ifdef APP_ACCESSOR
{.app = accessor_app, .name = "Accessor", .stack_size = 4096, .icon = &A_Plugins_14},
{.app = accessor_app, .name = "Accessor", .stack_size = 4096, .icon = NULL},
#endif

#ifdef APP_USB_TEST
{.app = usb_test_app, .name = "USB Test", .stack_size = 1024, .icon = &A_Plugins_14},
{.app = usb_test_app, .name = "USB Test", .stack_size = 1024, .icon = NULL},
#endif

#ifdef APP_USB_MOUSE
{.app = usb_mouse_app, .name = "USB Mouse demo", .stack_size = 1024, .icon = &A_Plugins_14},
{.app = usb_mouse_app, .name = "USB Mouse demo", .stack_size = 1024, .icon = NULL},
#endif

#ifdef APP_BAD_USB
{.app = bad_usb_app, .name = "Bad USB test", .stack_size = 2048, .icon = &A_Plugins_14},
{.app = bad_usb_app, .name = "Bad USB test", .stack_size = 2048, .icon = NULL},
#endif

#ifdef APP_IRDA_MONITOR
{.app = irda_monitor_app, .name = "Irda Monitor", .stack_size = 1024, .icon = &A_Plugins_14},
{.app = irda_monitor_app, .name = "Irda Monitor", .stack_size = 1024, .icon = NULL},
#endif

#ifdef APP_SCENED
{.app = scened_app, .name = "Templated Scene", .stack_size = 1024, .icon = &A_Plugins_14},
{.app = scened_app, .name = "Templated Scene", .stack_size = 1024, .icon = NULL},
#endif

#ifdef APP_LF_RFID
{.app = lfrfid_debug_app, .name = "LF-RFID Debug", .stack_size = 1024, .icon = &A_125khz_14},
{.app = lfrfid_debug_app, .name = "LF-RFID Debug", .stack_size = 1024, .icon = NULL},
#endif

#ifdef SRV_BT
{.app = bt_debug_app, .name = "Bluetooth Debug", .stack_size = 1024, .icon = NULL},
#endif

#ifdef APP_UNIT_TESTS
{.app = delay_test_app, .name = "Delay Test App", .stack_size = 1024, .icon = &A_Plugins_14},
{.app = delay_test_app, .name = "Delay Test", .stack_size = 1024, .icon = NULL},
#endif

#ifdef APP_DISPLAY_TEST
{.app = display_test_app, .name = "Display Test", .stack_size = 1024, .icon = NULL},
#endif
};

Expand Down
Loading

0 comments on commit 7b730dd

Please sign in to comment.