diff options
author | Clifford Wolf <clifford@clifford.at> | 2017-10-30 11:22:54 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2017-10-30 11:22:54 +0100 |
commit | dda7db273d9b897ef39a93d8ee69c8f202b5540b (patch) | |
tree | c00198491d39e47929c6292c742699816b01f206 | |
parent | 31588b871e0258f28a6daa5a34a6ad53ab11f267 (diff) | |
download | picorv32-dda7db273d9b897ef39a93d8ee69c8f202b5540b.tar.gz picorv32-dda7db273d9b897ef39a93d8ee69c8f202b5540b.zip |
Add missing "volatile" to "asm" statements
-rw-r--r-- | dhrystone/stdlib.c | 6 | ||||
-rw-r--r-- | firmware/stats.c | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/dhrystone/stdlib.c b/dhrystone/stdlib.c index 55150a7..f88023b 100644 --- a/dhrystone/stdlib.c +++ b/dhrystone/stdlib.c @@ -26,7 +26,7 @@ int heap_memory_used = 0; long time() { int cycles; - asm("rdcycle %0" : "=r"(cycles)); + asm volatile ("rdcycle %0" : "=r"(cycles)); // printf("[time() -> %d]", cycles); return cycles; } @@ -34,7 +34,7 @@ long time() long insn() { int insns; - asm("rdinstret %0" : "=r"(insns)); + asm volatile ("rdinstret %0" : "=r"(insns)); // printf("[insn() -> %d]", insns); return insns; } @@ -46,7 +46,7 @@ char *malloc(int size) // printf("[malloc(%d) -> %d (%d..%d)]", size, (int)p, heap_memory_used, heap_memory_used + size); heap_memory_used += size; if (heap_memory_used > 1024) - asm("ebreak"); + asm volatile ("ebreak"); return p; } diff --git a/firmware/stats.c b/firmware/stats.c index 4a06751..80e22dd 100644 --- a/firmware/stats.c +++ b/firmware/stats.c @@ -28,7 +28,7 @@ static void stats_print_dec(unsigned int val, int digits, bool zero_pad) void stats(void) { unsigned int num_cycles, num_instr; - __asm__("rdcycle %0; rdinstret %1;" : "=r"(num_cycles), "=r"(num_instr)); + __asm__ volatile ("rdcycle %0; rdinstret %1;" : "=r"(num_cycles), "=r"(num_instr)); print_str("Cycle counter ........"); stats_print_dec(num_cycles, 8, false); print_str("\nInstruction counter .."); |