/* * flashUpdate.h * * Created on: Oct 23, 2023 * Author: Brian.Bailey */ #ifndef LOADER_FLASHUPDATE_H_ #define LOADER_FLASHUPDATE_H_ #include "sha256.h" #include "LPC54114_cm4_features.h" typedef struct { uint32_t numBytesToProgram; //number of bytes to burn to FLASH uint32_t flashProgramTargetAddress; //Target address in FLASH to write program uint32_t numBytesProgrammed; //number of bytes programmed to FLASH uint8_t hostHash[SHA256_BLOCK_SIZE]; //SHA256 hash of program data from host uint8_t flashHash[SHA256_BLOCK_SIZE]; //SHA256 hash computed from data in FLASH bool imageReceived; //Entire program image received (got the number of bytes) bool flashHashMatch; //flashHash matches hostHash uint8_t rxPageData[FSL_FEATURE_SYSCON_FLASH_PAGE_SIZE_BYTES]; //save packets data when the number is less then one page uint16_t numBytesInPageData; //number of bytes saved in rxPageData bool programCompleted; //Entire program completed }FLASH_UPDATE_t; void FU_ProgramSetup(uint8_t *data); void FU_WriteProgramDataToFLASH(void); void FU_VerifyImage(); void FU_ResetProcessor(); #endif /* LOADER_FLASHUPDATE_H_ */