From 1571d4ec547459285a6d7b402f4bfcfc3f68d8c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=81=8F?= Date: Mon, 15 Nov 2021 22:55:25 +0300 Subject: [PATCH] Project: enum cast fix. Makefile: blackmagic rule in global makefile (#819) --- Makefile | 4 ++++ applications/subghz/subghz_i.c | 3 +-- lib/subghz/protocols/subghz_protocol_common.c | 3 ++- lib/subghz/protocols/subghz_protocol_princeton.c | 2 +- lib/subghz/protocols/subghz_protocol_raw.c | 2 +- lib/subghz/subghz_keystore.c | 8 ++++---- make/rules.mk | 2 +- 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 062ed8ff..c077407c 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,10 @@ flash: bootloader_flash firmware_flash debug: $(MAKE) -C firmware -j$(NPROCS) debug +.PHONY: blackmagic +blackmagic: + $(MAKE) -C firmware -j$(NPROCS) blackmagic + .PHONY: wipe wipe: $(PROJECT_ROOT)/scripts/flash.py wipe diff --git a/applications/subghz/subghz_i.c b/applications/subghz/subghz_i.c index ce693991..ff1596e8 100644 --- a/applications/subghz/subghz_i.c +++ b/applications/subghz/subghz_i.c @@ -345,8 +345,7 @@ bool subghz_save_protocol_to_file(SubGhz* subghz, const char* dev_name) { break; } - if(!flipper_file_write_uint32( - flipper_file, "Frequency", (uint32_t*)&subghz->txrx->frequency, 1)) { + if(!flipper_file_write_uint32(flipper_file, "Frequency", &subghz->txrx->frequency, 1)) { FURI_LOG_E(SUBGHZ_PARSER_TAG, "Unable to add Frequency"); break; } diff --git a/lib/subghz/protocols/subghz_protocol_common.c b/lib/subghz/protocols/subghz_protocol_common.c index 95ca876f..927e2157 100644 --- a/lib/subghz/protocols/subghz_protocol_common.c +++ b/lib/subghz/protocols/subghz_protocol_common.c @@ -178,8 +178,9 @@ bool subghz_protocol_common_to_save_file(SubGhzProtocolCommon* instance, Flipper FURI_LOG_E(SUBGHZ_PARSER_TAG, "Unable to add Protocol"); break; } + uint32_t temp = instance->code_last_count_bit; if(!flipper_file_write_uint32( - flipper_file, "Bit", (uint32_t*)&instance->code_last_count_bit, 1)) { + flipper_file, "Bit", &temp, 1)) { FURI_LOG_E(SUBGHZ_PARSER_TAG, "Unable to add Bit"); break; } diff --git a/lib/subghz/protocols/subghz_protocol_princeton.c b/lib/subghz/protocols/subghz_protocol_princeton.c index 238770e7..0f2fdf77 100644 --- a/lib/subghz/protocols/subghz_protocol_princeton.c +++ b/lib/subghz/protocols/subghz_protocol_princeton.c @@ -298,7 +298,7 @@ bool subghz_decoder_princeton_to_save_file( FlipperFile* flipper_file) { bool res = subghz_protocol_common_to_save_file((SubGhzProtocolCommon*)instance, flipper_file); if(res) { - res = flipper_file_write_uint32(flipper_file, "TE", (uint32_t*)&instance->te, 1); + res = flipper_file_write_uint32(flipper_file, "TE", &instance->te, 1); if(!res) FURI_LOG_E(SUBGHZ_PARSER_TAG, "Unable to add Te"); } return res; diff --git a/lib/subghz/protocols/subghz_protocol_raw.c b/lib/subghz/protocols/subghz_protocol_raw.c index 49ce87ed..b9b9c5bc 100644 --- a/lib/subghz/protocols/subghz_protocol_raw.c +++ b/lib/subghz/protocols/subghz_protocol_raw.c @@ -177,7 +177,7 @@ bool subghz_protocol_raw_save_to_file_init( break; } - if(!flipper_file_write_uint32(instance->flipper_file, "Frequency", (uint32_t*)&frequency, 1)) { + if(!flipper_file_write_uint32(instance->flipper_file, "Frequency", &frequency, 1)) { FURI_LOG_E(TAG, "Unable to add Frequency"); break; } diff --git a/lib/subghz/subghz_keystore.c b/lib/subghz/subghz_keystore.c index 04fb80ea..174b39d1 100644 --- a/lib/subghz/subghz_keystore.c +++ b/lib/subghz/subghz_keystore.c @@ -248,8 +248,8 @@ bool subghz_keystore_save(SubGhzKeystore* instance, const char* file_name, uint8 FURI_LOG_E(TAG, "Unable to add header"); break; } - SubGhzKeystoreEncryption encryption = SubGhzKeystoreEncryptionAES256; - if(!flipper_file_write_uint32(flipper_file, "Encryption", (uint32_t*)&encryption, 1)) { + uint32_t encryption = SubGhzKeystoreEncryptionAES256; + if(!flipper_file_write_uint32(flipper_file, "Encryption", &encryption, 1)) { FURI_LOG_E(TAG, "Unable to add Encryption"); break; } @@ -379,9 +379,9 @@ bool subghz_keystore_raw_encrypted_save( FURI_LOG_E(TAG, "Unable to add header"); break; } - SubGhzKeystoreEncryption tmp_encryption = SubGhzKeystoreEncryptionAES256; + uint32_t encryption = SubGhzKeystoreEncryptionAES256; if(!flipper_file_write_uint32( - output_flipper_file, "Encryption", (uint32_t*)&tmp_encryption, 1)) { + output_flipper_file, "Encryption", &encryption, 1)) { FURI_LOG_E(TAG, "Unable to add Encryption"); break; } diff --git a/make/rules.mk b/make/rules.mk index 831f9958..7f4332ab 100644 --- a/make/rules.mk +++ b/make/rules.mk @@ -100,7 +100,7 @@ debug_other: -ex "svd_load $(SVD_FILE)" \ -blackmagic: flash +blackmagic: arm-none-eabi-gdb-py \ -ex 'target extended-remote $(BLACKMAGIC)' \ -ex 'monitor swdp_scan' \