更新诊断
This commit is contained in:
parent
ae73ec6964
commit
11f860438c
File diff suppressed because one or more lines are too long
@ -657,7 +657,7 @@ static bool Bootloader_GetBootReq(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Clear the no-init ram */
|
/* Clear the no-init ram */
|
||||||
sBootloader_Req = 0x778899AA;
|
sBootloader_Req = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -689,6 +689,8 @@ static void Bootloader_JumpToApp(void)
|
|||||||
|
|
||||||
IrqDrv_DisableGlobalInterrupt();
|
IrqDrv_DisableGlobalInterrupt();
|
||||||
|
|
||||||
|
FlexCanDrv_SoftReset(flexCanDrv_DemoObj);
|
||||||
|
|
||||||
/* MSP */
|
/* MSP */
|
||||||
appStack = *(uint32_t *)BOOTLOADER_CFG_APP_START_ADDR;
|
appStack = *(uint32_t *)BOOTLOADER_CFG_APP_START_ADDR;
|
||||||
/* PC */
|
/* PC */
|
||||||
@ -697,9 +699,9 @@ static void Bootloader_JumpToApp(void)
|
|||||||
pJumpToApp = (void (*)(void))appEntry;
|
pJumpToApp = (void (*)(void))appEntry;
|
||||||
statckPointer = appStack;
|
statckPointer = appStack;
|
||||||
/* Set the MSP */
|
/* Set the MSP */
|
||||||
__set_MSP(statckPointer);
|
|
||||||
__set_PSP(statckPointer);
|
__set_PSP(statckPointer);
|
||||||
|
__set_MSP(statckPointer);
|
||||||
|
|
||||||
SCB->VTOR = (uint32_t)BOOTLOADER_CFG_APP_START_ADDR;
|
SCB->VTOR = (uint32_t)BOOTLOADER_CFG_APP_START_ADDR;
|
||||||
/* Jump action */
|
/* Jump action */
|
||||||
pJumpToApp();
|
pJumpToApp();
|
||||||
|
@ -656,6 +656,8 @@ void IsoTp_HandleIncomingCanMsg(IsoTpType *obj, uint32_t id, const uint8_t *data
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Send FC when BS reaches limit */
|
/* Send FC when BS reaches limit */
|
||||||
|
if(obj->blockSize > 0)
|
||||||
|
{
|
||||||
if(0 == --obj->receiveBlockSizeCount)
|
if(0 == --obj->receiveBlockSizeCount)
|
||||||
{
|
{
|
||||||
obj->receiveBlockSizeCount = obj->blockSize;
|
obj->receiveBlockSizeCount = obj->blockSize;
|
||||||
@ -663,6 +665,7 @@ void IsoTp_HandleIncomingCanMsg(IsoTpType *obj, uint32_t id, const uint8_t *data
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ extern "C" {
|
|||||||
|
|
||||||
#define BYTES_OF(x) (sizeof(x) / sizeof(uint8_t))
|
#define BYTES_OF(x) (sizeof(x) / sizeof(uint8_t))
|
||||||
|
|
||||||
#define UDS_RSP_LEN_MAX (64)
|
#define UDS_RSP_LEN_MAX (512)
|
||||||
|
|
||||||
/* DID type */
|
/* DID type */
|
||||||
#define UDS_VAR_TYPE_NONVOL_STORAGE (1 << 0) /* set if non-volatile data */
|
#define UDS_VAR_TYPE_NONVOL_STORAGE (1 << 0) /* set if non-volatile data */
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "uds_service10.h"
|
#include "uds_service10.h"
|
||||||
|
#include "uds_service31.h"
|
||||||
#include "bootloader.h"
|
#include "bootloader.h"
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@ -60,6 +61,7 @@ void UdsService10_SessionControl(UdsType *obj, const uint8_t msgBuf[], uint16_t
|
|||||||
rspBuffer[3] = (uint8_t)(obj->p2Server_ms & 0x00ff);
|
rspBuffer[3] = (uint8_t)(obj->p2Server_ms & 0x00ff);
|
||||||
rspBuffer[4] = (uint8_t)(obj->p2xServer_10ms >> 8);
|
rspBuffer[4] = (uint8_t)(obj->p2xServer_10ms >> 8);
|
||||||
rspBuffer[5] = (uint8_t)(obj->p2xServer_10ms & 0x00ff);
|
rspBuffer[5] = (uint8_t)(obj->p2xServer_10ms & 0x00ff);
|
||||||
|
Routine_StatusInit();
|
||||||
switch(subFunction)
|
switch(subFunction)
|
||||||
{
|
{
|
||||||
case UDS_SESSION_DEFAULT:
|
case UDS_SESSION_DEFAULT:
|
||||||
|
@ -99,18 +99,15 @@ Uds_RtnCtrl udsRtnCtrlTable[] = {
|
|||||||
* the functions
|
* the functions
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void Routine_StatusInit(uint16_t routineId)
|
void Routine_StatusInit(void)
|
||||||
{
|
{
|
||||||
uint8_t rtnIndex = 0;
|
uint8_t rtnIndex = 0;
|
||||||
uint8_t rntNum = sizeof(udsRtnCtrlTable) / sizeof(Uds_RtnCtrl);
|
uint8_t rntNum = sizeof(udsRtnCtrlTable) / sizeof(Uds_RtnCtrl);
|
||||||
|
|
||||||
for(rtnIndex = 0; rtnIndex < rntNum; rtnIndex++)
|
for(rtnIndex = 0; rtnIndex < rntNum; rtnIndex++)
|
||||||
{
|
{
|
||||||
if(udsRtnCtrlTable[rtnIndex].rtnCtrlId == routineId)
|
|
||||||
{
|
|
||||||
udsRtnCtrlTable[rtnIndex].rtnStatus = UDS_RTN_ST_IDLE;
|
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)
|
static void Routine_StartEreaseMemory(const uint8_t *pdata, uint16_t len, uint8_t *pRspData, uint16_t rspSize, uint16_t *pRspLen)
|
||||||
|
@ -53,7 +53,7 @@ extern void UdsService31_RoutineControl(UdsType *obj, const uint8_t msgBuf[], ui
|
|||||||
|
|
||||||
/*! \brief Routine status init
|
/*! \brief Routine status init
|
||||||
*/
|
*/
|
||||||
extern void Routine_StatusInit(uint16_t routineId);
|
extern void Routine_StatusInit(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -45,10 +45,9 @@
|
|||||||
|
|
||||||
uint32_t Uds_GetMaxfBlockSize(void)
|
uint32_t Uds_GetMaxfBlockSize(void)
|
||||||
{
|
{
|
||||||
/* user add code to get max num of block length */
|
|
||||||
uint32_t blockSize = 0;
|
uint32_t blockSize = 0;
|
||||||
/* user add code to get max num of block length */
|
/* user add code to get max num of block length */
|
||||||
blockSize = Bootloader_GetPgmBlockSize();
|
blockSize = Bootloader_GetPgmBlockSize() + 2u;
|
||||||
|
|
||||||
return blockSize;
|
return blockSize;
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ typedef struct _Uds_DidBuffer_
|
|||||||
uint8_t buffer_F186[1];
|
uint8_t buffer_F186[1];
|
||||||
uint8_t buffer_F187[8];//ecu name
|
uint8_t buffer_F187[8];//ecu name
|
||||||
uint8_t buffer_F180[8];//boot version
|
uint8_t buffer_F180[8];//boot version
|
||||||
|
uint8_t buffer_F191[24];//buildtime
|
||||||
uint8_t buffer_F193[4];//hw version
|
uint8_t buffer_F193[4];//hw version
|
||||||
uint8_t buffer_F195[8];//sw version
|
uint8_t buffer_F195[8];//sw version
|
||||||
} Uds_DidBuffer;
|
} Uds_DidBuffer;
|
||||||
@ -89,6 +90,7 @@ 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},
|
{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},
|
{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},
|
{0xF180, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F180, BYTES_OF(udsDidBuf.buffer_F180),DID_F180_func},
|
||||||
|
{0xF191, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F191, BYTES_OF(udsDidBuf.buffer_F191),DID_F191_func},
|
||||||
{0xF193, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F193, BYTES_OF(udsDidBuf.buffer_F193),DID_F193_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},
|
{0xF195, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F195, BYTES_OF(udsDidBuf.buffer_F195),DID_F195_func},
|
||||||
};
|
};
|
||||||
@ -125,6 +127,15 @@ void DID_F187_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen)
|
|||||||
PBootInfo = (Bootloade_CfgInfoType *)0x0000400;
|
PBootInfo = (Bootloade_CfgInfoType *)0x0000400;
|
||||||
memcpy(dataBuf, &(PBootInfo->ECUName), dataLen);
|
memcpy(dataBuf, &(PBootInfo->ECUName), dataLen);
|
||||||
}
|
}
|
||||||
|
void DID_F191_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen)
|
||||||
|
{
|
||||||
|
Bootloade_CfgInfoType * PBootInfo;
|
||||||
|
PBootInfo = (Bootloade_CfgInfoType *)0x0000400;
|
||||||
|
//memcpy(dataBuf, &(PBootInfo->HWVersion), dataLen);
|
||||||
|
memcpy(dataBuf, &(PBootInfo->bootBuildDate), 12);
|
||||||
|
memcpy(dataBuf + 12, &(PBootInfo->bootBuildTime), 8);
|
||||||
|
dataBuf[11] = ' ';
|
||||||
|
}
|
||||||
void DID_F193_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen)
|
void DID_F193_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen)
|
||||||
{
|
{
|
||||||
Bootloade_CfgInfoType * PBootInfo;
|
Bootloade_CfgInfoType * PBootInfo;
|
||||||
@ -135,7 +146,7 @@ void DID_F195_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen)
|
|||||||
{
|
{
|
||||||
for (uint8_t i = 0; i < dataLen; i++)
|
for (uint8_t i = 0; i < dataLen; i++)
|
||||||
{
|
{
|
||||||
dataBuf[i] = " ";//TODO
|
dataBuf[i] = 0x20;//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -71,6 +71,8 @@ extern void Uds_UserInit(UdsType *obj, const Uds_ParamsType *pParams);
|
|||||||
|
|
||||||
extern void DID_F180_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
|
extern void DID_F180_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
|
||||||
extern void DID_F186_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
|
extern void DID_F186_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
|
||||||
|
extern void DID_F187_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
|
||||||
|
extern void DID_F191_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
|
||||||
extern void DID_F193_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
|
extern void DID_F193_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
|
||||||
extern void DID_F195_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
|
extern void DID_F195_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user