Mark uptime counter volatile to avoid miscompilation of delay loops

Since the uptime counter is updated in an ISR, the compiler may
attempt to optimize away code that checks for an updated value.

Avoid this by marking the uptime counter as volatile.
parent d64bb14d
Pipeline #271 passed with stage
in 18 seconds
......@@ -10,7 +10,7 @@ uint32_t irq_unhandled_source = 0;
uint8_t irq_unhandled_vector_valid = 0;
uint8_t irq_unhandled_source_valid = 0;
uint64_t uptime_counter_ms = 0;
volatile uint64_t uptime_counter_ms = 0;
void isr(uint64_t vec);
void isr_dec(void);
......
......@@ -112,7 +112,7 @@
uint8_t host_flash_write_buffer[FLASH_MAX_WR_WINDOW_BYTES];
extern uint64_t uptime_counter_ms;
extern volatile uint64_t uptime_counter_ms;
extern uint32_t irq_unhandled_vector;
extern uint32_t irq_unhandled_source;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment