Part Number: TDA4VEN-Q1
Other Parts Discussed in Thread: AWR2944
Environment:
Device: TDA4VEN
SDK: 11.0.0
Core: MCU domain R5F (MCU Channel)
Compiler options: Release, -Os
Measurement method: Check GTC time before and after the loop
Issue Description:
I am running a for loop on the MCU R5F that involves swapping a struct of about 80 bytes. Each swap performs 3 struct assignments, and the outer loop runs 3100 times. The total time is about 5.8 ms. The same code takes about 3 ms on the TI AWR2944 MCU R5F. TDA4VEN is noticeably slower.
I placed .text, .bss, and .data into TCM and 512KB OCRAM separately, and the timing is almost the same (about 5.8 ms).
Currently, with -Os and -O3, the timing is about the same.
Test Code:
typedef struct
{
float f32ObjX;
float f32ObjY;
}G_MAP_ObjCoor_struct_t;
typedef struct
{
G_MAP_ObjCoor_struct_t strObjCarCoor;
G_MAP_ObjCoor_struct_t strObjOdoCoor;
uint8 e_feature_type;
uint8 e_match_type;
uint8 e_signalway;
float f32_angle;
float PointCar_angle;
uint64 u64_timestamp;
uint8 u8_vaild_pro;
sint8 s8Cluster_Id;
uint8 u8_exist_prob;
#if 0
uint8 u8_high_prob;
uint8 u8_low_prob;
#endif
uint8 u8_PointHeightType;
sint8 s8_PointHeightProba;
uint8 u8_is_sharp;
uint8 u8_is_line;
uint8 u8_is_line_ep;
uint8 u8_PointCloud_Id;
uint8 u8_is_used;
uint8 u8_is_ML_Used;
uint8 u8_MeasType;
uint8 u8_MasterSnsId;
uint8 u8_ListenSnsId;
uint8 u8_Point_index;
uint8 u8_Confidence;
uint8 u8_is_history;
uint8 u8_is_New;
uint8 u8_PointCloudArea;
uint16 u16_PointToCarDist;
uint16 u16_MasterEchoDist;
uint16 u16_ListenEchoDist;
uint16 u16_MasterEchoHeight;
uint16 u16_ListenEchoHeight;
uint16 u16_MasterSecondDis;
uint16 u16_ListenSecondDis;
uint16 u16_MasterSecondHeight;
uint16 u16_ListenSecondHeight;
}G_MapPointCloud_struct_t1;
volatile G_MapPointCloud_struct_t1 dat1;
volatile G_MapPointCloud_struct_t1 dat2;
volatile G_MapPointCloud_struct_t1 dat3;
void Bsw_20ms_Task(void *args)
{
memset((void *)&dat1, 0x5a, sizeof(G_MapPointCloud_struct_t1));
memset((void *)&dat2, 0xa5, sizeof(G_MapPointCloud_struct_t1));
memset((void *)&dat3, 0x7e, sizeof(G_MapPointCloud_struct_t1));
time1 = GetGTCTime();
for(uint16 i = 0; i < 3100; i++)
{
dat1 = dat2;
dat2 = dat3;
dat3 = dat1;
}
time2 = GetGTCTime();
printf("time = %llu\n", time2 - time1);
}
How can I optimize the execution speed in this case? Does TI have any suggestions?
Best regards
Bingxian