[FL-1990] Correct release type in copro manifest and rename boot to bootloader (#787)
* World: rename boot to bootloader. * Scripts: correct release type in copro bundler.
This commit is contained in:
		
							parent
							
								
									d9d33a0213
								
							
						
					
					
						commit
						ae016ce464
					
				| @ -129,11 +129,11 @@ static DialogMessageButton fw_version_screen(DialogsApp* dialogs, DialogMessage* | |||||||
|     return result; |     return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static DialogMessageButton boot_version_screen(DialogsApp* dialogs, DialogMessage* message) { | static DialogMessageButton bootloader_version_screen(DialogsApp* dialogs, DialogMessage* message) { | ||||||
|     DialogMessageButton result; |     DialogMessageButton result; | ||||||
|     string_t buffer; |     string_t buffer; | ||||||
|     string_init(buffer); |     string_init(buffer); | ||||||
|     const Version* ver = furi_hal_version_get_boot_version(); |     const Version* ver = furi_hal_version_get_bootloader_version(); | ||||||
| 
 | 
 | ||||||
|     if(!ver) { |     if(!ver) { | ||||||
|         string_cat_printf(buffer, "No info\n"); |         string_cat_printf(buffer, "No info\n"); | ||||||
| @ -167,7 +167,7 @@ const AboutDialogScreen about_screens[] = { | |||||||
|     icon2_screen, |     icon2_screen, | ||||||
|     hw_version_screen, |     hw_version_screen, | ||||||
|     fw_version_screen, |     fw_version_screen, | ||||||
|     boot_version_screen}; |     bootloader_version_screen}; | ||||||
| 
 | 
 | ||||||
| const size_t about_screens_count = sizeof(about_screens) / sizeof(AboutDialogScreen); | const size_t about_screens_count = sizeof(about_screens) / sizeof(AboutDialogScreen); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -56,13 +56,13 @@ static const uint8_t enclave_signature_expected[ENCLAVE_SIGNATURE_KEY_SLOTS][ENC | |||||||
|  */ |  */ | ||||||
| void cli_command_device_info(Cli* cli, string_t args, void* context) { | void cli_command_device_info(Cli* cli, string_t args, void* context) { | ||||||
|     // Device Info version
 |     // Device Info version
 | ||||||
|     printf("device_info_major   : %d\r\n", 1); |     printf("device_info_major       : %d\r\n", 2); | ||||||
|     printf("device_info_minor   : %d\r\n", 0); |     printf("device_info_minor       : %d\r\n", 0); | ||||||
|     // Model name
 |     // Model name
 | ||||||
|     printf("hardware_model      : %s\r\n", furi_hal_version_get_model_name()); |     printf("hardware_model          : %s\r\n", furi_hal_version_get_model_name()); | ||||||
| 
 | 
 | ||||||
|     // Unique ID
 |     // Unique ID
 | ||||||
|     printf("hardware_uid        : "); |     printf("hardware_uid            : "); | ||||||
|     const uint8_t* uid = furi_hal_version_uid(); |     const uint8_t* uid = furi_hal_version_uid(); | ||||||
|     for(size_t i = 0; i < furi_hal_version_uid_size(); i++) { |     for(size_t i = 0; i < furi_hal_version_uid_size(); i++) { | ||||||
|         printf("%02X", uid[i]); |         printf("%02X", uid[i]); | ||||||
| @ -70,69 +70,69 @@ void cli_command_device_info(Cli* cli, string_t args, void* context) { | |||||||
|     printf("\r\n"); |     printf("\r\n"); | ||||||
| 
 | 
 | ||||||
|     // OTP Revision
 |     // OTP Revision
 | ||||||
|     printf("hardware_otp_ver    : %d\r\n", furi_hal_version_get_otp_version()); |     printf("hardware_otp_ver        : %d\r\n", furi_hal_version_get_otp_version()); | ||||||
|     printf("hardware_timestamp  : %lu\r\n", furi_hal_version_get_hw_timestamp()); |     printf("hardware_timestamp      : %lu\r\n", furi_hal_version_get_hw_timestamp()); | ||||||
| 
 | 
 | ||||||
|     // Board Revision
 |     // Board Revision
 | ||||||
|     printf("hardware_ver        : %d\r\n", furi_hal_version_get_hw_version()); |     printf("hardware_ver            : %d\r\n", furi_hal_version_get_hw_version()); | ||||||
|     printf("hardware_target     : %d\r\n", furi_hal_version_get_hw_target()); |     printf("hardware_target         : %d\r\n", furi_hal_version_get_hw_target()); | ||||||
|     printf("hardware_body       : %d\r\n", furi_hal_version_get_hw_body()); |     printf("hardware_body           : %d\r\n", furi_hal_version_get_hw_body()); | ||||||
|     printf("hardware_connect    : %d\r\n", furi_hal_version_get_hw_connect()); |     printf("hardware_connect        : %d\r\n", furi_hal_version_get_hw_connect()); | ||||||
|     printf("hardware_display    : %d\r\n", furi_hal_version_get_hw_display()); |     printf("hardware_display        : %d\r\n", furi_hal_version_get_hw_display()); | ||||||
| 
 | 
 | ||||||
|     // Board Personification
 |     // Board Personification
 | ||||||
|     printf("hardware_color      : %d\r\n", furi_hal_version_get_hw_color()); |     printf("hardware_color          : %d\r\n", furi_hal_version_get_hw_color()); | ||||||
|     printf("hardware_region     : %d\r\n", furi_hal_version_get_hw_region()); |     printf("hardware_region         : %d\r\n", furi_hal_version_get_hw_region()); | ||||||
|     const char* name = furi_hal_version_get_name_ptr(); |     const char* name = furi_hal_version_get_name_ptr(); | ||||||
|     if(name) { |     if(name) { | ||||||
|         printf("hardware_name       : %s\r\n", name); |         printf("hardware_name           : %s\r\n", name); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // Bootloader Version
 |     // Bootloader Version
 | ||||||
|     const Version* boot_version = furi_hal_version_get_boot_version(); |     const Version* bootloader_version = furi_hal_version_get_bootloader_version(); | ||||||
|     if(boot_version) { |     if(bootloader_version) { | ||||||
|         printf("boot_commit         : %s\r\n", version_get_githash(boot_version)); |         printf("bootloader_commit       : %s\r\n", version_get_githash(bootloader_version)); | ||||||
|         printf("boot_branch         : %s\r\n", version_get_gitbranch(boot_version)); |         printf("bootloader_branch       : %s\r\n", version_get_gitbranch(bootloader_version)); | ||||||
|         printf("boot_branch_num     : %s\r\n", version_get_gitbranchnum(boot_version)); |         printf("bootloader_branch_num   : %s\r\n", version_get_gitbranchnum(bootloader_version)); | ||||||
|         printf("boot_version        : %s\r\n", version_get_version(boot_version)); |         printf("bootloader_version      : %s\r\n", version_get_version(bootloader_version)); | ||||||
|         printf("boot_build_date     : %s\r\n", version_get_builddate(boot_version)); |         printf("bootloader_build_date   : %s\r\n", version_get_builddate(bootloader_version)); | ||||||
|         printf("boot_target         : %d\r\n", version_get_target(boot_version)); |         printf("bootloader_target       : %d\r\n", version_get_target(bootloader_version)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // Firmware version
 |     // Firmware version
 | ||||||
|     const Version* firmware_version = furi_hal_version_get_firmware_version(); |     const Version* firmware_version = furi_hal_version_get_firmware_version(); | ||||||
|     if(firmware_version) { |     if(firmware_version) { | ||||||
|         printf("firmware_commit     : %s\r\n", version_get_githash(firmware_version)); |         printf("firmware_commit         : %s\r\n", version_get_githash(firmware_version)); | ||||||
|         printf("firmware_branch     : %s\r\n", version_get_gitbranch(firmware_version)); |         printf("firmware_branch         : %s\r\n", version_get_gitbranch(firmware_version)); | ||||||
|         printf("firmware_branch_num : %s\r\n", version_get_gitbranchnum(firmware_version)); |         printf("firmware_branch_num     : %s\r\n", version_get_gitbranchnum(firmware_version)); | ||||||
|         printf("firmware_version    : %s\r\n", version_get_version(firmware_version)); |         printf("firmware_version        : %s\r\n", version_get_version(firmware_version)); | ||||||
|         printf("firmware_build_date : %s\r\n", version_get_builddate(firmware_version)); |         printf("firmware_build_date     : %s\r\n", version_get_builddate(firmware_version)); | ||||||
|         printf("firmware_target     : %d\r\n", version_get_target(firmware_version)); |         printf("firmware_target         : %d\r\n", version_get_target(firmware_version)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     WirelessFwInfo_t pWirelessInfo; |     WirelessFwInfo_t pWirelessInfo; | ||||||
|     if(furi_hal_bt_is_alive() && SHCI_GetWirelessFwInfo(&pWirelessInfo) == SHCI_Success) { |     if(furi_hal_bt_is_alive() && SHCI_GetWirelessFwInfo(&pWirelessInfo) == SHCI_Success) { | ||||||
|         printf("radio_alive         : true\r\n"); |         printf("radio_alive             : true\r\n"); | ||||||
|         // FUS Info
 |         // FUS Info
 | ||||||
|         printf("radio_fus_major     : %d\r\n", pWirelessInfo.FusVersionMajor); |         printf("radio_fus_major         : %d\r\n", pWirelessInfo.FusVersionMajor); | ||||||
|         printf("radio_fus_minor     : %d\r\n", pWirelessInfo.FusVersionMinor); |         printf("radio_fus_minor         : %d\r\n", pWirelessInfo.FusVersionMinor); | ||||||
|         printf("radio_fus_sub       : %d\r\n", pWirelessInfo.FusVersionSub); |         printf("radio_fus_sub           : %d\r\n", pWirelessInfo.FusVersionSub); | ||||||
|         printf("radio_fus_sram2b    : %dK\r\n", pWirelessInfo.FusMemorySizeSram2B); |         printf("radio_fus_sram2b        : %dK\r\n", pWirelessInfo.FusMemorySizeSram2B); | ||||||
|         printf("radio_fus_sram2a    : %dK\r\n", pWirelessInfo.FusMemorySizeSram2A); |         printf("radio_fus_sram2a        : %dK\r\n", pWirelessInfo.FusMemorySizeSram2A); | ||||||
|         printf("radio_fus_flash     : %dK\r\n", pWirelessInfo.FusMemorySizeFlash * 4); |         printf("radio_fus_flash         : %dK\r\n", pWirelessInfo.FusMemorySizeFlash * 4); | ||||||
|         // Stack Info
 |         // Stack Info
 | ||||||
|         printf("radio_stack_type    : %d\r\n", pWirelessInfo.StackType); |         printf("radio_stack_type        : %d\r\n", pWirelessInfo.StackType); | ||||||
|         printf("radio_stack_major   : %d\r\n", pWirelessInfo.VersionMajor); |         printf("radio_stack_major       : %d\r\n", pWirelessInfo.VersionMajor); | ||||||
|         printf("radio_stack_minor   : %d\r\n", pWirelessInfo.VersionMinor); |         printf("radio_stack_minor       : %d\r\n", pWirelessInfo.VersionMinor); | ||||||
|         printf("radio_stack_sub     : %d\r\n", pWirelessInfo.VersionSub); |         printf("radio_stack_sub         : %d\r\n", pWirelessInfo.VersionSub); | ||||||
|         printf("radio_stack_branch  : %d\r\n", pWirelessInfo.VersionBranch); |         printf("radio_stack_branch      : %d\r\n", pWirelessInfo.VersionBranch); | ||||||
|         printf("radio_stack_release : %d\r\n", pWirelessInfo.VersionReleaseType); |         printf("radio_stack_release     : %d\r\n", pWirelessInfo.VersionReleaseType); | ||||||
|         printf("radio_stack_sram2b  : %dK\r\n", pWirelessInfo.MemorySizeSram2B); |         printf("radio_stack_sram2b      : %dK\r\n", pWirelessInfo.MemorySizeSram2B); | ||||||
|         printf("radio_stack_sram2a  : %dK\r\n", pWirelessInfo.MemorySizeSram2A); |         printf("radio_stack_sram2a      : %dK\r\n", pWirelessInfo.MemorySizeSram2A); | ||||||
|         printf("radio_stack_sram1   : %dK\r\n", pWirelessInfo.MemorySizeSram1); |         printf("radio_stack_sram1       : %dK\r\n", pWirelessInfo.MemorySizeSram1); | ||||||
|         printf("radio_stack_flash   : %dK\r\n", pWirelessInfo.MemorySizeFlash * 4); |         printf("radio_stack_flash       : %dK\r\n", pWirelessInfo.MemorySizeFlash * 4); | ||||||
|         // Mac address
 |         // Mac address
 | ||||||
|         printf("radio_ble_mac       : "); |         printf("radio_ble_mac           : "); | ||||||
|         const uint8_t* ble_mac = furi_hal_version_get_ble_mac(); |         const uint8_t* ble_mac = furi_hal_version_get_ble_mac(); | ||||||
|         for(size_t i = 0; i < 6; i++) { |         for(size_t i = 0; i < 6; i++) { | ||||||
|             printf("%02X", ble_mac[i]); |             printf("%02X", ble_mac[i]); | ||||||
| @ -154,12 +154,12 @@ void cli_command_device_info(Cli* cli, string_t args, void* context) { | |||||||
|                 furi_hal_crypto_store_unload_key(key_slot + 1); |                 furi_hal_crypto_store_unload_key(key_slot + 1); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         printf("enclave_valid_keys  : %d\r\n", enclave_valid_keys); |         printf("enclave_valid_keys      : %d\r\n", enclave_valid_keys); | ||||||
|         printf( |         printf( | ||||||
|             "enclave_valid       : %s\r\n", |             "enclave_valid           : %s\r\n", | ||||||
|             (enclave_valid_keys == ENCLAVE_SIGNATURE_KEY_SLOTS) ? "true" : "false"); |             (enclave_valid_keys == ENCLAVE_SIGNATURE_KEY_SLOTS) ? "true" : "false"); | ||||||
|     } else { |     } else { | ||||||
|         printf("radio_alive         : false\r\n"); |         printf("radio_alive             : false\r\n"); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -42,7 +42,7 @@ void desktop_debug_render(Canvas* canvas, void* model) { | |||||||
|             my_name ? my_name : "Unknown"); |             my_name ? my_name : "Unknown"); | ||||||
|         canvas_draw_str(canvas, 5, 23, buffer); |         canvas_draw_str(canvas, 5, 23, buffer); | ||||||
| 
 | 
 | ||||||
|         ver = m->screen == DesktopViewStatsBoot ? furi_hal_version_get_boot_version() : |         ver = m->screen == DesktopViewStatsBoot ? furi_hal_version_get_bootloader_version() : | ||||||
|                                                   furi_hal_version_get_firmware_version(); |                                                   furi_hal_version_get_firmware_version(); | ||||||
| 
 | 
 | ||||||
|         if(!ver) { |         if(!ver) { | ||||||
|  | |||||||
| @ -23,7 +23,7 @@ void power_cli_factory_reset(Cli* cli, string_t args, void* context) { | |||||||
|     char c = cli_getc(cli); |     char c = cli_getc(cli); | ||||||
|     if(c == 'y' || c == 'Y') { |     if(c == 'y' || c == 'Y') { | ||||||
|         printf("Data will be wiped after reboot.\r\n"); |         printf("Data will be wiped after reboot.\r\n"); | ||||||
|         furi_hal_boot_set_flags(FuriHalBootFlagFactoryReset); |         furi_hal_bootloader_set_flags(FuriHalBootloaderFlagFactoryReset); | ||||||
|         power_reboot(PowerBootModeNormal); |         power_reboot(PowerBootModeNormal); | ||||||
|     } else { |     } else { | ||||||
|         printf("Safe choice.\r\n"); |         printf("Safe choice.\r\n"); | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| #include "power_i.h" | #include "power_i.h" | ||||||
| #include <furi.h> | #include <furi.h> | ||||||
| #include "furi-hal-power.h" | #include "furi-hal-power.h" | ||||||
| #include "furi-hal-boot.h" | #include "furi-hal-bootloader.h" | ||||||
| 
 | 
 | ||||||
| void power_off(Power* power) { | void power_off(Power* power) { | ||||||
|     furi_hal_power_off(); |     furi_hal_power_off(); | ||||||
| @ -14,9 +14,9 @@ void power_off(Power* power) { | |||||||
| 
 | 
 | ||||||
| void power_reboot(PowerBootMode mode) { | void power_reboot(PowerBootMode mode) { | ||||||
|     if(mode == PowerBootModeNormal) { |     if(mode == PowerBootModeNormal) { | ||||||
|         furi_hal_boot_set_mode(FuriHalBootModeNormal); |         furi_hal_bootloader_set_mode(FuriHalBootloaderModeNormal); | ||||||
|     } else if(mode == PowerBootModeDfu) { |     } else if(mode == PowerBootModeDfu) { | ||||||
|         furi_hal_boot_set_mode(FuriHalBootModeDFU); |         furi_hal_bootloader_set_mode(FuriHalBootloaderModeDFU); | ||||||
|     } |     } | ||||||
|     furi_hal_power_reset(); |     furi_hal_power_reset(); | ||||||
| } | } | ||||||
|  | |||||||
| @ -163,15 +163,15 @@ static LFSData* storage_int_lfs_data_alloc() { | |||||||
| 
 | 
 | ||||||
| static void storage_int_lfs_mount(LFSData* lfs_data, StorageData* storage) { | static void storage_int_lfs_mount(LFSData* lfs_data, StorageData* storage) { | ||||||
|     int err; |     int err; | ||||||
|     FuriHalBootFlag boot_flags = furi_hal_boot_get_flags(); |     FuriHalBootloaderFlag bootloader_flags = furi_hal_bootloader_get_flags(); | ||||||
|     lfs_t* lfs = &lfs_data->lfs; |     lfs_t* lfs = &lfs_data->lfs; | ||||||
| 
 | 
 | ||||||
|     if(boot_flags & FuriHalBootFlagFactoryReset) { |     if(bootloader_flags & FuriHalBootloaderFlagFactoryReset) { | ||||||
|         // Factory reset
 |         // Factory reset
 | ||||||
|         err = lfs_format(lfs, &lfs_data->config); |         err = lfs_format(lfs, &lfs_data->config); | ||||||
|         if(err == 0) { |         if(err == 0) { | ||||||
|             FURI_LOG_I(TAG, "Factory reset: Format successful, trying to mount"); |             FURI_LOG_I(TAG, "Factory reset: Format successful, trying to mount"); | ||||||
|             furi_hal_boot_set_flags(boot_flags & ~FuriHalBootFlagFactoryReset); |             furi_hal_bootloader_set_flags(bootloader_flags & ~FuriHalBootloaderFlagFactoryReset); | ||||||
|             err = lfs_mount(lfs, &lfs_data->config); |             err = lfs_mount(lfs, &lfs_data->config); | ||||||
|             if(err == 0) { |             if(err == 0) { | ||||||
|                 FURI_LOG_I(TAG, "Factory reset: Mounted"); |                 FURI_LOG_I(TAG, "Factory reset: Mounted"); | ||||||
|  | |||||||
| @ -272,7 +272,7 @@ const struct Version* furi_hal_version_get_firmware_version(void) { | |||||||
|     return version_get(); |     return version_get(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const struct Version* furi_hal_version_get_boot_version(void) { | const struct Version* furi_hal_version_get_bootloader_version(void) { | ||||||
| #ifdef NO_BOOTLOADER | #ifdef NO_BOOTLOADER | ||||||
|     return 0; |     return 0; | ||||||
| #else | #else | ||||||
|  | |||||||
| @ -272,7 +272,7 @@ const struct Version* furi_hal_version_get_firmware_version(void) { | |||||||
|     return version_get(); |     return version_get(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const struct Version* furi_hal_version_get_boot_version(void) { | const struct Version* furi_hal_version_get_bootloader_version(void) { | ||||||
| #ifdef NO_BOOTLOADER | #ifdef NO_BOOTLOADER | ||||||
|     return 0; |     return 0; | ||||||
| #else | #else | ||||||
|  | |||||||
| @ -148,7 +148,7 @@ const uint8_t* furi_hal_version_get_ble_mac(); | |||||||
|  * |  * | ||||||
|  * @return     Address of boot version structure. |  * @return     Address of boot version structure. | ||||||
|  */ |  */ | ||||||
| const struct Version* furi_hal_version_get_boot_version(); | const struct Version* furi_hal_version_get_bootloader_version(); | ||||||
| 
 | 
 | ||||||
| /** Get address of version structure of firmware.
 | /** Get address of version structure of firmware.
 | ||||||
|  * |  * | ||||||
|  | |||||||
| @ -25,7 +25,7 @@ static void flipper_print_version(const char* target, const Version* version) { | |||||||
| void flipper_init() { | void flipper_init() { | ||||||
|     const Version* version; |     const Version* version; | ||||||
| 
 | 
 | ||||||
|     version = (const Version*)furi_hal_version_get_boot_version(); |     version = (const Version*)furi_hal_version_get_bootloader_version(); | ||||||
|     flipper_print_version("Bootloader", version); |     flipper_print_version("Bootloader", version); | ||||||
| 
 | 
 | ||||||
|     version = (const Version*)furi_hal_version_get_firmware_version(); |     version = (const Version*)furi_hal_version_get_firmware_version(); | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| #include <furi-hal-boot.h> | #include <furi-hal-bootloader.h> | ||||||
| #include <stm32wbxx_ll_rtc.h> | #include <stm32wbxx_ll_rtc.h> | ||||||
| #include <furi.h> | #include <furi.h> | ||||||
| 
 | 
 | ||||||
| @ -7,25 +7,25 @@ | |||||||
| #define BOOT_REQUEST_CLEAN 0xDADEDADE | #define BOOT_REQUEST_CLEAN 0xDADEDADE | ||||||
| #define BOOT_REQUEST_DFU 0xDF00B000 | #define BOOT_REQUEST_DFU 0xDF00B000 | ||||||
| 
 | 
 | ||||||
| void furi_hal_boot_init() { | void furi_hal_bootloader_init() { | ||||||
| #ifndef DEBUG | #ifndef DEBUG | ||||||
|     LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, BOOT_REQUEST_TAINTED); |     LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, BOOT_REQUEST_TAINTED); | ||||||
| #endif | #endif | ||||||
|     FURI_LOG_I("FuriHalBoot", "Init OK"); |     FURI_LOG_I("FuriHalBoot", "Init OK"); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void furi_hal_boot_set_mode(FuriHalBootMode mode) { | void furi_hal_bootloader_set_mode(FuriHalBootloaderMode mode) { | ||||||
|     if (mode == FuriHalBootModeNormal) { |     if (mode == FuriHalBootloaderModeNormal) { | ||||||
|         LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, BOOT_REQUEST_CLEAN); |         LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, BOOT_REQUEST_CLEAN); | ||||||
|     } else if (mode == FuriHalBootModeDFU) { |     } else if (mode == FuriHalBootloaderModeDFU) { | ||||||
|         LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, BOOT_REQUEST_DFU); |         LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, BOOT_REQUEST_DFU); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void furi_hal_boot_set_flags(FuriHalBootFlag flags) { | void furi_hal_bootloader_set_flags(FuriHalBootloaderFlag flags) { | ||||||
|     LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR2, flags); |     LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR2, flags); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| FuriHalBootFlag furi_hal_boot_get_flags() { | FuriHalBootloaderFlag furi_hal_bootloader_get_flags() { | ||||||
|     return LL_RTC_BAK_GetRegister(RTC, LL_RTC_BKP_DR2); |     return LL_RTC_BAK_GetRegister(RTC, LL_RTC_BKP_DR2); | ||||||
| } | } | ||||||
| @ -276,7 +276,7 @@ const struct Version* furi_hal_version_get_firmware_version(void) { | |||||||
|     return version_get(); |     return version_get(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const struct Version* furi_hal_version_get_boot_version(void) { | const struct Version* furi_hal_version_get_bootloader_version(void) { | ||||||
| #ifdef NO_BOOTLOADER | #ifdef NO_BOOTLOADER | ||||||
|     return 0; |     return 0; | ||||||
| #else | #else | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ void furi_hal_init() { | |||||||
| 
 | 
 | ||||||
|     MX_RTC_Init(); |     MX_RTC_Init(); | ||||||
|     FURI_LOG_I("HAL", "RTC OK"); |     FURI_LOG_I("HAL", "RTC OK"); | ||||||
|     furi_hal_boot_init(); |     furi_hal_bootloader_init(); | ||||||
|     furi_hal_version_init(); |     furi_hal_version_init(); | ||||||
| 
 | 
 | ||||||
|     furi_hal_spi_init(); |     furi_hal_spi_init(); | ||||||
|  | |||||||
| @ -153,9 +153,9 @@ C_SOURCES += \ | |||||||
| 
 | 
 | ||||||
| # Linker options
 | # Linker options
 | ||||||
| ifeq ($(NO_BOOTLOADER), 1) | ifeq ($(NO_BOOTLOADER), 1) | ||||||
| LDFLAGS += -T$(MXPROJECT_DIR)/stm32wb55xx_flash_cm4_no_boot.ld | LDFLAGS += -T$(MXPROJECT_DIR)/stm32wb55xx_flash_cm4_no_bootloader.ld | ||||||
| else | else | ||||||
| LDFLAGS += -T$(MXPROJECT_DIR)/stm32wb55xx_flash_cm4_boot.ld | LDFLAGS += -T$(MXPROJECT_DIR)/stm32wb55xx_flash_cm4_with_bootloader.ld | ||||||
| endif | endif | ||||||
| 
 | 
 | ||||||
| SVD_FILE = ../debug/STM32WB55_CM4.svd | SVD_FILE = ../debug/STM32WB55_CM4.svd | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| #include <furi-hal-boot.h> | #include <furi-hal-bootloader.h> | ||||||
| #include <stm32wbxx_ll_rtc.h> | #include <stm32wbxx_ll_rtc.h> | ||||||
| #include <furi.h> | #include <furi.h> | ||||||
| 
 | 
 | ||||||
| @ -7,25 +7,25 @@ | |||||||
| #define BOOT_REQUEST_CLEAN 0xDADEDADE | #define BOOT_REQUEST_CLEAN 0xDADEDADE | ||||||
| #define BOOT_REQUEST_DFU 0xDF00B000 | #define BOOT_REQUEST_DFU 0xDF00B000 | ||||||
| 
 | 
 | ||||||
| void furi_hal_boot_init() { | void furi_hal_bootloader_init() { | ||||||
| #ifndef DEBUG | #ifndef DEBUG | ||||||
|     LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, BOOT_REQUEST_TAINTED); |     LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, BOOT_REQUEST_TAINTED); | ||||||
| #endif | #endif | ||||||
|     FURI_LOG_I("FuriHalBoot", "Init OK"); |     FURI_LOG_I("FuriHalBoot", "Init OK"); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void furi_hal_boot_set_mode(FuriHalBootMode mode) { | void furi_hal_bootloader_set_mode(FuriHalBootloaderMode mode) { | ||||||
|     if (mode == FuriHalBootModeNormal) { |     if (mode == FuriHalBootloaderModeNormal) { | ||||||
|         LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, BOOT_REQUEST_CLEAN); |         LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, BOOT_REQUEST_CLEAN); | ||||||
|     } else if (mode == FuriHalBootModeDFU) { |     } else if (mode == FuriHalBootloaderModeDFU) { | ||||||
|         LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, BOOT_REQUEST_DFU); |         LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, BOOT_REQUEST_DFU); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void furi_hal_boot_set_flags(FuriHalBootFlag flags) { | void furi_hal_bootloader_set_flags(FuriHalBootloaderFlag flags) { | ||||||
|     LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR2, flags); |     LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR2, flags); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| FuriHalBootFlag furi_hal_boot_get_flags() { | FuriHalBootloaderFlag furi_hal_bootloader_get_flags() { | ||||||
|     return LL_RTC_BAK_GetRegister(RTC, LL_RTC_BKP_DR2); |     return LL_RTC_BAK_GetRegister(RTC, LL_RTC_BKP_DR2); | ||||||
| } | } | ||||||
| @ -276,7 +276,7 @@ const struct Version* furi_hal_version_get_firmware_version(void) { | |||||||
|     return version_get(); |     return version_get(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const struct Version* furi_hal_version_get_boot_version(void) { | const struct Version* furi_hal_version_get_bootloader_version(void) { | ||||||
| #ifdef NO_BOOTLOADER | #ifdef NO_BOOTLOADER | ||||||
|     return 0; |     return 0; | ||||||
| #else | #else | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ void furi_hal_init() { | |||||||
| 
 | 
 | ||||||
|     MX_RTC_Init(); |     MX_RTC_Init(); | ||||||
|     FURI_LOG_I("HAL", "RTC OK"); |     FURI_LOG_I("HAL", "RTC OK"); | ||||||
|     furi_hal_boot_init(); |     furi_hal_bootloader_init(); | ||||||
|     furi_hal_version_init(); |     furi_hal_version_init(); | ||||||
| 
 | 
 | ||||||
|     furi_hal_spi_init(); |     furi_hal_spi_init(); | ||||||
|  | |||||||
| @ -153,9 +153,9 @@ C_SOURCES += \ | |||||||
| 
 | 
 | ||||||
| # Linker options
 | # Linker options
 | ||||||
| ifeq ($(NO_BOOTLOADER), 1) | ifeq ($(NO_BOOTLOADER), 1) | ||||||
| LDFLAGS += -T$(MXPROJECT_DIR)/stm32wb55xx_flash_cm4_no_boot.ld | LDFLAGS += -T$(MXPROJECT_DIR)/stm32wb55xx_flash_cm4_no_bootloader.ld | ||||||
| else | else | ||||||
| LDFLAGS += -T$(MXPROJECT_DIR)/stm32wb55xx_flash_cm4_boot.ld | LDFLAGS += -T$(MXPROJECT_DIR)/stm32wb55xx_flash_cm4_with_bootloader.ld | ||||||
| endif | endif | ||||||
| 
 | 
 | ||||||
| SVD_FILE = ../debug/STM32WB55_CM4.svd | SVD_FILE = ../debug/STM32WB55_CM4.svd | ||||||
|  | |||||||
| @ -1,50 +0,0 @@ | |||||||
| /**
 |  | ||||||
|  * @file furi-hal-boot.h |  | ||||||
|  * Bootloader HAL API |  | ||||||
|  */ |  | ||||||
| 
 |  | ||||||
| #pragma once |  | ||||||
| 
 |  | ||||||
| #include <stdint.h> |  | ||||||
| 
 |  | ||||||
| #ifdef __cplusplus |  | ||||||
| extern "C" { |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| /** Boot modes */ |  | ||||||
| typedef enum { |  | ||||||
|     FuriHalBootModeNormal, |  | ||||||
|     FuriHalBootModeDFU |  | ||||||
| } FuriHalBootMode; |  | ||||||
| 
 |  | ||||||
| /** Boot flags */ |  | ||||||
| typedef enum { |  | ||||||
|     FuriHalBootFlagDefault=0, |  | ||||||
|     FuriHalBootFlagFactoryReset=1, |  | ||||||
| } FuriHalBootFlag; |  | ||||||
| 
 |  | ||||||
| /** Initialize boot subsystem
 |  | ||||||
|  */ |  | ||||||
| void furi_hal_boot_init(); |  | ||||||
| 
 |  | ||||||
| /** Set boot mode
 |  | ||||||
|  * |  | ||||||
|  * @param[in]  mode  FuriHalBootMode |  | ||||||
|  */ |  | ||||||
| void furi_hal_boot_set_mode(FuriHalBootMode mode); |  | ||||||
| 
 |  | ||||||
| /** Set boot flags
 |  | ||||||
|  * |  | ||||||
|  * @param[in]  flags  FuriHalBootFlag |  | ||||||
|  */ |  | ||||||
| void furi_hal_boot_set_flags(FuriHalBootFlag flags); |  | ||||||
| 
 |  | ||||||
| /** Get boot flag
 |  | ||||||
|  * |  | ||||||
|  * @return     FuriHalBootFlag |  | ||||||
|  */ |  | ||||||
| FuriHalBootFlag furi_hal_boot_get_flags(); |  | ||||||
| 
 |  | ||||||
| #ifdef __cplusplus |  | ||||||
| } |  | ||||||
| #endif |  | ||||||
							
								
								
									
										50
									
								
								firmware/targets/furi-hal-include/furi-hal-bootloader.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								firmware/targets/furi-hal-include/furi-hal-bootloader.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,50 @@ | |||||||
|  | /**
 | ||||||
|  |  * @file furi-hal-bootloader.h | ||||||
|  |  * Bootloader HAL API | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #pragma once | ||||||
|  | 
 | ||||||
|  | #include <stdint.h> | ||||||
|  | 
 | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | /** Boot modes */ | ||||||
|  | typedef enum { | ||||||
|  |     FuriHalBootloaderModeNormal, | ||||||
|  |     FuriHalBootloaderModeDFU | ||||||
|  | } FuriHalBootloaderMode; | ||||||
|  | 
 | ||||||
|  | /** Boot flags */ | ||||||
|  | typedef enum { | ||||||
|  |     FuriHalBootloaderFlagDefault=0, | ||||||
|  |     FuriHalBootloaderFlagFactoryReset=1, | ||||||
|  | } FuriHalBootloaderFlag; | ||||||
|  | 
 | ||||||
|  | /** Initialize boot subsystem
 | ||||||
|  |  */ | ||||||
|  | void furi_hal_bootloader_init(); | ||||||
|  | 
 | ||||||
|  | /** Set bootloader mode
 | ||||||
|  |  * | ||||||
|  |  * @param[in]  mode  FuriHalBootloaderMode | ||||||
|  |  */ | ||||||
|  | void furi_hal_bootloader_set_mode(FuriHalBootloaderMode mode); | ||||||
|  | 
 | ||||||
|  | /** Set bootloader flags
 | ||||||
|  |  * | ||||||
|  |  * @param[in]  flags  FuriHalBootloaderFlag | ||||||
|  |  */ | ||||||
|  | void furi_hal_bootloader_set_flags(FuriHalBootloaderFlag flags); | ||||||
|  | 
 | ||||||
|  | /** Get boot flag
 | ||||||
|  |  * | ||||||
|  |  * @return     FuriHalBootloaderFlag | ||||||
|  |  */ | ||||||
|  | FuriHalBootloaderFlag furi_hal_bootloader_get_flags(); | ||||||
|  | 
 | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
| @ -148,7 +148,7 @@ const uint8_t* furi_hal_version_get_ble_mac(); | |||||||
|  * |  * | ||||||
|  * @return     Address of boot version structure. |  * @return     Address of boot version structure. | ||||||
|  */ |  */ | ||||||
| const struct Version* furi_hal_version_get_boot_version(); | const struct Version* furi_hal_version_get_bootloader_version(); | ||||||
| 
 | 
 | ||||||
| /** Get address of version structure of firmware.
 | /** Get address of version structure of firmware.
 | ||||||
|  * |  * | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ | |||||||
| template <unsigned int N> struct STOP_EXTERNING_ME {}; | template <unsigned int N> struct STOP_EXTERNING_ME {}; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #include "furi-hal-boot.h" | #include "furi-hal-bootloader.h" | ||||||
| #include "furi-hal-clock.h" | #include "furi-hal-clock.h" | ||||||
| #include "furi-hal-crypto.h" | #include "furi-hal-crypto.h" | ||||||
| #include "furi-hal-console.h" | #include "furi-hal-console.h" | ||||||
|  | |||||||
| @ -18,14 +18,14 @@ class Main(App): | |||||||
|         self.parser_wipe = self.subparsers.add_parser("wipe", help="Wipe MCU Flash") |         self.parser_wipe = self.subparsers.add_parser("wipe", help="Wipe MCU Flash") | ||||||
|         self.parser_wipe.set_defaults(func=self.wipe) |         self.parser_wipe.set_defaults(func=self.wipe) | ||||||
|         # Core 1 boot |         # Core 1 boot | ||||||
|         self.parser_core1boot = self.subparsers.add_parser( |         self.parser_core1bootloader = self.subparsers.add_parser( | ||||||
|             "core1boot", help="Flash Core1 Bootloader" |             "core1bootloader", help="Flash Core1 Bootloader" | ||||||
|         ) |         ) | ||||||
|         self._addArgsSWD(self.parser_core1boot) |         self._addArgsSWD(self.parser_core1bootloader) | ||||||
|         self.parser_core1boot.add_argument( |         self.parser_core1bootloader.add_argument( | ||||||
|             "bootloader", type=str, help="Bootloader binary" |             "bootloader", type=str, help="Bootloader binary" | ||||||
|         ) |         ) | ||||||
|         self.parser_core1boot.set_defaults(func=self.core1boot) |         self.parser_core1bootloader.set_defaults(func=self.core1bootloader) | ||||||
|         # Core 1 firmware |         # Core 1 firmware | ||||||
|         self.parser_core1firmware = self.subparsers.add_parser( |         self.parser_core1firmware = self.subparsers.add_parser( | ||||||
|             "core1firmware", help="Flash Core1 Firmware" |             "core1firmware", help="Flash Core1 Firmware" | ||||||
| @ -37,7 +37,7 @@ class Main(App): | |||||||
|         self.parser_core1firmware.set_defaults(func=self.core1firmware) |         self.parser_core1firmware.set_defaults(func=self.core1firmware) | ||||||
|         # Core 1 all |         # Core 1 all | ||||||
|         self.parser_core1 = self.subparsers.add_parser( |         self.parser_core1 = self.subparsers.add_parser( | ||||||
|             "core1", help="Flash Core1 Boot and Firmware" |             "core1", help="Flash Core1 Bootloader and Firmware" | ||||||
|         ) |         ) | ||||||
|         self._addArgsSWD(self.parser_core1) |         self._addArgsSWD(self.parser_core1) | ||||||
|         self.parser_core1.add_argument("bootloader", type=str, help="Bootloader binary") |         self.parser_core1.add_argument("bootloader", type=str, help="Bootloader binary") | ||||||
| @ -97,7 +97,7 @@ class Main(App): | |||||||
|         self.logger.info(f"Complete") |         self.logger.info(f"Complete") | ||||||
|         return 0 |         return 0 | ||||||
| 
 | 
 | ||||||
|     def core1boot(self): |     def core1bootloader(self): | ||||||
|         self.logger.info(f"Flashing bootloader") |         self.logger.info(f"Flashing bootloader") | ||||||
|         cp = CubeProgrammer(self.args.port) |         cp = CubeProgrammer(self.args.port) | ||||||
|         cp.flashBin("0x08000000", self.args.bootloader) |         cp.flashBin("0x08000000", self.args.bootloader) | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ MANIFEST_TEMPLATE = { | |||||||
|                 "minor": 12, |                 "minor": 12, | ||||||
|                 "sub": 1, |                 "sub": 1, | ||||||
|                 "branch": 0, |                 "branch": 0, | ||||||
|                 "release": 7, |                 "release": 1, | ||||||
|             }, |             }, | ||||||
|             "files": [], |             "files": [], | ||||||
|         }, |         }, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 あく
						あく