From a86024c2233d10948c5a0027836b339246c55523 Mon Sep 17 00:00:00 2001 From: sunbeam Date: Wed, 25 Dec 2024 09:00:18 +0800 Subject: [PATCH] =?UTF-8?q?20241222=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SDK/middleware/uds/user/uds_service10.c | 90 -- .../SDK/middleware/uds/user/uds_service10.h | 60 - .../SDK/middleware/uds/user/uds_service11.c | 91 -- .../SDK/middleware/uds/user/uds_service11.h | 59 - .../SDK/middleware/uds/user/uds_service27.c | 213 ---- .../SDK/middleware/uds/user/uds_service27.h | 60 - .../SDK/middleware/uds/user/uds_service31.c | 278 ----- .../SDK/middleware/uds/user/uds_service31.h | 62 - .../SDK/middleware/uds/user/uds_service34.c | 146 --- .../SDK/middleware/uds/user/uds_service34.h | 61 - .../SDK/middleware/uds/user/uds_service36.c | 160 --- .../SDK/middleware/uds/user/uds_service36.h | 97 -- .../SDK/middleware/uds/user/uds_user.c | 179 --- .../SDK/middleware/uds/user/uds_user.h | 76 -- .../drivers/cpu/startup/system_M012x.c | 4 +- .../drivers/cpu/startup/system_M012x.h | 2 +- .../linker/bootloader_m0128_flash.icf | 4 +- .../settings/cva_bootloader_m0128.dbgdt | 1016 ++++++++++++++++- .../settings/cva_bootloader_m0128.dnx | 43 + .../settings/cva_bootloader_m0128.wsdt | 60 +- .../src/bootloader/bootloader.c | 3 +- .../src/bootloader/bootloader.h | 3 +- .../src/bootloader/bootloader_cfg.h | 12 +- cva_bootloader_m0128/src/main.c | 64 +- .../src/private_driver/isotp/isotp.c | 24 +- .../src/private_driver/uds/stack/uds.h | 4 +- .../src/private_driver/uds/user/uds_dtc.c | 221 ---- .../src/private_driver/uds/user/uds_dtc.h | 175 --- .../private_driver/uds/user/uds_service14.c | 76 -- .../private_driver/uds/user/uds_service14.h | 60 - .../private_driver/uds/user/uds_service19.c | 163 --- .../private_driver/uds/user/uds_service19.h | 60 - .../private_driver/uds/user/uds_service22.c | 126 -- .../private_driver/uds/user/uds_service22.h | 60 - .../private_driver/uds/user/uds_service27.c | 83 +- .../private_driver/uds/user/uds_service28.c | 147 --- .../private_driver/uds/user/uds_service28.h | 64 -- .../private_driver/uds/user/uds_service2E.c | 116 -- .../private_driver/uds/user/uds_service2E.h | 62 - .../private_driver/uds/user/uds_service2F.c | 189 --- .../private_driver/uds/user/uds_service2F.h | 60 - .../private_driver/uds/user/uds_service31.c | 6 +- .../private_driver/uds/user/uds_service37.c | 95 -- .../private_driver/uds/user/uds_service37.h | 60 - .../private_driver/uds/user/uds_service3E.c | 70 -- .../private_driver/uds/user/uds_service3E.h | 60 - .../private_driver/uds/user/uds_service85.c | 81 -- .../private_driver/uds/user/uds_service85.h | 60 - .../src/private_driver/uds/user/uds_user.c | 2 +- 49 files changed, 1196 insertions(+), 3771 deletions(-) delete mode 100644 cva_bootloader_m0128/SDK/middleware/uds/user/uds_service10.c delete mode 100644 cva_bootloader_m0128/SDK/middleware/uds/user/uds_service10.h delete mode 100644 cva_bootloader_m0128/SDK/middleware/uds/user/uds_service11.c delete mode 100644 cva_bootloader_m0128/SDK/middleware/uds/user/uds_service11.h delete mode 100644 cva_bootloader_m0128/SDK/middleware/uds/user/uds_service27.c delete mode 100644 cva_bootloader_m0128/SDK/middleware/uds/user/uds_service27.h delete mode 100644 cva_bootloader_m0128/SDK/middleware/uds/user/uds_service31.c delete mode 100644 cva_bootloader_m0128/SDK/middleware/uds/user/uds_service31.h delete mode 100644 cva_bootloader_m0128/SDK/middleware/uds/user/uds_service34.c delete mode 100644 cva_bootloader_m0128/SDK/middleware/uds/user/uds_service34.h delete mode 100644 cva_bootloader_m0128/SDK/middleware/uds/user/uds_service36.c delete mode 100644 cva_bootloader_m0128/SDK/middleware/uds/user/uds_service36.h delete mode 100644 cva_bootloader_m0128/SDK/middleware/uds/user/uds_user.c delete mode 100644 cva_bootloader_m0128/SDK/middleware/uds/user/uds_user.h delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_dtc.c delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_dtc.h delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_service14.c delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_service14.h delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_service19.c delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_service19.h delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_service22.c delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_service22.h delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_service28.c delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_service28.h delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_service2E.c delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_service2E.h delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_service2F.c delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_service2F.h delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_service37.c delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_service37.h delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_service3E.c delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_service3E.h delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_service85.c delete mode 100644 cva_bootloader_m0128/src/private_driver/uds/user/uds_service85.h diff --git a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service10.c b/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service10.c deleted file mode 100644 index 2d92ba4..0000000 --- a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service10.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include "uds_service10.h" - - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the constants - ******************************************************************************/ - -/******************************************************************************* - * the functions - ******************************************************************************/ - -void UdsService10_SessionControl(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen) -{ - uint8_t subFunction; - uint8_t rspBuffer[8] = {0}; /* polyspace DEFECT:PARTIALLY_ACCESSED_ARRAY [No action planned:Low] "Still keep default though member6~7 is not written" */ - - if(msgLen != obj->seviceTable[obj->curServiceIdx].minLen) - { - Uds_NegativeResponse(obj, 0x10, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - subFunction = UDS_GET_SUB_FUNCTION (msgBuf[1]); - - rspBuffer[0] = UDS_GET_POSITIVE_RSP(0x10); - rspBuffer[1] = subFunction; - rspBuffer[2] = (uint8_t)(obj->p2Server_ms >> 8); - rspBuffer[3] = (uint8_t)(obj->p2Server_ms & 0x00ff); - rspBuffer[4] = (uint8_t)(obj->p2xServer_10ms >> 8); - rspBuffer[5] = (uint8_t)(obj->p2xServer_10ms & 0x00ff); - switch(subFunction) - { - case UDS_SESSION_DEFAULT: - obj->securityLevel = UDS_SA_NONE; - obj->session = subFunction; - Uds_PositiveResponse(obj, rspBuffer, 6); - break; - case UDS_SESSION_EXTENDED: - obj->securityLevel = UDS_SA_NONE; - obj->session = subFunction; - Uds_PositiveResponse(obj, rspBuffer, 6); - break; - case UDS_SESSION_PROGRAMMING: - obj->securityLevel = UDS_SA_NONE; - obj->session = subFunction; - Uds_PositiveResponse(obj, rspBuffer, 6); - break; - case UDS_SESSION_SAFTY: - obj->securityLevel = UDS_SA_NONE; - obj->session = subFunction; - Uds_PositiveResponse(obj, rspBuffer, 6); - break; - default: - Uds_NegativeResponse(obj, 0x10, NRC_SUBFUNCTION_NOT_SUPPORTED); - break; - } -} - diff --git a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service10.h b/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service10.h deleted file mode 100644 index 995a8d9..0000000 --- a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service10.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -#ifndef _UDS_SERVICE10_H_ -#define _UDS_SERVICE10_H_ - -/*! \brief Contains public interface to various functions related - * to the user-defined UDS service 10 - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include -#include -#include "../stack/uds.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the function prototypes - ******************************************************************************/ - -/*! \brief Uds Service 10 processing - */ -extern void UdsService10_SessionControl(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen); - -#ifdef __cplusplus -} -#endif /* extern "C" */ - -#endif /* _UDS_SERVICE10_H_ */ diff --git a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service11.c b/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service11.c deleted file mode 100644 index d8e2ec5..0000000 --- a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service11.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include "uds_service11.h" - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/*! \brief The Reset type definition of Uds - */ -typedef enum _UdsResetType_ -{ - UDS_RESET_NONE = 0, - UDS_RESET_HARD, - UDS_RESET_KEYOFFON, - UDS_RESET_SOFT -} UdsResetType; - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the constants - ******************************************************************************/ - -/******************************************************************************* - * the functions - ******************************************************************************/ - -void UdsService11_ResetEcu(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen) -{ - uint8_t subFunction; - uint8_t rspBuffer[8] = {0}; /* polyspace DEFECT:PARTIALLY_ACCESSED_ARRAY [No action planned:Low] "Still keep default though member3~7 is not written" */ - uint8_t powerDownTime = 0xFF; - - if(msgLen != obj->seviceTable[obj->curServiceIdx].minLen) - { - Uds_NegativeResponse(obj, 0x11, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - subFunction = UDS_GET_SUB_FUNCTION(msgBuf[1]); - - rspBuffer[0] = UDS_GET_POSITIVE_RSP(0x11); - rspBuffer[1] = subFunction; - rspBuffer[2] = powerDownTime; - switch(subFunction) - { - case UDS_RESET_HARD: - Uds_PositiveResponse(obj, rspBuffer, 3); - /*add hardware reset code*/ - - break; - case UDS_RESET_KEYOFFON: - Uds_PositiveResponse(obj, rspBuffer, 3); - /*add keyoffon reset code*/ - - break; - case UDS_RESET_SOFT: - Uds_PositiveResponse(obj, rspBuffer, 3); - /*add software reset code*/ - - break; - default: - Uds_NegativeResponse(obj, 0x11, NRC_SUBFUNCTION_NOT_SUPPORTED); - break; - } -} diff --git a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service11.h b/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service11.h deleted file mode 100644 index ef4b0aa..0000000 --- a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service11.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -#ifndef _UDS_SERVICE11_H_ -#define _UDS_SERVICE11_H_ - -/*! \brief Contains public interface to various functions related - * to the user-defined UDS service 11 - */ -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include -#include -#include "../stack/uds.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the function prototypes - ******************************************************************************/ - -/*! \brief Uds Service 11 processing - */ -extern void UdsService11_ResetEcu(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen); - -#ifdef __cplusplus -} -#endif /* extern "C" */ - -#endif /* _UDS_SERVICE11_H_ */ diff --git a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service27.c b/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service27.c deleted file mode 100644 index 281372b..0000000 --- a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service27.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include -#include "uds_service27.h" - -/******************************************************************************* - * the defines - ******************************************************************************/ - -#define SUPPORT_LEVEL_NUM 4 /* supported security level number */ - -#define MAX_ALLOW_ERROR_NUM 5 /* the max allow number of key error */ - -#define STARTUP_DELAY_MS 2000 /* the service allow access time delay after UDS start */ -#define ERR_EXCEED_DELAY_MS 10000 /* the service allow access time delay after error number exceed */ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -typedef struct _SecurityLevel_Param_ -{ - uint8_t level; - uint8_t keyErrorCnt; - uint8_t maxErrNum; - int64_t MaxErrTimeStamp; -} SecurityLevel_Param; - -/******************************************************************************* - * the globals - ******************************************************************************/ - -SecurityLevel_Param scrtParam[SUPPORT_LEVEL_NUM] = { - {UDS_SA_LEVEL_1, 0, MAX_ALLOW_ERROR_NUM, 0}, - {UDS_SA_LEVEL_3, 0, MAX_ALLOW_ERROR_NUM, 0}, - {UDS_SA_LEVEL_11, 0, MAX_ALLOW_ERROR_NUM, 0}, - {UDS_SA_LEVEL_63, 0, MAX_ALLOW_ERROR_NUM, 0}, -}; - -/******************************************************************************* - * the constants - ******************************************************************************/ - -/******************************************************************************* - * the functions - ******************************************************************************/ - -static void UdsSecurityAccess_GenerateSeed(UdsType *obj, uint8_t newLevel, uint8_t *outData, uint8_t outBufsize, uint16_t *outLen) -{ - /* seed is defined by user, It's usually a random value */ - uint8_t seed[4] = {1, 2, 3, 4}; - - if(outBufsize < sizeof(seed)) - { - return; - } - - *outLen = sizeof(seed); - if(newLevel == obj->securityLevel) - { - memset(outData, 0, sizeof(seed)); - } - else - { - memcpy(outData, seed, sizeof(seed)); - } -} - -static bool UdsSecurityAccess_ValidateKey(uint8_t seedLevel, const uint8_t *seed, uint16_t seedLen, const uint8_t *key, uint16_t keyLen) -{ - /* The encryption algorithm is provided by the vehicle manufacturer */ - - return true; -} - -void UdsService27_SecurityAccess(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen) -{ - static uint8_t seedLevel = 0; - static uint8_t seedValue[8] = {0}; - static uint16_t seedLen = 0; - uint8_t subFunction; - uint8_t udx = 0; - uint8_t rspBuffer[8] = {0}; - uint16_t dataLen = 0, remainSize = 0; - bool ret = false; - - if(msgLen < obj->seviceTable[obj->curServiceIdx].minLen) - { - Uds_NegativeResponse(obj, 0x27, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - if(obj->session == UDS_SESSION_DEFAULT) - { - Uds_NegativeResponse(obj, 0x27, NRC_CONDITIONS_NOT_CORRECT); - return; - } - - if(obj->timeStamp_ms < STARTUP_DELAY_MS) - { - Uds_NegativeResponse(obj, 0x27, NRC_REQUIRED_TIME_DELAY_NOT_EXPIRED); - return; - } - - subFunction = UDS_GET_SUB_FUNCTION(msgBuf[1]); - rspBuffer[0] = UDS_GET_POSITIVE_RSP(0x27); - rspBuffer[1] = subFunction; - if(subFunction % 2) - { - seedLevel = 0; - for(udx = 0; udx < SUPPORT_LEVEL_NUM; udx++) - { - if(subFunction == scrtParam[udx].level) - { - if(scrtParam[udx].keyErrorCnt > scrtParam[udx].maxErrNum) - { - if(obj->timeStamp_ms - scrtParam[udx].MaxErrTimeStamp < ERR_EXCEED_DELAY_MS) - { - Uds_NegativeResponse(obj, 0x27, NRC_EXCEEDED_NUMBER_OF_ATTEMPTS); - return; - } - else - { - scrtParam[udx].keyErrorCnt = 0; - } - } - break; - } - } - - if(udx >= SUPPORT_LEVEL_NUM) - { - Uds_NegativeResponse(obj, 0x27, NRC_REQUEST_OUT_OF_RANGE); - return; - } - - remainSize = sizeof(rspBuffer) - 2; - UdsSecurityAccess_GenerateSeed(obj, subFunction, &rspBuffer[2], remainSize, &dataLen); - if(dataLen > 0) - { - Uds_PositiveResponse(obj, rspBuffer, dataLen + 2); - - seedLevel = subFunction; - seedLen = dataLen; - memcpy(seedValue, &rspBuffer[2], dataLen); - } - else - { - Uds_NegativeResponse(obj, 0x27, NRC_REQUEST_OUT_OF_RANGE); - } - } - else - { - if(subFunction != seedLevel + 1) - { - Uds_NegativeResponse(obj, 0x27, NRC_REQUEST_SEQUENCE_ERROR); - return; - } - - /* polyspace-begin DEFECT:DEAD_CODE [No action planned:Low] "Still reserve though it's maybe unreachable" */ - ret = UdsSecurityAccess_ValidateKey(seedLevel, seedValue, seedLen, &msgBuf[2], msgLen - 2); - if(ret == true) - { - Uds_PositiveResponse(obj, rspBuffer, 2); - - seedLevel = 0; - obj->securityLevel = subFunction - 1; - - for(udx = 0; udx < SUPPORT_LEVEL_NUM; udx++) - { - if(subFunction == scrtParam[udx].level) - { - scrtParam[udx].keyErrorCnt = 0; - } - } - } - else - { - Uds_NegativeResponse(obj, 0x27, NRC_INVALID_KEY); - - for(udx = 0; udx < SUPPORT_LEVEL_NUM; udx++) - { - if(seedLevel == scrtParam[udx].level) - { - scrtParam[udx].keyErrorCnt++; - if(scrtParam[udx].keyErrorCnt > scrtParam[udx].maxErrNum) - { - scrtParam[udx].MaxErrTimeStamp = obj->timeStamp_ms; - } - } - } - } - /* polyspace-end DEFECT:DEAD_CODE [No action planned:Low] "Still reserve though it's maybe unreachable" */ - } -} diff --git a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service27.h b/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service27.h deleted file mode 100644 index 8d04ec9..0000000 --- a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service27.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -#ifndef _UDS_SERVICE27_H_ -#define _UDS_SERVICE27_H_ - -/*! \brief Contains public interface to various functions related - * to the user-defined UDS service 27 - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include -#include -#include "../stack/uds.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the function prototypes - ******************************************************************************/ - -/*! \brief Uds Service 27 processing - */ -extern void UdsService27_SecurityAccess(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen); - -#ifdef __cplusplus -} -#endif /* extern "C" */ - -#endif /* _UDS_SERVICE27_H_ */ diff --git a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service31.c b/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service31.c deleted file mode 100644 index 38a8d9b..0000000 --- a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service31.c +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include "uds_service31.h" - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/*! \brief The Uds routine control type - */ -typedef enum _UdsRoutineCtrlType_ -{ - UDS_ROUTINE_CTRL_NONE = 0, - UDS_ROUTINE_CTRL_START = 0x01, - UDS_ROUTINE_CTRL_STOP = 0x02, - UDS_ROUTINE_CTRL_REQUEST_RESULT = 0x03 -} UdsRoutineCtrlType; - -/*! \brief The Uds routine control status - */ -typedef enum _UdsRtnCtrlStatus_ -{ - UDS_RTN_ST_IDLE = 0x00, - UDS_RTN_ST_RUNNING = 0x01, -} UdsRtnCtrlStatus; - -/*! \brief The Uds routine control struct - */ -typedef struct _Uds_RtnCtrl_ -{ - uint16_t rtnCtrlId; - uint8_t sessionLevel; - uint8_t securityLevel; - UdsRtnCtrlStatus rtnStatus; - void (*Routine_Start)(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen); - void (*Routine_Stop)(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen); - void (*Routine_Result)(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen); -} Uds_RtnCtrl; - -/******************************************************************************* - * the constants - ******************************************************************************/ - -static void Routine_StartEreaseMemory(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen); -static void Routine_StopEreaseMemory(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen); -static void Routine_EreaseMemoryResult(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen); -static void Routine_StartCheckProgramDependencies(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen); -static void Routine_StopCheckProgramDependencies(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen); -static void Routine_CheckProgramDependenciesResult(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen); -static void Routine_StartEreaseMirrorMemDtcs(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen); -static void Routine_StopEreaseMirrorMemDtcs(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen); -static void Routine_EreaseMirrorMemDtcsResult(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen); - -/******************************************************************************* - * the globals - ******************************************************************************/ - -Uds_RtnCtrl udsRtnCtrlTable[] = { - {0xFF00, UDS_SESSION_EXTENDED, UDS_SA_LEVEL_1, UDS_RTN_ST_IDLE, &Routine_StartEreaseMemory, &Routine_StopEreaseMemory, &Routine_EreaseMemoryResult }, - {0xFF01, UDS_SESSION_EXTENDED, UDS_SA_LEVEL_1, UDS_RTN_ST_IDLE, &Routine_StartCheckProgramDependencies, &Routine_StopCheckProgramDependencies, &Routine_CheckProgramDependenciesResult}, - {0xFF02, UDS_SESSION_EXTENDED, UDS_SA_LEVEL_1, UDS_RTN_ST_IDLE, &Routine_StartEreaseMirrorMemDtcs, &Routine_StopEreaseMirrorMemDtcs, &Routine_EreaseMirrorMemDtcsResult }, -}; - -/******************************************************************************* - * the functions - ******************************************************************************/ - -void Routine_StatusInit(uint16_t routineId) -{ - uint8_t rtnIndex = 0; - uint8_t rntNum = sizeof(udsRtnCtrlTable) / sizeof(Uds_RtnCtrl); - - for(rtnIndex = 0; rtnIndex < rntNum; rtnIndex++) - { - if(udsRtnCtrlTable[rtnIndex].rtnCtrlId == routineId) - { - udsRtnCtrlTable[rtnIndex].rtnStatus = UDS_RTN_ST_IDLE; - } - } -} - -static void Routine_StartEreaseMemory(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen) -{ - if(pdata == NULL) - { - return; - } - /* user add start erease memory code */ -} - -static void Routine_StopEreaseMemory(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen) -{ - if(pdata == NULL) - { - return; - } - /* user add stop erease memory code */ -} - -static void Routine_EreaseMemoryResult(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen) -{ - if(pdata == NULL) - { - return; - } - /* user add erease memory result code */ -} - -static void Routine_StartCheckProgramDependencies(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen) -{ - if(pdata == NULL) - { - return; - } - /* user add start check program dependencies code */ -} - -static void Routine_StopCheckProgramDependencies(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen) -{ - if(pdata == NULL) - { - return; - } - /* user add stop check program dependencies code */ -} - -static void Routine_CheckProgramDependenciesResult(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen) -{ - if(pdata == NULL) - { - return; - } - /* user add check program dependencies result code */ -} - -static void Routine_StartEreaseMirrorMemDtcs(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen) -{ - if(pdata == NULL) - { - return; - } - /* user add start erease mirror memory Dtcs code */ -} - -static void Routine_StopEreaseMirrorMemDtcs(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen) -{ - if(pdata == NULL) - { - return; - } - /* user add stop erease mirror memory Dtcs code */ -} - -static void Routine_EreaseMirrorMemDtcsResult(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen) -{ - if(pdata == NULL) - { - return; - } - /* user add erease mirror memory Dtcs resultl code */ -} - -void UdsService31_RoutineControl(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen) -{ - const uint8_t *pOptionParam = NULL; - uint8_t subFunction = 0; - uint16_t optionParamLen = 0; - uint16_t routineId = 0; - uint8_t rtnIndex = 0; - uint8_t rntNum = sizeof(udsRtnCtrlTable) / sizeof(Uds_RtnCtrl); - uint8_t rspBuffer[UDS_RSP_LEN_MAX] = {0}; - uint16_t rspLen = 0; - - if(msgLen < obj->seviceTable[obj->curServiceIdx].minLen) - { - Uds_NegativeResponse(obj, 0x31, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - subFunction = UDS_GET_SUB_FUNCTION(msgBuf[1]); - routineId = ((uint16_t)msgBuf[2] << 8) + msgBuf[3]; - optionParamLen = msgLen - 4; - if(optionParamLen > 0) - { - pOptionParam = &msgBuf[4]; - } - - for(rtnIndex = 0; rtnIndex < rntNum; rtnIndex++) - { - if(udsRtnCtrlTable[rtnIndex].rtnCtrlId == routineId) - { - if(obj->session == udsRtnCtrlTable[rtnIndex].sessionLevel) - { - if((udsRtnCtrlTable[rtnIndex].securityLevel != UDS_SA_NONE) && (udsRtnCtrlTable[rtnIndex].securityLevel != obj->securityLevel)) - { - Uds_NegativeResponse(obj, 0x31, NRC_SECURITY_ACCESS_DENIED); - return; - } - - break; - } - else - { - Uds_NegativeResponse(obj, 0x31, NRC_CONDITIONS_NOT_CORRECT); - return; - } - } - } - - if(rtnIndex >= rntNum) - { - Uds_NegativeResponse(obj, 0x31, NRC_REQUEST_OUT_OF_RANGE); - return; - } - - memset(rspBuffer, 0, UDS_RSP_LEN_MAX); - - switch(subFunction) - { - case UDS_ROUTINE_CTRL_START: - udsRtnCtrlTable[rtnIndex].Routine_Start(pOptionParam, optionParamLen, rspBuffer, UDS_RSP_LEN_MAX, &rspLen); - udsRtnCtrlTable[rtnIndex].rtnStatus = UDS_RTN_ST_RUNNING; - break; - case UDS_ROUTINE_CTRL_STOP: - if(udsRtnCtrlTable[rtnIndex].rtnStatus != UDS_RTN_ST_IDLE) - { - udsRtnCtrlTable[rtnIndex].Routine_Stop(pOptionParam, optionParamLen, rspBuffer, UDS_RSP_LEN_MAX, &rspLen); - udsRtnCtrlTable[rtnIndex].rtnStatus = UDS_RTN_ST_IDLE; - } - break; - case UDS_ROUTINE_CTRL_REQUEST_RESULT: - if(udsRtnCtrlTable[rtnIndex].rtnStatus != UDS_RTN_ST_IDLE) - { - udsRtnCtrlTable[rtnIndex].Routine_Result(pOptionParam, optionParamLen, rspBuffer, UDS_RSP_LEN_MAX, &rspLen); - } - break; - default: - Uds_NegativeResponse(obj, 0x31, NRC_SUBFUNCTION_NOT_SUPPORTED); - return; - } - - /* polyspace-begin DEFECT:DEAD_CODE [No action planned:Low] "Still reserve though it's maybe unreachable" */ - if((rspLen >= 4) && (rspBuffer[0] == UDS_GET_POSITIVE_RSP(0x31))) - { - Uds_PositiveResponse(obj, rspBuffer, rspLen); - } - else if((rspLen == 3) && (rspBuffer[0] == NEGATIVE_RSP)) - { - Uds_NegativeResponse(obj, 0x31, rspBuffer[2]); - } - else - { - Uds_NegativeResponse(obj, 0x31, NRC_REQUEST_SEQUENCE_ERROR); - } - /* polyspace-end DEFECT:DEAD_CODE [No action planned:Low] "Still reserve though it's maybe unreachable" */ -} diff --git a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service31.h b/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service31.h deleted file mode 100644 index a51729d..0000000 --- a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service31.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -#ifndef _UDS_SERVICE31_H_ -#define _UDS_SERVICE31_H_ - -/*! \brief Contains public interface to various functions related - * to the user-defined UDS service 31 - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include "../stack/uds.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the function prototypes - ******************************************************************************/ - -/*! \brief Uds Service 31 processing - */ -extern void UdsService31_RoutineControl(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen); - -/*! \brief Routine status init - */ -extern void Routine_StatusInit(uint16_t routineId); - -#ifdef __cplusplus -} -#endif /* extern "C" */ - -#endif /* _UDS_SERVICE31_H_ */ diff --git a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service34.c b/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service34.c deleted file mode 100644 index 554a7e1..0000000 --- a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service34.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include "uds_service34.h" -#include "uds_service36.h" - - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the constants - ******************************************************************************/ - -/******************************************************************************* - * the functions - ******************************************************************************/ - -uint32_t Uds_GetMaxfBlockSize(void) -{ - /* user add code to get max num of block length */ - - return 128; -} - -uint8_t Uds_GetValidBytesNumOfData(uint32_t data) -{ - uint8_t index = 0; - uint8_t bytesNum = 0; - - for(index = 1; index <= 4; index++) - { - if(data >> ((4 - index) * 8)) - { - bytesNum = 4 - index + 1; - break; - } - } - - return bytesNum; -} - -void UdsService34_RequestDownload(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen) -{ - uint32_t memAddress = 0; - uint8_t memAddrLen = 0; - uint32_t memSize = 0; - uint8_t memSizeLen = 0; - uint8_t maxBlockSizeLen = 0; - uint32_t maxBlockSize = 0; - uint8_t index = 0; - uint16_t rspLen = 0; - uint8_t rspBuffer[8]; - - if(obj->session == UDS_SESSION_DEFAULT) - { - Uds_NegativeResponse(obj, 0x34, NRC_CONDITIONS_NOT_CORRECT); - return; - } - - if(msgLen < obj->seviceTable[obj->curServiceIdx].minLen) - { - Uds_NegativeResponse(obj, 0x34, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - memAddrLen = msgBuf[2] & 0x0F; - memSizeLen = msgBuf[2] >> 4; - - if((memAddrLen == 0) || (memAddrLen > sizeof(memAddress)) || (memSizeLen == 0) || (memSizeLen > sizeof(memSize))) - { - Uds_NegativeResponse(obj, 0x34, NRC_REQUEST_OUT_OF_RANGE); - return; - } - - for(index = 0; index < memAddrLen; index++) - { - memAddress <<= 8; - memAddress += msgBuf[3 + index]; - } - - for(index = 0; index < memSizeLen; index++) - { - memSize <<= 8; - memSize += msgBuf[3 + memAddrLen + index]; - } - - if(memSize == 0) - { - Uds_NegativeResponse(obj, 0x34, NRC_CONDITIONS_NOT_CORRECT); - return; - } - - /* user add judge code for the security level */ - if(0) - { - Uds_NegativeResponse(obj, 0x34, NRC_SECURITY_ACCESS_DENIED); - return; - } - - Uds_SetMemAddr(memAddress); - Uds_SetMemSize(memSize); - - Uds_SetDataTransferDirect(UDS_TRANSFER_DIR_DOWNLOAD); - - maxBlockSize = Uds_GetMaxfBlockSize(); - maxBlockSizeLen = Uds_GetValidBytesNumOfData(maxBlockSize); - - rspBuffer[rspLen++] = UDS_GET_POSITIVE_RSP(0x34); - rspBuffer[rspLen++] = maxBlockSizeLen << 4; - for(index = 1; index <= maxBlockSizeLen; index++) - { - rspBuffer[rspLen++] = maxBlockSize >> (8 * (maxBlockSizeLen - index)); - } - - Uds_PositiveResponse(obj, rspBuffer, rspLen); -} - - - diff --git a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service34.h b/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service34.h deleted file mode 100644 index 072140b..0000000 --- a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service34.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -#ifndef _UDS_SERVICE34_H_ -#define _UDS_SERVICE34_H_ - -/*! \brief Contains public interface to various functions related - * to the user-defined UDS service 34 - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include -#include -#include -#include "../stack/uds.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the function prototypes - ******************************************************************************/ - -/*! \brief Uds Service 34 processing - */ -extern void UdsService34_RequestDownload(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen); - -#ifdef __cplusplus -} -#endif /* extern "C" */ - -#endif /* _UDS_SERVICE34_H_ */ diff --git a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service36.c b/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service36.c deleted file mode 100644 index cea934a..0000000 --- a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service36.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include "uds_service36.h" - - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -static uint32_t s_memAddr = 0; -static uint32_t s_memSize = 0; -static UdsTransDirType s_dataTransDir = UDS_TRANSFER_DIR_NONE; - -static uint8_t s_curRcvSequence = 0; -static uint8_t s_lastRcvSqunce = 0; -static uint32_t s_rcvDataTotalLen = 0; - -/******************************************************************************* - * the constants - ******************************************************************************/ - -/******************************************************************************* - * the functions - ******************************************************************************/ - -void Uds_SetMemAddr(uint32_t addr) -{ - s_memAddr = addr; -} - -uint32_t Uds_GetMemAddr(void) -{ - return s_memAddr; -} - -void Uds_SetMemSize(uint32_t size) -{ - s_memSize = size; -} - -uint32_t Uds_GetMemSize(void) -{ - return s_memSize; -} - -void Uds_SetDataTransferDirect(UdsTransDirType dirType) -{ - s_dataTransDir = dirType; - - /* clear sequence number */ - s_lastRcvSqunce = 0x00; - s_curRcvSequence = 0x00; - - /* clear receive data total number */ - s_rcvDataTotalLen = 0x00; -} - -UdsTransDirType Uds_GetDataTransferDirect(void) -{ - return s_dataTransDir; -} - -uint32_t Uds_GetRcvDataTotalLen(void) -{ - return s_rcvDataTotalLen; -} - -void UdsService36_TransferData(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen) -{ - uint16_t rspLen = 0; - uint8_t rspBuffer[UDS_RSP_LEN_MAX] = {0}; /* polyspace DEFECT:PARTIALLY_ACCESSED_ARRAY [No action planned:Low] "Still reserve though member2~511 is not written" */ - - if(obj->session == UDS_SESSION_DEFAULT) - { - Uds_NegativeResponse(obj, 0x36, NRC_CONDITIONS_NOT_CORRECT); - return; - } - - if(msgLen < obj->seviceTable[obj->curServiceIdx].minLen) - { - Uds_NegativeResponse(obj, 0x36, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - switch(s_dataTransDir) - { - case UDS_TRANSFER_DIR_DOWNLOAD: - s_curRcvSequence = msgBuf[1]; - - if((s_curRcvSequence != s_lastRcvSqunce) && (s_curRcvSequence != ((uint8_t)(s_lastRcvSqunce + 1)))) - { - Uds_NegativeResponse(obj, 0x36, NRC_WRONG_BLOCK_SEQUENCE_COUNTER); - return; - } - - rspBuffer[rspLen++] = UDS_GET_POSITIVE_RSP(0x36); - rspBuffer[rspLen++] = msgBuf[1]; - if(s_curRcvSequence == s_lastRcvSqunce) - { - Uds_PositiveResponse(obj, rspBuffer, rspLen); - return; - } - - if((s_rcvDataTotalLen + msgLen - 2) > s_memSize) - { - Uds_NegativeResponse(obj, 0x36, NRC_TRANSFER_DATA_SUSPENDED); - return; - } - - /* user add code to deal with download data */ - /* polyspace-begin DEFECT:DEAD_CODE [No action planned:Low] "Still reserve though it's maybe unreachable" */ - if(1) /* deal success */ - { - s_rcvDataTotalLen += msgLen - 2; - s_lastRcvSqunce = s_curRcvSequence; - Uds_PositiveResponse(obj, rspBuffer, rspLen); - } - else - { - Uds_NegativeResponse(obj, 0x36, NRC_GENERAL_PROGRAMMING_FAILURE); - } - /* polyspace-end DEFECT:DEAD_CODE [No action planned:Low] "Still reserve though it's maybe unreachable" */ - break; - case UDS_TRANSFER_DIR_UPLOAD: - Uds_NegativeResponse(obj, 0x36, NRC_REQUEST_OUT_OF_RANGE); - break; - default: - Uds_NegativeResponse(obj, 0x36, NRC_REQUEST_SEQUENCE_ERROR); - break; - } -} - - - diff --git a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service36.h b/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service36.h deleted file mode 100644 index a0dd723..0000000 --- a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_service36.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -#ifndef _UDS_SERVICE36_H_ -#define _UDS_SERVICE36_H_ - -/*! \brief Contains public interface to various functions related - * to the user-defined UDS service 36 - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include -#include -#include "../stack/uds.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/*! \brief The Uds IO control type - */ -typedef enum _UdsTransDirType_ -{ - UDS_TRANSFER_DIR_NONE = 0x00, - UDS_TRANSFER_DIR_DOWNLOAD = 0x01, - UDS_TRANSFER_DIR_UPLOAD = 0x02, -} UdsTransDirType; - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the function prototypes - ******************************************************************************/ - -/*! \brief set memery start address - */ -extern void Uds_SetMemAddr(uint32_t addr); - -/*! \brief get memery start address - */ -extern uint32_t Uds_GetMemAddr(void); - -/*! \brief set memery size - */ -extern void Uds_SetMemSize(uint32_t size); - -/*! \brief get memery size - */ -extern uint32_t Uds_GetMemSize(void); - -/*! \brief set data transfer direct - */ -extern void Uds_SetDataTransferDirect(UdsTransDirType dirType); - -/*! \brief get data transfer direct - */ -extern UdsTransDirType Uds_GetDataTransferDirect(void); - -/*! \brief get receive data total len - */ -extern uint32_t Uds_GetRcvDataTotalLen(void); - -/*! \brief Uds Service 10 processing - */ -extern void UdsService36_TransferData(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen); - -#ifdef __cplusplus -} -#endif /* extern "C" */ - -#endif /* _UDS_SERVICE36_H_ */ diff --git a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_user.c b/cva_bootloader_m0128/SDK/middleware/uds/user/uds_user.c deleted file mode 100644 index b29374a..0000000 --- a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_user.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include "uds_user.h" - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/*! \brief The Data-by-ID definition of UDS - */ -typedef struct _Uds_DidBuffer_ -{ - uint8_t buffer_F113[4]; - uint8_t buffer_F180[16]; - uint8_t buffer_F186[1]; - uint8_t buffer_F18A[6]; - uint8_t buffer_F195[16]; - uint8_t buffer_F1A0[8]; - uint8_t buffer_F1A1[8]; - uint8_t buffer_F1A2[8]; - uint8_t buffer_F1A5[8]; - uint8_t buffer_F1AE[16]; - uint8_t buffer_4F53[1]; - uint8_t buffer_4F80[2]; - uint8_t buffer_4F65[1]; - uint8_t buffer_4F66[1]; - uint8_t buffer_4F67[2]; - uint8_t buffer_F19E[32]; - uint8_t buffer_F1AA[8]; - uint8_t buffer_F1AB[8]; - uint8_t buffer_F112[8]; - uint8_t buffer_F190[17]; - uint8_t buffer_F191[16]; - uint8_t buffer_F193[16]; - uint8_t buffer_F197[8]; - uint8_t buffer_F198[16]; - uint8_t buffer_F199[4]; - uint8_t buffer_F19D[4]; - uint8_t buffer_DFEF[64]; - uint8_t buffer_F101[4]; - uint8_t buffer_F110[8]; - uint8_t buffer_4F51[16]; - uint8_t buffer_4F54[16]; - uint8_t buffer_F18C[24]; - uint8_t buffer_F18B[4]; - uint8_t buffer_0200[1]; - uint8_t buffer_0201[1]; - uint8_t buffer_F187[10]; - uint8_t buffer_F189[16]; - uint8_t buffer_FD01[1]; - uint8_t buffer_FD02[1]; - uint8_t buffer_FD03[1]; -} Uds_DidBuffer; - -/******************************************************************************* - * the globals - ******************************************************************************/ - -Uds_DidBuffer udsDidBuf; - -/******************************************************************************* - * the constants - ******************************************************************************/ - -static const Uds_ServiceType udsServiceTable[UDS_SERVICE_NUM] = { - {0x10, 2, true, UdsService10_SessionControl }, - {0x11, 2, true, UdsService11_ResetEcu }, - {0x27, 2, true, UdsService27_SecurityAccess }, - {0x28, 3, true, UdsService28_CommunicationControl }, - {0x3E, 2, true, UdsService3E_TesterPresent }, - {0x85, 2, true, UdsService85_ControlDtcSetting }, - {0x22, 3, false, UdsService22_ReadDataByIdentifier }, - {0x2E, 4, false, UdsService2E_WriteDataByIdentifier}, - {0x14, 4, false, UdsService14_ClearDiagInfo }, - {0x19, 3, true, UdsService19_ReadDtcInformation }, - {0x2F, 3, false, UdsService2F_InputOutputCtrlById }, - {0x31, 4, true, UdsService31_RoutineControl }, - {0x34, 5, false, UdsService34_RequestDownload }, - {0x36, 2, false, UdsService36_TransferData }, - {0x37, 1, false, UdsService37_RequestTransferExit }, -}; - -static const bool udsSecurityTable[UDS_SERVICE_NUM][UDS_SA_LEVEL_NUM] = { - {false, false, false}, /* 0x10 */ - {false, false, false}, /* 0x11 */ - {false, false, false}, /* 0x27 */ - {false, false, false}, /* 0x28 */ - {false, false, false}, /* 0x3E */ - {false, false, false}, /* 0x85 */ - {false, false, false}, /* 0x22 */ - {false, false, false}, /* 0x2E */ - {false, false, false}, /* 0x14 */ - {false, false, false}, /* 0x19 */ - {false, false, false}, /* 0x2F */ - {false, false, false}, /* 0x31 */ - {false, false, false}, /* 0x34 */ - {false, false, false}, /* 0x36 */ - {false, false, false}, /* 0x37 */ -}; - -Uds_DidType udsDidTable[] = { - {0xF113, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F113, BYTES_OF(udsDidBuf.buffer_F113)}, - {0xF180, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F180, BYTES_OF(udsDidBuf.buffer_F180)}, - {0xF186, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F186, BYTES_OF(udsDidBuf.buffer_F186)}, - {0xF18A, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F18A, BYTES_OF(udsDidBuf.buffer_F18A)}, - {0xF195, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F195, BYTES_OF(udsDidBuf.buffer_F195)}, - {0xF1A0, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F1A0, BYTES_OF(udsDidBuf.buffer_F1A0)}, - {0xF1A1, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F1A1, BYTES_OF(udsDidBuf.buffer_F1A1)}, - {0xF1A2, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F1A2, BYTES_OF(udsDidBuf.buffer_F1A2)}, - {0xF1A5, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F1A5, BYTES_OF(udsDidBuf.buffer_F1A5)}, - {0xF1AE, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F1AE, BYTES_OF(udsDidBuf.buffer_F1AE)}, - {0x4F53, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_4F53, BYTES_OF(udsDidBuf.buffer_4F53)}, - {0x4F80, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_4F80, BYTES_OF(udsDidBuf.buffer_4F80)}, - {0x4F65, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_4F65, BYTES_OF(udsDidBuf.buffer_4F65)}, - {0x4F66, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_4F66, BYTES_OF(udsDidBuf.buffer_4F66)}, - {0x4F67, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_4F67, BYTES_OF(udsDidBuf.buffer_4F67)}, - {0xF19E, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F19E, BYTES_OF(udsDidBuf.buffer_F19E)}, - {0xF1AA, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F1AA, BYTES_OF(udsDidBuf.buffer_F1AA)}, - {0xF1AB, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F1AB, BYTES_OF(udsDidBuf.buffer_F1AB)}, - {0xF112, UDS_DID_TYPE_NVM_RW, UDS_SESSION_EXTENDED, UDS_SA_LEVEL_1, udsDidBuf.buffer_F112, BYTES_OF(udsDidBuf.buffer_F112)}, - {0xF190, UDS_DID_TYPE_NVM_RW, UDS_SESSION_EXTENDED, UDS_SA_LEVEL_1, udsDidBuf.buffer_F190, BYTES_OF(udsDidBuf.buffer_F190)}, - {0xF191, UDS_DID_TYPE_NVM_RO, UDS_SESSION_SUPPLIER, UDS_SA_LEVEL_63, udsDidBuf.buffer_F191, BYTES_OF(udsDidBuf.buffer_F191)}, - {0xF193, UDS_DID_TYPE_NVM_RO, UDS_SESSION_SUPPLIER, UDS_SA_LEVEL_63, udsDidBuf.buffer_F193, BYTES_OF(udsDidBuf.buffer_F193)}, - {0xF197, UDS_DID_TYPE_NVM_RW, UDS_SESSION_EXTENDED, UDS_SA_LEVEL_1, udsDidBuf.buffer_F197, BYTES_OF(udsDidBuf.buffer_F197)}, - {0xF198, UDS_DID_TYPE_NVM_RO, UDS_SESSION_SUPPLIER, UDS_SA_LEVEL_63, udsDidBuf.buffer_F198, BYTES_OF(udsDidBuf.buffer_F198)}, - {0xF199, UDS_DID_TYPE_NVM_RO, UDS_SESSION_SUPPLIER, UDS_SA_LEVEL_63, udsDidBuf.buffer_F199, BYTES_OF(udsDidBuf.buffer_F199)}, - {0xF19D, UDS_DID_TYPE_NVM_RW, UDS_SESSION_EXTENDED, UDS_SA_LEVEL_1, udsDidBuf.buffer_F19D, BYTES_OF(udsDidBuf.buffer_F19D)}, - {0xDFEF, UDS_DID_TYPE_NVM_RW, UDS_SESSION_EXTENDED, UDS_SA_LEVEL_1, udsDidBuf.buffer_DFEF, BYTES_OF(udsDidBuf.buffer_DFEF)}, - {0xF101, UDS_DID_TYPE_NVM_RW, UDS_SESSION_EXTENDED, UDS_SA_LEVEL_1, udsDidBuf.buffer_F101, BYTES_OF(udsDidBuf.buffer_F101)}, - {0xF110, UDS_DID_TYPE_NVM_RO, UDS_SESSION_EXTENDED, UDS_SA_LEVEL_1, udsDidBuf.buffer_F110, BYTES_OF(udsDidBuf.buffer_F110)}, - {0x4F51, UDS_DID_TYPE_NVM_WO, UDS_SESSION_EXTENDED, UDS_SA_LEVEL_1, udsDidBuf.buffer_4F51, BYTES_OF(udsDidBuf.buffer_4F51)}, - {0x4F54, UDS_DID_TYPE_NVM_WO, UDS_SESSION_EXTENDED, UDS_SA_LEVEL_1, udsDidBuf.buffer_4F54, BYTES_OF(udsDidBuf.buffer_4F54)}, - {0xF18C, UDS_DID_TYPE_NVM_RO, UDS_SESSION_SUPPLIER, UDS_SA_LEVEL_63, udsDidBuf.buffer_F18C, BYTES_OF(udsDidBuf.buffer_F18C)}, - {0xF18B, UDS_DID_TYPE_NVM_RO, UDS_SESSION_SUPPLIER, UDS_SA_LEVEL_63, udsDidBuf.buffer_F18B, BYTES_OF(udsDidBuf.buffer_F18B)}, - {0x0200, UDS_DID_TYPE_NVM_RO, UDS_SESSION_EXTENDED, UDS_SA_LEVEL_1, udsDidBuf.buffer_0200, BYTES_OF(udsDidBuf.buffer_0200)}, - {0x0201, UDS_DID_TYPE_NVM_RO, UDS_SESSION_EXTENDED, UDS_SA_LEVEL_1, udsDidBuf.buffer_0201, BYTES_OF(udsDidBuf.buffer_0201)}, - {0xF187, UDS_DID_TYPE_NVM_RO, UDS_SESSION_SUPPLIER, UDS_SA_LEVEL_63, udsDidBuf.buffer_F187, BYTES_OF(udsDidBuf.buffer_F187)}, - {0xF189, UDS_DID_TYPE_NVM_RO, UDS_SESSION_SUPPLIER, UDS_SA_LEVEL_63, udsDidBuf.buffer_F189, BYTES_OF(udsDidBuf.buffer_F189)}, - {0xFD01, UDS_DID_TYPE_NVM_RO, UDS_SESSION_SUPPLIER, UDS_SA_LEVEL_63, udsDidBuf.buffer_FD01, BYTES_OF(udsDidBuf.buffer_FD01)}, - {0xFD02, UDS_DID_TYPE_NVM_RO, UDS_SESSION_SUPPLIER, UDS_SA_LEVEL_63, udsDidBuf.buffer_FD02, BYTES_OF(udsDidBuf.buffer_FD02)}, - {0xFD03, UDS_DID_TYPE_NVM_RO, UDS_SESSION_SUPPLIER, UDS_SA_LEVEL_63, udsDidBuf.buffer_FD03, BYTES_OF(udsDidBuf.buffer_FD03)}, -}; - -/******************************************************************************* - * the functions - ******************************************************************************/ - -void Uds_UserInit(UdsType *obj, const Uds_ParamsType *pParams) -{ - Uds_Init(obj, pParams); - - obj->seviceTable = udsServiceTable; - obj->securityTable = &udsSecurityTable[0][0]; - obj->serviceNum = UDS_SERVICE_NUM; - obj->didTable = udsDidTable; - obj->didNum = sizeof(udsDidTable) / sizeof(Uds_DidType); -} diff --git a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_user.h b/cva_bootloader_m0128/SDK/middleware/uds/user/uds_user.h deleted file mode 100644 index 1925d50..0000000 --- a/cva_bootloader_m0128/SDK/middleware/uds/user/uds_user.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -#ifndef _UDS_USER_H_ -#define _UDS_USER_H_ - -/*! \brief Contains public interface to various functions related - * to the user-defined UDS application - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include -#include -#include "../stack/uds.h" -#include "uds_service10.h" -#include "uds_service11.h" -#include "uds_service14.h" -#include "uds_service19.h" -#include "uds_service22.h" -#include "uds_service27.h" -#include "uds_service28.h" -#include "uds_service2E.h" -#include "uds_service2F.h" -#include "uds_service31.h" -#include "uds_service34.h" -#include "uds_service36.h" -#include "uds_service37.h" -#include "uds_service3E.h" -#include "uds_service85.h" -#include "uds_dtc.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the function prototypes - ******************************************************************************/ - -/*! \brief Initialize the UDS object - */ -extern void Uds_UserInit(UdsType *obj, const Uds_ParamsType *pParams); - -#ifdef __cplusplus -} -#endif /* extern "C" */ - -#endif /* _UDS_USER_H_ */ diff --git a/cva_bootloader_m0128/SDK/platform/devices/CVM012x/drivers/cpu/startup/system_M012x.c b/cva_bootloader_m0128/SDK/platform/devices/CVM012x/drivers/cpu/startup/system_M012x.c index 106b830..592d3ca 100644 --- a/cva_bootloader_m0128/SDK/platform/devices/CVM012x/drivers/cpu/startup/system_M012x.c +++ b/cva_bootloader_m0128/SDK/platform/devices/CVM012x/drivers/cpu/startup/system_M012x.c @@ -64,7 +64,7 @@ void SystemInit(void) #ifdef _USE_EXT_OSC_ /* Use External oscillator */ - Scg0Reg_SetOscCtrlRange(SCG0, 3); /* set SOSC frequency range(use max value when SOSC as the clock source of the PLL) */ + Scg0Reg_SetOscCtrlRange(SCG0, 1); /* set SOSC frequency range(use max value when SOSC as the clock source of the PLL) */ Scg0Reg_SetOscCtrlEnSosc(SCG0, 1); /* enable SOSC */ while(Scg0Reg_GetStatusSoscRdy(SCG0) == 0) { @@ -83,7 +83,7 @@ void SystemInit(void) */ Scg0Reg_SetPllCtrl1PllClkinSel(SCG0, 1); Scg0Reg_SetPllCtrl0PllPreDiv(SCG0, 0); - Scg0Reg_SetPllCtrl0PllM(SCG0, 20); + Scg0Reg_SetPllCtrl0PllM(SCG0, 40); Scg0Reg_SetPllCtrl0PllOutDiv(SCG0, 1); Scg0Reg_SetPllCtrl0PllPosDiv(SCG0, 2); /* Enable PLL */ diff --git a/cva_bootloader_m0128/SDK/platform/devices/CVM012x/drivers/cpu/startup/system_M012x.h b/cva_bootloader_m0128/SDK/platform/devices/CVM012x/drivers/cpu/startup/system_M012x.h index 5694043..7c265ee 100644 --- a/cva_bootloader_m0128/SDK/platform/devices/CVM012x/drivers/cpu/startup/system_M012x.h +++ b/cva_bootloader_m0128/SDK/platform/devices/CVM012x/drivers/cpu/startup/system_M012x.h @@ -36,7 +36,7 @@ extern "C" { ******************************************************************************/ /* Value of the external crystal or oscillator clock frequency in Hz */ -#define CPU_XTAL_CLK_HZ (16000000u) +#define CPU_XTAL_CLK_HZ (8000000u) #if CPU_XTAL_CLK_HZ > 40000000 #error "The external crystal or oscillator clock frequency is out of range." #endif diff --git a/cva_bootloader_m0128/linker/bootloader_m0128_flash.icf b/cva_bootloader_m0128/linker/bootloader_m0128_flash.icf index 4d2fcaa..eeea221 100644 --- a/cva_bootloader_m0128/linker/bootloader_m0128_flash.icf +++ b/cva_bootloader_m0128/linker/bootloader_m0128_flash.icf @@ -41,9 +41,9 @@ define symbol m_interrupts_start = 0x00000000; define symbol m_interrupts_end = 0x000000BF; define symbol m_bootinformation_start = 0x000000C0; -define symbol m_bootinformation_end = 0x000000C3; +define symbol m_bootinformation_end = 0x000000FF; -define symbol m_text_start = 0x00000C4; +define symbol m_text_start = 0x0000100; define symbol m_text_end = 0x0000FFFF; /* .data space */ diff --git a/cva_bootloader_m0128/settings/cva_bootloader_m0128.dbgdt b/cva_bootloader_m0128/settings/cva_bootloader_m0128.dbgdt index 73e71f6..fddc922 100644 --- a/cva_bootloader_m0128/settings/cva_bootloader_m0128.dbgdt +++ b/cva_bootloader_m0128/settings/cva_bootloader_m0128.dbgdt @@ -1,4 +1,1016 @@ - + - + + + 34048 + 34049 + 34050 + 34051 + 34052 + 34053 + 34054 + 34055 + 34056 + 34057 + 34058 + 34059 + 34060 + 34061 + 34062 + 34063 + 34064 + 34065 + 34066 + 34067 + 34068 + 34069 + 34070 + 34071 + 34072 + 34073 + 34074 + 34075 + 34076 + 34077 + 34078 + 34079 + 34080 + 34081 + 34082 + 34083 + 34084 + 34085 + 34086 + 34087 + 34088 + 34089 + 34090 + 34091 + 34092 + 34093 + 34094 + 34095 + 34096 + 34097 + 34098 + 34099 + 34100 + 34101 + 34102 + 34103 + 34104 + 34105 + + + + + 34001 + 0 + + + + + 34390 + 34323 + 34398 + 34400 + 34397 + 34320 + 34321 + 34324 + 0 + + + + + 37459 + 37460 + + + + + 57600 + 57601 + 57603 + 33024 + 0 + 57607 + 0 + 57635 + 57634 + 57637 + 0 + 57643 + 57644 + 0 + 33090 + 33057 + 57636 + 57640 + 57641 + 33026 + 33065 + 33063 + 33064 + 33053 + 33054 + 0 + 33035 + 33036 + 34399 + 0 + 33055 + 33056 + 33094 + 0 + + + + + + Disassembly + _I0 + + + 500 + 20 + + 1 + 1 + + + 14 + 32 + + + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 2C0000000700108600000C00000020810000020000000C8100000E00000056860000050000000E8100000100000011860000070000004681000003000000 + + + 08000D8400000F84000008840000FFFFFFFF54840000328100001C81000009840000 + 04000E8400005100000030840000530000000B8100001E0000000D81000020000000 + + + 0 + 0A0000000A0000006E0000006E000000 + 000000001A030000000600002B030000 + 4096 + 0 + 0 + 32767 + 0 + + + 1 + + + 4294967295 + 00000000CB010000000600007C020000 + 00000000B40100000006000065020000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + 34052 + 00000000170000000601000078010000 + FE0400004A000000FC05000000030000 + 16384 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34072 + 00000000170000000601000078010000 + FE0400004A000000FC05000000030000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34095 + 00000000170000000601000078010000 + FE0400004A000000FC05000000030000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34101 + 00000000170000000601000078010000 + FA04000046000000000600001A030000 + 4096 + 0 + 0 + 32767 + 0 + + + 1 + + + + + + + Expression + Location + Type + Value + + + 100 + 150 + 100 + 100 + + 0 + + + 34102 + 00000000170000000601000078010000 + FE0400004A000000FC05000000030000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34103 + 00000000170000000601000078010000 + FE0400004A000000FC05000000030000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34104 + 00000000170000000601000078010000 + FE0400004A000000FC05000000030000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34053 + 000000001700000022010000C8000000 + 0400000081020000FC05000000030000 + 32768 + 0 + 0 + 32767 + 0 + + + 0 + + + 34079 + 000000001700000022010000C8000000 + 0400000081020000FC05000000030000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34054 + 000000001700000022010000C8000000 + 0400000081020000F204000000030000 + 32768 + 0 + 0 + 32767 + 0 + + + 1 + + + 34062 + 000000001700000022010000C8000000 + 0400000081020000F204000000030000 + 4096 + 0 + 0 + 32767 + 0 + + + 1 + + + 34066 + 000000001700000022010000C8000000 + 0400000081020000F204000000030000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + 34067 + 000000001700000022010000C8000000 + 0400000081020000F204000000030000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + 34068 + 000000001700000022010000C8000000 + 0400000081020000F204000000030000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + 34087 + 000000001700000022010000C8000000 + 0400000081020000F204000000030000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + 34090 + 000000001700000022010000C8000000 + 0400000081020000F204000000030000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + 34100 + 000000001700000022010000C8000000 + 0400000081020000F204000000030000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + 34055 + 000000001700000080020000A8000000 + 00000000000000008002000091000000 + 32768 + 0 + 0 + 32767 + 0 + + + 0 + + + 34056 + 00000000170000000601000078010000 + 0400000030000000020100004B020000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34092 + 00000000170000000601000078010000 + 0400000030000000020100004B020000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34093 + 00000000170000000601000078010000 + 0400000030000000020100004B020000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34057 + 00000000170000000601000078010000 + 00000000000000000601000061010000 + 16384 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34058 + 000000001700000022010000C8000000 + 000000000000000022010000B1000000 + 32768 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34059 + 000000001700000022010000C8000000 + 000000000000000022010000B1000000 + 32768 + 0 + 0 + 32767 + 0 + + + 0 + + + 34060 + 000000001700000022010000C8000000 + 000000000000000022010000B1000000 + 32768 + 0 + 0 + 32767 + 0 + + + 0 + + + 34061 + 00000000170000000601000078010000 + FE04000030000000FC0500004B020000 + 16384 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34073 + 00000000170000000601000078010000 + FE04000030000000FC0500004B020000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34063 + 00000000170000000601000078010000 + F003000032000000F604000065020000 + 16384 + 0 + 0 + 32767 + 0 + + + 1 + + + 34064 + 000000001700000022010000C8000000 + 000000000000000022010000B1000000 + 32768 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34065 + 000000001700000022010000C8000000 + 04000000CC010000FC0500004B020000 + 32768 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34070 + 000000001700000022010000C8000000 + 04000000CC010000FC0500004B020000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34088 + 000000001700000022010000C8000000 + 04000000CC010000FC0500004B020000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34089 + 000000001700000022010000C8000000 + 04000000CC010000FC0500004B020000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34069 + 000000001700000022010000C8000000 + 000000000000000022010000B1000000 + 32768 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34071 + 000000001700000022010000C8000000 + 000000000000000022010000B1000000 + 32768 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34074 + 00000000170000000601000078010000 + FE04000030000000FC0500004B020000 + 16384 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34082 + 00000000170000000601000078010000 + FE04000030000000FC0500004B020000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34083 + 00000000170000000601000078010000 + FE04000030000000FC0500004B020000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34084 + 00000000170000000601000078010000 + FE04000030000000FC0500004B020000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34085 + 00000000170000000601000078010000 + FE04000030000000FC0500004B020000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34075 + 000000001700000022010000C8000000 + 04000000CC010000FC0500004B020000 + 32768 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34076 + 000000001700000022010000C8000000 + 04000000CC010000FC0500004B020000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34077 + 000000001700000022010000C8000000 + 04000000CC010000FC0500004B020000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34078 + 000000001700000022010000C8000000 + 04000000CC010000FC0500004B020000 + 4096 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34080 + 000000001700000022010000C8000000 + 000000000000000022010000B1000000 + 32768 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34081 + 000000001700000022010000C8000000 + 000000000000000022010000B1000000 + 32768 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34086 + 00000000170000000601000078010000 + 00000000000000000601000061010000 + 16384 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34091 + 000000001700000080020000A8000000 + 00000000000000008002000091000000 + 32768 + 0 + 0 + 32767 + 0 + + + 0 + + + 34094 + 00000000170000000601000078010000 + 00000000000000000601000061010000 + 16384 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34096 + 000000001700000022010000C8000000 + 000000000000000022010000B1000000 + 32768 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34097 + 000000001700000022010000C8000000 + 000000000000000022010000B1000000 + 32768 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34098 + 00000000170000000601000078010000 + 00000000000000000601000061010000 + 16384 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34099 + 0000000017000000AE010000D8000000 + 0000000000000000AE010000C1000000 + 32768 + 0 + 0 + 32767 + 0 + + + 0 + + + + 34105 + 00000000170000000601000078010000 + 00000000320000000601000065020000 + 4096 + 0 + 0 + 32767 + 0 + + + 1 + + + 0000000036000000000000000010000001000000FFFFFFFFFFFFFFFF06010000320000000A01000065020000010000000200001004000000010000000000000000000000398500000000000000000000000000000000000001000000398500000100000039850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000338500000000000000000000000000000000000001000000338500000100000033850000000000000040000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000200000004000000010000000000000000000000328500000000000000000000000000000000000001000000328500000100000032850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000318500000000000000000000000000000000000001000000318500000100000031850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000308500000000000000000000000000000000000001000000308500000100000030850000000000000040000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000002000000040000000100000000000000000000002E85000000000000000000000000000000000000010000002E850000010000002E850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000000040000000100000000000000000000002B85000000000000000000000000000000000000010000002B850000010000002B850000000000000040000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000200000004000000010000000000000000000000268500000000000000000000000000000000000001000000268500000100000026850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000218500000000000000000000000000000000000001000000218500000100000021850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000208500000000000000000000000000000000000001000000208500000100000020850000000000000080000000000000FFFFFFFFFFFFFFFF00000000B001000000060000B4010000000000000100000004000000010000000000000000000000FFFFFFFF040000001B8500001C8500001D8500001E850000FFFF02000B004354616262656450616E65008000000000000000000000CB010000000600007C02000000000000B40100000006000065020000000000004080004604000000FFFEFF084D0065006D006F007200790020003100000000001B85000001000000FFFFFFFFFFFFFFFFFFFEFF084D0065006D006F007200790020003200000000001C85000001000000FFFFFFFFFFFFFFFFFFFEFF084D0065006D006F007200790020003300000000001D85000001000000FFFFFFFFFFFFFFFFFFFEFF084D0065006D006F007200790020003400000000001E85000001000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000001000000FFFFFFFF1B85000001000000FFFFFFFF1B850000000000000040000000000000FFFFFFFFFFFFFFFFF604000018000000FA04000065020000000000000200000004000000010000000000000000000000FFFFFFFF050000001A8500002285000023850000248500002585000001800040000000000000FA0400002F000000000600007C020000FA040000180000000006000065020000000000004040004605000000FFFEFF124D006100630072006F00200052006500670069007300740072006100740069006F006E00000000001A85000001000000FFFFFFFFFFFFFFFFFFFEFF0B52006500670069007300740065007200730020003100000000002285000001000000FFFFFFFFFFFFFFFFFFFEFF0B52006500670069007300740065007200730020003200000000002385000001000000FFFFFFFFFFFFFFFFFFFEFF0B52006500670069007300740065007200730020003300000000002485000001000000FFFFFFFFFFFFFFFFFFFEFF0B52006500670069007300740065007200730020003400000000002585000001000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000001000000FFFFFFFF1A85000001000000FFFFFFFF1A850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000178500000000000000000000000000000000000001000000178500000100000017850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000158500000000000000000000000000000000000001000000158500000100000015850000000000000080000000000000FFFFFFFFFFFFFFFF00000000B001000000060000B4010000000000000100000004000000010000000000000000000000FFFFFFFF04000000118500001685000028850000298500000180008000000000000000000000CB010000000600007C02000000000000B40100000006000065020000000000004080004604000000FFFEFF09530057004F00200054007200610063006500000000001185000001000000FFFFFFFFFFFFFFFFFFFEFF11460069006E006400200049006E002000530057004F00200054007200610063006500000000001685000001000000FFFFFFFFFFFFFFFFFFFEFF12450054004D002000460075006E006300740069006F006E00200054007200610063006500000000002885000001000000FFFFFFFFFFFFFFFFFFFEFF09450054004D00200054007200610063006500000000002985000001000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000001000000FFFFFFFF1185000001000000FFFFFFFF11850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000108500000000000000000000000000000000000001000000108500000100000010850000000000000040000001000000FFFFFFFFFFFFFFFFEC03000032000000F0030000650200000100000002000010040000000100000000000000000000000F85000000000000000000000000000000000000010000000F850000010000000F850000000000000040000000000000FFFFFFFFFFFFFFFFF604000018000000FA04000065020000000000000200000004000000010000000000000000000000FFFFFFFF020000000D8500001985000001800040000000000000FA0400002F000000000600007C020000FA040000180000000006000065020000000000004040004602000000FFFEFF0F4400650062007500670067006500720020004D006100630072006F007300000000000D85000001000000FFFFFFFFFFFFFFFFFFFEFF114D006100630072006F00200051007500690063006B006C00610075006E0063006800000000001985000001000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000001000000FFFFFFFF0D85000001000000FFFFFFFF0D850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000000040000000100000000000000000000000C85000000000000000000000000000000000000010000000C850000010000000C850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000000040000000100000000000000000000000B85000000000000000000000000000000000000010000000B850000010000000B850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000000040000000100000000000000000000000A85000000000000000000000000000000000000010000000A850000010000000A850000000000000040000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000200000004000000010000000000000000000000098500000000000000000000000000000000000001000000098500000100000009850000000000000010000000000000FFFFFFFFFFFFFFFF06010000180000000A01000065020000000000000200000004000000010000000000000000000000FFFFFFFF03000000088500002C8500002D85000001800010000000000000000000002F000000060100007C02000000000000180000000601000065020000000000004010004603000000FFFEFF0A430061006C006C00200053007400610063006B00000000000885000001000000FFFFFFFFFFFFFFFFFFFEFF0753007400610063006B0020003100000000002C85000001000000FFFFFFFFFFFFFFFFFFFEFF0753007400610063006B0020003200000000002D85000001000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000001000000FFFFFFFF0885000001000000FFFFFFFF08850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000078500000000000000000000000000000000000001000000078500000100000007850000000000000080000001000000FFFFFFFFFFFFFFFF0000000065020000F604000069020000010000000100001004000000010000000000000000000000FFFFFFFF08000000068500000E850000128500001385000014850000278500002A85000034850000018000800000010000000000000080020000F6040000310300000000000069020000F60400001A030000000000004080005608000000FFFEFF054200750069006C006400010000000685000001000000FFFFFFFFFFFFFFFFFFFEFF094400650062007500670020004C006F006700010000000E85000001000000FFFFFFFFFFFFFFFFFFFEFF0C4400650063006C00610072006100740069006F006E007300000000001285000001000000FFFFFFFFFFFFFFFFFFFEFF0A5200650066006500720065006E00630065007300000000001385000001000000FFFFFFFFFFFFFFFFFFFEFF0D460069006E006400200069006E002000460069006C0065007300000000001485000001000000FFFFFFFFFFFFFFFFFFFEFF1541006D0062006900670075006F0075007300200044006500660069006E006900740069006F006E007300000000002785000001000000FFFFFFFFFFFFFFFFFFFEFF1153006F0075007200630065002000420072006F0077007300650020004C006F006700000000002A85000001000000FFFFFFFFFFFFFFFFFFFEFF0B54006F006F006C0020004F0075007400700075007400000000003485000001000000FFFFFFFFFFFFFFFF01000000000000000000000000000000000000000000000001000000FFFFFFFF0685000001000000FFFFFFFF06850000000000000080000000000000FFFFFFFFFFFFFFFF00000000650200000006000069020000000000000100000004000000010000000000000000000000FFFFFFFF02000000058500001F85000001800080000000000000000000008002000000060000310300000000000069020000000600001A030000000000004080004602000000FFFEFF0B42007200650061006B0070006F0069006E0074007300000000000585000001000000FFFFFFFFFFFFFFFFFFFEFF1042007200650061006B0070006F0069006E007400200055007300610067006500000000001F85000001000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000001000000FFFFFFFF0585000001000000FFFFFFFF05850000000000000040000001000000FFFFFFFFFFFFFFFFF604000032000000FA0400001A030000010000000200001004000000010000000000000000000000FFFFFFFF0700000004850000188500002F8500003585000036850000378500003885000001800040000001000000FA040000490000000006000031030000FA04000032000000000600001A030000000000004040005607000000FFFEFF044100750074006F00000000000485000001000000FFFFFFFFFFFFFFFFFFFEFF064C006F00630061006C007300000000001885000001000000FFFFFFFFFFFFFFFFFFFEFF0A4C00690076006500200057006100740063006800000000002F85000001000000FFFFFFFFFFFFFFFFFFFEFF075700610074006300680020003100010000003585000001000000FFFFFFFFFFFFFFFFFFFEFF075700610074006300680020003200000000003685000001000000FFFFFFFFFFFFFFFFFFFEFF075700610074006300680020003300000000003785000001000000FFFFFFFFFFFFFFFFFFFEFF075700610074006300680020003400000000003885000001000000FFFFFFFFFFFFFFFF03000000000000000000000000000000000000000000000001000000FFFFFFFF0485000001000000FFFFFFFF04850000000000000000000000000000 + + + CMSIS-Pack + 00200000010000000100FFFF01001100434D4643546F6F6C426172427574746F6ED18400000200000084040000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF0A43004D005300490053002D005000610063006B0018000000 + + + 34048 + 0A0000000A0000006E0000006E000000 + 6704000000000000950400001A000000 + 8192 + 0 + 0 + 24 + 0 + + + 1 + + + Debug + 00200000010000000800FFFF01001100434D4643546F6F6C426172427574746F6E56860000020000009F040000FFFEFF000000000000000000000000000100000001000000018013860000020000009B040000FFFEFF00000000000000000000000000010000000100000001805E86000002000000A1040000FFFEFF00000000000000000000000000010000000100000001806086000002000000A3040000FFFEFF00000000000000000000000000010000000100000001805D86000002000000A0040000FFFEFF0000000000000000000000000001000000010000000180108600000200000099040000FFFEFF000000000000000000000000000100000001000000018011860000020004009A040000FFFEFF000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E14860000020000009C040000FFFEFF205200650073006500740020007400680065002000640065006200750067006700650064002000700072006F006700720061006D000A00520065007300650074000000000000000000000000000100000001000000000000000000000001000000060009802B87000000000000FFFFFFFFFFFEFF13440069007300610062006C0065006400200028004E006F0020007200650073006500740029000100000000000000000000000100000001000000000000000000000001000000000009802C87000000000000FFFFFFFFFFFEFF0853006F006600740077006100720065000100000000000000000000000100000001000000000000000000000001000000000009802D87000000000000FFFFFFFFFFFEFF144800610072006400770061007200650020002800520065007300650074002000700069006E0029000100000000000000000000000100000001000000000000000000000001000000000009802F87000000000000FFFFFFFFFFFEFF064E006F0072006D0061006C000100000000000000000000000100000001000000000000000000000001000000000009800000000000000400FFFFFFFFFFFEFF000000000000000000000000000100000001000000000000000000000001000000000009801986000000000000FFFFFFFFFFFEFF000100000000000000000000000100000001000000000000000000000001000000000000000000FFFEFF0544006500620075006700C6000000 + + + 34049 + 0A0000000A0000006E0000006E000000 + 51030000000000002D0400001A000000 + 8192 + 0 + 0 + 198 + 0 + + + 1 + + + Trace + 00200000010000000200FFFF01001100434D4643546F6F6C426172427574746F6E539200000000000006050000FFFEFF03450054004D0000000000000000000000000001000000010000000180549200000000040007050000FFFEFF03530057004F00000000000000000000000000010000000100000000000000FFFEFF05540072006100630065002F000000 + + + 34050 + 0A0000000A0000006E0000006E000000 + 2D04000000000000670400001A000000 + 8192 + 0 + 0 + 47 + 0 + + + 1 + + + Main + 00200000010000002100FFFF01001100434D4643546F6F6C426172427574746F6E00E1000000000000E6040000FFFEFF000000000000000000000000000100000001000000018001E1000000000000E7040000FFFEFF000000000000000000000000000100000001000000018003E1000000000000E9040000FFFEFF00000000000000000000000000010000000100000001800081000000000000C6040000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E1000000000000EC040000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E1000000000400EE040000FFFEFF000000000000000000000000000100000001000000018022E1000000000400ED040000FFFEFF000000000000000000000000000100000001000000018025E1000000000000EF040000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE1000000000400F0040000FFFEFF00000000000000000000000000010000000100000001802CE1000000000400F1040000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01000D005061737465436F6D626F426F784281000000000000FFFFFFFFFFFEFF000100000000000000010000000000000001000000B400000002002050FFFFFFFFFFFEFF009600000000000000000001802181000000000400D8040000FFFEFF000000000000000000000000000100000001000000018024E1000000000000E1040000FFFEFF000000000000000000000000000100000001000000018028E1000000000400E0040000FFFEFF000000000000000000000000000100000001000000018029E1000000000000E2040000FFFEFF00000000000000000000000000010000000100000001800281000000000000C7040000FFFEFF00000000000000000000000000010000000100000001802981000000000000DC040000FFFEFF00000000000000000000000000010000000100000001802781000000000000DA040000FFFEFF00000000000000000000000000010000000100000001802881000000000000DB040000FFFEFF00000000000000000000000000010000000100000001801D81000000000000D4040000FFFEFF00000000000000000000000000010000000100000001801E81000000000400D5040000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B81000002000000CB040000FFFEFF00000000000000000000000000010000000100000001800C81000002000000CC040000FFFEFF00000000000000000000000000010000000100000001805F86000002000000DF040000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001801F81000002000000D6040000FFFEFF00000000000000000000000000010000000100000001802081000002000000D7040000FFFEFF00000000000000000000000000010000000100000001804681000002000200DD040000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E003B030000 + + + 34051 + 0A0000000A0000006E0000006E000000 + 0000000000000000510300001A000000 + 8192 + 0 + 0 + 827 + 0 + + + 1 + + + diff --git a/cva_bootloader_m0128/settings/cva_bootloader_m0128.dnx b/cva_bootloader_m0128/settings/cva_bootloader_m0128.dnx index 6211712..1b3d9f7 100644 --- a/cva_bootloader_m0128/settings/cva_bootloader_m0128.dnx +++ b/cva_bootloader_m0128/settings/cva_bootloader_m0128.dnx @@ -12,9 +12,15 @@ 50 + 0 E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\CVAChip\CVM0128.ddf + 12 + 0 + 0x10000 + 0x0 + 0x0 _ 0 _ 0 @@ -22,6 +28,43 @@ 0 1 + + 3012610226 + + + 1 + 0 + + + 0 + 1 + + + 1 + 10 + $PROJ_DIR$\TermIOInput.txt + 1 + 0 + 2 + 2 + + + _ 0 + _ 0 + + + 0 + + + 0 + 1 + 0 + 0 + + + 0 + 0 + _ 0 _ "" diff --git a/cva_bootloader_m0128/settings/cva_bootloader_m0128.wsdt b/cva_bootloader_m0128/settings/cva_bootloader_m0128.wsdt index 8820f4d..8101264 100644 --- a/cva_bootloader_m0128/settings/cva_bootloader_m0128.wsdt +++ b/cva_bootloader_m0128/settings/cva_bootloader_m0128.wsdt @@ -65,6 +65,7 @@ 0 33038 33039 + 33877 0 @@ -74,7 +75,7 @@ _I0 - 1503 + 1220 20 2 @@ -86,7 +87,16 @@ cva_bootloader_m0128 cva_bootloader_m0128/src + cva_bootloader_m0128/src/fls + cva_bootloader_m0128/src/middleware + cva_bootloader_m0128/src/middleware/uds + cva_bootloader_m0128/src/middleware/uds/user cva_bootloader_m0128/src/private_driver + cva_bootloader_m0128/src/private_driver/drivers + cva_bootloader_m0128/src/private_driver/isotp + cva_bootloader_m0128/src/private_driver/uds + cva_bootloader_m0128/src/private_driver/uds/stack + cva_bootloader_m0128/src/private_driver/uds/user @@ -101,11 +111,11 @@ 1 1 1 - 0600000001000C81000006000000 + 1800000009004881000001000000108600000300000020810000010000000C81000012000000568600000200000055840000010000000E8100000400000011860000030000004681000001000000 - 08000D8400000F84000008840000FFFFFFFF54840000328100001C81000009840000 - 040030840000530000000E840000510000000B810000680000000D8100006A000000 + 39000D8400000F84000008840000FFFFFFFF54840000328100001C810000098400000C8400003384000078840000118400002DDE00001FDE000020DE000021DE000026DE000028DE000023DE000022DE000024DE000027DE000025DE0000209200002892000029920000379200003892000034920000339200001E9200001D9200002CDE000008800000098000000A8000000B8000000C800000158000000A81000001E80000D6840000D7840000D8840000D9840000DA840000DB840000DC840000DD840000DE840000DF840000E0840000E1840000E9840000EA8400002481000048810000 + 1000268100002C050000048100001B0500000090000058050000098100001D0500002592000059000000449200000C0500000E8400005100000030840000530000001F920000090500002D9200000B0500000B8100001E000000058100001C05000035E100004505000002E100003B0500000D810000200000002C9200000A050000 0 @@ -136,8 +146,8 @@ 4294967295 - 00000000800200000006000031030000 - 0000000069020000000600001A030000 + 000000006E0200000006000031030000 + 0000000057020000000600001A030000 4096 0 0 @@ -150,7 +160,7 @@ 34051 000000001700000022010000C8000000 - 0400000081020000FC05000000030000 + 040000006F020000FC05000000030000 32768 0 0 @@ -168,9 +178,9 @@ _I0 - 476 + 465 40 - 969 + 980 20 2 @@ -181,7 +191,7 @@ 34055 000000001700000022010000C8000000 - 0400000081020000FC05000000030000 + 040000006F020000FC05000000030000 4096 0 0 @@ -194,7 +204,7 @@ 34056 000000001700000022010000C8000000 - 0400000081020000FC05000000030000 + 040000006F020000FC05000000030000 4096 0 0 @@ -216,7 +226,7 @@ 34057 000000001700000022010000C8000000 - 0400000081020000FC05000000030000 + 040000006F020000FC05000000030000 4096 0 0 @@ -238,7 +248,7 @@ 34058 000000001700000022010000C8000000 - 0400000081020000FC05000000030000 + 040000006F020000FC05000000030000 4096 0 0 @@ -252,7 +262,7 @@ 34059 000000001700000022010000C8000000 - 0400000081020000FC05000000030000 + 040000006F020000FC05000000030000 4096 0 0 @@ -274,7 +284,7 @@ 34060 000000001700000022010000C8000000 - 0400000081020000FC05000000030000 + 040000006F020000FC05000000030000 4096 0 0 @@ -282,7 +292,7 @@ 0 - 0 + 1 2 @@ -293,7 +303,7 @@ 34062 000000001700000022010000C8000000 - 0400000081020000FC05000000030000 + 040000006F020000FC05000000030000 4096 0 0 @@ -447,7 +457,7 @@ 34063 00000000170000000601000078010000 - 00000000320000000601000065020000 + 00000000320000000601000053020000 4096 0 0 @@ -458,16 +468,16 @@ 1 - 000000000E000000000000000010000001000000FFFFFFFFFFFFFFFF06010000320000000A010000650200000100000002000010040000000100000000000000000000000F85000000000000000000000000000000000000010000000F850000010000000F850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000000040000000100000000000000000000000D85000000000000000000000000000000000000010000000D850000010000000D850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000068500000000000000000000000000000000000001000000068500000100000006850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000058500000000000000000000000000000000000001000000058500000100000005850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000048500000000000000000000000000000000000001000000048500000100000004850000000000000080000001000000FFFFFFFFFFFFFFFF00000000650200000006000069020000010000000100001004000000010000000000000000000000FFFFFFFF08000000038500000785000008850000098500000A8500000B8500000C8500000E850000FFFF02000B004354616262656450616E650080000001000000000000008002000000060000310300000000000069020000000600001A030000000000004080005608000000FFFEFF054200750069006C006400010000000385000001000000FFFFFFFFFFFFFFFFFFFEFF094400650062007500670020004C006F006700010000000785000001000000FFFFFFFFFFFFFFFFFFFEFF0C4400650063006C00610072006100740069006F006E007300000000000885000001000000FFFFFFFFFFFFFFFFFFFEFF0A5200650066006500720065006E00630065007300000000000985000001000000FFFFFFFFFFFFFFFFFFFEFF0D460069006E006400200069006E002000460069006C0065007300000000000A85000001000000FFFFFFFFFFFFFFFFFFFEFF1541006D0062006900670075006F0075007300200044006500660069006E006900740069006F006E007300000000000B85000001000000FFFFFFFFFFFFFFFFFFFEFF1153006F0075007200630065002000420072006F0077007300650020004C006F006700000000000C85000001000000FFFFFFFFFFFFFFFFFFFEFF0B54006F006F006C0020004F0075007400700075007400000000000E85000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFF0385000001000000FFFFFFFF03850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000028500000000000000000000000000000000000001000000028500000100000002850000000000000000000000000000 + 000000000E000000000000000010000001000000FFFFFFFFFFFFFFFF06010000320000000A010000530200000100000002000010040000000100000000000000000000000F85000000000000000000000000000000000000010000000F850000010000000F850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000000040000000100000000000000000000000D85000000000000000000000000000000000000010000000D850000010000000D850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000068500000000000000000000000000000000000001000000068500000100000006850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000058500000000000000000000000000000000000001000000058500000100000005850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000048500000000000000000000000000000000000001000000048500000100000004850000000000000080000001000000FFFFFFFFFFFFFFFF00000000530200000006000057020000010000000100001004000000010000009FFEFFFF3C010000FFFFFFFF08000000038500000785000008850000098500000A8500000B8500000C8500000E850000FFFF02000B004354616262656450616E650080000001000000000000006E02000000060000310300000000000057020000000600001A030000000000004080005608000000FFFEFF054200750069006C006400010000000385000001000000FFFFFFFFFFFFFFFFFFFEFF094400650062007500670020004C006F006700010000000785000001000000FFFFFFFFFFFFFFFFFFFEFF0C4400650063006C00610072006100740069006F006E007300000000000885000001000000FFFFFFFFFFFFFFFFFFFEFF0A5200650066006500720065006E00630065007300000000000985000001000000FFFFFFFFFFFFFFFFFFFEFF0D460069006E006400200069006E002000460069006C0065007300000000000A85000001000000FFFFFFFFFFFFFFFFFFFEFF1541006D0062006900670075006F0075007300200044006500660069006E006900740069006F006E007300000000000B85000001000000FFFFFFFFFFFFFFFFFFFEFF1153006F0075007200630065002000420072006F0077007300650020004C006F006700010000000C85000001000000FFFFFFFFFFFFFFFFFFFEFF0B54006F006F006C0020004F0075007400700075007400000000000E85000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFF0385000001000000FFFFFFFF03850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000028500000000000000000000000000000000000001000000028500000100000002850000000000000000000000000000 CMSIS-Pack - 00200000010000000100FFFF01001100434D4643546F6F6C426172427574746F6ED18400000200000059000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF0A43004D005300490053002D005000610063006B0018000000 + 00200000010000000100FFFF01001100434D4643546F6F6C426172427574746F6ED18400000200000059050000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF0A43004D005300490053002D005000610063006B0018000000 34048 0A0000000A0000006E0000006E000000 - 3A03000000000000680300001A000000 + CB03000000000000F90300001A000000 8192 0 0 @@ -479,16 +489,16 @@ Main - 00200000010000002000FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000083000000FFFEFF000000000000000000000000000100000001000000018001E100000000000084000000FFFEFF000000000000000000000000000100000001000000018003E100000000000086000000FFFEFF0000000000000000000000000001000000010000000180008100000000000063000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E100000000000089000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E10000000000008B000000FFFEFF000000000000000000000000000100000001000000018022E10000000000008A000000FFFEFF000000000000000000000000000100000001000000018025E10000000004008C000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE10000000004008D000000FFFEFF00000000000000000000000000010000000100000001802CE10000000004008E000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01000D005061737465436F6D626F426F784281000000000000FFFFFFFFFFFEFF000000000000000000010000000000000001000000B400000002002050FFFFFFFFFFFEFF00960000000000000000000180218100000000040075000000FFFEFF000000000000000000000000000100000001000000018024E10000000000007E000000FFFEFF000000000000000000000000000100000001000000018028E10000000004007D000000FFFEFF000000000000000000000000000100000001000000018029E10000000000007F000000FFFEFF0000000000000000000000000001000000010000000180028100000000000064000000FFFEFF0000000000000000000000000001000000010000000180298100000000000079000000FFFEFF0000000000000000000000000001000000010000000180278100000000000077000000FFFEFF0000000000000000000000000001000000010000000180288100000000000078000000FFFEFF00000000000000000000000000010000000100000001801D8100000000000071000000FFFEFF00000000000000000000000000010000000100000001801E8100000000040072000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B8100000200040068000000FFFEFF00000000000000000000000000010000000100000001800C8100000200000069000000FFFEFF00000000000000000000000000010000000100000001805F860000020000007C000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800E810000020000006B000000FFFEFF00000000000000000000000000010000000100000001800F810000020000006C000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E0024030000 + 00200000010000002100FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000083050000FFFEFF000000000000000000000000000100000001000000018001E100000000000084050000FFFEFF000000000000000000000000000100000001000000018003E100000000000086050000FFFEFF0000000000000000000000000001000000010000000180008100000000000063050000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E100000000000089050000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E10000000004008B050000FFFEFF000000000000000000000000000100000001000000018022E10000000004008A050000FFFEFF000000000000000000000000000100000001000000018025E10000000000008C050000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE10000000004008D050000FFFEFF00000000000000000000000000010000000100000001802CE10000000004008E050000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01000D005061737465436F6D626F426F784281000000000000FFFFFFFFFFFEFF000000000000000000010000000000000001000000B400000002002050FFFFFFFFFFFEFF00960000000000000000000180218100000000040075050000FFFEFF000000000000000000000000000100000001000000018024E10000000000007E050000FFFEFF000000000000000000000000000100000001000000018028E10000000004007D050000FFFEFF000000000000000000000000000100000001000000018029E10000000000007F050000FFFEFF0000000000000000000000000001000000010000000180028100000000000064050000FFFEFF0000000000000000000000000001000000010000000180298100000000000079050000FFFEFF0000000000000000000000000001000000010000000180278100000000000077050000FFFEFF0000000000000000000000000001000000010000000180288100000000000078050000FFFEFF00000000000000000000000000010000000100000001801D8100000000000071050000FFFEFF00000000000000000000000000010000000100000001801E8100000000040072050000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B8100000200000068050000FFFEFF00000000000000000000000000010000000100000001800C8100000200000069050000FFFEFF00000000000000000000000000010000000100000001805F860000020000007C050000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800E810000020000006B050000FFFEFF00000000000000000000000000010000000100000001800F810000020000006C050000FFFEFF00000000000000000000000000010000000100000001805584000002000000FFFFFFFFFFFEFF1B44006F0077006E006C006F0061006400200061006300740069007600650020006100700070006C00690063006100740069006F006E00010000000000000001000000000000000100000000000000FFFEFF044D00610069006E00E4010000 34049 0A0000000A0000006E0000006E000000 - 00000000000000003A0300001A000000 + 0000000000000000CB0300001A000000 8192 0 0 - 804 + 484 0 @@ -497,7 +507,7 @@ - 010000000300000001000000000000000000000001000000010000000200000000000000010000000100000000000000280000002800000001000000020000000100000001000000FFFEFF132400570053005F0044004900520024005C007300720063005C006D00610069006E002E00630001000000FFFF010017004966436F6E74656E7453746F726167654D6663496D706CFFFEFF00FFFEFFFF25013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E00310038003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E003200370038003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E003200370038003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF066D00610069006E002E00630000000000FFFFFFFFFFFFFFFFFFFEFF332400570053005F0044004900520024005C00530044004B005C0070006C006100740066006F0072006D005C0064006500760069006300650073005C00430056004D0030003100320078005C007200650067005C006100640063005F007200650067002E006800010000000180FFFEFF00FFFEFFFF26013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E0036003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0031003000350036003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0031003000370032003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF096100640063005F007200650067002E00680000000000FFFFFFFFFFFFFFFF0000000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD5000100000001000000020000000A01000049000000000600007C020000 + 010000000300000001000000000000000000000001000000010000000200000000000000010000000100000000000000280000002800000001000000090000000700000001000000FFFEFF132400570053005F0044004900520024005C007300720063005C006D00610069006E002E00630001000000FFFF010017004966436F6E74656E7453746F726167654D6663496D706CFFFEFF00FFFEFFFF22013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E003700380037003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0030003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0030003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF066D00610069006E002E00630000000000FFFFFFFFFFFFFFFFFFFEFF332400570053005F0044004900520024005C00530044004B005C0070006C006100740066006F0072006D005C0064006500760069006300650073005C00430056004D0030003100320078005C007200650067005C006100640063005F007200650067002E006800010000000180FFFEFF00FFFEFFFF26013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E0036003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0031003000350036003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0031003000370032003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF096100640063005F007200650067002E00680000000000FFFFFFFFFFFFFFFFFFFEFF342400570053005F0044004900520024005C007300720063005C0070007200690076006100740065005F006400720069007600650072005C007500640073005C0075007300650072005C007500640073005F007300650072007600690063006500320037002E006300010000000180FFFEFF00FFFEFFFF27013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E00330037003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0032003100310036003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0032003100330031003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0F7500640073005F007300650072007600690063006500320037002E00630000000000FFFFFFFFFFFFFFFFFFFEFF342400570053005F0044004900520024005C007300720063005C0070007200690076006100740065005F006400720069007600650072005C007500640073005C0075007300650072005C007500640073005F007300650072007600690063006500330031002E006300010000000180FFFEFF00FFFEFFFF28013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E003100390031003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0038003000380039003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0038003100310030003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0F7500640073005F007300650072007600690063006500330031002E00630000000000FFFFFFFFFFFFFFFFFFFEFF342400570053005F0044004900520024005C007300720063005C0070007200690076006100740065005F006400720069007600650072005C007500640073005C0075007300650072005C007500640073005F007300650072007600690063006500310031002E006300010000000180FFFEFF00FFFEFFFF27013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E00330039003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0032003600310033003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0032003600340031003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0F7500640073005F007300650072007600690063006500310031002E00630000000000FFFFFFFFFFFFFFFFFFFEFF242400570053005F0044004900520024005C007300720063005C0062006F006F0074006C006F0061006400650072005C0062006F006F0074006C006F0061006400650072002E006300010000000180FFFEFF00FFFEFFFF22013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E003700360038003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0030003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0030003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0C62006F006F0074006C006F0061006400650072002E00630000000000FFFFFFFFFFFFFFFFFFFEFF2F2400570053005F0044004900520024005C007300720063005C0070007200690076006100740065005F006400720069007600650072005C007500640073005C0075007300650072005C007500640073005F0075007300650072002E006300010000000180FFFEFF00FFFEFFFF28013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E003100300032003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0036003800370033003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0036003800370033003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0A7500640073005F0075007300650072002E00630000000000FFFFFFFFFFFFFFFFFFFEFF302400570053005F0044004900520024005C00530044004B005C006D006900640064006C00650077006100720065005C007500640073005C0075007300650072005C007500640073005F007300650072007600690063006500320032002E006300010000000180FFFEFF00FFFEFFFF27013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E00380031003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0033003200390038003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0033003200390038003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0F7500640073005F007300650072007600690063006500320032002E00630000000000FFFFFFFFFFFFFFFFFFFEFF292400570053005F0044004900520024005C007300720063005C0070007200690076006100740065005F006400720069007600650072005C00690073006F00740070005C00690073006F00740070002E006300010000000180FFFEFF00FFFEFFFF2A013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E003400340036003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E00310033003700370030003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E00310033003700380030003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF07690073006F00740070002E00630000000000FFFFFFFFFFFFFFFF0000000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD5000100000001000000020000000A01000049000000000600006A020000 diff --git a/cva_bootloader_m0128/src/bootloader/bootloader.c b/cva_bootloader_m0128/src/bootloader/bootloader.c index 30322a9..d190a3f 100644 --- a/cva_bootloader_m0128/src/bootloader/bootloader.c +++ b/cva_bootloader_m0128/src/bootloader/bootloader.c @@ -775,9 +775,10 @@ void Bootloader_EventEmergeBootRequest(bool requestEn) * * \return void */ -void Bootloader_EventResetRequest(bool requestEn) +void Bootloader_EventResetRequest(bool requestEn,uint8_t resetMode) { sBootloader_Cb.resetReqEn = requestEn; + sBootloader_Cb.resetReqMode = resetMode; #if BOOTLOADER_CFG_FLS_COPY_AUTO_EN == 0u sBootloader_Cb.flsDrvInfo.flashDriverDownloaded = false; #endif diff --git a/cva_bootloader_m0128/src/bootloader/bootloader.h b/cva_bootloader_m0128/src/bootloader/bootloader.h index 062b88d..0458dbe 100644 --- a/cva_bootloader_m0128/src/bootloader/bootloader.h +++ b/cva_bootloader_m0128/src/bootloader/bootloader.h @@ -190,6 +190,7 @@ typedef struct bool emergeBootReqEn; bool resetReqEn; bool resetActionReady; + uint8_t resetReqMode; bool bootActive; #if BOOTLOADER_CFG_FLS_COPY_AUTO_EN == 0u Bootloader_FlsDrvInfoType flsDrvInfo; @@ -309,7 +310,7 @@ extern void Bootloader_EventEmergeBootRequest(bool requestEn); * * \return void */ -extern void Bootloader_EventResetRequest(bool requestEn); +extern void Bootloader_EventResetRequest(bool requestEn,uint8_t resetMode); /*! \brief Set the erase information * diff --git a/cva_bootloader_m0128/src/bootloader/bootloader_cfg.h b/cva_bootloader_m0128/src/bootloader/bootloader_cfg.h index ef0c432..0743488 100644 --- a/cva_bootloader_m0128/src/bootloader/bootloader_cfg.h +++ b/cva_bootloader_m0128/src/bootloader/bootloader_cfg.h @@ -98,11 +98,13 @@ typedef struct typedef struct { - uint8_t bootVersionGeneration; - uint8_t bootVersionMajor; - uint8_t bootVersionMinor; - uint8_t bootVersionRevision; -} Bootloade_CfgInfoType; + uint8_t HWVersion[4]; + uint8_t BLVersion[8]; + uint8_t bootBuildTime[12]; + uint8_t bootBuildDate[16]; + uint8_t ECUName[8]; + uint8_t Reverse[16]; +} Bootloade_CfgInfoType;//64 byte /******************************************************************************* * the globals diff --git a/cva_bootloader_m0128/src/main.c b/cva_bootloader_m0128/src/main.c index 0079c95..0ead744 100644 --- a/cva_bootloader_m0128/src/main.c +++ b/cva_bootloader_m0128/src/main.c @@ -37,7 +37,7 @@ #define UDS_PHYS_RESP_MSG_ID (0x7B2) #define UDS_RECV_BUF (1026) -#define UDS_SEND_BUF (8) +#define UDS_SEND_BUF UDS_RSP_LEN_MAX #define CAN_DATA_BUFFER_SIZE (8u) #define CAN_BUFFER_FIFO_SIZE (16u) @@ -92,10 +92,14 @@ static uint32_t sBootloader_Req ; #pragma location = ".bootloaderInfo" const Bootloade_CfgInfoType sBootloader_Version __attribute__((used, section(".bootloaderInfo"))) = { - .bootVersionGeneration = 0, - .bootVersionMajor = 0x14, - .bootVersionMinor = 0x06, - .bootVersionRevision = 0}; + .HWVersion = "HW01", + .BLVersion = "BL0101", + .bootBuildDate = __DATE__, + .bootBuildTime = __TIME__, + .ECUName = "RP-77A", +}; + + McuType mcu; volatile uint32_t gSystick1msEvent = 0, gSystick1msCnt = 0, gTestIoEn = 0; @@ -832,22 +836,6 @@ int main(void) flexCanCfg.msgCfg = msgCfgObj; FlexCanBoot_Init(); - /* LED */ - PinsDrv_SetMuxModeSel(&mcu.ptc, 3, PINSDRV_MUX_AS_GPIO); - PinsDrv_SetPinDirection(&mcu.ptc, 3, 1); - PinsDrv_SetPullSel(&mcu.ptc, 3, PINSDRV_INTERNAL_PULL_UP); - PinsDrv_WritePin(&mcu.ptc, 3, 0); - - PinsDrv_SetMuxModeSel(&mcu.ptc, 1, PINSDRV_MUX_AS_GPIO); - PinsDrv_SetPinDirection(&mcu.ptc, 1, 1); - PinsDrv_SetPullSel(&mcu.ptc, 1, PINSDRV_INTERNAL_PULL_UP); - PinsDrv_WritePin(&mcu.ptc, 1, 0); - - PinsDrv_SetMuxModeSel(&mcu.ptc, 2, PINSDRV_MUX_AS_GPIO); - PinsDrv_SetPinDirection(&mcu.ptc, 2, 1); - PinsDrv_SetPullSel(&mcu.ptc, 2, PINSDRV_INTERNAL_PULL_UP); - PinsDrv_WritePin(&mcu.ptc, 2, 0); - /* UDS init */ Uds_UserInit(&udsObj, &udsParam); @@ -875,40 +863,28 @@ int main(void) if(gTestIoEn == 0) { gTestIoEn = 1; - if(resetSource == 1) - { - PinsDrv_WritePin(&mcu.ptc, 1, 1); - PinsDrv_WritePin(&mcu.ptc, 2, 0); - PinsDrv_WritePin(&mcu.ptc, 3, 0); - } - else if(resetSource == 2) - { - PinsDrv_WritePin(&mcu.ptc, 1, 1); - PinsDrv_WritePin(&mcu.ptc, 2, 0); - PinsDrv_WritePin(&mcu.ptc, 3, 1); - } + } else { gTestIoEn = 0; - PinsDrv_WritePin(&mcu.ptc, 1, 0); - PinsDrv_WritePin(&mcu.ptc, 2, 0); - PinsDrv_WritePin(&mcu.ptc, 3, 0); + } } - /* Handler user routine */ - if(FlexCanBoot_ReadoutMsg(&rxMsg) == true) - { - if((rxMsg.id == UDS_PHYS_RECV_MSG_ID) || (rxMsg.id == UDS_FUNC_RECV_MSG_ID)) - { - IsoTp_HandleIncomingCanMsg(&udsObj.isotp, rxMsg.id, rxMsg.data, rxMsg.len); - } - } + Bootloader_TimingProcess(1); Uds_Run(&udsObj); Bootloader_StateProc(); } + /* Handler user routine */ + if(FlexCanBoot_ReadoutMsg(&rxMsg) == true) + { + if((rxMsg.id == UDS_PHYS_RECV_MSG_ID) || (rxMsg.id == UDS_FUNC_RECV_MSG_ID)) + { + IsoTp_HandleIncomingCanMsg(&udsObj.isotp, rxMsg.id, rxMsg.data, rxMsg.len); + } + } } } diff --git a/cva_bootloader_m0128/src/private_driver/isotp/isotp.c b/cva_bootloader_m0128/src/private_driver/isotp/isotp.c index 462835d..e34d39f 100644 --- a/cva_bootloader_m0128/src/private_driver/isotp/isotp.c +++ b/cva_bootloader_m0128/src/private_driver/isotp/isotp.c @@ -119,6 +119,8 @@ #define IsoTp_SetFCStmin(byte, STmin) (byte[2] = STmin) #define IsoTp_GetFCStmin(byte) (byte[2]) +#define TP_DUMMY 0xCC + /******************************************************************************* * the typedefs ******************************************************************************/ @@ -242,8 +244,9 @@ static int8_t IsoTp_SendSingleFrame(IsoTpType *obj) /* All pad with 0 */ for(i = 0; i < 7 - obj->sendSize; ++i) { - msg.byte[i + obj->sendSize + 1] = 0; + msg.byte[i + obj->sendSize + 1] = TP_DUMMY; } + ret = obj->sendCanMsg(obj->sendArbitrationId, msg.byte, 8); } else @@ -306,7 +309,7 @@ static int8_t IsoTp_SendConsecutiveFrame(IsoTpType *obj) uint8_t i = 0; for(i = 0; i < 7 - dataLength; ++i) { - msg.byte[i + 1 + dataLength] = 0; + msg.byte[i + 1 + dataLength] = TP_DUMMY; } ret = obj->sendCanMsg(obj->sendArbitrationId, msg.byte, 8); } @@ -653,17 +656,16 @@ void IsoTp_HandleIncomingCanMsg(IsoTpType *obj, uint32_t id, const uint8_t *data else { /* Send FC when BS reaches limit */ - if(obj->blockSize > 0) - { - if(0 == --obj->receiveBlockSizeCount) - { - - obj->receiveBlockSizeCount = obj->blockSize; - IsoTp_SendFlowControl(obj, ISOTP_PCI_FLOW_STATUS_CONTINUE, obj->receiveBlockSizeCount, ISOTP_DEFAULT_ST_MIN); - } - } + if(obj->blockSize > 0) + { + if(0 == --obj->receiveBlockSizeCount) + { + obj->receiveBlockSizeCount = obj->blockSize; + IsoTp_SendFlowControl(obj, ISOTP_PCI_FLOW_STATUS_CONTINUE, obj->receiveBlockSizeCount, ISOTP_DEFAULT_ST_MIN); + } } } + } break; } diff --git a/cva_bootloader_m0128/src/private_driver/uds/stack/uds.h b/cva_bootloader_m0128/src/private_driver/uds/stack/uds.h index a9d0b33..34c755f 100644 --- a/cva_bootloader_m0128/src/private_driver/uds/stack/uds.h +++ b/cva_bootloader_m0128/src/private_driver/uds/stack/uds.h @@ -71,9 +71,7 @@ extern "C" { #define UDS_SA_NONE (0) #define UDS_SA_LEVEL_1 (0x01) #define UDS_SA_LEVEL_3 (0x03) -#define UDS_SA_LEVEL_9 (0x09) -#define UDS_SA_LEVEL_3 (0x03) -#define UDS_SA_LEVEL_11 (0x11) +#define UDS_SA_LEVEL_09 (0x09) #define UDS_SA_LEVEL_63 (0x63) #define UDS_SESSION_DEFAULT (0x01) diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_dtc.c b/cva_bootloader_m0128/src/private_driver/uds/user/uds_dtc.c deleted file mode 100644 index 346c288..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_dtc.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include "uds_dtc.h" - -/******************************************************************************* - * the defines - ******************************************************************************/ - -#define DTCG_EMISSION_START (0x00000000ul) /* 24Bit DTC define ISO-15031-6 DTC + ISO-15031-6 Failure Type, ISO14229-1 format */ -#define DTCG_EMISSION_END (0x000FFFFFul) -#define DTCG_POWERTRAIN_START (0x00100000ul) -#define DTCG_POWERTRAIN_END (0x003FFFFFul) -#define DTCG_CHASSIS_START (0x00400000ul) -#define DTCG_CHASSIS_END (0x007FFFFFul) -#define DTCG_BODY_START (0x00800000ul) -#define DTCG_BODY_END (0x00BFFFFFul) -#define DTCG_NETWORK_START (0x00C00000ul) -#define DTCG_NETWORK_END (0x00FFFFFFul) - -#define FAULTDT_MAX (127) /* refers to ISO14229-1 D.6 */ -#define FAULTDT_MIN (-128) /* refers to ISO14229-1 D.6 */ -#define AGING_MAX (40) /* refers to ISO14229-1 D.7 */ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/* the meaning of UDS DTC value refers to ISO 15031-6 */ -static Uds_DtcType udsDtcTable[DTC_MAX_COUNT] = { - {0x04621A, 0x50, 0x00, 0x00}, /* P0462 fuel level sensor "A" circuit resistance low */ - {0x04631B, 0x50, 0x00, 0x00}, /* P0463 fuel level sensor "A" circuit resistance high */ - {0xF00316, 0x50, 0x00, 0x00}, /* U3003 battery voltage low */ - {0xF00317, 0x50, 0x00, 0x00}, /* U3003 battery voltage high */ - {0xC07388, 0x50, 0x00, 0x00}, /* U0073 control module communication bus off */ - {0xC10001, 0x50, 0x00, 0x00}, /* U0100 lost communication with ECM/PCM "A" */ - {0xC10101, 0x50, 0x00, 0x00}, /* U0101 lost communication with TCM */ - {0xC12101, 0x50, 0x00, 0x00}, /* U0121 lost communication with ABS control module */ - {0xC12701, 0x50, 0x00, 0x00}, /* U0127 lost communication with tire pressure monitor module */ - {0xC12801, 0x50, 0x00, 0x00}, /* U0128 lost communication with park brake control module */ - {0xC12901, 0x50, 0x00, 0x00}, /* U0129 lost communication with brake system control module */ - {0xC13101, 0x50, 0x00, 0x00}, /* U0131 lost communication with power sterring control module */ - {0xC14100, 0x50, 0x00, 0x00}, /* U0141 lost communication with body control module "A" */ - {0xC15101, 0x50, 0x00, 0x00}, /* U0151 lost communication with restraints control module */ - {0xC16300, 0x50, 0x00, 0x00}, /* U0163 lost communication with navigation control module */ - {0xC16900, 0x50, 0x00, 0x00}, /* U0169 lost communication with sunroof control module */ - {0xC18101, 0x50, 0x00, 0x00}, /* U0181 lost communication with headlamp leveling control module */ - {0xC23601, 0x50, 0x00, 0x00}, /* U0236 lost communication with column lock module */ - {0xC16400, 0x50, 0x00, 0x00}, /* U0164 lost communication with HVAC control module */ - {0xC16700, 0x50, 0x00, 0x00}, /* U0167 lost communication with vehicle immobilizer control module */ -}; - -static bool dtcOffCtrl = false; - -/******************************************************************************* - * the constants - ******************************************************************************/ - -/******************************************************************************* - * the functions - ******************************************************************************/ - -void Uds_SetDtcOffCtrl(bool val) -{ - dtcOffCtrl = val; -} - -bool Uds_GetDtcOffCtrlState(void) -{ - return dtcOffCtrl; -} - -void Uds_ClearDtcByDtcIndex(uint16_t dtcIndex) -{ - if(dtcIndex >= DTC_MAX_COUNT) - { - return; - } - - udsDtcTable[dtcIndex].dtcStatus.all = 0; - udsDtcTable[dtcIndex].dtcStatus.bit.testNcmpSlc = 1; - udsDtcTable[dtcIndex].dtcStatus.bit.testNcmpToc = 1; - - udsDtcTable[dtcIndex].faultDtCnt = 0; - udsDtcTable[dtcIndex].AgingCnt = 0; -} - -void Uds_LoadDtc(void) -{ - /* code implemented by the user */ -} - -void Uds_SaveDtc(void) -{ - /* code implemented by the user */ -} - -uint16_t Uds_GetDtcNumberByStatusMask(uint8_t mask) -{ - uint16_t dtcCnt = 0; - uint8_t dtcState = 0; - uint16_t dtcNum = 0; - - for(dtcCnt = 0; dtcCnt < DTC_MAX_COUNT; dtcCnt++) - { - dtcState = (udsDtcTable[dtcCnt].dtcStatus.all & DTC_AVAILABILITY_STATUS_MASK); - if(0 != (dtcState & mask)) - { - dtcNum++; - } - } - - return dtcNum; -} - -uint16_t Uds_GetDtcByStatusMask(uint8_t *pDtcBuf, uint16_t bufLen, uint8_t mask) -{ - uint16_t dtcCnt = 0; - uint8_t dtcState = 0; - uint16_t dtcDlc = 0; - - for(dtcCnt = 0; dtcCnt < DTC_MAX_COUNT; dtcCnt++) - { - dtcState = udsDtcTable[dtcCnt].dtcStatus.all; - if(0 != (dtcState & mask)) - { - if((dtcDlc + 4) <= bufLen) - { - pDtcBuf[dtcDlc++] = (uint8_t)(udsDtcTable[dtcCnt].dtcCode >> 16); - pDtcBuf[dtcDlc++] = (uint8_t)(udsDtcTable[dtcCnt].dtcCode >> 8); - pDtcBuf[dtcDlc++] = (uint8_t)(udsDtcTable[dtcCnt].dtcCode >> 0); - pDtcBuf[dtcDlc++] = (dtcState & DTC_AVAILABILITY_STATUS_MASK); - } - else - { - break; - } - } - } - - return dtcDlc; -} - -uint16_t Uds_GetSupportedDtc(uint8_t *pDtcBuf, uint16_t bufLen) -{ - uint16_t dtcCnt = 0; - uint8_t dtcState = 0; - uint16_t dtcDlc = 0; - - for(dtcCnt = 0; dtcCnt < DTC_MAX_COUNT; dtcCnt++) - { - dtcState = udsDtcTable[dtcCnt].dtcStatus.all; - if((dtcDlc + 4) <= bufLen) - { - pDtcBuf[dtcDlc++] = (uint8_t)(udsDtcTable[dtcCnt].dtcCode >> 16); - pDtcBuf[dtcDlc++] = (uint8_t)(udsDtcTable[dtcCnt].dtcCode >> 8); - pDtcBuf[dtcDlc++] = (uint8_t)(udsDtcTable[dtcCnt].dtcCode >> 0); - pDtcBuf[dtcDlc++] = (dtcState & DTC_AVAILABILITY_STATUS_MASK); - } - else - { - break; - } - } - - return dtcDlc; -} - -void Uds_ClearDtcByGroup(uint32_t group) -{ - uint16_t dtcCnt = 0; - - switch(group) - { - case EMISSION_SYSTEM_GROUP: - for(dtcCnt = 0; dtcCnt < DTC_MAX_COUNT; dtcCnt++) - { - if(udsDtcTable[dtcCnt].dtcCode <= DTCG_EMISSION_END) - { - Uds_ClearDtcByDtcIndex(dtcCnt); - } - } - break; - case SAFETY_SYSTEM_GROUP: - for(dtcCnt = 0; dtcCnt < DTC_MAX_COUNT; dtcCnt++) - { - if((udsDtcTable[dtcCnt].dtcCode >= DTCG_CHASSIS_START) && (udsDtcTable[dtcCnt].dtcCode <= DTCG_CHASSIS_END)) - { - Uds_ClearDtcByDtcIndex(dtcCnt); - } - } - break; - case ALL_FUNC_SYSTEM_GROUP: - for(dtcCnt = 0; dtcCnt < DTC_MAX_COUNT; dtcCnt++) - { - Uds_ClearDtcByDtcIndex(dtcCnt); - } - break; - } -} diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_dtc.h b/cva_bootloader_m0128/src/private_driver/uds/user/uds_dtc.h deleted file mode 100644 index 155c984..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_dtc.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -#ifndef _UDS_DTC_H_ -#define _UDS_DTC_H_ - -/*! \brief Contains public interface to various functions related - * to the user-defined UDS application - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * the defines - ******************************************************************************/ - -#define EMISSION_SYSTEM_GROUP (0x00FFFF33) -#define SAFETY_SYSTEM_GROUP (0x00FFFFD0) -#define ALL_FUNC_SYSTEM_GROUP (0x00FFFFFF) - -#define REPORT_DTC_NUMBER_BY_STATUS_MASK (0x01) -#define REPORT_DTC_BY_STATUS_MASK (0x02) -#define REPORT_DTC_SNOPSHOT_IDENTIFICATION (0x03) -#define REPORT_DTC_SNOPSHOT_RECORD_BY_DTC_NUMBER (0x04) -#define REPORT_DTC_STORE_DATA_BY_RECORD_NUMBER (0x05) -#define REPORT_DTC_EXT_DATA_RECORD_BY_DTC_NUMBER (0x06) -#define REPORT_DTC_NUMBER_BY_SEVERITY_MASK_RECORD (0x07) -#define REPORT_DTC_BY_SEVERITY_MASK_RECORD (0x08) -#define REPORT_SUPPORTED_DTC (0x0a) - -#define DTC_FORMAT_15031 (0x00) -#define DTC_FORMAT_14229 (0x01) -#define DTC_FORMAT_J1939 (0x02) -#define DTC_FORMAT_11992 (0x03) - -#define DTC_AVAILABILITY_STATUS_MASK (0x7F) - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/*! \brief The DTC Index name of UDS supported - */ -typedef enum _Uds_DtcIndexNameType_ -{ - DTC_FUEL_SENSOR_BELOW = 0, - DTC_FUEL_SENSOR_ABOVE, - DTC_BATT_VOLTAG_BELOW, - DTC_BATT_VOLTAG_ABOVE, - DTC_CAN_BUS_OFF, - DTC_COM_LOST_EMS, - DTC_COM_LOST_TCU, - DTC_COM_LOST_ABS, - DTC_COM_LOST_TPMS, - DTC_COM_LOST_EPB, - DTC_COM_LOST_ESP, - DTC_COM_LOST_EPS, - DTC_COM_LOST_BCM, - DTC_COM_LOST_SRS, - DTC_COM_LOST_DVD, - DTC_COM_LOST_PDC, - DTC_COM_LOST_ALS, - DTC_COM_LOST_PEPS, - DTC_COM_LOST_AC, - DTC_COM_LOST_AVM, - DTC_MAX_COUNT -} Uds_DtcIndexNameType; - -/*! \brief The DTC status definition refers to ISO14229-1 D.2.4 - * \note Bit 0, testFailed, clear by test pass or ClearDiagnosticInformation - * Bit 1, testFailedThisOperationCycle, clear by new OC or ClearDiagnosticInformation - * Bit 2, latch, pendingDTC, clear by fault never happened in cur OC or ClearDiagnosticInformation, if test not completed, must hold. - * Bit 3, latch, confirmedDTC, clear by ClearDiagnosticInformation, one(only by normal fault) or 40 OC not detect any fault. - * Bit 4, latch, testNotCompletedSinceLastClear, set by a new OC start or ClearDiagnosticInformation - * Bit 5, latch, testFailedSinceLastClear, clear by ClearDiagnosticInformation - * Bit 6, testNotCompletedThisOperationCycle - * Bit 7, warningIndicatorRequested(unsupported) - */ -typedef union _Uds_DtcStatusType_ -{ - uint8_t all; - struct - { - uint8_t testFailed : 1; - uint8_t testFailToc : 1; - uint8_t pending : 1; - uint8_t confirmed : 1; - uint8_t testNcmpSlc : 1; - uint8_t testFailSlc : 1; - uint8_t testNcmpToc : 1; - uint8_t wnIndreq : 1; - } bit; -} Uds_DtcStatusType; - -/*! \brief The DTC definition of UDS - */ -typedef struct _Uds_DtcType_ -{ - uint32_t dtcCode; - Uds_DtcStatusType dtcStatus; - int16_t faultDtCnt; /* refers to ISO14229-1 D.6 */ - uint8_t AgingCnt; /* refers to ISO14229-1 D.7 */ -} Uds_DtcType; - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the function prototypes - ******************************************************************************/ - -/*! \brief control DTC status updata stop and start - */ -extern void Uds_SetDtcOffCtrl(bool val); - -/*! \brief get control DTC status - */ -extern bool Uds_GetDtcOffCtrlState(void); - -/*! \brief clear DTC by dtc index - */ -extern void Uds_ClearDtcByDtcIndex(uint16_t dtcIndex); - -/*! \brief load dtc data from EEPROM - */ -extern void Uds_LoadDtc(void); - -/*! \brief save dtc data to EEPROM - */ -extern void Uds_SaveDtc(void); - -/*! \brief get DTC counter by dtc status mask - */ -extern uint16_t Uds_GetDtcNumberByStatusMask(uint8_t mask); - -/*! \brief get DTC data by dtc status mask - */ -extern uint16_t Uds_GetDtcByStatusMask(uint8_t *pDtcBuf, uint16_t bufLen, uint8_t mask); - -/*! \brief get all supported DTC data - */ -extern uint16_t Uds_GetSupportedDtc(uint8_t *pDtcBuf, uint16_t bufLen); - -/*! \brief clear DTC by dtc group - */ -extern void Uds_ClearDtcByGroup(uint32_t group); - -#ifdef __cplusplus -} -#endif /* extern "C" */ - -#endif /* _UDS_DTC_H_ */ diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service14.c b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service14.c deleted file mode 100644 index bd0e350..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service14.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include "uds_service14.h" -#include "uds_dtc.h" - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the constants - ******************************************************************************/ - -/******************************************************************************* - * the functions - ******************************************************************************/ - -void UdsService14_ClearDiagInfo(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen) -{ - uint32_t dtcGroup = 0; - uint8_t rspBuffer[8] = {0}; - - if(msgLen != obj->seviceTable[obj->curServiceIdx].minLen) - { - Uds_NegativeResponse(obj, 0x14, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - dtcGroup |= ((uint32_t)msgBuf[1]) << 16; - dtcGroup |= ((uint32_t)msgBuf[2]) << 8; - dtcGroup |= ((uint32_t)msgBuf[3]) << 0; - - rspBuffer[0] = UDS_GET_POSITIVE_RSP(0x14); - - switch(dtcGroup) - { - case EMISSION_SYSTEM_GROUP: - case SAFETY_SYSTEM_GROUP: - case ALL_FUNC_SYSTEM_GROUP: - Uds_ClearDtcByGroup(dtcGroup); - Uds_PositiveResponse(obj, rspBuffer, 1); - break; - default: - Uds_NegativeResponse(obj, 0x14, NRC_REQUEST_OUT_OF_RANGE); - break; - } -} - - - diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service14.h b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service14.h deleted file mode 100644 index d01d624..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service14.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -#ifndef _UDS_SERVICE14_H_ -#define _UDS_SERVICE14_H_ - -/*! \brief Contains public interface to various functions related - * to the user-defined UDS service 14 - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include -#include -#include "../stack/uds.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the function prototypes - ******************************************************************************/ - -/*! \brief Uds Service 14 processing - */ -extern void UdsService14_ClearDiagInfo(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen); - -#ifdef __cplusplus -} -#endif /* extern "C" */ - -#endif /* _UDS_SERVICE14_H_ */ diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service19.c b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service19.c deleted file mode 100644 index 7787a63..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service19.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include "uds_service19.h" -#include "uds_dtc.h" - - - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the constants - ******************************************************************************/ - -/******************************************************************************* - * the functions - ******************************************************************************/ - -void UdsService19_ReadDtcInformation(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen) -{ - uint8_t subFunction = 0; - uint8_t dtcStatusMask = 0; - uint16_t dtcCount = 0; - uint16_t dtcDlc = 0; - uint8_t rspBuffer[UDS_RSP_LEN_MAX] = {0}; - - if(msgLen < obj->seviceTable[obj->curServiceIdx].minLen) - { - Uds_NegativeResponse(obj, 0x19, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - subFunction = UDS_GET_SUB_FUNCTION (msgBuf[1]); - rspBuffer[0] = UDS_GET_POSITIVE_RSP(0x19); - rspBuffer[1] = subFunction; - switch(subFunction) - { - case REPORT_DTC_NUMBER_BY_STATUS_MASK: - if(msgLen != 3) - { - Uds_NegativeResponse(obj, 0x19, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - dtcStatusMask = msgBuf[2]; - dtcCount = Uds_GetDtcNumberByStatusMask(dtcStatusMask); - rspBuffer[2] = DTC_AVAILABILITY_STATUS_MASK; - rspBuffer[3] = DTC_FORMAT_14229; - rspBuffer[4] = (dtcCount >> 8) & 0xFF; - rspBuffer[5] = (dtcCount >> 0) & 0xFF; - Uds_PositiveResponse(obj, rspBuffer, 6); - break; - case REPORT_DTC_BY_STATUS_MASK: - if(msgLen != 3) - { - Uds_NegativeResponse(obj, 0x19, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - dtcStatusMask = msgBuf[2]; - rspBuffer[2] = DTC_AVAILABILITY_STATUS_MASK; - dtcDlc = Uds_GetDtcByStatusMask(&rspBuffer[3], UDS_RSP_LEN_MAX - 3, dtcStatusMask); - Uds_PositiveResponse(obj, rspBuffer, dtcDlc + 3); - break; -#if 0 - case REPORT_DTC_SNOPSHOT_IDENTIFICATION: - if(msgLen != 6) - { - UDS_negativeResponse(obj, 0x19, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - /* add user code */ - - break; - case REPORT_DTC_SNOPSHOT_RECORD_BY_DTC_NUMBER: - if(msgLen != 6) - { - UDS_negativeResponse(obj, 0x19, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - /* add user code */ - - break; - case REPORT_DTC_STORE_DATA_BY_RECORD_NUMBER: - if(msgLen != 3) - { - UDS_negativeResponse(obj, 0x19, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - /* add user code */ - - break; - case REPORT_DTC_EXT_DATA_RECORD_BY_DTC_NUMBER: - if(msgLen != 6) - { - UDS_negativeResponse(obj, 0x19, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - /* add user code */ - - break; - case REPORT_DTC_NUMBER_BY_SEVERITY_MASK_RECORD: - if(msgLen != 4) - { - UDS_negativeResponse(obj, 0x19, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - /* add user code */ - - break; - case REPORT_DTC_BY_SEVERITY_MASK_RECORD: - if(msgLen != 4) - { - UDS_negativeResponse(obj, 0x19, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - /* add user code */ - - break; -#endif - case REPORT_SUPPORTED_DTC: - if(msgLen != 2) - { - Uds_NegativeResponse(obj, 0x19, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - dtcDlc = Uds_GetSupportedDtc(&rspBuffer[3], UDS_RSP_LEN_MAX - 3); - Uds_PositiveResponse(obj, rspBuffer, dtcDlc + 3); - break; - default: - Uds_NegativeResponse(obj, 0x19, NRC_SUBFUNCTION_NOT_SUPPORTED); - break; - } -} - - diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service19.h b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service19.h deleted file mode 100644 index 6179d1d..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service19.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -#ifndef _UDS_SERVICE19_H_ -#define _UDS_SERVICE19_H_ - -/*! \brief Contains public interface to various functions related - * to the user-defined UDS service 19 - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include -#include -#include "../stack/uds.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the function prototypes - ******************************************************************************/ - -/*! \brief Uds Service 19 processing - */ -extern void UdsService19_ReadDtcInformation(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen); - -#ifdef __cplusplus -} -#endif /* extern "C" */ - -#endif /* _UDS_SERVICE19_H_ */ diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service22.c b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service22.c deleted file mode 100644 index bff4058..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service22.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ -#include -#include "uds_service22.h" - - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the constants - ******************************************************************************/ - -/******************************************************************************* - * the functions - ******************************************************************************/ - -void UdsService22_ReadDataByIdentifier(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen) -{ - uint16_t didNum = 0; - uint16_t didValue = 0; - uint16_t rspLen = 0; - uint16_t msgPos = 0, didIdx = 0; - bool findDid = false; - uint8_t rspBuffer[UDS_RSP_LEN_MAX] = {0}; - - if(msgLen < obj->seviceTable[obj->curServiceIdx].minLen) - { - Uds_NegativeResponse(obj, 0x22, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - if(0 != (msgLen - 1) % sizeof(uint16_t)) - { - Uds_NegativeResponse(obj, 0x22, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - didNum = msgLen / sizeof(uint16_t); - if(0 == didNum) - { - Uds_NegativeResponse(obj, 0x22, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - rspBuffer[rspLen++] = UDS_GET_POSITIVE_RSP(0x22); - - for(msgPos = 1; msgPos < msgLen; msgPos += 2) - { - didValue = ((uint16_t)msgBuf[msgPos]) << 8; - didValue |= msgBuf[msgPos + 1]; - - findDid = false; - for(didIdx = 0; didIdx < obj->didNum; didIdx++) - { - if(obj->didTable[didIdx].did == didValue) - { - if(obj->securityLevel != obj->didTable[didIdx].securityLevel) - { - Uds_NegativeResponse(obj, 0x22, NRC_SECURITY_ACCESS_DENIED); - return; - } - else if((rspLen + 2 + obj->didTable[didIdx].length) > UDS_RSP_LEN_MAX) - { - Uds_NegativeResponse(obj, 0x22, NRC_RESPONSE_TOO_LONG); - return; - } - - if((UDS_DID_TYPE_NVM_WO == obj->didTable[didIdx].type) || (obj->session < obj->didTable[didIdx].sessionLevel)) - { - Uds_NegativeResponse(obj, 0x22, NRC_CONDITIONS_NOT_CORRECT); - return; - } - - findDid = true; - rspBuffer[rspLen++] = msgBuf[msgPos]; - rspBuffer[rspLen++] = msgBuf[msgPos + 1]; - memcpy(&rspBuffer[rspLen], obj->didTable[didIdx].pBytes, obj->didTable[didIdx].length); - rspLen += obj->didTable[didIdx].length; - break; - } - } - if(false == findDid) - { - break; - } - } - - if(true == findDid) - { - Uds_PositiveResponse(obj, rspBuffer, rspLen); - } - else - { - Uds_NegativeResponse(obj, 0x22, NRC_REQUEST_OUT_OF_RANGE); - } - -} - - diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service22.h b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service22.h deleted file mode 100644 index c1d11dd..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service22.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -#ifndef _UDS_SERVICE22_H_ -#define _UDS_SERVICE22_H_ - -/*! \brief Contains public interface to various functions related - * to the user-defined UDS service 22 - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include -#include -#include "../stack/uds.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the function prototypes - ******************************************************************************/ - -/*! \brief Uds Service 22 processing - */ -extern void UdsService22_ReadDataByIdentifier(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen); - -#ifdef __cplusplus -} -#endif /* extern "C" */ - -#endif /* _UDS_SERVICE22_H_ */ diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service27.c b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service27.c index 10e53e4..7b9ee1a 100644 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service27.c +++ b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service27.c @@ -25,9 +25,9 @@ * the defines ******************************************************************************/ -#define SUPPORT_LEVEL_NUM 4 /* supported security level number */ +#define SUPPORT_LEVEL_NUM 2 /* supported security level number */ -#define MAX_ALLOW_ERROR_NUM 3 /* the max allow number of key error */ +#define MAX_ALLOW_ERROR_NUM 5 /* the max allow number of key error */ #define STARTUP_DELAY_MS 2000 /* the service allow access time delay after UDS start */ #define ERR_EXCEED_DELAY_MS 10000 /* the service allow access time delay after error number exceed */ @@ -49,15 +49,18 @@ typedef struct _SecurityLevel_Param_ ******************************************************************************/ SecurityLevel_Param scrtParam[SUPPORT_LEVEL_NUM] = { - {UDS_SA_LEVEL_9, 0, MAX_ALLOW_ERROR_NUM, 0}, - {UDS_SA_LEVEL_3, 0, MAX_ALLOW_ERROR_NUM, 0}, - {UDS_SA_LEVEL_11, 0, MAX_ALLOW_ERROR_NUM, 0}, - {UDS_SA_LEVEL_63, 0, MAX_ALLOW_ERROR_NUM, 0} + {UDS_SA_LEVEL_1, 0, MAX_ALLOW_ERROR_NUM, 0}, + //{UDS_SA_LEVEL_3, 0, MAX_ALLOW_ERROR_NUM, 0}, + {UDS_SA_LEVEL_09, 0, MAX_ALLOW_ERROR_NUM, 0}, + //{UDS_SA_LEVEL_63, 0, MAX_ALLOW_ERROR_NUM, 0}, }; +extern uint32_t gSystick1msEvent; /******************************************************************************* * the constants ******************************************************************************/ +static const uint8_t DMxorArray[4] = {0x4D,0x53,0x57,0x51}; + /******************************************************************************* * the functions @@ -66,7 +69,12 @@ SecurityLevel_Param scrtParam[SUPPORT_LEVEL_NUM] = { static void UdsSecurityAccess_GenerateSeed(UdsType *obj, uint8_t newLevel, uint8_t *outData, uint8_t outBufsize, uint16_t *outLen) { /* seed is defined by user, It's usually a random value */ - uint8_t seed[4] = {0, 0, 0, 0}; + uint8_t seed[4] = {1, 2, 3, 4}; + uint32_t timeseed = (uint32_t)(obj->timeStamp_ms); + seed[0] = (uint8_t)(timeseed & 0xFF); + seed[1] = (uint8_t)((timeseed>>8) & 0xFF); + seed[2] = (uint8_t)((timeseed>>16) & 0xFF)+(seed[1]*7); + seed[3] = (uint8_t)((timeseed>>24) & 0xFF)+(seed[0]*3); if(outBufsize < sizeof(seed)) { @@ -80,44 +88,53 @@ static void UdsSecurityAccess_GenerateSeed(UdsType *obj, uint8_t newLevel, uint8 } else { - seed[0] = obj->timeStamp_ms & 0xFF; - seed[1] = ((obj->timeStamp_ms >> 8) & 0xFF) + 1; - seed[2] = (~seed[0]) + seed[1] + 1; - seed[3] = (~seed[2]) + seed[0] + 2; - memcpy(outData, seed, sizeof(seed)); } } static bool UdsSecurityAccess_ValidateKey(uint8_t seedLevel, const uint8_t *seed, uint16_t seedLen, const uint8_t *key, uint16_t keyLen) { - bool ret = true; - /* TODO: make sure to define the value */ - uint8_t xor [4] = {0xC4, 0xA7, 0x96, 0xE5}; - uint8_t i = 0; - uint8_t cal[4] = {0, 0, 0, 0}; - uint8_t calKey[4] = {0, 0, 0, 0}; - - for(i = 0; i < seedLen; i++) + /* The encryption algorithm is provided by the vehicle manufacturer */ + uint8_t cal[4],calc_key[8]; + switch (seedLevel) { - cal[i] = seed[i] ^ xor[i]; - } + case UDS_SA_LEVEL_1: + cal[0] = seed[0]^DMxorArray[0]; + cal[1] = seed[1]^DMxorArray[1]; + cal[2] = seed[2]^DMxorArray[2]; + cal[3] = seed[3]^DMxorArray[3]; - calKey[0] = ((cal[0] & 0x0F) << 4) | (cal[1] & 0x0F); - calKey[1] = ((cal[1] & 0xF0) >> 4) | ((cal[2] & 0x0F) << 4); - calKey[2] = ((cal[2] & 0xF0) >> 4) | (cal[3] & 0xF0); - calKey[3] = (cal[3] & 0x0F) | ((cal[0] & 0xF0) >> 4); - - for (i = 0; i< keyLen; i++) - { - if(calKey[i] != key[i]) + calc_key[0] = ((cal[2]&0xF0)<<4)|(cal[3]&0xF0); + calc_key[1] = ((cal[3]&0x2F)<<2)|(cal[1]&0x03); + calc_key[2] = ((cal[1]&0xFC)>>2)|(cal[0]&0xC0); + calc_key[3] = ((cal[0]&0x0F)<<4)|(cal[2]&0x0F); + if (calc_key[0]!=key[0] || calc_key[1]!=key[1] || calc_key[2]!=key[2] || calc_key[3]!=key[3]) { - ret = false; - break; + //TxTestMsg(calc_key); + return false; } + return true; + case UDS_SA_LEVEL_09: + cal[0] = seed[0]^DMxorArray[0]; + cal[1] = seed[1]^DMxorArray[1]; + cal[2] = seed[2]^DMxorArray[2]; + cal[3] = seed[3]^DMxorArray[3]; + + calc_key[0] = ((cal[1]&0x7F)<<2)|(cal[2]&0xF0); + calc_key[1] = ((cal[0]&0xEC)>>2)|(cal[1]&0x7E); + calc_key[2] = ((cal[3]&0xF0)>>4)|(cal[0]&0x2C); + calc_key[3] = ((cal[2]&0x0F)<<4)|(cal[3]&0x7D); + if (calc_key[0]!=key[0] || calc_key[1]!=key[1] || calc_key[2]!=key[2] || calc_key[3]!=key[3]) + { + //TxTestMsg(calc_key); + return false; + } + return true; + default: + return false; } - return ret; + return false; } void UdsService27_SecurityAccess(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen) diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service28.c b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service28.c deleted file mode 100644 index 8fbcf7b..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service28.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include "uds_service28.h" - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/*! \brief The uds communication type definition of UDS - */ -typedef enum _UdsComType_ -{ - UDS_CC_TYPE_NONE = 0, - UDS_CC_TYPE_NORMAL, /* normal message */ - UDS_CC_TYPE_NM, /* network management */ - UDS_CC_TYPE_NOR_NM, /* normal and network management message */ -} UdsComType; - -/*! \brief The uds communication control mode definition of UDS - */ -typedef enum _UdsComCtrlMode_ -{ - UDS_CC_MODE_RX_TX = 0, - UDS_CC_MODE_RX_NO, - UDS_CC_MODE_NO_TX, - UDS_CC_MODE_NO_NO -} UdsComCtrMode; - -/******************************************************************************* - * the globals - ******************************************************************************/ - -static uint8_t udsComCtrlType = 0; - -/******************************************************************************* - * the constants - ******************************************************************************/ - -/******************************************************************************* - * the functions - ******************************************************************************/ - -uint8_t Uds_GetCommunicationControlMode(void) -{ - return udsComCtrlType; -} - -void UdsService28_CommunicationControl(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen) -{ - uint8_t subFunction; - uint8_t rspBuffer[8] = {0}; /* polyspace DEFECT:PARTIALLY_ACCESSED_ARRAY [No action planned:Low] "Still keep default though member2~7 is not written" */ - uint8_t ccType = 0; - - if(msgLen < obj->seviceTable[obj->curServiceIdx].minLen) - { - Uds_NegativeResponse(obj, 0x28, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - if(obj->session == UDS_SESSION_DEFAULT) - { - Uds_NegativeResponse(obj, 0x28, NRC_CONDITIONS_NOT_CORRECT); - return; - } - - subFunction = UDS_GET_SUB_FUNCTION(msgBuf[1]); - ccType = msgBuf[2]; - - rspBuffer[0] = UDS_GET_POSITIVE_RSP(0x28); - rspBuffer[1] = subFunction; - switch(subFunction) - { - case UDS_CC_MODE_RX_TX: - if(ccType == UDS_CC_TYPE_NORMAL || ccType == UDS_CC_TYPE_NM || ccType == UDS_CC_TYPE_NOR_NM) - { - udsComCtrlType = UDS_CC_MODE_RX_TX; - - Uds_PositiveResponse(obj, rspBuffer, 2); - } - else - { - Uds_NegativeResponse(obj, 0x28, NRC_REQUEST_OUT_OF_RANGE); - } - break; - case UDS_CC_MODE_RX_NO: - if(ccType == UDS_CC_TYPE_NORMAL || ccType == UDS_CC_TYPE_NM || ccType == UDS_CC_TYPE_NOR_NM) - { - udsComCtrlType = UDS_CC_MODE_RX_NO; - - Uds_PositiveResponse(obj, rspBuffer, 2); - } - else - { - Uds_NegativeResponse(obj, 0x28, NRC_REQUEST_OUT_OF_RANGE); - } - break; - case UDS_CC_MODE_NO_TX: - if(ccType == UDS_CC_TYPE_NORMAL || ccType == UDS_CC_TYPE_NM || ccType == UDS_CC_TYPE_NOR_NM) - { - udsComCtrlType = UDS_CC_MODE_NO_TX; - - Uds_PositiveResponse(obj, rspBuffer, 2); - } - else - { - Uds_NegativeResponse(obj, 0x28, NRC_REQUEST_OUT_OF_RANGE); - } - break; - case UDS_CC_MODE_NO_NO: - if(ccType == UDS_CC_TYPE_NORMAL || ccType == UDS_CC_TYPE_NM || ccType == UDS_CC_TYPE_NOR_NM) - { - udsComCtrlType = UDS_CC_MODE_NO_NO; - - Uds_PositiveResponse(obj, rspBuffer, 2); - } - else - { - Uds_NegativeResponse(obj, 0x28, NRC_REQUEST_OUT_OF_RANGE); - } - break; - default: - Uds_NegativeResponse(obj, 0x28, NRC_SUBFUNCTION_NOT_SUPPORTED); - break; - } -} diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service28.h b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service28.h deleted file mode 100644 index 7e3c098..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service28.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -#ifndef _UDS_SERVICE28_H_ -#define _UDS_SERVICE28_H_ - -/*! \brief Contains public interface to various functions related - * to the user-defined UDS service 28 - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include -#include -#include "../stack/uds.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the function prototypes - ******************************************************************************/ - -/*! \brief Get Communication Control Mode - */ -uint8_t Uds_GetCommunicationControlMode(void); - -/*! \brief Uds Service 28 processing - */ -extern void UdsService28_CommunicationControl(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen); - -#ifdef __cplusplus -} -#endif /* extern "C" */ - -#endif /* _UDS_SERVICE28_H_ */ diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service2E.c b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service2E.c deleted file mode 100644 index d97834e..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service2E.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include -#include "uds_service2E.h" - -/******************************************************************************* - * the defines - ******************************************************************************/ - - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the constants - ******************************************************************************/ - -/******************************************************************************* - * the functions - ******************************************************************************/ - -void UdsService2E_WriteDataByIdentifier(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen) -{ - uint16_t didValue = 0; - uint16_t didIdx = 0; - uint8_t rspBuffer[8] = {0}; - bool writeResult = false; - - if(msgLen < obj->seviceTable[obj->curServiceIdx].minLen) - { - Uds_NegativeResponse(obj, 0x2E, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - didValue = ((uint16_t)msgBuf[1]) << 8; - didValue |= msgBuf[2]; - - rspBuffer[0] = UDS_GET_POSITIVE_RSP(0x2E); - rspBuffer[1] = msgBuf[1]; - rspBuffer[2] = msgBuf[2]; - for(didIdx = 0; didIdx < obj->didNum; didIdx++) - { - if(obj->didTable[didIdx].did == didValue) - { - if((obj->didTable[didIdx].securityLevel != UDS_SA_NONE) && (obj->securityLevel != obj->didTable[didIdx].securityLevel)) - { - Uds_NegativeResponse(obj, 0x22, NRC_SECURITY_ACCESS_DENIED); - return; - } - else if((msgLen - 3) != obj->didTable[didIdx].length) - { - Uds_NegativeResponse(obj, 0x2E, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - if((UDS_DID_TYPE_NVM_RO == obj->didTable[didIdx].type) || (obj->session < obj->didTable[didIdx].sessionLevel)) - { - Uds_NegativeResponse(obj, 0x2E, NRC_CONDITIONS_NOT_CORRECT); - return; - } - - memcpy(obj->didTable[didIdx].pBytes, &msgBuf[3], obj->didTable[didIdx].length); - /* add user code to save data */ - switch(didValue) - { - case UDS_USER_DID_PRINT_FOOT: - /* TODO: write data to eeprom */ - - writeResult = true; - break; - } - - /* check save data success */ - /* polyspace-begin DEFECT:DEAD_CODE [No action planned:Low] "Still reserve though it's maybe unreachable" */ - if(writeResult == true) - { - Uds_PositiveResponse(obj, rspBuffer, 3); - return; - } - else - { - Uds_NegativeResponse(obj, 0x2E, NRC_GENERAL_PROGRAMMING_FAILURE); - return; - } - /* polyspace-end DEFECT:DEAD_CODE [No action planned:Low] "Still reserve though it's maybe unreachable" */ - } - } - - Uds_NegativeResponse(obj, 0x2E, NRC_REQUEST_OUT_OF_RANGE); -} - - - diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service2E.h b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service2E.h deleted file mode 100644 index 84a7479..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service2E.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -#ifndef _UDS_SERVICE2E_H_ -#define _UDS_SERVICE2E_H_ - -/*! \brief Contains public interface to various functions related - * to the user-defined UDS service 2E - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include -#include -#include "../stack/uds.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * the defines - ******************************************************************************/ -#define UDS_USER_DID_PRINT_FOOT (0xF184) -#define UDS_USER_DID_PRINT_FOOT_DATA_LEN (9) - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the function prototypes - ******************************************************************************/ - -/*! \brief Uds Service 2E processing - */ -extern void UdsService2E_WriteDataByIdentifier(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen); - -#ifdef __cplusplus -} -#endif /* extern "C" */ - -#endif /* _UDS_SERVICE2E_H_ */ diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service2F.c b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service2F.c deleted file mode 100644 index 9023068..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service2F.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include -#include -#include "uds_service2F.h" - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/*! \brief The Uds IO control type - */ -typedef enum _UdsIoCtrlType_ -{ - UDS_IOCTRL_RETURN_TO_ECU = 0x00, - UDS_IOCTRL_RETSET_TO_DEFAULT = 0x01, - UDS_IOCTRL_FREEZE_CURRENT_STATE = 0x02, - UDS_IOCTRL_SHORT_ADJUSTMENT = 0x03 -} UdsIoCtrlType; - -/*! \brief The Uds IO control struct - */ -typedef struct _Uds_IoCtrl_ -{ - uint16_t did; - uint8_t securityLevel; - uint8_t *pData; - uint8_t dataLen; - uint8_t defaultValue; - uint8_t step; - bool enable; - void (*IoCtrl_Init)(void); - void (*IoCtrl_Stop)(void); -} Uds_IoCtrl; - -/*! \brief The IoControl-by-ID definition of UDS - */ -typedef struct _Uds_IoCtrlBuf_ -{ - uint8_t backlightLevel[2]; - uint8_t buzzer[2]; -} Uds_IoCtrlBuf; - -/******************************************************************************* - * the constants - ******************************************************************************/ - -static void IoCtrl_InitBackLight(void); -static void IoCtrl_StopBacklight(void); -static void IoCtrl_InitBuzzer(void); -static void IoCtrl_StopBuzzer(void); - -/******************************************************************************* - * the globals - ******************************************************************************/ - -Uds_IoCtrlBuf udsIoCtrlBuffer; - -Uds_IoCtrl udsIoCtrlTable[] = { - {0xF092, UDS_SA_NONE, udsIoCtrlBuffer.backlightLevel, 2, 0, 0, 0, &IoCtrl_InitBackLight, &IoCtrl_StopBacklight}, - {0xF020, UDS_SA_NONE, udsIoCtrlBuffer.buzzer, 2, 0, 0, 0, &IoCtrl_InitBuzzer, &IoCtrl_StopBuzzer }, -}; - -/******************************************************************************* - * the functions - ******************************************************************************/ - -static void IoCtrl_InitBackLight(void) -{ - /* user add back light control code */ -} - -static void IoCtrl_StopBacklight(void) -{ - /* user add back light stop code */ -} - -static void IoCtrl_InitBuzzer(void) -{ - /* user add buzzer control code */ -} - -static void IoCtrl_StopBuzzer(void) -{ - /* user add buzzer stop code */ -} - -void UdsService2F_InputOutputCtrlById(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen) -{ - uint16_t ioCtrlId = 0; - uint8_t ioCtrlParam = 0; - uint8_t ioCtrlIndex = 0; - uint8_t ioCtrlNum = sizeof(udsIoCtrlTable) / sizeof(udsIoCtrlTable[0]); - uint8_t rspBuffer[UDS_RSP_LEN_MAX] = {0}; - - if(msgLen < obj->seviceTable[obj->curServiceIdx].minLen) - { - Uds_NegativeResponse(obj, 0x2F, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - if(obj->session == UDS_SESSION_DEFAULT) - { - Uds_NegativeResponse(obj, 0x2F, NRC_CONDITIONS_NOT_CORRECT); - return; - } - - ioCtrlId = ((uint16_t)msgBuf[1] << 8) + msgBuf[2]; - ioCtrlParam = msgBuf[3]; - - for(ioCtrlIndex = 0; ioCtrlIndex < ioCtrlNum; ioCtrlIndex++) - { - if(udsIoCtrlTable[ioCtrlIndex].did == ioCtrlId) - { - if((udsIoCtrlTable[ioCtrlIndex].securityLevel != UDS_SA_NONE) && (udsIoCtrlTable[ioCtrlIndex].securityLevel != obj->securityLevel)) - { - Uds_NegativeResponse(obj, 0x2F, NRC_SECURITY_ACCESS_DENIED); - return; - } - - break; - } - } - - if(ioCtrlIndex >= ioCtrlNum) - { - Uds_NegativeResponse(obj, 0x2F, NRC_REQUEST_OUT_OF_RANGE); - return; - } - - rspBuffer[0] = UDS_GET_POSITIVE_RSP(0x2F); - rspBuffer[1] = msgBuf[1]; - rspBuffer[2] = msgBuf[2]; - rspBuffer[3] = msgBuf[3]; - switch(ioCtrlParam) - { - case UDS_IOCTRL_RETURN_TO_ECU: - /* add user code */ - udsIoCtrlTable[ioCtrlIndex].enable = false; - if(udsIoCtrlTable[ioCtrlIndex].IoCtrl_Stop != NULL) - { - udsIoCtrlTable[ioCtrlIndex].IoCtrl_Stop(); - Uds_PositiveResponse(obj, rspBuffer, 4); - } - - break; - case UDS_IOCTRL_SHORT_ADJUSTMENT: - /* add user code */ - if(msgLen < (udsIoCtrlTable[ioCtrlIndex].dataLen + 4)) - { - Uds_NegativeResponse(obj, 0x2F, NRC_CONDITIONS_NOT_CORRECT); - return; - } - - udsIoCtrlTable[ioCtrlIndex].enable = true; - memcpy(udsIoCtrlTable[ioCtrlIndex].pData, &msgBuf[4], udsIoCtrlTable[ioCtrlIndex].dataLen); - if(udsIoCtrlTable[ioCtrlIndex].IoCtrl_Init != NULL) - { - udsIoCtrlTable[ioCtrlIndex].IoCtrl_Init(); - Uds_PositiveResponse(obj, rspBuffer, 4); - } - break; - default: - Uds_NegativeResponse(obj, 0x2F, NRC_REQUEST_OUT_OF_RANGE); - break; - } -} diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service2F.h b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service2F.h deleted file mode 100644 index 77ea61b..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service2F.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -#ifndef _UDS_SERVICE2F_H_ -#define _UDS_SERVICE2F_H_ - -/*! \brief Contains public interface to various functions related - * to the user-defined UDS service 2F - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include -#include -#include "../stack/uds.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the function prototypes - ******************************************************************************/ - -/*! \brief Uds Service 2F processing - */ -extern void UdsService2F_InputOutputCtrlById(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen); - -#ifdef __cplusplus -} -#endif /* extern "C" */ - -#endif /* _UDS_SERVICE2F_H_ */ diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service31.c b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service31.c index 3db97b5..ed16429 100644 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service31.c +++ b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service31.c @@ -91,10 +91,10 @@ static void Routine_ResultVerifyCompatibility(const uint8_t *pdata, uint16_t len ******************************************************************************/ Uds_RtnCtrl udsRtnCtrlTable[] = { - {RID_ERASE_MEMORY, UDS_SESSION_PROGRAMMING, UDS_SA_LEVEL_9, UDS_RTN_ST_IDLE, &Routine_StartEreaseMemory, &Routine_StopEreaseMemory, &Routine_ResultEreaseMemory }, + {RID_ERASE_MEMORY, UDS_SESSION_PROGRAMMING, UDS_SA_LEVEL_09, UDS_RTN_ST_IDLE, &Routine_StartEreaseMemory, &Routine_StopEreaseMemory, &Routine_ResultEreaseMemory }, {RID_PGM_CONDITION_CHECK, UDS_SESSION_PROGRAMMING | UDS_SESSION_EXTENDED, UDS_SA_NONE, UDS_RTN_ST_IDLE, &Routine_StartCheckPgmCondition, &Routine_StopCheckPgmCondition, &Routine_ResultCheckPgmCondition }, - {RID_CRC_CHECK, UDS_SESSION_PROGRAMMING, UDS_SA_LEVEL_9, UDS_RTN_ST_IDLE, &Routine_StartCheckCrc, &Routine_StopCheckCrc, &Routine_ResultCheckCrc }, - {RID_COMPATIBILITY, UDS_SESSION_PROGRAMMING, UDS_SA_LEVEL_9, UDS_RTN_ST_IDLE, &Routine_StartVerifyCompatibility, &Routine_StopVerifyCompatibility, &Routine_ResultVerifyCompatibility}, + {RID_CRC_CHECK, UDS_SESSION_PROGRAMMING, UDS_SA_LEVEL_09, UDS_RTN_ST_IDLE, &Routine_StartCheckCrc, &Routine_StopCheckCrc, &Routine_ResultCheckCrc }, + {RID_COMPATIBILITY, UDS_SESSION_PROGRAMMING, UDS_SA_LEVEL_09, UDS_RTN_ST_IDLE, &Routine_StartVerifyCompatibility, &Routine_StopVerifyCompatibility, &Routine_ResultVerifyCompatibility}, }; /******************************************************************************* diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service37.c b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service37.c deleted file mode 100644 index f94681d..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service37.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ -#include "uds_service36.h" -#include "uds_service37.h" - - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the constants - ******************************************************************************/ - -/******************************************************************************* - * the functions - ******************************************************************************/ - -void UdsService37_RequestTransferExit(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen) -{ - uint16_t rspLen = 0; - uint8_t rspBuffer[8] ={0}; /* polyspace DEFECT:PARTIALLY_ACCESSED_ARRAY [No action planned:Low] "Still reserve though member1~7 is not written" */ - - if(obj->session == UDS_SESSION_DEFAULT) - { - Uds_NegativeResponse(obj, 0x37, NRC_CONDITIONS_NOT_CORRECT); - return; - } - - if(msgLen < obj->seviceTable[obj->curServiceIdx].minLen) - { - Uds_NegativeResponse(obj, 0x37, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - rspBuffer[rspLen++] = UDS_GET_POSITIVE_RSP(0x37); - switch(Uds_GetDataTransferDirect()) - { - case UDS_TRANSFER_DIR_DOWNLOAD: - if(Uds_GetRcvDataTotalLen() != Uds_GetMemSize()) - { - Uds_NegativeResponse(obj, 0x37, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - break; - } - - /* user add process code, example data CRC */ - /* polyspace-begin DEFECT:DEAD_CODE [No action planned:Low] "Still reserve though it's maybe unreachable" */ - if(1) /* result check correct */ - { - Uds_PositiveResponse(obj, rspBuffer, rspLen); - } - else - { - Uds_NegativeResponse(obj, 0x37, NRC_GENERAL_PROGRAMMING_FAILURE); - } - /* polyspace-end DEFECT:DEAD_CODE [No action planned:Low] "Still reserve though it's maybe unreachable" */ - break; - case UDS_TRANSFER_DIR_UPLOAD: - Uds_NegativeResponse(obj, 0x37, NRC_REQUEST_OUT_OF_RANGE); - break; - default: - Uds_NegativeResponse(obj, 0x37, NRC_REQUEST_SEQUENCE_ERROR); - break; - } - - Uds_SetDataTransferDirect(UDS_TRANSFER_DIR_NONE); -} - - - diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service37.h b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service37.h deleted file mode 100644 index cd6da79..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service37.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -#ifndef _UDS_SERVICE37_H_ -#define _UDS_SERVICE37_H_ - -/*! \brief Contains public interface to various functions related - * to the user-defined UDS service 37 - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include -#include -#include "../stack/uds.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the function prototypes - ******************************************************************************/ - -/*! \brief Uds Service 37 processing - */ -void UdsService37_RequestTransferExit(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen); - -#ifdef __cplusplus -} -#endif /* extern "C" */ - -#endif /* _UDS_SERVICE37_H_ */ diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service3E.c b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service3E.c deleted file mode 100644 index e371eb8..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service3E.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include "uds_service3E.h" - - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the constants - ******************************************************************************/ - -/******************************************************************************* - * the functions - ******************************************************************************/ - -void UdsService3E_TesterPresent(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen) -{ - uint8_t subFunction; - uint8_t rspBuffer[8] = {0}; /* polyspace DEFECT:PARTIALLY_ACCESSED_ARRAY [No action planned:Low] "Still keep default though member2~7 is not written" */ - - if(msgLen != obj->seviceTable[obj->curServiceIdx].minLen) - { - Uds_NegativeResponse(obj, 0x3E, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - subFunction = UDS_GET_SUB_FUNCTION (msgBuf[1]); - - if(subFunction == 0) - { - rspBuffer[0] = UDS_GET_POSITIVE_RSP(0x3E); - rspBuffer[1] = subFunction; - Uds_PositiveResponse(obj, rspBuffer, 2); - } - else - { - Uds_NegativeResponse(obj, 0x3E, NRC_SUBFUNCTION_NOT_SUPPORTED); - } - -} - - diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service3E.h b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service3E.h deleted file mode 100644 index d714e26..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service3E.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -#ifndef _UDS_SERVICE3E_H_ -#define _UDS_SERVICE3E_H_ - -/*! \brief Contains public interface to various functions related - * to the user-defined UDS service 3E - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include -#include -#include "../stack/uds.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the function prototypes - ******************************************************************************/ - -/*! \brief Uds Service 3E processing - */ -extern void UdsService3E_TesterPresent(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen); - -#ifdef __cplusplus -} -#endif /* extern "C" */ - -#endif /* _UDS_SERVICE3E_H_ */ diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service85.c b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service85.c deleted file mode 100644 index 570654b..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service85.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include "uds_service85.h" -#include "uds_dtc.h" - - - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the constants - ******************************************************************************/ - -/******************************************************************************* - * the functions - ******************************************************************************/ - -void UdsService85_ControlDtcSetting(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen) -{ - uint8_t subFunction; - uint8_t rspBuffer[8] = {0}; /* polyspace DEFECT:PARTIALLY_ACCESSED_ARRAY [No action planned:Low] "Still keep default though member2~7 is not written" */ - - if(msgLen < obj->seviceTable[obj->curServiceIdx].minLen) - { - Uds_NegativeResponse(obj, 0x85, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT); - return; - } - - if(obj->session == UDS_SESSION_DEFAULT) - { - Uds_NegativeResponse(obj, 0x85, NRC_CONDITIONS_NOT_CORRECT); - return; - } - - subFunction = UDS_GET_SUB_FUNCTION (msgBuf[1]); - rspBuffer[0] = UDS_GET_POSITIVE_RSP(0x85); - rspBuffer[1] = subFunction; - switch(subFunction) - { - case 1: - Uds_SetDtcOffCtrl(true); - Uds_PositiveResponse(obj, rspBuffer, 2); - break; - case 2: - Uds_SetDtcOffCtrl(false); - Uds_PositiveResponse(obj, rspBuffer, 2); - break; - default: - Uds_NegativeResponse(obj, 0x85, NRC_SUBFUNCTION_NOT_SUPPORTED); - break; - } - -} diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service85.h b/cva_bootloader_m0128/src/private_driver/uds/user/uds_service85.h deleted file mode 100644 index 0d55da3..0000000 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_service85.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD - * All rights reserved. - * - * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use - * exclusively with CVA's microcontroller products. This file can be freely - * distributed within development tools that are supporting such microcontroller - * products. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - */ - -#ifndef _UDS_SERVICE85_H_ -#define _UDS_SERVICE85_H_ - -/*! \brief Contains public interface to various functions related - * to the user-defined UDS service 85 - */ - -/******************************************************************************* - * the includes - ******************************************************************************/ - -#include -#include -#include "../stack/uds.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * the defines - ******************************************************************************/ - -/******************************************************************************* - * the typedefs - ******************************************************************************/ - -/******************************************************************************* - * the globals - ******************************************************************************/ - -/******************************************************************************* - * the function prototypes - ******************************************************************************/ - -/*! \brief Uds Service 85 processing - */ -extern void UdsService85_ControlDtcSetting(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen); - -#ifdef __cplusplus -} -#endif /* extern "C" */ - -#endif /* _UDS_SERVICE85_H_ */ diff --git a/cva_bootloader_m0128/src/private_driver/uds/user/uds_user.c b/cva_bootloader_m0128/src/private_driver/uds/user/uds_user.c index 39c5c48..8777ac2 100644 --- a/cva_bootloader_m0128/src/private_driver/uds/user/uds_user.c +++ b/cva_bootloader_m0128/src/private_driver/uds/user/uds_user.c @@ -19,7 +19,7 @@ ******************************************************************************/ #include "uds_user.h" - +#include "bootloader_cfg.h" /******************************************************************************* * the defines ******************************************************************************/