Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8093

General • Re: Assign variables to specific addresses?

$
0
0

Code:

extern volatile SomeType my_var; asm("my_var = 0x20010000");
If I understand things correctly this is actually slower than it needs to be. The volatile tells the compiler that the variable may change not the destination. So for each access of the destination the compiler is forced to load the variable and then load the destination. Where as if you tell the compiler the destination is volatile then the pointer can stay in a register.

Statistics: Posted by dp11 — Sun Mar 23, 2025 10:58 am



Viewing all articles
Browse latest Browse all 8093

Trending Articles