2. System and memory overview

2.1 System architecture

The main system consists of:

These are interconnected using a multilayer AHB bus architecture as shown in Figure 1 :

Figure 1. System architecture

Figure 1. System architecture diagram showing the interconnection of various components via a multilayer AHB bus architecture.

The diagram illustrates the system architecture of the STM32L0x1 microcontroller. At the center is the Busmatrix , which acts as a bridge between the system bus and the AHB bus. The Cortex M0+ core and the DMA Controller (Channels 1 to 7) are connected to the Busmatrix via the System bus and DMA respectively. The GPIO ports A,B,C,D,E,H are connected to the Cortex M0+ via IOPORT . The Busmatrix is also connected to the MIF Memory interface and SRAM . The MIF Memory interface is connected to the NVM memory . The Busmatrix is connected to the AHB bus , which in turn connects to the AHB2APB Bridges . The AHB2APB Bridges are connected to the APB buses , which are connected to a large block of APB peripherals . The APB peripherals include: SYSCFG, FIREWALL, PWR, EXTI, ADC, COMP1/2, TIM2/3/6/7/21/22, LPTIM1, IWDG, WWDG, RTC, DBGMCU, I2C1/2/3, USART1/2/3/4/LPUART1, and SPI1/2. The Reset and clock controller (RCC) and CRC are also connected to the AHB bus. The DMA request line is shown connecting the APB peripherals back to the DMA Controller. The diagram is labeled with MS34749V2 in the bottom right corner.

Figure 1. System architecture diagram showing the interconnection of various components via a multilayer AHB bus architecture.
  1. 1. Refer to Table 1: STM32L0x1 memory density , to Table 2: Overview of features per category and to the device datasheets for the GPIO ports and peripherals available on your device.

2.1.1 S0: Cortex ® -bus

This bus connects the DCode/ICode bus of the Cortex ® -M0+ core to the BusMatrix. This bus is used by the core to fetch instructions, get data and access the AHB/APB resources.

2.1.2 S1: DMA-bus

This bus connects the AHB master interface of the DMA to the BusMatrix which manages the access of the different masters to Flash memory and data EEPROM, the SRAM and the AHB/APB peripherals.

2.1.3 BusMatrix

The BusMatrix manages the access arbitration between masters. The arbitration uses a Round Robin algorithm. The BusMatrix is composed of two masters (CPU, DMA) and three slaves (NVM interface, SRAM, AHB2APB1/2 bridges).

AHB/APB bridges

The AHB/APB bridge provide full synchronous connections between the AHB and the 2 APB buses. APB1 and APB2 operate at a maximum frequency of 32 MHz.

Refer to Section 2.2.2: Memory map and register boundary addresses on page 52 for the address mapping of the peripherals connected to this bridge.

After each device reset, all peripheral clocks are disabled (except for the SRAM and MIF). Before using a peripheral you have to enable its clock in the RCC_AHBENR, RCC_APB2ENR, RCC_APB1ENR or RCC_IOPENR register.

Note: When a 16- or 8-bit access is performed on an APB register, the access is transformed into a 32-bit access: the bridge duplicates the 16- or 8-bit data to feed the 32-bit vector.

2.2 Memory organization

2.2.1 Introduction

Program memory, data memory, registers and I/O ports are organized within the same linear 4-Gbyte address space.

The bytes are coded in memory in Little Endian format. The lowest numbered byte in a word is considered the word's least significant byte and the highest numbered byte the most significant.

The addressable memory space is divided into eight main blocks, of 512 Mbytes each.

2.2.2 Memory map and register boundary addresses

Figure 2. Memory map

Memory map diagram showing the layout of memory from 0x0000 0000 to 0xFFFF FFFF. The diagram is divided into three vertical columns. The left column shows the full 4GB address space with major blocks: CODE (0x0000 0000 to 0x2000 0000), SRAM (0x2000 0000 to 0x4000 0000), Peripherals (0x4000 0000 to 0x6000 0000), and Cortex-M0+ peripherals (0xE000 0000 to 0xE010 0000). The middle column provides a detailed view of the first 2MB (0x0000 0000 to 0x00FF FFFF), showing Flash, system memory or SRAM (depending on BOOT configuration), reserved areas, Flash system memory, and Option bytes. The right column shows the peripheral register map from 0x4000 0000 to 0x5000 1FFF, including APB1, reserved, APB2, reserved, AHB, reserved, and IOPORT. A legend indicates that grey-shaded areas are 'Reserved'.

