修改诊断信息

This commit is contained in:
sunbeam 2024-12-11 14:22:51 +08:00
parent 2edb06eae7
commit 32a6c33afe
10 changed files with 106 additions and 46 deletions

View File

@ -653,8 +653,6 @@ 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;
@ -662,7 +660,6 @@ void IsoTp_HandleIncomingCanMsg(IsoTpType *obj, uint32_t id, const uint8_t *data
}
}
}
}
break;
}

View File

@ -54,7 +54,7 @@ extern "C" {
/*! \brief The STmin parameter value specifies the minimum time gap allowed between
* the transmission of consecutive frame network protocol data units
*/
#define ISOTP_DEFAULT_ST_MIN (1)
#define ISOTP_DEFAULT_ST_MIN (0)
/*! \brief This parameter indicate how many FC N_PDU WTs can be transmitted by the
* receiver in a row.

View File

@ -89,12 +89,12 @@ typedef enum
*/
typedef enum
{
NVM_STATUS_IDLE = 0x01,
NVM_STATUS_READ = 0x02,
NVM_STATUS_WRITE = 0x03,
NVM_STATUS_GC = 0x04,
NVM_STATUS_UNKNOW = 0x05,
NVM_STATUS_ERROR = 0x06,
NVM_STATUS_IDLE = 0x00,
NVM_STATUS_READ = 0x01,
NVM_STATUS_WRITE = 0x02,
NVM_STATUS_GC = 0x03,
NVM_STATUS_UNKNOW = 0x04,
NVM_STATUS_ERROR = 0x05,
} Nvm_StatusType;
/*! \brief Define the type of virtual function for Notification.

View File

@ -26,6 +26,7 @@
******************************************************************************/
void DID_F180_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
void DID_F186_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
void DID_F187_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
void DID_F193_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
void DID_F195_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
void DID_F191_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
@ -39,10 +40,11 @@ void DID_F191_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
typedef struct _Uds_DidBuffer_
{
uint8_t buffer_F186[1];
uint8_t buffer_F180[4];
uint8_t buffer_F193[8];
uint8_t buffer_F195[16];
uint8_t buffer_F191[24];
uint8_t buffer_F187[8];//ecu name
uint8_t buffer_F180[8];//boot version
uint8_t buffer_F193[4];//hw version
uint8_t buffer_F195[16];//sw version
uint8_t buffer_F191[24];//buildtime
} Uds_DidBuffer;
/*******************************************************************************
@ -93,6 +95,7 @@ static const bool udsSecurityTable[UDS_SERVICE_NUM][UDS_SA_LEVEL_NUM] = {
Uds_DidType udsDidTable[] = {
{0xF186, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F186, BYTES_OF(udsDidBuf.buffer_F186),DID_F186_func},
{0xF187, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F187, BYTES_OF(udsDidBuf.buffer_F187),DID_F187_func},
{0xF180, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F180, BYTES_OF(udsDidBuf.buffer_F180),DID_F180_func},
{0xF193, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F193, BYTES_OF(udsDidBuf.buffer_F193),DID_F193_func},
{0xF195, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F195, BYTES_OF(udsDidBuf.buffer_F195),DID_F195_func},
@ -117,14 +120,16 @@ void Uds_UserInit(UdsType *obj, const Uds_ParamsType *pParams)
/******************************DID FUNC****************************************/
void DID_F180_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen)
{
uint8_t * pdata;
pdata = (uint8_t *)0x0000400;
memcpy(dataBuf, pdata, dataLen);
getBL_VERSION(dataBuf);
}
void DID_F186_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen)
{
dataBuf[0] = obj->session;
}
void DID_F187_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen)
{
getEcuName(dataBuf);
}
void DID_F193_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen)
{
getHW_VERSION(dataBuf);

View File

@ -44,9 +44,9 @@ define symbol m_interrupts_start = isdefinedsymbol(__asw_debug_en__) ? 0 :
define symbol m_interrupts_end = isdefinedsymbol(__asw_debug_en__) ? 0 : 0x000103FF;
define symbol m_asw_header_start = 0x00010400;
define symbol m_asw_header_end = 0x0001041f;
define symbol m_asw_header_end = 0x0001043f;
define symbol m_asw_code_start = 0x00010420;
define symbol m_asw_code_start = 0x00010440;
define symbol m_asw_code_end = 0x0007FFFB;
define symbol m_asw_crc_start = 0x0007FFFC;

View File

@ -25,8 +25,8 @@
<MemConfigValue>E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\CVAChip\CVM0144.ddf</MemConfigValue>
</PlDriver>
<ArmDriver>
<EnableCache>0</EnableCache>
<EnforceMemoryConfiguration>1</EnforceMemoryConfiguration>
<EnableCache>0</EnableCache>
</ArmDriver>
<DebugChecksum>
<Checksum>3190234441</Checksum>

File diff suppressed because one or more lines are too long

View File

@ -1,22 +1,74 @@
/*******************************************************************************
* the includes
******************************************************************************/
#include "extern.h"
#include "TLE94x1.h"
#include <string.h>
#include "drivers/reset/reset_drv.h"
#include "mcu.h"
static const unsigned char SW_VERSION[16] = "SW0101_20240510";
static const unsigned char HW_VERSION[8] = "HW01";
/*******************************************************************************
* the defines
******************************************************************************/
#define ASW_HEAD_MASK (0xAABBCCDDul)
/*******************************************************************************
* the typedefs
******************************************************************************/
typedef struct
{
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
typedef struct
{
uint32_t sAswHeader;
uint8_t appBuildTime[12];
uint8_t appBuildDate[16];
uint8_t appSW_VERSION[16];
uint8_t reverse[16];
} app_CfgInfoType;//64 byte
/*******************************************************************************
* the globals
******************************************************************************/
extern McuType mcu;
/*******************************************************************************
* the constants
******************************************************************************/
#pragma location = ".asw_header"
__root const app_CfgInfoType app_info = {
.sAswHeader = ASW_HEAD_MASK,//0x00010400
.appBuildTime = __TIME__,//0x00010404
.appBuildDate = __DATE__,//0x00010410
.appSW_VERSION = "SW0101_20241211",
};
/*******************************************************************************
* the functions
******************************************************************************/
void getSW_VERSION(unsigned char *pdata)
{
memcpy(pdata, SW_VERSION, sizeof(SW_VERSION));
memcpy(pdata, &(app_info.appSW_VERSION), sizeof(app_info.appSW_VERSION));
}
void getHW_VERSION(unsigned char *pdata)
{
memcpy(pdata, HW_VERSION, sizeof(HW_VERSION));
Bootloade_CfgInfoType * PBootInfo;
PBootInfo = (Bootloade_CfgInfoType *)0x0000400;
memcpy(pdata, &(PBootInfo->HWVersion), sizeof(PBootInfo->HWVersion));
//memcpy(pdata, HW_VERSION, );
}
void getBuildTime(unsigned char *pdata)
@ -26,6 +78,20 @@ void getBuildTime(unsigned char *pdata)
pdata[11] = ' ';
}
void getBL_VERSION(unsigned char *pdata)
{
Bootloade_CfgInfoType * PBootInfo;
PBootInfo = (Bootloade_CfgInfoType *)0x0000400;
memcpy(pdata, &(PBootInfo->BLVersion), sizeof(PBootInfo->BLVersion));
}
void getEcuName(unsigned char *pdata)
{
Bootloade_CfgInfoType * PBootInfo;
PBootInfo = (Bootloade_CfgInfoType *)0x0000400;
memcpy(pdata, &(PBootInfo->ECUName), sizeof(PBootInfo->ECUName));
}
void extHardwareReset(void)
{
SBC_Write_RegField(SBC_M_S_CTRL, SBC_M_S_CTRL_MODE_Msk, SBC_M_S_CTRL_MODE_Pos, SBC_MODE_RESET, NULL);

View File

@ -4,7 +4,9 @@
void getSW_VERSION(unsigned char *pdata);
void getHW_VERSION(unsigned char *pdata);
void getBL_VERSION(unsigned char *pdata);
void getBuildTime(unsigned char *pdata);
void getEcuName(unsigned char *pdata);
void extHardwareReset(void);
void extSortwareReset(void);

View File

@ -35,7 +35,7 @@
/* Asw code head id to show asw is not empty */
#define ASW_HEAD_MASK (0xAABBCCDDul)
#define ASW_VECTOR_START_ADDR 0xc000ul
@ -43,24 +43,14 @@
* the typedefs
******************************************************************************/
typedef struct
{
uint32_t sAswHeader;
uint8_t appBuildTime[12];
uint8_t appBuildDate[16];
} app_CfgInfoType;
/*******************************************************************************
* the globals
******************************************************************************/
McuType mcu;
#pragma location = ".asw_header"
__root const app_CfgInfoType app_inif = {
.sAswHeader = ASW_HEAD_MASK,//0x00010400
.appBuildTime = __TIME__,//0x00010404
.appBuildDate = __DATE__,//0x00010410
};