LPC1768 UCOSII is ported to IAR8.3 environment. There is no problem in compiling, but it is stuck when creating the first task function...[Copy link]
Previously, the program was run in the KEIL5 environment and there was no problem; Now I have changed to the IAR8.30 environment, configured and compiled, and there are 3 warnings, as shown in black below; Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement Because this is variable-related, it is not processed //system_LPC17xx.c file 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 osci llator => 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; } } //---------------------------------------------------------------------------------- After downloading and running, there is no problem in the initialization at the beginning, but it gets stuck every time it runs to the black mark below 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(); } Stuck at the black mark below //startup_LPC177x_8x.s file PUBWEAK HardFault_Handler SECTION .text:CODE:NOROOT:REORDER(1) HardFault_Handler B HardFault_Handle There are the following prompts: Fri Dec 28, 2018 17:15:45: A precise data access error has occurred (CFSR.PRECISERR, BFAR) at data address 0x40034000.