Memory map details:

Peripheral register map:

Legend: Reserved

MS34761V2

Memory map diagram showing the layout of memory from 0x0000 0000 to 0xFFFF FFFF. The diagram is divided into three vertical columns. The left column shows the full 4GB address space with major blocks: CODE (0x0000 0000 to 0x2000 0000), SRAM (0x2000 0000 to 0x4000 0000), Peripherals (0x4000 0000 to 0x6000 0000), and Cortex-M0+ peripherals (0xE000 0000 to 0xE010 0000). The middle column provides a detailed view of the first 2MB (0x0000 0000 to 0x00FF FFFF), showing Flash, system memory or SRAM (depending on BOOT configuration), reserved areas, Flash system memory, and Option bytes. The right column shows the peripheral register map from 0x4000 0000 to 0x5000 1FFF, including APB1, reserved, APB2, reserved, AHB, reserved, and IOPORT. A legend indicates that grey-shaded areas are 'Reserved'.

All the memory map areas that are not allocated to on-chip memories and peripherals are considered “Reserved”. For the detailed mapping of available memory and register areas, refer to the following table.

The following table gives the boundary addresses of the peripherals available in the devices.

Table 3. STM32L0x1 peripheral register boundary addresses (1)

BusBoundary addressSize (bytes)PeripheralPeripheral register map
IOPORT0X5000 1C00 - 0X5000 1FFF1 KGPIOHSection 8.4.12: GPIO register map
0X5000 1400 - 0X5000 1BFF2 KReserved-
0X5000 1000 - 0X5000 13FF1 KGPIOESection 8.4.12: GPIO register map
0X5000 0C00 - 0X5000 0FFF1 KGPIO DSection 8.4.12: GPIO register map
0X5000 0800 - 0X5000 0BFF1 KGPIO CSection 8.4.12: GPIO register map
0X5000 0400 - 0X5000 07FF1 KGPIOBSection 8.4.12: GPIO register map
0X5000 0000 - 0X5000 03FF1 KGPIOASection 8.4.12: GPIO register map
AHB0X4002 6400 - 0X4002 FFFF49 KReserved-
0X4002 6000 - 0X4002 63FF1 KAES (Cat. 1, 2 and 5 with AES only)Section 15.7.13: AES register map
0X4002 5400 - 0X4002 5FFF3 KReserved-
0X4002 4400 - 0X4002 53FF3 KReserved-
0X4002 3400 - 0X4002 3FFF3 KReserved-
0X4002 3000 - 0X4002 33FF1 KCRCSection 4.4.6: CRC register map
0X4002 2400 - 0X4002 2FFF3 KReserved-
0X4002 2000 - 0X4002 23FF1 KFLASHSection 3.7.11: Flash register map
0X4002 1400 - 0X4002 1FFF3 KReserved-
0X4002 1000 - 0X4002 13FF1 KRCCSection 7.3.21: RCC register map
0X4002 0400 - 0X4002 0FFF3 KReserved-
0X4002 0000 - 0X4002 03FF1 KDMA1Section 10.6.8: DMA register map
Table 3. STM32L0x1 peripheral register boundary addresses (1) (continued)
BusBoundary addressSize (bytes)PeripheralPeripheral register map
APB20X4001 5C00 - 0X4001 FFFF42 KReserved-
0X4001 5800 - 0X4001 5BFF1 KDBGSection 27.10: DBG register map
0X4001 3C00 - 0X4001 57FF7 KReserved-
0X4001 3800 - 0X4001 3BFF1 KUSART1Section 24.8.12: USART register map
0X4001 3400 - 0X4001 37FF1 KReserved-
0X4001 3000 - 0X4001 33FF1 KSPI1Section 26.7.10: SPI register map
0X4001 2800 - 0X4001 2FFF2 KReserved-
0X4001 2400 - 0X4001 27FF1 KADC1Section 13.12: ADC register map
0X4001 2000 - 0X4001 23FF1 KReserved-
0X4001 1C00 - 0X4001 1FFF1 KFirewallSection 5.4.8: Firewall register map
0X4001 1800 - 0X4001 1BFF1 KReserved-
0X4001 1400 - 0X4001 17FF1 KTIM22Section 17.4.16: TIM21/22 register map
0X4001 0C000 - 0X4001 13FF2 KReserved-
0X4001 0800 - 0X4001 0BFF1 KTIM21Section 17.4.16: TIM21/22 register map
0X4001 0400 - 0X4001 07FF1 KEXTISection 12.5.7: EXTI register map
0X4001 0000 - 0X4001 03FF1 KSYSCFG, COMPSection 9.2.8: SYSCFG register map, Section 14.5.3: COMP register map
APB10X4000 8000 - 0X4000 FFFF32 KReserved-
0X4000 7C00 - 0X4000 7FFF1 KLPTIM1Section 19.7.9: LPTIM register map
0X4000 7800 - 0X4000 7BFF1 KI2C3Section 23.7.12: I2C register map
0X4000 7000 - 0X4000 73FF1 KPWRSection 6.4.3: PWR register map
0X4000 5C00 - 0X4000 6FFF1 KReserved-
Table 3. STM32L0x1 peripheral register boundary addresses (1) (continued)
BusBoundary addressSize (bytes)PeripheralPeripheral register map
APB10X4000 5800 - 0X4000 5BFF1 KI2C2Section 23.7.12: I2C register map
0X4000 5400 - 0X4000 57FF1 KI2C1Section 23.7.12: I2C register map
0X4000 5000 - 0X4000 53FF1 KUSART5Section 24.8.12: USART register map
0X4000 4C00 - 0X4000 4FFF1 KUSART4Section 24.8.12: USART register map
0X4000 4800 - 0X4000 4BFF1 KLPUART1Section 25.7.10: LPUART register map
0X4000 4400 - 0X4000 47FF1 KUSART2Section 24.8.12: USART register map
0X4000 3C00 - 0X4000 43FF2 KReserved-
0X4000 3800 - 0X4000 3BFF1 KSPI2Section 26.7.10: SPI register map
0X4000 3400 - 0X4000 37FF1 KReserved-
0X4000 3000 - 0X4000 33FF1 KIWDGSection 20.4.6: IWDG register map
0X4000 2C00 - 0X4000 2FFF1 KWWDGSection 21.5.4: WWDG register map
0X4000 2800 - 0X4000 2BFF1 KRTC + BKP_REGSection 22.7.21: RTC register map
0X4000 1800 - 0X4000 27FF3 KReserved-
0X4000 1400 - 0X4000 17FF1 KTIMER7Section 18.4.9: TIM6/7 register map
0X4000 1000 - 0X4000 13FF1 KTIMER6Section 18.4.9: TIM6/7 register map
0X4000 0800 - 0X4000 0FFF1 KReserved-
0X4000 0400 - 0X4000 07FF1 KTIMER3Section 16.5: TIMx register map
0X4000 0000 - 0X4000 03FF1 KTIMER2Section 16.5: TIMx register map
SRAM0X2000 2000 - 0X3FFF FFFF~524 MReserved-
0X2000 0000 - 0X2000 4FFFup to 20 KSRAM-
Table 3. STM32L0x1 peripheral register boundary addresses (1) (continued)
BusBoundary addressSize (bytes)PeripheralPeripheral register map
NVM0X0800 0000 - 0X0802 FFFFup to 192 KFlash program memory-
0x0808 0000 - 0x0808 17FFup to 6 KData EEPROM-
0x1FF0 0000 - 0x1FF0 1FFF8 KSystem memory-
0x1FF8 0020 - 0x1FF8 007F96Factory option bytes-
0x1FF8 0000 - 0x1FF8 001F32User option bytes-
  1. 1. Refer to Table 1: STM32L0x1 memory density , to Table 2: Overview of features per category and to the device datasheets for the GPIO ports and peripherals available on your device. The memory area corresponding to unavailable GPIO ports or peripherals are reserved.

