8#ifndef INC_UPDATE_FW_H_
9#define INC_UPDATE_FW_H_
28#ifdef UBI_SDK_TARGET_ESP32
32#define IN_MAIN_APP_STATUS 0x01
33#define IN_BOOTLOADER_STATUS 0x02
35#define BAD_CRC_FIRMWARE 0x1E
36#define GOOD_CRC_FIRMWARE 0x2E
38#define BAD_COMPARE 0x00
39#define GOOD_COMPARE 0x01
41#define SIZE_BUFF_FOR_BOOT 1024
43#define SIZE_FW_INFO_STRUCT 10
45#define BEGIN_CALCULATE_CRC 0x01
46#define END_CALCULATE_CRC 0x00
136#ifdef UBI_SDK_FAMILY_STM32
141#elif defined(UBI_SDK_TARGET_ESP32)
142 uint32_t calculate_crc_func(partition_flash_driver_struct* memory_driver,
base_FWInfo_struct *l_FW_struct, uint32_t calculate_part_delay);
144 void StartESP_Bootloader();
145 void SetESP_Bootloader();
Definition update_fw.h:49
uint32_t BoardAdditionalInfo
Definition update_fw.h:60
uint8_t SDKMinorVersion
Definition update_fw.h:77
uint8_t FWType
Definition update_fw.h:69
uint8_t BoardCode
Definition update_fw.h:57
uint8_t FWCode
Definition update_fw.h:70
uint8_t FWMinorVersion
Definition update_fw.h:64
uint32_t FWSize
Definition update_fw.h:73
uint16_t BoardBuild
Definition update_fw.h:55
uint8_t SDKQuickFixVersion
Definition update_fw.h:78
uint8_t SDKMajorVersion
Definition update_fw.h:76
uint8_t BoardRev
Definition update_fw.h:53
uint8_t FWSinceLastTag
Definition update_fw.h:66
uint8_t FWQuickFixVersion
Definition update_fw.h:65
uint8_t FWMajorVersion
Definition update_fw.h:63
uint8_t BoardVersion
Definition update_fw.h:51
uint8_t BoardSubRev
Definition update_fw.h:54
uint8_t SDKSinceLastTag
Definition update_fw.h:79
uint32_t FWCRC
Definition update_fw.h:74
char FWLabel[16]
Definition update_fw.h:68
uint32_t FWStartAddress
Definition update_fw.h:72
uint32_t FWAdditionalInfo
Definition update_fw.h:82
uint8_t BoardAdditionalInfoType
Definition update_fw.h:59
uint8_t BoardSubVersion
Definition update_fw.h:52
char FWName[32]
Definition update_fw.h:62
char BoardName[32]
Definition update_fw.h:50
uint8_t BoardType
Definition update_fw.h:56
uint8_t FWAdditionalInfoType
Definition update_fw.h:81
Definition update_fw.h:87
uint32_t bytes_interval
Definition update_fw.h:89
uint16_t timeout_ms
Definition update_fw.h:90
uint16_t flash_clear_delay_ms
Definition update_fw.h:91
uint16_t chanck_size
Definition update_fw.h:88
Definition device_info_structs.h:97
Definition device_info_structs.h:137
Definition device_info_structs.h:112
Definition a_protocol_struct.h:18
Definition a_protocol.h:313
uint8_t Get_Enable_CRC(void)
The function returned by flag_crc.
Definition update_fw.c:750
void Calculate_CRC()
A function for calculating the CRC of downloaded firmware from memory.
Definition update_fw.c:728
void Set_Enable_CRC(uint8_t value)
The function being modified by flag_crc.
Definition update_fw.c:770
state_process_bootloader
Definition update_fw.h:114
@ DONE_CALCULATE_CRC
Definition update_fw.h:122
@ BOOTLOADER_CHECK_INFO_FW
Definition update_fw.h:120
@ BOOTLOADER_PRELOAD_STATE
Definition update_fw.h:118
@ PROCESSING_CLER
Definition update_fw.h:116
@ DONE_CLEAR
Definition update_fw.h:117
@ BOOTLOADER_CONTINUE_WRITE_FW
Definition update_fw.h:119
@ BOOTLOADER_IDLE
Definition update_fw.h:115
@ PROCESSING_CULCULATE_CRC
Definition update_fw.h:121
void Update_FW_Receive(base_device_information_struct *deviceInfo, ubi4_bus_protocol_obj_struct *protocol_str, protocol_receive_struct receive_str)
A function that determines which command has arrived and which state needs to be switched to.
Definition update_fw.c:637
void JumpToProgramCommand(uint32_t address_to_jump)
The function goes to the received address.
Definition update_fw.c:599
uint8_t Compare_Data(void)
A function for verifying the firmware.
Definition update_fw.c:698
update_fw_program_type_enum
Definition update_fw.h:126
@ MAIN_PROGRAM
Definition update_fw.h:128
@ BOOTLOADER
Definition update_fw.h:127
void Init_Need_Struct_For_FW(base_BootloaderInfo_struct *base_boot, base_FWInfo_struct *base_fw, base_BoardInfo_struct *base_board)
A function for initializing "Bootloader_struct", "FW_struct" and "Board_struct" from flash.
Definition update_fw.c:675
update_fw_state_enum
Definition update_fw.h:94
@ JUMP_TO_BOOTLOADER
Definition update_fw.h:96
@ LOAD_NEW_FW
Definition update_fw.h:99
@ GET_BOOTLOADER_INFO
Definition update_fw.h:103
@ START_SYSTEM_UPDATE
Definition update_fw.h:108
@ GET_UP_LOAD_ATRIBUTE
Definition update_fw.h:106
@ CALCULATE_CRC
Definition update_fw.h:101
@ CHECK_NEW_BOOTLOADER
Definition update_fw.h:104
@ CHECK_NEW_FW
Definition update_fw.h:97
@ COMPLITE_CRC
Definition update_fw.h:102
@ GET_BOOTLOADER_STATUS
Definition update_fw.h:100
@ FINISH_SYSTEM_UPDATE
Definition update_fw.h:109
@ PRELOAD_INFO
Definition update_fw.h:98
@ GET_RUN_PROGRAM_TYPE
Definition update_fw.h:95
@ LOAD_NEW_BOOTLOADER
Definition update_fw.h:105