From bc7d59851792b140abd8d65f0baf644cb1e6e54c Mon Sep 17 00:00:00 2001 From: Neven Sajko Date: Thu, 27 Feb 2020 23:39:52 +0000 Subject: [PATCH] [ion] do not increment volatile variable in isr_systick In 2019 a proposal was approved which is deprecating this and other harmful usage of volatile in C++ in 2020. See web links at the end. Note that this did not at all change the GCC-generated machine code. Deprecating volatile (adopted in 2019 for C++20): http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1152r0.html http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1152r4.html Related, but less relevant: volatile_load and volatile_store: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1382r1.pdf Deprecating volatile: library: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1831r0.html --- ion/src/device/shared/boot/rt0.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ion/src/device/shared/boot/rt0.cpp b/ion/src/device/shared/boot/rt0.cpp index 8e8f2e39e..45a003f40 100644 --- a/ion/src/device/shared/boot/rt0.cpp +++ b/ion/src/device/shared/boot/rt0.cpp @@ -119,5 +119,7 @@ void __attribute__((noinline)) start() { } void __attribute__((interrupt, noinline)) isr_systick() { - Ion::Device::Timing::MillisElapsed++; + auto t = Ion::Device::Timing::MillisElapsed; + t++; + Ion::Device::Timing::MillisElapsed = t; }