diff options
author | Damien George <damien.p.george@gmail.com> | 2015-11-24 16:23:54 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-11-24 16:23:54 +0000 |
commit | 36bd10779c3721d1b4b66c549023fd4a33f4db58 (patch) | |
tree | dbdf19a3c93be9722ee28c8782d37e42e53c4594 | |
parent | e99e6c883d70eda894aba124c8ee0495dc90c350 (diff) | |
download | micropython-36bd10779c3721d1b4b66c549023fd4a33f4db58.tar.gz micropython-36bd10779c3721d1b4b66c549023fd4a33f4db58.zip |
stmhal: In SysTick IRQ handler, make uwTick variable non-volatile.
uwTick can only change in the SysTick IRQ so this IRQ function does not
need to take special care with this variable. It's important to make
this IRQ function as efficient as possible.
-rw-r--r-- | stmhal/stm32_it.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/stmhal/stm32_it.c b/stmhal/stm32_it.c index 90826a5702..5f96c6083b 100644 --- a/stmhal/stm32_it.c +++ b/stmhal/stm32_it.c @@ -261,7 +261,10 @@ void SysTick_Handler(void) { // Instead of calling HAL_IncTick we do the increment here of the counter. // This is purely for efficiency, since SysTick is called 1000 times per // second at the highest interrupt priority. - extern __IO uint32_t uwTick; + // Note: we don't need uwTick to be declared volatile here because this is + // the only place where it can be modified, and the code is more efficient + // without the volatile specifier. + extern uint32_t uwTick; uwTick += 1; // Read the systick control regster. This has the side effect of clearing |