From 3740dbb9495ab8e9eed8b1d576cc4c2a2e517662 Mon Sep 17 00:00:00 2001 From: cfif Date: Wed, 27 May 2026 16:12:32 +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=20=D0=BF=D0=BB=D0=B0=D1=82=D1=8B=20=D0=BD?= =?UTF-8?q?=D0=B0=20V2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CanUds.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/CanUds.c b/CanUds.c index 05f0ea9..d39d64b 100644 --- a/CanUds.c +++ b/CanUds.c @@ -1097,17 +1097,19 @@ vUDS_routine_Check_Programming_Dependancies(tCanUds *env, eUdsRoutineControlType char *version_id_main = (char *) (ADR_HEX_BlockMain + 0x400); int result = memcmp(version_id_main, version_id, 9); -/* + if ((env->CheckSum_BlockMain == false) || (env->CheckSum_BlockCalib == false) || (env->CheckSum_BlockMeta == false)) { LoggerErrorStatic(LOGGER, LOG_SIGN, "At least one logical block missing"); env->dataResponse[4] = 4; - } else if (result != 0) { + return 4 + 1; + } + + if (result != 0) { LoggerErrorStatic(LOGGER, LOG_SIGN, "Software incompatibility"); env->dataResponse[4] = 3; - } else { - env->dataResponse[4] = UDS_routine_RoutineStartStopSuccess; + return 4 + 1; } -*/ + setResponseErrorPending(env, UDS_RoutineControl, UDS_error_requestCorrectlyReceived_ResponsePending); uint32_t crc32_calc = UdsCrc32Update(0xFFFFFFFF, (uint8_t *) ADR_HEX_Mapped_BlockMain, @@ -1116,7 +1118,8 @@ vUDS_routine_Check_Programming_Dependancies(tCanUds *env, eUdsRoutineControlType crc32_calc = UdsCrc32Finalize(crc32_calc); memcpy(&env->data->data[1024], (uint8_t *) ADR_HEX_Mapped_BlockMeta, SIZE_HEX_BlockMeta); - (*(uint32_t *) (SIZE_HEX_BlockMeta - 4)) = crc32_calc; + uint32_t *crcFromFlash = (uint32_t *) (SIZE_HEX_BlockMeta - 4); + *crcFromFlash = crc32_calc; result = env->clear_flash_func(ADR_HEX_Mapped_BlockMeta, SIZE_HEX_BlockMeta); @@ -1134,6 +1137,10 @@ vUDS_routine_Check_Programming_Dependancies(tCanUds *env, eUdsRoutineControlType return 4 + 1; } +#if (LOG_UDS == 1) + LoggerFormatInfo(LOGGER, LOG_SIGN, "Update Crc: 0x%08X", *crcFromFlash) +#endif + env->dataResponse[4] = UDS_routine_RoutineStartStopSuccess; return 4 + 1; @@ -1492,7 +1499,7 @@ static uint16_t RequestDownload_34(tCanUds *env) { #if (LOG_UDS == 1) - LoggerFormatInfo(LOGGER, LOG_SIGN, "RequestDownload: memoryAddress = %d memorySize = %d ", env->AdrFlash, + LoggerFormatInfo(LOGGER, LOG_SIGN, "RequestDownload: memoryAddress = %08X memorySize = %08X", env->AdrFlash, env->DownloadFirmwareSize) #endif