4 ms·
*(uint32_t *)0x40021018 = 0x00000004; Actually that line is not ok. But for another reason. Without "volatile" in there, the compiler may reorder this access
by dmitrygr 8y ago
*(uint32_t *)0x40021018 = 0x00000004;
Actually that line is not ok. But for another reason. Without "volatile" in there, the compiler may reorder this access with others, or remove it, or combine it with others. None of that is good.
- arcticbull 8y agoThat's a very important call-out. This is the kind of tear-your-hair-out stuff that's going to be very difficult to track down unless you get it exactly right. I echo that using the definitions makes the code infinitely more readable and writeable, and makes zero difference in terms of performance.
- timakro 8y agoThanks, I updated the post.