*(unsigned int*)0x40021018 = | 1<<4; 等于 RCC_APB2ENR = | 1 << 4;
#define RCC_APB2ENR *(unsigned int*)0x40021018
#define PERIPH_BASE ((uint32_t)0x40000000)
#define APB1PERIPH_BASE PERIPH_BASE
#define APB2PERIPH_BASE (PERIPH_BASE + 0x10000)
#define GPIOA_BASE (APB2PERIPH_BASE + 0x0800)
GPIOA_BASE = (uint32_t)0x40000000+0x10000 +0x0800 = 0x400010800
#define GPIOA ((GPIO_TypeDef *) GPIOA_BASE)
*(unsigned int*)0x40021018 取指针指向地址的寄存器
GPIOA = (GPIO_TypeDef *) ((uint32_t)0x400010800);//将实际地址转成结构体指针,通过指针指向的偏移地址来赋值。