diff --git a/CanUds.c b/CanUds.c index ddf16d4..922f80c 100644 --- a/CanUds.c +++ b/CanUds.c @@ -11,6 +11,7 @@ #include "SystemDelayInterface.h" #include "candb.h" #include "stdio.h" +#include "fc7xxx_driver_flash.h" #define LOG_SIGN "CAN_UDS" #define LOGGER env->logger @@ -953,6 +954,8 @@ static uint16_t vUDS_routine_Compare_Checksum(tCanUds *env, eUdsRoutineControlTy return 4 + 1; } +uint8_t zzz[2048]; + static uint16_t vUDS_routine_Erase_Memory(tCanUds *env, eUdsRoutineControlType udsRoutineControlType) { eUdsRoutineStartStopRoutineResult udsStartStopRoutineResult = UDS_routine_RoutineStartStopSuccess; @@ -960,7 +963,16 @@ static uint16_t vUDS_routine_Erase_Memory(tCanUds *env, eUdsRoutineControlType u if ((udsRoutineControlType == UDS_routine_StartRoutine) || (udsRoutineControlType == UDS_routine_StopRoutine)) { - bool result = env->clear_flash_func(0x01010000, 1 * 2048); + bool result = env->clear_flash_func(0x01100000, 512 * 1024); + + +// bool result = FLASHDRIVER_FlashEraseBlock(FLASH_BLOCK_SELECT1); + + uint32_t adr = 0x01100000; + for (uint32_t i = 0; i < 256; ++i) { + env->write_flash_func(adr, zzz, 2048); + adr += 2048; + } if (result) { env->dataResponse[4] = UDS_routine_RoutineStartStopSuccess;