From 49d9ed793773426abc4c5e6880dac2e5d66a49d5 Mon Sep 17 00:00:00 2001 From: gornekich Date: Tue, 24 Oct 2023 13:31:27 +0400 Subject: [PATCH 01/11] firmware: remove nfc lib build settings section --- firmware.scons | 9 --------- 1 file changed, 9 deletions(-) diff --git a/firmware.scons b/firmware.scons index d8e96ad7d03..82f775d719c 100644 --- a/firmware.scons +++ b/firmware.scons @@ -71,15 +71,6 @@ env = ENV.Clone( "FURI_DEBUG" if ENV["DEBUG"] else "FURI_NDEBUG", ], }, - "nfc": { - "CCFLAGS": [ - "-Og", - ], - "CPPDEFINES": [ - "NDEBUG", - "FURI_DEBUG", - ], - }, }, FW_API_TABLE=None, _APP_ICONS=None, From 45448c95785a1577e160edc7b27ae33ec521750b Mon Sep 17 00:00:00 2001 From: gornekich Date: Tue, 24 Oct 2023 13:33:19 +0400 Subject: [PATCH 02/11] furi hal nfc: fix nfc irq gpio deinit --- firmware/targets/f7/furi_hal/furi_hal_nfc_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firmware/targets/f7/furi_hal/furi_hal_nfc_irq.c b/firmware/targets/f7/furi_hal/furi_hal_nfc_irq.c index 63dc3541550..170d8dee619 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_nfc_irq.c +++ b/firmware/targets/f7/furi_hal/furi_hal_nfc_irq.c @@ -23,6 +23,6 @@ void furi_hal_nfc_init_gpio_isr() { } void furi_hal_nfc_deinit_gpio_isr() { - furi_hal_gpio_init(&gpio_nfc_irq_rfid_pull, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow); furi_hal_gpio_remove_int_callback(&gpio_nfc_irq_rfid_pull); + furi_hal_gpio_init(&gpio_nfc_irq_rfid_pull, GpioModeAnalog, GpioPullNo, GpioSpeedLow); } From 2eeea8339e707eac1f1532fd8a01eaaedd631bb6 Mon Sep 17 00:00:00 2001 From: gornekich Date: Tue, 24 Oct 2023 13:36:39 +0400 Subject: [PATCH 03/11] lib nfc: remove deprecated exception from sources --- lib/nfc/SConscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nfc/SConscript b/lib/nfc/SConscript index 0e09b693923..6c55cf5d2bf 100644 --- a/lib/nfc/SConscript +++ b/lib/nfc/SConscript @@ -51,7 +51,7 @@ env.Append( libenv = env.Clone(FW_LIB_NAME="nfc") libenv.ApplyLibFlags() -sources = libenv.GlobRecursive("*.c*", exclude="deprecated/*c") +sources = libenv.GlobRecursive("*.c*") lib = libenv.StaticLibrary("${FW_LIB_NAME}", sources) libenv.Install("${LIB_DIST_DIR}", lib) From 695385e8fb4e2916000e5f1f56d6c800e5798cc9 Mon Sep 17 00:00:00 2001 From: gornekich Date: Tue, 24 Oct 2023 16:22:07 +0400 Subject: [PATCH 04/11] nfc: use ASK demodulator in transparent mode --- firmware/targets/f7/furi_hal/furi_hal_nfc_iso15693.c | 2 +- lib/signal_reader/parsers/iso15693/iso15693_parser.c | 2 +- lib/signal_reader/signal_reader.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/firmware/targets/f7/furi_hal/furi_hal_nfc_iso15693.c b/firmware/targets/f7/furi_hal/furi_hal_nfc_iso15693.c index 19ac6dc034f..cc936644b4e 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_nfc_iso15693.c +++ b/firmware/targets/f7/furi_hal/furi_hal_nfc_iso15693.c @@ -48,7 +48,7 @@ static FuriHalNfcIso15693Listener* furi_hal_nfc_iso15693_listener_alloc() { instance->signal = iso15693_signal_alloc(&gpio_spi_r_mosi); instance->parser = - iso15693_parser_alloc(&gpio_spi_r_miso, FURI_HAL_NFC_ISO15693_MAX_FRAME_SIZE); + iso15693_parser_alloc(&gpio_nfc_irq_rfid_pull, FURI_HAL_NFC_ISO15693_MAX_FRAME_SIZE); return instance; } diff --git a/lib/signal_reader/parsers/iso15693/iso15693_parser.c b/lib/signal_reader/parsers/iso15693/iso15693_parser.c index a398516c925..c5326a354d7 100644 --- a/lib/signal_reader/parsers/iso15693/iso15693_parser.c +++ b/lib/signal_reader/parsers/iso15693/iso15693_parser.c @@ -68,7 +68,7 @@ Iso15693Parser* iso15693_parser_alloc(const GpioPin* pin, size_t max_frame_size) signal_reader_set_sample_rate( instance->signal_reader, SignalReaderTimeUnit64Mhz, ISO15693_PARSER_BITRATE_F64MHZ); signal_reader_set_pull(instance->signal_reader, GpioPullDown); - signal_reader_set_polarity(instance->signal_reader, SignalReaderPolarityInverted); + signal_reader_set_polarity(instance->signal_reader, SignalReaderPolarityNormal); signal_reader_set_trigger(instance->signal_reader, SignalReaderTriggerRisingFallingEdge); return instance; diff --git a/lib/signal_reader/signal_reader.c b/lib/signal_reader/signal_reader.c index 7c4d0bae7ed..07570a66ee3 100644 --- a/lib/signal_reader/signal_reader.c +++ b/lib/signal_reader/signal_reader.c @@ -74,7 +74,7 @@ SignalReader* signal_reader_alloc(const GpioPin* gpio_pin, uint32_t size) { SignalReader* instance = malloc(sizeof(SignalReader)); instance->pin = gpio_pin; - instance->pull = GpioPullNo; + instance->pull = GpioPullDown; instance->buffer_size = size; instance->gpio_buffer = malloc(sizeof(uint16_t) * size * 8); From 528f284510d4686c3e30ca7bed1f2e922d130096 Mon Sep 17 00:00:00 2001 From: gornekich Date: Tue, 24 Oct 2023 16:29:14 +0400 Subject: [PATCH 05/11] mf ultralight: add upper page bound for NTAGI2C1K --- lib/nfc/protocols/mf_ultralight/mf_ultralight_listener_i.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/nfc/protocols/mf_ultralight/mf_ultralight_listener_i.c b/lib/nfc/protocols/mf_ultralight/mf_ultralight_listener_i.c index 3d6b9a94fdf..64647492de1 100644 --- a/lib/nfc/protocols/mf_ultralight/mf_ultralight_listener_i.c +++ b/lib/nfc/protocols/mf_ultralight/mf_ultralight_listener_i.c @@ -518,6 +518,8 @@ static uint16_t mf_ultralight_get_upper_page_bound(MfUltralightType type) { upper_page_bound = 511; else if(type == MfUltralightTypeNTAGI2C2K) upper_page_bound = 479; + else if(type == MfUltralightTypeNTAGI2C1K) + upper_page_bound = 225; else { upper_page_bound = mf_ultralight_get_config_page_num(type) - 2; } From 8cd34a12396fb96dfd1c0db2433ae3512f5d0593 Mon Sep 17 00:00:00 2001 From: gornekich Date: Tue, 24 Oct 2023 18:02:16 +0400 Subject: [PATCH 06/11] furi hal nfc: set event if nfc event was started --- firmware/targets/f7/furi_hal/furi_hal_nfc_event.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/firmware/targets/f7/furi_hal/furi_hal_nfc_event.c b/firmware/targets/f7/furi_hal/furi_hal_nfc_event.c index cce16c5dc9b..266b606fd1b 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_nfc_event.c +++ b/firmware/targets/f7/furi_hal/furi_hal_nfc_event.c @@ -25,9 +25,10 @@ FuriHalNfcError furi_hal_nfc_event_stop() { void furi_hal_nfc_event_set(FuriHalNfcEventInternalType event) { furi_assert(furi_hal_nfc_event); - furi_assert(furi_hal_nfc_event->thread); - furi_thread_flags_set(furi_hal_nfc_event->thread, event); + if(furi_hal_nfc_event->thread) { + furi_thread_flags_set(furi_hal_nfc_event->thread, event); + } } FuriHalNfcError furi_hal_nfc_abort() { From df3649883fed0fa4da22663d84f068ea551ab7b7 Mon Sep 17 00:00:00 2001 From: gornekich Date: Tue, 24 Oct 2023 18:44:39 +0400 Subject: [PATCH 07/11] nfc: fix PVS warnings --- lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c | 3 ++- lib/nfc/protocols/mf_ultralight/mf_ultralight.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c b/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c index e86cb4c68c2..3f2747e37a6 100644 --- a/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c +++ b/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c @@ -344,7 +344,8 @@ MfDesfireError mf_desfire_poller_async_read_file_value( return error; } -MfDesfireError mf_desfire_poller_async_read_file_records( +// TODO FL-3639: this function is equal to mf_desfire_poller_async_read_file_data() +MfDesfireError mf_desfire_poller_async_read_file_records( //-V524 MfDesfirePoller* instance, MfDesfireFileId id, uint32_t offset, diff --git a/lib/nfc/protocols/mf_ultralight/mf_ultralight.c b/lib/nfc/protocols/mf_ultralight/mf_ultralight.c index 40d99768636..fd845f3c085 100644 --- a/lib/nfc/protocols/mf_ultralight/mf_ultralight.c +++ b/lib/nfc/protocols/mf_ultralight/mf_ultralight.c @@ -297,7 +297,7 @@ bool mf_ultralight_load(MfUltralightData* data, FlipperFormat* ff, uint32_t vers uint32_t pages_total = 0; if(!flipper_format_read_uint32(ff, MF_ULTRALIGHT_PAGES_TOTAL_KEY, &pages_total, 1)) break; uint32_t pages_read = 0; - if(data_format_version < mf_ultralight_data_format_version) { + if(data_format_version < mf_ultralight_data_format_version) { //-V547 pages_read = pages_total; } else { if(!flipper_format_read_uint32(ff, MF_ULTRALIGHT_PAGES_READ_KEY, &pages_read, 1)) From 987f7f68ed2e650124563327fbbbe1a8090e9a23 Mon Sep 17 00:00:00 2001 From: gornekich Date: Wed, 25 Oct 2023 13:12:23 +0400 Subject: [PATCH 08/11] lib signal reader: remove gpio pull setting in alloc --- lib/signal_reader/signal_reader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/signal_reader/signal_reader.c b/lib/signal_reader/signal_reader.c index 07570a66ee3..7c4d0bae7ed 100644 --- a/lib/signal_reader/signal_reader.c +++ b/lib/signal_reader/signal_reader.c @@ -74,7 +74,7 @@ SignalReader* signal_reader_alloc(const GpioPin* gpio_pin, uint32_t size) { SignalReader* instance = malloc(sizeof(SignalReader)); instance->pin = gpio_pin; - instance->pull = GpioPullDown; + instance->pull = GpioPullNo; instance->buffer_size = size; instance->gpio_buffer = malloc(sizeof(uint16_t) * size * 8); From 455316cfcdf58d2b2d428860a098d820e955dde8 Mon Sep 17 00:00:00 2001 From: hedger Date: Fri, 27 Oct 2023 22:52:41 +0400 Subject: [PATCH 09/11] furi: added math.h include for compatibility with existing apps --- furi/furi.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/furi/furi.h b/furi/furi.h index cfdeb2c0f40..b1299c9a952 100644 --- a/furi/furi.h +++ b/furi/furi.h @@ -24,6 +24,9 @@ // FreeRTOS timer, REMOVE AFTER REFACTORING #include +// Workaround for math.h leaking through HAL in older versions +#include + #ifdef __cplusplus extern "C" { #endif From 9bf740b879d436395e0c4b3ce057d5b5c34004c8 Mon Sep 17 00:00:00 2001 From: gornekich Date: Sat, 28 Oct 2023 17:59:37 +0400 Subject: [PATCH 10/11] nfc: remove resolved TODO in mf desfire poller --- lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c b/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c index 59c972b4012..17377d66e3c 100644 --- a/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c +++ b/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c @@ -344,8 +344,7 @@ MfDesfireError mf_desfire_poller_async_read_file_value( return error; } -// TODO FL-3639: this function is equal to mf_desfire_poller_async_read_file_data() -MfDesfireError mf_desfire_poller_async_read_file_records( //-V524 +MfDesfireError mf_desfire_poller_async_read_file_records( MfDesfirePoller* instance, MfDesfireFileId id, uint32_t offset, From 830f7e454a525a938a817cbe29e05faccc47e818 Mon Sep 17 00:00:00 2001 From: Aleksandr Kutuzov Date: Sat, 28 Oct 2023 23:12:10 +0900 Subject: [PATCH 11/11] Bump api symbols for new SDK with math.h fix --- firmware/targets/f18/api_symbols.csv | 2 +- firmware/targets/f7/api_symbols.csv | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/firmware/targets/f18/api_symbols.csv b/firmware/targets/f18/api_symbols.csv index 8e15030a94a..4789d316d62 100644 --- a/firmware/targets/f18/api_symbols.csv +++ b/firmware/targets/f18/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,40.0,, +Version,+,40.1,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index 3ae099b5f14..038a22eae43 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,40.0,, +Version,+,40.1,, Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,,