2.3 Embedded SRAM

STM32L0x1 devices feature up to 20 Kbytes of static SRAM.

This RAM can be accessed as bytes, half-words (16 bits) or full words (32 bits). This memory can be addressed at maximum system clock frequency without wait state and thus by both CPU and DMA.

The SRAM start address is 0x2000 0000.

The CPU can access the SRAM from address 0x0000 0000 when physical remap is selected through boot pin or MEM_MODE (see Section 9.2.1: SYSCFG memory remap register (SYSCFG_CFGR1) ).

2.4 Boot configuration

In the STM32L0x1, three different boot modes can be selected through the BOOT0 pin and boot configuration bits in the User option byte, as shown in the following table.

Table 4. Boot modes (1)
Boot mode configurationAliasing
nBOOT1 bitBOOT0 pinnBOOT_SEL bitnBOOT0 bit
X00XFlash program memory is selected as boot area
110XSystem memory is selected as boot area
010XEmbedded SRAM is selected as boot area
XX11Flash program memory is selected as boot area
1X10System memory is selected as boot area
0X10Embedded SRAM is selected as boot area
  1. 1. Grayed options are available on category 1 devices only.

The boot mode configuration is latched on the 2nd rising edge of SYSCLK after reset. For category 1 devices, the value present on BOOT0 pin is latched on NRST rising edge. It is up to the user to set nBOOT1 and BOOT0 to select the required boot mode.

