Each port has 16 pins and all gpios are connected to these ports.

GPIOA is a peripheral inside the STM32 microcontroller. Likewise all the ports have corresponding peripherals.

Each peripheral has a set of registers to control pin’s mode, state and functionalities. These peripheral registers are memory mapped in the peripheral section of the address map of ARM Cortex M. Therefore we can directly modify these registers using these memory addresses.

These peripherals have different number of peripheral registers of constant size 32bits. GPIOA has 10 registers each of 32 bits. Each peripheral register of GPIOA is is mapped to the gpio pins: 0 to 15. Thus each bitfield on location x corresponds to gpio pin x on Peripheral GPIOA.