之前程序是在KEIL5环境下的,运行没有问题;
现在改到IAR8.30环境,配置后编译,有3个告警,如下标黑;
Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement
因为这个是变量相关的,没有处理
//system_LPC17xx.c文件
void SystemCoreClockUpdate (void) /* Get Core Clock Frequency */
{
/* Determine clock frequency according to clock register values */
if (((LPC_SC->PLL0STAT >> 24) & 3) == 3) { /* If PLL0 enabled and connected */
switch (LPC_SC->CLKSRCSEL & 0x03) {
case 0: /* Int. RC oscillator => PLL0 */
case 3: /* Reserved, default to Int. RC */
SystemCoreClock = (IRC_OSC *
((2 * ((LPC_SC->PLL0STAT & 0x7FFF) + 1))) /
(((LPC_SC->PLL0STAT >> 16) & 0xFF) + 1) /
((LPC_SC->CCLKCFG & 0xFF)+ 1));
break;
case 1: /* Main oscillator => PLL0 */
SystemCoreClock = (OSC_CLK *
((2 * ((LPC_SC->PLL0STAT & 0x7FFF) + 1))) /
(((LPC_SC->PLL0STAT >> 16) & 0xFF) + 1) /
((LPC_SC->CCLKCFG & 0xFF)+ 1));
break;
case 2: /* RTC oscillator => PLL0 */
SystemCoreClock = (RTC_CLK *
((2 * ((LPC_SC->PLL0STAT & 0x7FFF) + 1))) /
(((LPC_SC->PLL0STAT >> 16) & 0xFF) + 1) /
((LPC_SC->CCLKCFG & 0xFF)+ 1));
break;
}
} else {
switch (LPC_SC->CLKSRCSEL & 0x03) {
case 0: /* Int. RC oscillator => PLL0 */
case 3: /* Reserved, default to Int. RC */
SystemCoreClock = IRC_OSC / ((LPC_SC->CCLKCFG & 0xFF)+ 1);
break;
case 1: /* Main oscillator => PLL0 */
SystemCoreClock = OSC_CLK / ((LPC_SC->CCLKCFG & 0xFF)+ 1);
break;
case 2: /* RTC oscillator => PLL0 */
SystemCoreClock = RTC_CLK / ((LPC_SC->CCLKCFG & 0xFF)+ 1);
break;
}
}
//----------------------------------------------------------------------------------
下载运行后,前边初始化时没有问题的,每次运行到下边标黑处就卡死了
int main(void)
{
BSP_Init ();
BSP_Start ();
OSInit();
Timer0_Init();
OSTaskCreate(LEDON, (void *)0, &stkLEDON[sizeof(stkLEDON)/4-1], 5);
OSTaskCreate(LEDOFF, (void *)0, &stkLEDOFF[sizeof(stkLEDOFF)/4-1], 4);
OSStart();
}
卡死到下边标黑处
//startup_LPC177x_8x.s文件
PUBWEAK HardFault_Handler
SECTION .text:CODE:NOROOT:REORDER(1)
HardFault_Handler
B HardFault_Handle
有如下提示:
Fri Dec 28, 2018 17:15:45: A precise data access error has occurred (CFSR.PRECISERR, BFAR) at data address 0x40034000.
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>