typedef struct _PARA_SET
{
#if STRING_STORE_USE_ARRAY
char name[NAME_STRING_MAX];
char alias[ALIAS_STRING_MAX];
char unit[UNIT_STRING_MAX];
char strValue[LINE_STRING_MAX];
#else
char *name;
char *alias;
char *unit;
char *strValue;
#endif
tParaType type;
FLOAT32 value;
FLOAT32 MaxValue;
FLOAT32 MinValue;
FLOAT32 DefValue;
}tParaSet;
tParaSet DevCommSets[3];
static void DEV_ReadCommSets(void)
{
UINT32 i, value;
tParaSet *pSets = DevCommSets;
DF_ReadMainMemoryPage(SAVE_DEV_COMM_SETS_PAGE,
DEV_ReadData, COMM_MAX_SETS * 4 + 4);
for (i = 0; i < COMM_MAX_SETS; i++)
{
value = BytesToDword(&DEV_ReadData[i * 4]);
pSets->value = value;
if ((pSets->value > pSets->MaxValue) || (pSets->value < pSets->MinValue))
{
pSets->value = pSets->DefValue;
}
pSets++;
}
DEV_CommSetsCrc = BytesToDword(&DEV_ReadData[i * 4]);
}
调试过程如下:
(gdb) n
Reset_Handler () at startup_stm32f10x_hd.c:262
262 SystemInit();
(gdb) n
268 __Init_Data();
(gdb) n
271 main();
(gdb) n
Breakpoint 1, DEV_ReadCommSets () at device.c:980
980 for (i = 0; i < COMM_MAX_SETS; i++)
(gdb) n
982 value = BytesToDword(&DEV_ReadData[i * 4]);
(gdb) n
984 pSets->value = value; //运行这条语句后进入硬中断void HardFault_Handler(void){ while(1){} }中,不知道为什么?
(gdb) n
HardFault_Handler () at stm32f10x_it.c:61
61 {
(gdb) n
64 {}