2021-10-21 12:24:34 +00:00
|
|
|
PROJECT_ROOT := $(abspath $(dir $(abspath $(firstword $(MAKEFILE_LIST)))))
|
|
|
|
COPRO_DIR := $(PROJECT_ROOT)/lib/STM32CubeWB/Projects/STM32WB_Copro_Wireless_Binaries/STM32WB5x
|
|
|
|
|
2021-10-21 18:12:20 +00:00
|
|
|
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
|
|
|
|
|
2021-10-21 12:24:34 +00:00
|
|
|
.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:
|
2021-10-21 18:12:20 +00:00
|
|
|
$(MAKE) -C firmware -j$(NPROCS) debug
|
2021-10-21 12:24:34 +00:00
|
|
|
|
2021-11-15 19:55:25 +00:00
|
|
|
.PHONY: blackmagic
|
|
|
|
blackmagic:
|
|
|
|
$(MAKE) -C firmware -j$(NPROCS) blackmagic
|
|
|
|
|
2021-10-21 12:24:34 +00:00
|
|
|
.PHONY: wipe
|
|
|
|
wipe:
|
|
|
|
$(PROJECT_ROOT)/scripts/flash.py wipe
|
|
|
|
$(PROJECT_ROOT)/scripts/ob.py set
|
|
|
|
|
|
|
|
.PHONY: bootloader_all
|
|
|
|
bootloader_all:
|
2021-10-21 18:12:20 +00:00
|
|
|
$(MAKE) -C $(PROJECT_ROOT)/bootloader -j$(NPROCS) all
|
2021-10-21 12:24:34 +00:00
|
|
|
|
|
|
|
.PHONY: firmware_all
|
|
|
|
firmware_all:
|
2021-10-21 18:12:20 +00:00
|
|
|
$(MAKE) -C $(PROJECT_ROOT)/firmware -j$(NPROCS) all
|
2021-10-21 12:24:34 +00:00
|
|
|
|
|
|
|
.PHONY: bootloader_clean
|
|
|
|
bootloader_clean:
|
2021-10-21 18:12:20 +00:00
|
|
|
$(MAKE) -C $(PROJECT_ROOT)/bootloader -j$(NPROCS) clean
|
2021-10-21 12:24:34 +00:00
|
|
|
|
|
|
|
.PHONY: firmware_clean
|
|
|
|
firmware_clean:
|
2021-10-21 18:12:20 +00:00
|
|
|
$(MAKE) -C $(PROJECT_ROOT)/firmware -j$(NPROCS) clean
|
2021-10-21 12:24:34 +00:00
|
|
|
|
|
|
|
.PHONY: bootloader_flash
|
|
|
|
bootloader_flash:
|
2021-11-11 12:49:19 +00:00
|
|
|
ifeq ($(FORCE), 1)
|
2021-10-21 12:24:34 +00:00
|
|
|
rm $(PROJECT_ROOT)/bootloader/.obj/f*/flash || true
|
2021-11-01 13:11:25 +00:00
|
|
|
endif
|
2021-10-21 18:12:20 +00:00
|
|
|
$(MAKE) -C $(PROJECT_ROOT)/bootloader -j$(NPROCS) flash
|
2021-10-21 12:24:34 +00:00
|
|
|
|
|
|
|
.PHONY: firmware_flash
|
|
|
|
firmware_flash:
|
2021-11-11 12:49:19 +00:00
|
|
|
ifeq ($(FORCE), 1)
|
2021-10-21 12:24:34 +00:00
|
|
|
rm $(PROJECT_ROOT)/firmware/.obj/f*/flash || true
|
2021-11-01 13:11:25 +00:00
|
|
|
endif
|
2021-10-21 18:12:20 +00:00
|
|
|
$(MAKE) -C $(PROJECT_ROOT)/firmware -j$(NPROCS) flash
|
2021-10-21 12:24:34 +00:00
|
|
|
|
|
|
|
.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
|
|
|
|
|
2021-11-01 13:11:25 +00:00
|
|
|
.PHONY: flash_radio_fus_please_i_m_not_going_to_complain
|
2021-10-21 12:24:34 +00:00
|
|
|
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
|
2021-11-01 13:11:25 +00:00
|
|
|
|
|
|
|
FORMAT_SOURCES = $(shell find applications bootloader core -iname "*.h" -o -iname "*.c" -o -iname "*.cpp")
|
|
|
|
|
|
|
|
.PHONY: format
|
|
|
|
format:
|
|
|
|
@echo "Formatting sources with clang-format"
|
|
|
|
@clang-format -style=file -i $(FORMAT_SOURCES)
|
|
|
|
|