我是一名学生,想在不使用示波器的情况下粗略测量ARM Cortex-M系列芯片的中断延迟。然而,我遇到了一个非常奇特的问题,让我非常困惑。
\n首先,让我简要概述一下我的测量方法。我尝试使用MCU的内置定时器粗略地测量中断延迟。我的基本想法如下:在进入中断服务程序(ISR)之前,我将计时器重置为零。然后,我将生成一个中断请求并进入 ISR。进入 ISR 后,我会立即读取计时器的值。此时,计时器值可以作为中断延迟的非常粗略的估计。
\n由于某些原因,我需要使用汇编语言编写上述ISR函数。在主函数中,我使用 SWIER 寄存器生成一个软件中断,这允许我进入我编写的 ISR。
\nI encountered a peculiar issue during this process. When writing an ISR in Assembly language, it is customary to push several registers onto the stack upon entering the function, such as R4 to R11, and pop them back when exiting the function. Therefore, in theory, if I don\'t push the registers onto the stack upon entering the ISR (assuming I don\'t use those registers within …