The boot mode configuration is also re-sampled when exiting from Standby mode, except for category 1 devices where BOOT0 pin is latched on NRST rising edge. Consequently the boot mode configuration must not be modified in Standby mode (except for category 1 devices). After this startup delay has elapsed, the CPU fetches the top-of-stack value from address 0x0000 0000, then starts code execution from the boot memory at 0x0000 0004.

Depending on the selected boot mode, Flash program memory, system memory or SRAM is accessible as follows:

BOOT0/GPIO pin sharing (category 1 devices only)

On category 1 devices, the BOOT0 pin is shared with a GPIO pin. The pin state is latched on NRST rising edge as BOOT0 state. The pin logic level can then be read as an input value on the shared GPIO pin. This pin feature specific input voltage characteristics (refer to the corresponding datasheets for details).

Empty check (category 1 devices only)

On category 1 devices, an internal empty check flag is implemented to allow easy programming of virgin devices by the bootloader. This flag is used when BOOT0 pin is configured to select Flash program memory as target boot area. When this flag is set, the device is considered as unprogrammed and the system memory (bootloader) is selected as boot area instead of the Flash program memory to allow the application to program the Flash memory.

The empty check flag is updated only when the option bytes are loaded: it is set when the content of address 0x0800 0000 is read as 0x0000 0000 and cleared otherwise. As a result, only a power-on reset or setting OBL_LAUNCH bit in FLASH_CR register can clear this flag after programming a virgin device to execute user code after system reset.

Note: If the device is programmed for the first time but the option bytes are not reloaded, the system memory will still be selected as boot area after system reset. In this case, the bootloader code switches the boot memory mapping to Flash program memory and performs a jump to the user code it hosts.

Bank swapping (category 5 devices only)

For devices featuring two banks, the bank swapping mechanism allows the CPU to point either to bank1 or to bank 2 in the boot memory space (0x0000 0000). Either Flash program and data EEPROM address are changed (see Table 10: NVM organization for UFB = 0 (128 Kbyte category 5 devices) , Table 12: NVM organization for UFB = 0 (64 Kbyte category 5 devices) ).

Physical remap

Once the boot pin and bit are selected, the application software can modify the memory accessible in the code area. This modification is performed by programming the MEM_MODE bits in the SYSCFG memory remap register (SYSCFG_CFGR1).

Embedded bootloader

The embedded bootloader is located in the System memory, programmed by ST during production. It is used to reprogram the Flash memory using one of the following serial interfaces:

For details concerning the bootloader serial interface corresponding I/O, refer to your device datasheet.

For further details on STM32 bootloader, please refer to AN2606.