From d543c67e5f5dfa51a491cc6fc9fd8dcd6f98ce6d Mon Sep 17 00:00:00 2001 From: cfif Date: Thu, 18 Dec 2025 13:31:11 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/StorageOnFlashFlagchip.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Src/StorageOnFlashFlagchip.c b/Src/StorageOnFlashFlagchip.c index 52b1c4e..abafd0e 100644 --- a/Src/StorageOnFlashFlagchip.c +++ b/Src/StorageOnFlashFlagchip.c @@ -57,11 +57,12 @@ xStorageOnFlashFlagchip_DumpOn( return STORAGE_ERR_DEVICE; } - if (sInternalFlashPage_Write(pageAddress, dataSizeOnFlash, (uint8_t *) &dataCrc, 4) != 4) { + uint64_t dataCrc64 = dataCrc; + if (sInternalFlashPage_Write(pageAddress, dataSizeOnFlash, (uint8_t *) &dataCrc64, 8) != 8) { return STORAGE_ERR_DEVICE; } - uint32_t flashCalcCrc = xStorageOnFlashArtery_CrcFlash((uint8_t *) pageAddress, size); + uint32_t flashCalcCrc = xStorageOnFlashArtery_CrcFlash((uint8_t *) pageAddress, size ); uint32_t flashReedCrc = iInternalFlashPage_ReadWord(pageAddress + dataSizeOnFlash); if ((flashCalcCrc == flashReedCrc) && (flashCalcCrc == dataCrc)) { @@ -74,6 +75,9 @@ xStorageOnFlashFlagchip_DumpOn( static uint8_t xStorageOnFlashFlagchip_Dump(tStorageOnFlashFlagchip *env, void *data, size_t size) { + + size = size - 8; + uint32_t crc = xStorageOnFlashArtery_Crc(data, size); if (xStorageOnFlashFlagchip_DumpOn(env, crc, env->recoveryFlashPageAddress, data, size) != STORAGE_OK) { @@ -90,6 +94,8 @@ static uint8_t xStorageOnFlashFlagchip_Dump(tStorageOnFlashFlagchip *env, void * eStorageStatus xStorageOnFlashFlagchip_Load(tStorageOnFlashFlagchip *env, void *data, size_t size) { + size = size - 8; + size_t dataSizeOnFlash = size;//(size + 3) & (~3); // выравниваем до кратного 4 (целое количество слов) uint32_t recoveryCrcCalc = xStorageOnFlashArtery_CrcFlash((uint8_t *) env->recoveryFlashPageAddress, size);