#avr Logs

Jul 15 2020

#avr Calendar

10:54 AM Miyu is now known as hackkitten
06:44 PM markasoftware: Does the `volatile` keyword in C force the variable to be stored in SRAM?
06:45 PM LeoNerd: No. It forces the optimiser not to elide accesses
06:45 PM markasoftware: I know that `volatile` disables some optimizations that assume the variable does not change between adjacent statements.
06:45 PM markasoftware: but I have heard this said about SRAM as well. I suspect it is just a rumor
06:45 PM LeoNerd: What is "SRAM" in this context?
06:45 PM markasoftware: not a register?
06:46 PM LeoNerd: What's the difference?
06:46 PM LeoNerd: This isn't x86
06:47 PM markasoftware: it does take extra instructions to manipulate arbitrary bytes in the heap than in r1, r2, etc though, right?
06:47 PM LeoNerd: Ohright, those..
06:47 PM LeoNerd: Yah I don't think variables ever get allocated into the actual working registers anyway
06:48 PM markasoftware: they aren't special purpose registers, why wouldn't the compiler use them?
06:49 PM LeoNerd: Well you'd have to check specifics with the compiler
06:49 PM LeoNerd: It's a compiler-specific question at that point
06:49 PM markasoftware: i think avr-gcc does use those registers, I remember seeing them in the disassembly once
06:50 PM LeoNerd: for automatics, probably. but not statics
06:53 PM markasoftware: yeah, you may be right, it is putting my global variables into the sram. Why is it necessary? Are registers cleared on sleep or something?
07:00 PM LeoNerd: I expect the compiler just doesn't want all the bookkeeping headache of tracking them. Or maybe the ABI says so
07:01 PM LeoNerd: I forget
07:11 PM markasoftware: alright, thanks! Maybe someone else will know
11:37 PM day_ is now known as day