[問卦] 碰過崁入式系統的請進

作者: dces4212 (flawless)   2023-08-15 19:56:04
各位晚安
廢話不多說,show me the code:
int main(void)
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
while (1)
{
// Stay IDLE .. Everything is done in the ISR Handler
}
}
上面這段程式碼想必大家非常熟悉
問題來了
看看那段 while(1)
即便主要功能都做在中斷裡面
平常中斷沒發生時,處理器難道沒有比 busy loop 更節能的事情做嗎?
還是說
例如 cortex-M4 這類 SoC 的 pipeline 有針對 busy loop 做能耗調整?
又或者說
在這種時候通常會進到睡眠模式之類的來等待中斷發生
你各位都是怎麼處理這個 while(1)??
掛?

Links booklink

Contact Us: admin [ a t ] ucptt.com