Implementation of app_info table handling .
Copyright (c) 2020 Microchip Technology Inc. and its subsidiaries.
#include <types.h>
#include <app_info.h>
#include <bootStructure.h>
#include <appEntry.h>
#include <eepromLoader.h>
#include <flashLoader.h>
#include "hardwareInit.h"
Macros | |
#define | APP_INFO_START_ADDRESS 0x0003FE00 |
#define | IMG_BASE2_START_ADDRESS 0x00022000 |
Functions | |
void | app_infoAction (void) |
void | clear_updateaction (uint8_t app_index) |
void | extReadDataForFlashArea (uint32_t ext_addr, uint32_t int_addr, uint32_t size, uint8_t img_type, uint8_t *key, uint8_t app_index) |
bool | img_hdr_validate (void) |
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 | |
uint32_t | alignedPayloadLen |
app_info_t | checkapp_info |
BootBuffer_t | dataBuffer |
bool | isCrcMatched = false |
uint32_t | otauFileHdrLen |
uint32_t | otauFileId |
uint32_t | otauFileLen |
uint16_t | otauHdrImgType |
uint32_t | payloadLen |
uint32_t | payloadOffset |
uint16_t | remainderData |
#define APP_INFO_START_ADDRESS 0x0003FE00 |
Referenced by readapp_infotable(), and writeapp_infotable().
#define IMG_BASE2_START_ADDRESS 0x00022000 |
Referenced by img_hdr_validate().
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().
void extReadDataForFlashArea | ( | uint32_t | ext_addr, |
uint32_t | int_addr, | ||
uint32_t | size, | ||
uint8_t | img_type, | ||
uint8_t * | key, | ||
uint8_t | app_index | ||
) |
Referenced by memcopy().
bool img_hdr_validate | ( | void | ) |
References _FotaImageHeader::crc8, IMG_BASE2_START_ADDRESS, and MemcalcCrc().
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().
uint32_t alignedPayloadLen |
app_info_t checkapp_info |
BootBuffer_t dataBuffer |
Referenced by app_infoAction(), jumpToApplication(), and writeapp_infotable().
uint32_t otauFileHdrLen |
uint32_t otauFileId |
uint32_t otauFileLen |
uint16_t otauHdrImgType |
uint32_t payloadLen |
uint32_t payloadOffset |
uint16_t remainderData |