MCU:? CH32X035C8
MRS 版本: v1.92
void SysTick_Handler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
void SysTick_Handler(void)
{
? ? runMilis++;
? ? SysTick->SR = 0;
}
//-------------------------------------------------------------------------------------//
// Get System tick counter
//-------------------------------------------------------------------------------------//
uint32_t get_time_tick(void)
{
? ? return runMilis;
}
//--------------------------------------------------------------------------//
// Delay function
//--------------------------------------------------------------------------//
void DelayMS( uint32_t nMS )
{
? ? volatile uint32_t now = get_time_tick();
? ? while( (get_time_tick() - now) < nMS );
}
仿真时 nMS = 500,? 变量 now = 1,? runMilis = 5389, 按理已经应该return了,但实际上程序还卡在while里出不来。
请问原厂的FAE,这个函数有什么问题吗?为何一直卡住?是不是编译器有啥BUG?