Question.1
A developer accesses a GPIO output register at address 0x40020014:
0x40020014
uint32_t *gpio_odr = (uint32_t *)0x40020014; *gpio_odr |= (1U << 5); // Set pin 5 high
Will this correctly set GPIO pin 5?
Select Answer
Yes — this is standard memory-mapped I/O in firmware
No — the pointer should be declared volatile to prevent compiler optimization
No — you cannot cast an integer to a pointer in C
Yes — volatile is only needed for read operations