diff --git a/applications/plugins/picopass/application.fam b/applications/plugins/picopass/application.fam index 887d0324..7a81e080 100644 --- a/applications/plugins/picopass/application.fam +++ b/applications/plugins/picopass/application.fam @@ -1,7 +1,7 @@ App( appid="picopass", name="PicoPass Reader", - apptype=FlipperAppType.PLUGIN, + apptype=FlipperAppType.EXTERNAL, entry_point="picopass_app", requires=[ "storage", diff --git a/assets/SConscript b/assets/SConscript index 6328035f..47713d1a 100644 --- a/assets/SConscript +++ b/assets/SConscript @@ -1,13 +1,5 @@ Import("env") -# HACHHACK -# Currently injected to CPPPATH by libs - since they are built earlier and depend on assets -# env.Append( -# CPPPATH=[ -# Dir("./compiled"), -# ] -# ) - assetsenv = env.Clone( tools=["fbt_assets"], FW_LIB_NAME="assets", @@ -109,6 +101,7 @@ if assetsenv["IS_BASE_FIRMWARE"]: ) # Exporting resources node to external environment + env["FW_ASSETS_HEADERS"] = assets_parts env["FW_RESOURCES"] = resources assetsenv.Alias("resources", resources) diff --git a/documentation/AppManifests.md b/documentation/AppManifests.md index 5e7ceb93..7bc8d0a4 100644 --- a/documentation/AppManifests.md +++ b/documentation/AppManifests.md @@ -1,16 +1,16 @@ # Flipper Application Manifests (.fam) -All components of Flipper Zero firmware — services, user applications, system settings — are developed independently. Each component has a build system manifest file, named `application.fam`, defining basic properties of a components and its relations to other parts of the system. +All components of Flipper Zero firmware — services, user applications, system settings — are developed independently. Each component has a build system manifest file, named `application.fam`, which defines basic properties of that component and its relations to other parts of the system. -When building firmware, **`fbt`** collects all application manifests, processes their dependencies and builds only those components that are utilized in current build configuration. See [fbt docs](./fbt.md#firmware-application-set) for details on build configurations. +When building firmware, **`fbt`** collects all application manifests and processes their dependencies. Then it builds only those components that are referenced in the current build configuration. See [fbt docs](./fbt.md#firmware-application-set) for details on build configurations. ## Application definition Properties of a firmware component are declared in a form of a Python code snippet, forming a call to App() function with various parameters. -Only 2 parameters are mandatoty: ***appid*** and ***apptype***, others are optional and may be meaningful only for certain application types. +Only 2 parameters are mandatory: ***appid*** and ***apptype***, others are optional and may only be meaningful for certain application types. -### Keys +### Parameters * **appid**: string, application id within the build system. Used for specifying which applications to include in build configuration and to resolve dependencies and conflicts. @@ -21,7 +21,7 @@ Only 2 parameters are mandatoty: ***appid*** and ***apptype***, others are optio | SERVICE | System service, created at early startup | | SYSTEM | Application not being shown in any menus. Can be started by other apps or from CLI | | APP | Regular application for main menu | -| PLUGIN | Application to be built as .fap plugin | +| PLUGIN | Application to be built as a part of firmware an to be placed in Plugins menu | | DEBUG | Application only visible in Debug menu with debug mode enabled | | ARCHIVE | One and only Archive app | | SETTINGS | Application to be placed in System settings menu | @@ -29,25 +29,28 @@ Only 2 parameters are mandatoty: ***appid*** and ***apptype***, others are optio | EXTERNAL | Application to be built as .fap plugin | | METAPACKAGE | Does not define any code to be run, used for declaring dependencies and application bundles | -* **name**: Name to show in menus. -* **entry_point**: C function to be used as applicaiton's entry point. +* **name**: Name that is displayed in menus. +* **entry_point**: C function to be used as application's entry point. * **flags**: Internal flags for system apps. Do not use. * **cdefines**: C preprocessor definitions to declare globally for other apps when current application is included in active build configuration. * **requires**: List of application IDs to also include in build configuration, when current application is referenced in list of applications to build. * **conflicts**: List of application IDs that current application conflicts with. If any of them is found in constructed application list, **`fbt`** will abort firmware build process. * **provides**: Functionally identical to ***requires*** field. -* **stack_size**: Stack size, in bytes, to allocate for application on its startup. Note that allocating a stack too small for app to run will cause system crash due to stack overflow, and allocating too much stack will reduce usable heap memory size for app to process data. *Note: you can use `ps` and `free` CLI commands to profile you app's memory usage.* +* **stack_size**: Stack size, in bytes, to allocate for application on its startup. Note that allocating a stack that is too small for an app to run will cause system crash due to stack overflow, and allocating too much stack space will reduce usable heap memory size for apps to process data. *Note: you can use `ps` and `free` CLI commands to profile your app's memory usage.* * **icon**: Animated icon name from built-in assets to be used when building app as a part of firmware. -* **order**: Order of an application within its group when sorting entries in it. The lower the order is, the closer to the start of the list the items is located. Used for ordering startup hooks and menu entries. -* **sdk_headers**: List of C header files from this app's code to include in API definitions for external applicaions. +* **order**: Order of an application within its group when sorting entries in it. The lower the order is, the closer to the start of the list the item is placed. *Used for ordering startup hooks and menu entries.* +* **sdk_headers**: List of C header files from this app's code to include in API definitions for external applications. The following parameters are used only for [FAPs](./AppsOnSDCard.md): * **sources**: list of file name masks, used for gathering sources within app folder. Default value of ["\*.c\*"] includes C and CPP source files. -* **version**: string, 2 numbers in form of "x.y": application version to be embedded within .fap file. -* **fap_icon**: name of .png file, 1-bit color depth, 10x10px, to be embedded within .fap file. +* **fap_version**: string, 2 numbers in form of "x.y": application version to be embedded within .fap file. +* **fap_icon**: name of a .png file, 1-bit color depth, 10x10px, to be embedded within .fap file. * **fap_libs**: list of extra libraries to link application against. Provides access to extra functions that are not exported as a part of main firmware at expense of increased .fap file size and RAM consumption. * **fap_category**: string, may be empty. App subcategory, also works as path of FAP within apps folder in the file system. +* **fap_description**: string, may be empty. Short application descriotion. +* **fap_author**: string, may be empty. Application's author. +* **fap_weburl**: string, may be empty. Application's homepage. ## .fam file contents @@ -76,4 +79,4 @@ App( ) ``` -For more examples, see application.fam files for basic firmware components. \ No newline at end of file +For more examples, see .fam files from various firmware parts. diff --git a/fbt_options.py b/fbt_options.py index bdf8fc03..716f99fd 100644 --- a/fbt_options.py +++ b/fbt_options.py @@ -73,7 +73,8 @@ FIRMWARE_APPS = { "system_apps", # Settings "settings_apps", - # Plugins + # Stock plugins - no longer built into fw, now they're .faps + # Yet you can still build them as a part of fw # "basic_plugins", # Debug # "debug_apps", diff --git a/firmware.scons b/firmware.scons index 962c7072..530634ef 100644 --- a/firmware.scons +++ b/firmware.scons @@ -302,7 +302,7 @@ if fwenv["IS_BASE_FIRMWARE"]: "-D__inline__=inline", ], ) - Depends(sdk_source, fwenv["SDK_HEADERS"]) + Depends(sdk_source, (fwenv["SDK_HEADERS"], fwenv["FW_ASSETS_HEADERS"])) sdk_tree = fwenv.SDKTree("sdk/sdk.opts", "sdk_origin") AlwaysBuild(sdk_tree) diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index 545e1d64..3f2a86b2 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,+,1.0,, +Version,+,1.3,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, @@ -109,6 +109,12 @@ Header,+,lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Inc/stm32wbxx_ll_wwdg.h,, Header,+,lib/flipper_application/flipper_application.h,, Header,+,lib/flipper_format/flipper_format.h,, Header,+,lib/flipper_format/flipper_format_i.h,, +Header,+,lib/lfrfid/lfrfid_dict_file.h,, +Header,+,lib/lfrfid/lfrfid_raw_file.h,, +Header,+,lib/lfrfid/lfrfid_raw_worker.h,, +Header,+,lib/lfrfid/lfrfid_worker.h,, +Header,+,lib/lfrfid/protocols/lfrfid_protocols.h,, +Header,+,lib/lfrfid/tools/bit_lib.h,, Header,+,lib/micro-ecc/uECC.h,, Header,+,lib/one_wire/ibutton/ibutton_worker.h,, Header,+,lib/one_wire/maxim_crc.h,, @@ -118,6 +124,7 @@ Header,+,lib/one_wire/one_wire_host_timing.h,, Header,+,lib/one_wire/one_wire_slave.h,, Header,+,lib/print/wrappers.h,, Header,+,lib/subghz/environment.h,, +Header,+,lib/subghz/protocols/raw.h,, Header,+,lib/subghz/receiver.h,, Header,+,lib/subghz/subghz_tx_rx_worker.h,, Header,+,lib/subghz/subghz_worker.h,, @@ -130,8 +137,10 @@ Header,+,lib/toolbox/manchester_decoder.h,, Header,+,lib/toolbox/manchester_encoder.h,, Header,+,lib/toolbox/md5.h,, Header,+,lib/toolbox/path.h,, +Header,+,lib/toolbox/protocols/protocol_dict.h,, Header,+,lib/toolbox/random_name.h,, Header,+,lib/toolbox/saved_struct.h,, +Header,+,lib/toolbox/stream/buffered_file_stream.h,, Header,+,lib/toolbox/stream/file_stream.h,, Header,+,lib/toolbox/stream/stream.h,, Header,+,lib/toolbox/stream/string_stream.h,, @@ -465,6 +474,26 @@ Function,-,atoll,long long,const char* Function,-,basename,char*,const char* Function,-,bcmp,int,"const void*, const void*, size_t" Function,-,bcopy,void,"const void*, void*, size_t" +Function,+,bit_lib_add_parity,size_t,"const uint8_t*, size_t, uint8_t*, size_t, uint8_t, uint8_t, BitLibParity" +Function,+,bit_lib_copy_bits,void,"uint8_t*, size_t, size_t, const uint8_t*, size_t" +Function,+,bit_lib_crc16,uint16_t,"const uint8_t*, size_t, uint16_t, uint16_t, _Bool, _Bool, uint16_t" +Function,+,bit_lib_crc8,uint16_t,"const uint8_t*, size_t, uint8_t, uint8_t, _Bool, _Bool, uint8_t" +Function,+,bit_lib_get_bit,_Bool,"const uint8_t*, size_t" +Function,+,bit_lib_get_bit_count,uint8_t,uint32_t +Function,+,bit_lib_get_bits,uint8_t,"const uint8_t*, size_t, uint8_t" +Function,+,bit_lib_get_bits_16,uint16_t,"const uint8_t*, size_t, uint8_t" +Function,+,bit_lib_get_bits_32,uint32_t,"const uint8_t*, size_t, uint8_t" +Function,+,bit_lib_print_bits,void,"const uint8_t*, size_t" +Function,+,bit_lib_print_regions,void,"const BitLibRegion*, size_t, const uint8_t*, size_t" +Function,+,bit_lib_push_bit,void,"uint8_t*, size_t, _Bool" +Function,+,bit_lib_remove_bit_every_nth,size_t,"uint8_t*, size_t, uint8_t, uint8_t" +Function,+,bit_lib_reverse_16_fast,uint16_t,uint16_t +Function,+,bit_lib_reverse_8_fast,uint8_t,uint8_t +Function,+,bit_lib_reverse_bits,void,"uint8_t*, size_t, uint8_t" +Function,+,bit_lib_set_bit,void,"uint8_t*, size_t, _Bool" +Function,+,bit_lib_set_bits,void,"uint8_t*, size_t, uint8_t, uint8_t" +Function,+,bit_lib_test_parity,_Bool,"const uint8_t*, size_t, uint8_t, BitLibParity, uint8_t" +Function,+,bit_lib_test_parity_32,_Bool,"uint32_t, BitLibParity" Function,+,ble_app_get_key_storage_buff,void,"uint8_t**, uint16_t*" Function,+,ble_app_init,_Bool, Function,+,ble_app_thread_stop,void, @@ -488,6 +517,11 @@ Function,+,bt_disconnect,void,Bt* Function,+,bt_forget_bonded_devices,void,Bt* Function,+,bt_set_profile,_Bool,"Bt*, BtProfile" Function,+,bt_set_status_changed_callback,void,"Bt*, BtStatusChangedCallback, void*" +Function,+,buffered_file_stream_alloc,Stream*,Storage* +Function,+,buffered_file_stream_close,_Bool,Stream* +Function,+,buffered_file_stream_get_error,FS_Error,Stream* +Function,+,buffered_file_stream_open,_Bool,"Stream*, const char*, FS_AccessMode, FS_OpenMode" +Function,+,buffered_file_stream_sync,_Bool,Stream* Function,+,button_menu_add_item,ButtonMenuItem*,"ButtonMenu*, const char*, int32_t, ButtonMenuItemCallback, ButtonMenuItemType, void*" Function,+,button_menu_alloc,ButtonMenu*, Function,+,button_menu_free,void,ButtonMenu* @@ -1099,7 +1133,6 @@ Function,+,furi_hal_power_get_battery_remaining_capacity,uint32_t, Function,+,furi_hal_power_get_battery_temperature,float,FuriHalPowerIC Function,+,furi_hal_power_get_battery_voltage,float,FuriHalPowerIC Function,+,furi_hal_power_get_pct,uint8_t, -Function,-,furi_hal_power_get_system_voltage,float, Function,+,furi_hal_power_get_usb_voltage,float, Function,+,furi_hal_power_info_get,void,"FuriHalPowerInfoCallback, void*" Function,-,furi_hal_power_init,void, @@ -1468,6 +1501,31 @@ Function,-,ldexp,double,"double, int" Function,-,ldexpf,float,"float, int" Function,-,ldexpl,long double,"long double, int" Function,-,ldiv,ldiv_t,"long, long" +Function,+,lfrfid_dict_file_load,ProtocolId,"ProtocolDict*, const char*" +Function,+,lfrfid_dict_file_save,_Bool,"ProtocolDict*, ProtocolId, const char*" +Function,+,lfrfid_raw_file_alloc,LFRFIDRawFile*,Storage* +Function,+,lfrfid_raw_file_free,void,LFRFIDRawFile* +Function,+,lfrfid_raw_file_open_read,_Bool,"LFRFIDRawFile*, const char*" +Function,+,lfrfid_raw_file_open_write,_Bool,"LFRFIDRawFile*, const char*" +Function,+,lfrfid_raw_file_read_header,_Bool,"LFRFIDRawFile*, float*, float*" +Function,+,lfrfid_raw_file_read_pair,_Bool,"LFRFIDRawFile*, uint32_t*, uint32_t*, _Bool*" +Function,+,lfrfid_raw_file_write_buffer,_Bool,"LFRFIDRawFile*, uint8_t*, size_t" +Function,+,lfrfid_raw_file_write_header,_Bool,"LFRFIDRawFile*, float, float, uint32_t" +Function,+,lfrfid_raw_worker_alloc,LFRFIDRawWorker*, +Function,+,lfrfid_raw_worker_free,void,LFRFIDRawWorker* +Function,+,lfrfid_raw_worker_start_emulate,void,"LFRFIDRawWorker*, const char*, LFRFIDWorkerEmulateRawCallback, void*" +Function,+,lfrfid_raw_worker_start_read,void,"LFRFIDRawWorker*, const char*, float, float, LFRFIDWorkerReadRawCallback, void*" +Function,+,lfrfid_raw_worker_stop,void,LFRFIDRawWorker* +Function,+,lfrfid_worker_alloc,LFRFIDWorker*,ProtocolDict* +Function,+,lfrfid_worker_emulate_raw_start,void,"LFRFIDWorker*, const char*, LFRFIDWorkerEmulateRawCallback, void*" +Function,+,lfrfid_worker_emulate_start,void,"LFRFIDWorker*, LFRFIDProtocol" +Function,+,lfrfid_worker_free,void,LFRFIDWorker* +Function,+,lfrfid_worker_read_raw_start,void,"LFRFIDWorker*, const char*, LFRFIDWorkerReadType, LFRFIDWorkerReadRawCallback, void*" +Function,+,lfrfid_worker_read_start,void,"LFRFIDWorker*, LFRFIDWorkerReadType, LFRFIDWorkerReadCallback, void*" +Function,+,lfrfid_worker_start_thread,void,LFRFIDWorker* +Function,+,lfrfid_worker_stop,void,LFRFIDWorker* +Function,+,lfrfid_worker_stop_thread,void,LFRFIDWorker* +Function,+,lfrfid_worker_write_start,void,"LFRFIDWorker*, LFRFIDProtocol, LFRFIDWorkerWriteCallback, void*" Function,-,lgamma,double,double Function,-,lgamma_r,double,"double, int*" Function,-,lgammaf,float,float @@ -1659,6 +1717,26 @@ Function,+,power_reboot,void,PowerBootMode Function,+,powf,float,"float, float" Function,-,powl,long double,"long double, long double" Function,-,printf,int,"const char*, ..." +Function,+,protocol_dict_alloc,ProtocolDict*,"const ProtocolBase**, size_t" +Function,+,protocol_dict_decoders_feed,ProtocolId,"ProtocolDict*, _Bool, uint32_t" +Function,+,protocol_dict_decoders_feed_by_feature,ProtocolId,"ProtocolDict*, uint32_t, _Bool, uint32_t" +Function,+,protocol_dict_decoders_feed_by_id,ProtocolId,"ProtocolDict*, size_t, _Bool, uint32_t" +Function,+,protocol_dict_decoders_start,void,ProtocolDict* +Function,+,protocol_dict_encoder_start,_Bool,"ProtocolDict*, size_t" +Function,+,protocol_dict_encoder_yield,LevelDuration,"ProtocolDict*, size_t" +Function,+,protocol_dict_free,void,ProtocolDict* +Function,+,protocol_dict_get_data,void,"ProtocolDict*, size_t, uint8_t*, size_t" +Function,+,protocol_dict_get_data_size,size_t,"ProtocolDict*, size_t" +Function,+,protocol_dict_get_features,uint32_t,"ProtocolDict*, size_t" +Function,+,protocol_dict_get_manufacturer,const char*,"ProtocolDict*, size_t" +Function,+,protocol_dict_get_max_data_size,size_t,ProtocolDict* +Function,+,protocol_dict_get_name,const char*,"ProtocolDict*, size_t" +Function,+,protocol_dict_get_protocol_by_name,ProtocolId,"ProtocolDict*, const char*" +Function,+,protocol_dict_get_validate_count,uint32_t,"ProtocolDict*, size_t" +Function,+,protocol_dict_get_write_data,_Bool,"ProtocolDict*, size_t, void*" +Function,+,protocol_dict_render_brief_data,void,"ProtocolDict*, string_t, size_t" +Function,+,protocol_dict_render_data,void,"ProtocolDict*, string_t, size_t" +Function,+,protocol_dict_set_data,void,"ProtocolDict*, size_t, const uint8_t*, size_t" Function,-,pselect,int,"int, fd_set*, fd_set*, fd_set*, const timespec*, const sigset_t*" Function,-,putc,int,"int, FILE*" Function,-,putc_unlocked,int,"int, FILE*" @@ -2105,6 +2183,22 @@ Function,-,subghz_protocol_decoder_base_get_hash_data,uint8_t,SubGhzProtocolDeco Function,-,subghz_protocol_decoder_base_get_string,_Bool,"SubGhzProtocolDecoderBase*, string_t" Function,+,subghz_protocol_decoder_base_serialize,_Bool,"SubGhzProtocolDecoderBase*, FlipperFormat*, SubGhzPresetDefinition*" Function,-,subghz_protocol_decoder_base_set_decoder_callback,void,"SubGhzProtocolDecoderBase*, SubGhzProtocolDecoderBaseRxCallback, void*" +Function,+,subghz_protocol_decoder_raw_alloc,void*,SubGhzEnvironment* +Function,+,subghz_protocol_decoder_raw_deserialize,_Bool,"void*, FlipperFormat*" +Function,+,subghz_protocol_decoder_raw_feed,void,"void*, _Bool, uint32_t" +Function,+,subghz_protocol_decoder_raw_free,void,void* +Function,+,subghz_protocol_decoder_raw_get_string,void,"void*, string_t" +Function,+,subghz_protocol_decoder_raw_reset,void,void* +Function,+,subghz_protocol_encoder_raw_alloc,void*,SubGhzEnvironment* +Function,+,subghz_protocol_encoder_raw_deserialize,_Bool,"void*, FlipperFormat*" +Function,+,subghz_protocol_encoder_raw_free,void,void* +Function,+,subghz_protocol_encoder_raw_stop,void,void* +Function,+,subghz_protocol_encoder_raw_yield,LevelDuration,void* +Function,+,subghz_protocol_raw_file_encoder_worker_set_callback_end,void,"SubGhzProtocolEncoderRAW*, SubGhzProtocolEncoderRAWCallbackEnd, void*" +Function,+,subghz_protocol_raw_gen_fff_data,void,"FlipperFormat*, const char*" +Function,+,subghz_protocol_raw_get_sample_write,size_t,SubGhzProtocolDecoderRAW* +Function,+,subghz_protocol_raw_save_to_file_init,_Bool,"SubGhzProtocolDecoderRAW*, const char*, SubGhzPresetDefinition*" +Function,+,subghz_protocol_raw_save_to_file_stop,void,SubGhzProtocolDecoderRAW* Function,+,subghz_receiver_alloc_init,SubGhzReceiver*,SubGhzEnvironment* Function,+,subghz_receiver_decode,void,"SubGhzReceiver*, _Bool, uint32_t" Function,+,subghz_receiver_free,void,SubGhzReceiver* @@ -2144,6 +2238,7 @@ Function,+,submenu_reset,void,Submenu* Function,+,submenu_set_header,void,"Submenu*, const char*" Function,+,submenu_set_selected_item,void,"Submenu*, uint32_t" Function,-,system,int,const char* +Function,+,t5577_write,void,LFRFIDT5577* Function,-,tan,double,double Function,-,tanf,float,float Function,-,tanh,double,double @@ -2667,6 +2762,7 @@ Variable,+,gpio_usb_dp,const GpioPin, Variable,+,ibutton_gpio,const GpioPin, Variable,+,input_pins,const InputPin[], Variable,+,input_pins_count,const size_t, +Variable,+,lfrfid_protocols,const ProtocolBase*[], Variable,+,message_blink_set_color_blue,const NotificationMessage, Variable,+,message_blink_set_color_cyan,const NotificationMessage, Variable,+,message_blink_set_color_green,const NotificationMessage, @@ -2861,6 +2957,9 @@ Variable,+,sequence_set_vibro_on,const NotificationSequence, Variable,+,sequence_single_vibro,const NotificationSequence, Variable,+,sequence_solid_yellow,const NotificationSequence, Variable,+,sequence_success,const NotificationSequence, +Variable,+,subghz_protocol_raw,const SubGhzProtocol, +Variable,+,subghz_protocol_raw_decoder,const SubGhzProtocolDecoder, +Variable,+,subghz_protocol_raw_encoder,const SubGhzProtocolEncoder, Variable,-,suboptarg,char*, Variable,+,usb_cdc_dual,FuriHalUsbInterface, Variable,+,usb_cdc_single,FuriHalUsbInterface, diff --git a/firmware/targets/furi_hal_include/furi_hal_power.h b/firmware/targets/furi_hal_include/furi_hal_power.h index 16af959c..3ab30c42 100644 --- a/firmware/targets/furi_hal_include/furi_hal_power.h +++ b/firmware/targets/furi_hal_include/furi_hal_power.h @@ -156,12 +156,6 @@ float furi_hal_power_get_battery_current(FuriHalPowerIC ic); */ float furi_hal_power_get_battery_temperature(FuriHalPowerIC ic); -/** Get System voltage in V - * - * @return voltage in V - */ -float furi_hal_power_get_system_voltage(); - /** Get USB voltage in V * * @return voltage in V diff --git a/lib/lfrfid/SConscript b/lib/lfrfid/SConscript index 8d354288..fd29ca2e 100644 --- a/lib/lfrfid/SConscript +++ b/lib/lfrfid/SConscript @@ -7,6 +7,14 @@ env.Append( CPPPATH=[ "#/lib/lfrfid", ], + SDK_HEADERS=[ + File("#/lib/lfrfid/lfrfid_worker.h"), + File("#/lib/lfrfid/lfrfid_raw_worker.h"), + File("#/lib/lfrfid/lfrfid_raw_file.h"), + File("#/lib/lfrfid/lfrfid_dict_file.h"), + File("#/lib/lfrfid/tools/bit_lib.h"), + File("#/lib/lfrfid/protocols/lfrfid_protocols.h"), + ], ) libenv = env.Clone(FW_LIB_NAME="lfrfid") diff --git a/lib/mbedtls.scons b/lib/mbedtls.scons index e39d9dae..b57221a4 100644 --- a/lib/mbedtls.scons +++ b/lib/mbedtls.scons @@ -11,6 +11,14 @@ env.Append( libenv = env.Clone(FW_LIB_NAME="mbedtls") libenv.ApplyLibFlags() +libenv.AppendUnique( + CCFLAGS=[ + # Required for lib to be linkable with .faps + "-mword-relocations", + "-mlong-calls", + ], +) + sources = [ "mbedtls/library/des.c", "mbedtls/library/sha1.c", diff --git a/lib/subghz/SConscript b/lib/subghz/SConscript index 50c92cbd..eff2f168 100644 --- a/lib/subghz/SConscript +++ b/lib/subghz/SConscript @@ -10,6 +10,7 @@ env.Append( File("#/lib/subghz/subghz_worker.h"), File("#/lib/subghz/subghz_tx_rx_worker.h"), File("#/lib/subghz/transmitter.h"), + File("#/lib/subghz/protocols/raw.h"), ], ) diff --git a/lib/subghz/protocols/raw.h b/lib/subghz/protocols/raw.h index 00654ad2..b52a7d84 100644 --- a/lib/subghz/protocols/raw.h +++ b/lib/subghz/protocols/raw.h @@ -4,6 +4,10 @@ #define SUBGHZ_PROTOCOL_RAW_NAME "RAW" +#ifdef __cplusplus +extern "C" { +#endif + typedef void (*SubGhzProtocolEncoderRAWCallbackEnd)(void* context); typedef struct SubGhzProtocolDecoderRAW SubGhzProtocolDecoderRAW; @@ -99,12 +103,6 @@ void subghz_protocol_encoder_raw_free(void* context); */ void subghz_protocol_encoder_raw_stop(void* context); -/** - * Сallback on completion of file transfer. - * @param context Pointer to a SubGhzProtocolEncoderRAW instance - */ -void subghz_protocol_raw_file_encoder_worker_callback_end(void* context); - /** * Set callback on completion of file transfer. * @param instance Pointer to a SubGhzProtocolEncoderRAW instance @@ -137,3 +135,7 @@ bool subghz_protocol_encoder_raw_deserialize(void* context, FlipperFormat* flipp * @return LevelDuration */ LevelDuration subghz_protocol_encoder_raw_yield(void* context); + +#ifdef __cplusplus +} +#endif diff --git a/lib/toolbox/SConscript b/lib/toolbox/SConscript index 6ced34d7..d631431e 100644 --- a/lib/toolbox/SConscript +++ b/lib/toolbox/SConscript @@ -23,6 +23,8 @@ env.Append( File("#/lib/toolbox/stream/stream.h"), File("#/lib/toolbox/stream/file_stream.h"), File("#/lib/toolbox/stream/string_stream.h"), + File("#/lib/toolbox/stream/buffered_file_stream.h"), + File("#/lib/toolbox/protocols/protocol_dict.h"), ], ) diff --git a/site_scons/extapps.scons b/site_scons/extapps.scons index cfffda04..4cb5e35c 100644 --- a/site_scons/extapps.scons +++ b/site_scons/extapps.scons @@ -63,7 +63,10 @@ def build_app_as_external(env, appdef): extapps["dist"][appdef.appid] = (appdef.fap_category, compact_elf) -apps_to_build_as_faps = [FlipperAppType.PLUGIN, FlipperAppType.EXTERNAL] +apps_to_build_as_faps = [ + FlipperAppType.PLUGIN, + FlipperAppType.EXTERNAL, +] if appenv["DEBUG_TOOLS"]: apps_to_build_as_faps.append(FlipperAppType.DEBUG) diff --git a/site_scons/fbt/appmanifest.py b/site_scons/fbt/appmanifest.py index a41717d6..a0ab5e7c 100644 --- a/site_scons/fbt/appmanifest.py +++ b/site_scons/fbt/appmanifest.py @@ -36,11 +36,16 @@ class FlipperApplication: icon: Optional[str] = None order: int = 0 sdk_headers: List[str] = field(default_factory=list) - version: Tuple[int] = field(default_factory=lambda: (0, 0)) + # .fap-specific sources: List[str] = field(default_factory=lambda: ["*.c*"]) + fap_version: Tuple[int] = field(default_factory=lambda: (0, 0)) fap_icon: Optional[str] = None fap_libs: List[str] = field(default_factory=list) fap_category: str = "" + fap_description: str = "" + fap_author: str = "" + fap_weburl: str = "" + # Internally used by fbt _appdir: Optional[object] = None _apppath: Optional[str] = None diff --git a/site_scons/fbt/elfmanifest.py b/site_scons/fbt/elfmanifest.py index 2f54810d..313a64c0 100644 --- a/site_scons/fbt/elfmanifest.py +++ b/site_scons/fbt/elfmanifest.py @@ -66,8 +66,8 @@ def assemble_manifest_data( ) image_data = image.data - app_version_as_int = ((app_manifest.version[0] & 0xFFFF) << 16) | ( - app_manifest.version[1] & 0xFFFF + app_version_as_int = ((app_manifest.fap_version[0] & 0xFFFF) << 16) | ( + app_manifest.fap_version[1] & 0xFFFF ) data = ElfManifestBaseHeader( diff --git a/site_scons/fbt/sdk.py b/site_scons/fbt/sdk.py index 2e951040..3d4a17b2 100644 --- a/site_scons/fbt/sdk.py +++ b/site_scons/fbt/sdk.py @@ -329,7 +329,6 @@ class SdkCache: self.sdk = ApiEntries() self.disabled_entries = set() self.new_entries = set() - self.loaded_dirty = False self.loaded_dirty_version = False self.version_action = VersionBump.NONE @@ -340,8 +339,7 @@ class SdkCache: return ( self.version != SdkVersion(0, 0) and self.version_action == VersionBump.NONE - and not self.loaded_dirty - and not self.new_entries + and not self._have_pending_entries() ) def _filter_enabled(self, sdk_entries): @@ -388,21 +386,12 @@ class SdkCache: if self._load_version_only: raise Exception("Only SDK version was loaded, cannot save") - version_is_clean = True - if self.loaded_dirty: - # There are still new entries and version was already updated - version_is_clean = False - if self.version_action == VersionBump.MINOR: self.version = SdkVersion(self.version.major, self.version.minor + 1) - version_is_clean = False elif self.version_action == VersionBump.MAJOR: self.version = SdkVersion(self.version.major + 1, 0) - version_is_clean = False - if version_is_clean: - print(f"API version {self.version} is up to date") - else: + if self._have_pending_entries(): self.new_entries.add(self.version) print( f"API version is still WIP: {self.version}. Review the changes and re-run command." @@ -418,16 +407,23 @@ class SdkCache: ) ) ) + else: + print(f"API version {self.version} is up to date") - if not version_is_clean or self.loaded_dirty_version: - # Regenerate cache file + regenerate_csv = ( + self.loaded_dirty_version + or self._have_pending_entries() + or self.version_action != VersionBump.NONE + ) + + if regenerate_csv: str_cache_entries = [self.version] name_getter = operator.attrgetter("name") str_cache_entries.extend(sorted(self.sdk.headers, key=name_getter)) str_cache_entries.extend(sorted(self.sdk.functions, key=name_getter)) str_cache_entries.extend(sorted(self.sdk.variables, key=name_getter)) - with open(self.cache_file_name, "w", newline="") as f: + with open(self.cache_file_name, "wt", newline="") as f: writer = csv.DictWriter(f, fieldnames=SdkCache.CSV_FIELD_NAMES) writer.writeheader() @@ -476,28 +472,37 @@ class SdkCache: f"Cannot load symbol cache '{self.cache_file_name}'! File does not exist" ) - with open(self.cache_file_name, "r") as f: + with open(self.cache_file_name, "rt") as f: reader = csv.DictReader(f) for row in reader: self._process_entry(row) if self._load_version_only and row.get("entry") == SdkVersion.csv_type: break - self.loaded_dirty = bool(self.new_entries) - def sync_sets(self, known_set: Set[Any], new_set: Set[Any]): + def _have_pending_entries(self) -> bool: + return any( + filter( + lambda e: not isinstance(e, SdkVersion), + self.new_entries, + ) + ) + + def sync_sets( + self, known_set: Set[Any], new_set: Set[Any], update_version: bool = True + ): new_entries = new_set - known_set if new_entries: print(f"New: {new_entries}") known_set |= new_entries self.new_entries |= new_entries - if self.version_action == VersionBump.NONE: + if update_version and self.version_action == VersionBump.NONE: self.version_action = VersionBump.MINOR removed_entries = known_set - new_set if removed_entries: print(f"Removed: {removed_entries}") known_set -= removed_entries - # If any of removed entries was part of active API, that's a major bump - if any( + # If any of removed entries was a part of active API, that's a major bump + if update_version and any( filter( lambda e: e not in self.disabled_entries and e not in self.new_entries, @@ -509,6 +514,6 @@ class SdkCache: self.new_entries -= removed_entries def validate_api(self, api: ApiEntries) -> None: - self.sync_sets(self.sdk.headers, api.headers) + self.sync_sets(self.sdk.headers, api.headers, False) self.sync_sets(self.sdk.functions, api.functions) self.sync_sets(self.sdk.variables, api.variables) diff --git a/site_scons/fbt/version.py b/site_scons/fbt/version.py index 4745c700..1b1c166f 100644 --- a/site_scons/fbt/version.py +++ b/site_scons/fbt/version.py @@ -1,7 +1,9 @@ import subprocess import datetime +from functools import cache +@cache def get_fast_git_version_id(): try: version = ( diff --git a/site_scons/site_tools/fbt_sdk.py b/site_scons/site_tools/fbt_sdk.py index 26d66365..f6c2d452 100644 --- a/site_scons/site_tools/fbt_sdk.py +++ b/site_scons/site_tools/fbt_sdk.py @@ -15,6 +15,7 @@ from fbt.sdk import SdkCollector, SdkCache def prebuild_sdk_emitter(target, source, env): target.append(env.ChangeFileExtension(target[0], ".d")) + target.append(env.ChangeFileExtension(target[0], ".i.c")) return target, source