Application info table structure and parameters.
Copyright (c) 2020 Microchip Technology Inc. and its subsidiaries.
#include "boot_version.h"
Data Structures | |
struct | _FotaImageHeader |
struct | app_info_t |
struct | app_table_tag |
struct | BootInfo_t |
struct | ExistingImageInfo_t |
Macros | |
#define | IS_SKIP_ADDRESS_WITHIN_BUFFER(address, len, skipAddress) ((skipAddress >= address) && (skipAddress < (address+len))) |
#define | SKIP_ADDRESS_LENGTH (4U) |
#define | TYPE_EXTERNAL 0x01 |
#define | TYPE_INTERNAL 0x00 |
#define | TYPE_SECURED 0x01 |
Typedefs | |
typedef struct app_table_tag | app_table_t |
typedef struct _FotaImageHeader | FotaImageHeader_t |
Functions | |
void | app_infoAction (void) |
void | clear_updateaction (uint8_t app_index) |
bool | img_hdr_validate (void) |
void | Loadsecdatafromextmem (uint32_t dst_addr, uint32_t src_addr, uint32_t size) |
uint8_t | MemcalcCrc (uint8_t crc, uint8_t *pcBlock, uint8_t length) |
Read EEPROM index 39 to 46, and populate skip offsets. More... | |
void | memcopy (uint8_t dst_mem, uint32_t dst_addr, uint8_t src_mem, uint32_t src_addr, uint8_t img_type, uint32_t img_size, uint8_t app_index) |
bool | readapp_infotable (void) |
void | update_action (void) |
void | update_boot_info (void) |
void | writeapp_infotable (void) |
Variables | |
bool | isCrcMatched |
#define IS_SKIP_ADDRESS_WITHIN_BUFFER | ( | address, | |
len, | |||
skipAddress | |||
) | ((skipAddress >= address) && (skipAddress < (address+len))) |
#define SKIP_ADDRESS_LENGTH (4U) |
#define TYPE_EXTERNAL 0x01 |
Referenced by memcopy().
#define TYPE_INTERNAL 0x00 |
Referenced by clear_updateaction(), and memcopy().
#define TYPE_SECURED 0x01 |
typedef struct app_table_tag app_table_t |
typedef struct _FotaImageHeader FotaImageHeader_t |
void app_infoAction | ( | void | ) |
References isCrcMatched, readapp_infotable(), and update_action().
Referenced by Boot_main().
void clear_updateaction | ( | uint8_t | app_index | ) |
References app_table_tag::app_size, app_table_tag::app_start_addr, appStartAddr, app_info_t::appTable, app_table_tag::bootInfo, app_table_tag::dest_addr, BootInfo_t::dest_memtype, app_table_tag::existingImageInfo, flashUpdateAppStartAddr(), app_table_tag::img_size, ExistingImageInfo_t::memtype, TYPE_INTERNAL, BootInfo_t::update_action, and writeapp_infotable().
Referenced by update_action().
bool img_hdr_validate | ( | void | ) |
References _FotaImageHeader::crc8, IMG_BASE2_START_ADDRESS, and MemcalcCrc().
void Loadsecdatafromextmem | ( | uint32_t | dst_addr, |
uint32_t | src_addr, | ||
uint32_t | size | ||
) |
uint8_t MemcalcCrc | ( | uint8_t | crc, |
uint8_t * | pcBlock, | ||
uint8_t | length | ||
) |
Read EEPROM index 39 to 46, and populate skip offsets.
Reads data from external flash and loads to internal flash. Counts crc given memory block. CRC-8. Polynom 0x31 x^8 + x^5 + x^4 + 1.
[in] | crc | - first crc state |
[in] | pcBlock | - pointer to the memory for crc counting |
[in] | length | - memory size |
Referenced by img_hdr_validate(), readapp_infotable(), update_boot_info(), and writeapp_infotable().
void memcopy | ( | uint8_t | dst_mem, |
uint32_t | dst_addr, | ||
uint8_t | src_mem, | ||
uint32_t | src_addr, | ||
uint8_t | img_type, | ||
uint32_t | img_size, | ||
uint8_t | app_index | ||
) |
References app_table_tag::app_start_addr, app_info_t::appTable, extReadDataForFlashArea(), FLASH_PAGESIZE, hwEraseFlashPage(), hwFillFlashPageBuffer(), hwWriteFlashPage(), app_table_tag::security_key, app_table_tag::skip_pds_end, app_table_tag::skip_pds_start, TYPE_EXTERNAL, and TYPE_INTERNAL.
Referenced by update_action().
bool readapp_infotable | ( | void | ) |
References APP_INFO_START_ADDRESS, app_info_t::crc, MemcalcCrc(), and app_info_t::reservedbytes.
Referenced by app_infoAction(), and writeapp_infotable().
void update_action | ( | void | ) |
References app_info_t::appTable, app_table_tag::bootInfo, clear_updateaction(), app_table_tag::dest_addr, BootInfo_t::dest_memtype, flag, app_table_tag::img_size, BootInfo_t::img_type, lowLevelUnInit(), memcopy(), RESET_FLAG, app_table_tag::src_addr, BootInfo_t::src_memtype, system_reset(), and BootInfo_t::update_action.
Referenced by app_infoAction().
void update_boot_info | ( | void | ) |
void writeapp_infotable | ( | void | ) |
References APP_INFO_START_ADDRESS, app_info_t::crc, FLASH_PAGESIZE, hwEraseFlashPage(), hwFillFlashPageBuffer(), hwWriteFlashPage(), isCrcMatched, MemcalcCrc(), readapp_infotable(), and app_info_t::reservedbytes.
Referenced by clear_updateaction().
bool isCrcMatched |
Referenced by app_infoAction(), jumpToApplication(), and writeapp_infotable().