Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
haoJin750TFT
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
时昊
haoJin750TFT
Commits
f958e54b
Commit
f958e54b
authored
Aug 16, 2024
by
李延凯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加周期检测Flash中的MCU信息, 删除不使用的诊断服务
parent
74f41343
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
138 additions
and
810 deletions
+138
-810
BackLight.h
Firmware/Source/Application/BackLight.h
+1
-1
AMT630H.h
Firmware/Source/Component/AMT630H/AMT630H.h
+1
-1
GraphicsFunc.c
Firmware/Source/Component/AMT630H/GraphicsFunc.c
+117
-0
Menu.h
Firmware/Source/Component/Menu/Menu.h
+1
-1
flash.h
...Device/Cmsemicon/BAT32A279/Library/Driver/include/flash.h
+5
-5
flash.c
...rce/Device/Cmsemicon/BAT32A279/Library/Driver/src/flash.c
+2
-3
Sys_Task_List.c
Firmware/Source/System/Sys_Task_List.c
+1
-0
UDS_ISO14229_Services.c
Firmware/Source/UDS/UDS_ISO14229_Services.c
+4
-752
UDS_ISO14229_Services.h
Firmware/Source/UDS/UDS_ISO14229_Services.h
+6
-47
No files found.
Firmware/Source/Application/BackLight.h
View file @
f958e54b
...
...
@@ -27,4 +27,4 @@ void BackLight_Process(void);
#endif
\ No newline at end of file
#endif
Firmware/Source/Component/AMT630H/AMT630H.h
View file @
f958e54b
...
...
@@ -39,4 +39,4 @@ void AMT630H_Main(void);
unsigned
char
AMT630H_isInitFinish
(
void
);
extern
uint32_t
Amt630hInitTimerCnts
;
#endif
\ No newline at end of file
#endif
Firmware/Source/Component/AMT630H/GraphicsFunc.c
View file @
f958e54b
#include "UartProtocol.h"
#include "PicBin.h"
#include <stdint.h>
#include "UDS_ISO14229_Services.h"
#define NULL 0
#define READ_MCU_DATA_MAX 0x400
extern
uint8_t
UartRevBuff
[
0x1000
];
extern
uint32_t
UartRevCnts
;
uint8_t
ReadDataBuf
[
READ_MCU_DATA_MAX
];
/* 读取缓存 */
uint32_t
NeedWriteSize
;
/* 需要写入文件的长度 */
uint32_t
FactOffset
;
/* 绝对地址 */
uint32_t
ReadOffset
;
/* 630中读取偏移量 */
uint32_t
AppOffset
;
uint32_t
Check_Upgrade_Cnt
;
uint8_t
*
GetUartRecvData
(
uint32_t
*
UartRecvBufLen
,
uint32_t
*
UartRecvPos
)
{
*
UartRecvBufLen
=
0x1000
;
...
...
@@ -345,3 +355,110 @@ void TestWrite630Backup(void)
}
}
/* Test end */
void
GetReadInfo
(
READ_ARK630_CMD
type
)
{
static
uint8_t
readSt
=
0
;
static
uint16_t
getStRetryCnts
=
0
;
uint32_t
tmpRet
;
if
(
NeedWriteSize
==
0
)
{
if
(
readSt
==
0
)
{
readSt
=
1
;
ProcMcuOrBackupData
(
type
,
0
,
0
,
0
);
/* 获取偏移地址 */
getStRetryCnts
=
500
;
}
else
{
tmpRet
=
ProcMcuOrBackupData
(
GET_STATUS
,
0
,
0
,
0
);
if
((
tmpRet
!=
2
)
||
(
--
getStRetryCnts
==
0
))
/* 非零值为获得的程序地址 */
{
if
(
tmpRet
!=
2
)
{
NeedWriteSize
=
32
;
/* 此时的NeedWriteSize不重要, 只要跳出循环就行 */
if
(
type
==
GET_APP_DATA_OFFSET
)
{
FactOffset
=
0
;
/* USB按相对地址获取数据 */
}
else
{
FactOffset
=
tmpRet
;
/* 备份程序按绝对地址获取数据 */
}
AppOffset
=
0x00
;
}
readSt
=
0
;
}
}
}
}
/**
* @brief 检查Flash中的MCU程序信息, 是否与当前运行的MCU_APP信息相同, 若不同, 则进入升级模式
*/
void
Check_MCU_in_Flash
(
READ_ARK630_CMD
type
)
{
static
uint8_t
readSt
=
0
;
static
uint16_t
getStRetryCnts
=
0
;
uint32_t
tmpLen
;
uint32_t
writeLen
;
uint8_t
saveVersion
[
16
];
uint8_t
readVersion
[
16
];
if
(
NeedWriteSize
!=
0
)
{
if
(
readSt
==
0
)
{
readSt
=
1
;
(
void
)
memset
(
ReadDataBuf
,
0xFFU
,
sizeof
(
ReadDataBuf
));
/* 初始化buffer */
ProcMcuOrBackupData
(
REQ_DATA
,
FactOffset
+
ReadOffset
,
READ_MCU_DATA_MAX
,
ReadDataBuf
);
// 按地址获取程序数据
getStRetryCnts
=
500
;
ReadOffset
+=
READ_MCU_DATA_MAX
;
}
else
{
tmpLen
=
ProcMcuOrBackupData
(
GET_STATUS
,
0
,
0
,
0
);
/* 获取读取状态 */
if
(
FactOffset
+
ReadOffset
==
tmpLen
)
/* 当返回值为目标位置时为数据获取成功 */
{
if
(
AppOffset
==
0
)
/* 首个数据块内解析文件信息 */
{
if
(
type
==
GET_APP_DATA_OFFSET
)
/* 从 MCU_APP 升级文件 */
{
flash_read
(
FLASH_630H_UPDATE_INFO
,
sizeof
(
saveVersion
),
saveVersion
);
/* 读取630H升级记录 */
memcpy
(
readVersion
,
&
ReadDataBuf
[
16
],
16
);
/* 630中读出的版本信息 */
if
(
memcmp
(
&
ReadDataBuf
[
16
],
saveVersion
,
16
)
!=
0
)
/* 对比版本不同才更新 */
{
Get_Into_630H_Update_MCU_Mode
();
}
else
{
/* 信息相同, 重置状态 */
NeedWriteSize
=
0
;
readSt
=
0
;
}
}
}
}
if
(
--
getStRetryCnts
==
0
)
{
/* 读信息超时, 重置状态 */
ReadOffset
-=
READ_MCU_DATA_MAX
;
readSt
=
0
;
}
}
}
}
void
Check_MCU_Info_in_630H
(
void
)
{
Check_Upgrade_Cnt
+=
100U
;
if
(
Check_Upgrade_Cnt
>=
5000U
)
/* 每5秒检查一次Flash中的MCU程序信息 */
{
Check_Upgrade_Cnt
=
0U
;
GetReadInfo
(
GET_APP_DATA_OFFSET
);
Check_MCU_in_Flash
(
GET_APP_DATA_OFFSET
);
}
}
Firmware/Source/Component/Menu/Menu.h
View file @
f958e54b
...
...
@@ -426,4 +426,4 @@ void Menu_User_WAKEUP(void);
/*-----------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------*/
#endif
\ No newline at end of file
#endif
Firmware/Source/Device/Cmsemicon/BAT32A279/Library/Driver/include/flash.h
View file @
f958e54b
...
...
@@ -15,10 +15,10 @@ typedef enum
extern
uint32_t
flash_protect_flag
;
int
EraseChip
(
uint32_t
adr
);
int
EraseSector
(
uint32_t
adr
);
int
ProgramPage
(
uint32_t
adr
,
uint32_t
sz
,
uint8_t
*
buf
);
FLASH_STATUS
flash_write
(
uint32_t
adr
,
uint32_t
sz
,
uint8_t
*
buf
);
void
flashRead
(
uint8_t
*
read_address
,
uint16_t
size
,
uint8_t
*
readbuf
);
extern
int
EraseChip
(
uint32_t
adr
);
extern
int
EraseSector
(
uint32_t
adr
);
extern
int
ProgramPage
(
uint32_t
adr
,
uint32_t
sz
,
uint8_t
*
buf
);
extern
FLASH_STATUS
flash_write
(
uint32_t
adr
,
uint32_t
sz
,
uint8_t
*
buf
);
extern
void
flash_read
(
uint32_t
read_address
,
uint16_t
size
,
uint8_t
*
readbuf
);
#endif
Firmware/Source/Device/Cmsemicon/BAT32A279/Library/Driver/src/flash.c
View file @
f958e54b
...
...
@@ -255,16 +255,15 @@ FLASH_STATUS flash_write(uint32_t adr, uint32_t sz, uint8_t *buf)
return
(
status
);
}
void
flash
Read
(
uint8_t
*
read_address
,
uint16_t
size
,
uint8_t
*
readbuf
)
void
flash
_read
(
uint32_t
read_address
,
uint16_t
size
,
uint8_t
*
readbuf
)
{
uint8_t
*
w_ptr
;
uint32_t
i
;
w_ptr
=
(
uint8_t
*
)
read_address
;
for
(
i
=
0
;
i
<
size
;
i
++
)
{
*
readbuf
=
*
w_ptr
++
;
readbuf
++
;
readbuf
++
;
}
}
...
...
Firmware/Source/System/Sys_Task_List.c
View file @
f958e54b
...
...
@@ -77,6 +77,7 @@ void Sys_100ms_Tasks(void)
ODOtest
=
Data_ODO_Read
();
Triptest
=
Data_Read_Trip
(
0
);
S3_ServerCNTT
();
Check_MCU_Info_in_630H
();
Get_DisTime_Service
();
Fuel_Cal_Sevice
(
100u
);
Coolant_Cal_Sevice
(
100u
);
...
...
Firmware/Source/UDS/UDS_ISO14229_Services.c
View file @
f958e54b
This diff is collapsed.
Click to expand it.
Firmware/Source/UDS/UDS_ISO14229_Services.h
View file @
f958e54b
...
...
@@ -41,10 +41,11 @@
*/
#define NoNeedWait 0x00u
#define NeedWait 0x01u
#define APP_STATUS_ADDR (0x501000)
#define APP_DATA_INFO (0x501400)
#define APP_DATA_WRITE (0x501800)
#define FLASH_APP_STATUS_INFO (0x00501000UL)
/* APP 程序有效性标识地址 */
#define FLASH_SECOND_BOOT_INFO (0x00501400UL)
/* 二级Boot程序状态地址 */
#define FLASH_630H_UPDATE_INFO (0x00501800UL)
/* 630H升级信息 */
#define FLASH_APP_RODATA_INFO (0x00501C00UL)
/* 存储只读DID信息 */
#define FLASH_APP_RWDATA_INFO (0x00502000UL)
/* 存储可写的DID信息 */
#define Data_Flash_Addr_BootValid_OFFSET 0x00000000
#define Data_Flash_Addr_DiagReceive_OFFSET 0x00002000
...
...
@@ -323,35 +324,6 @@
#define CheckSumErr 7 // Checksum Error
#define UnknownPartID 8 // Unknown Part ID
typedef
struct
{
uint32_t
Flag
;
uint8_t
Attemptcnt
;
uint8_t
RequestSeedCnt
;
uint8_t
AttemptIIcnt
;
uint8_t
RequestSeedIICnt
;
}
Ser27_FlowCtrlCntUnion
;
typedef
struct
{
uint32_t
Flag
;
uint8_t
DID_F180
[
6
];
uint8_t
DID_F187
[
16
];
uint8_t
DID_F193
[
6
];
uint8_t
DID_F195
[
6
];
uint8_t
Filldata
[
2
];
}
DiagDFlashData
;
extern
DiagDFlashData
DiagDataForDFlash
;
typedef
struct
{
uint32_t
Flag
;
uint8_t
DID_F184
[
32
];
}
Ser2EDFlashData
;
extern
Ser2EDFlashData
Ser2EDataForDFlash
;
typedef
struct
{
uint32_t
Flag
;
...
...
@@ -369,19 +341,10 @@ typedef struct
void
UDS_Service_10_Indication
(
uint16_t
A_TA_type
,
uint16_t
A_Length
,
uint8_t
*
A_Data
);
void
UDS_Service_11_Indication
(
uint16_t
A_TA_type
,
uint16_t
A_Length
,
uint8_t
*
A_Data
);
void
UDS_Service_22_Indication
(
uint16_t
A_TA_type
,
uint16_t
A_Length
,
uint8_t
*
A_Data
);
void
UDS_Service_2E_Indication
(
uint16_t
A_TA_type
,
uint16_t
A_Length
,
uint8_t
*
A_Data
);
void
UDS_Service_27_Indication
(
uint16_t
A_TA_type
,
uint16_t
A_Length
,
uint8_t
*
A_Data
);
void
UDS_Service_28_Indication
(
uint16_t
A_TA_type
,
uint16_t
A_Length
,
uint8_t
*
A_Data
);
void
UDS_Service_3E_Indication
(
uint16_t
A_TA_type
,
uint16_t
A_Length
,
uint8_t
*
A_Data
);
void
UDS_Service_85_Indication
(
uint16_t
A_TA_type
,
uint16_t
A_Length
,
uint8_t
*
A_Data
);
void
S3_ServerCNTT
(
void
);
void
Randomcnt
(
void
);
extern
void
DIAG_InitParameter
(
void
);
void
GetSeed
(
void
);
void
CalculateKey
(
void
);
void
CalculateKeyLv11
(
void
);
typedef
void
(
*
InitFunction
)(
void
);
/***********Local Functin*************/
...
...
@@ -390,15 +353,11 @@ uint8_t SerXXNRC12Filter(uint8_t insub, const uint8_t *supportsub, uint8_t size,
uint8_t
SerXXNRC13Filter
(
uint8_t
type
,
uint8_t
serlength
,
const
uint8_t
*
length
,
uint8_t
index
);
uint8_t
SerXXNRC22Filter
(
void
);
uint8_t
SerXXNRC31DIDFilter
(
uint16_t
inDID
,
const
uint16_t
*
DIDList
,
uint8_t
size
,
uint8_t
*
index
);
uint8_t
SerXXNRC33Filter
(
const
uint8_t
*
levelList
,
uint8_t
index
);
uint8_t
SerXXNRC7EFilter
(
const
uint8_t
*
SubSupportSession
,
uint8_t
index
);
uint8_t
SerXXNRC7FFilter
(
uint8_t
SupportSession
);
extern
void
Data_Set_DiagPara
(
void
);
void
Write_App_InValid
(
uint32_t
m32
);
void
Data_Read_DiagPara
(
void
);
void
DFlash_init
(
void
);
void
Data_Read_DiagPara
(
void
);
extern
void
Get_Into_630H_Update_MCU_Mode
(
void
);
extern
void
Check_MCU_Info_in_630H
(
void
);
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment