1. __DSB()指令:
Data Synchronization Barrier, This function acts as a special kind of Data Memory Barrier. It completes when all explicit memory accesses before this instruction complete.
实例(Timer的时钟源频率低于MCU主频):
void TIMER0_IRQHandler(void)
{
/* Clear interrupt source */
timer->IFC = TIMER_IFC_OF;
/* Flushing instructions to make sure that the interrupt is not re-triggered*/
/* This may be required when the peripheral clock is slower than the core */
__DSB(); //需要等待RAM访问完成,防止重复触发中断。
/* Stopping timer */
timer->CMD = TIMER_CMD_STOP;
}