// Pure Bare-Metal C in Wokwi (Paste directly into sketch.ino)
#include <stdint.h>
#define RCC_BASE 0x40021000
#define RCC_IOPENR (*(volatile uint32_t *)(RCC_BASE + 0x34))
#define GPIOA_BASE 0x50000000
#define GPIOA_MODER (*(volatile uint32_t *)(GPIOA_BASE + 0x00))
#define GPIOA_ODR (*(volatile uint32_t *)(GPIOA_BASE + 0x14))
void delay(void) {
for(volatile uint32_t i = 0; i < 200000; i++);
}
int main(void) {
// 1. Enable clock for GPIOA (Bit 0)
RCC_IOPENR |= (1 << 0);
// 2. Configure PA5 as output (Bits 11:10 -> 01)
GPIOA_MODER &= ~(3 << 10);
GPIOA_MODER |= (1 << 10);
while(1) {
GPIOA_ODR ^= (1 << 5); // Toggle PA5 (LED pin)
delay();
}
}