2. System and memory overview

2.1 System architecture

In STM32F412xx, the main system consists of 32-bit multilayer AHB bus matrix that interconnects:

The bus matrix provides access from a master to a slave, enabling concurrent access and efficient operation even when several high-speed peripherals work simultaneously. This architecture is shown in Figure 1 .

Figure 1. System architecture

Figure 1. System architecture diagram showing the interconnection of masters and slaves via a bus matrix.

The diagram illustrates the system architecture of the STM32F412xx. At the top, three master blocks are shown: ARM Cortex-M4, GP DMA1, and GP DMA2. The ARM Cortex-M4 is connected to the bus matrix via its I-bus, D-bus, and S-bus. GP DMA1 is connected via DMA_PI, DMA_MEM1, and DMA_MEM2. GP DMA2 is connected via DMA_P2. These connections lead to a central 'Bus matrix-S' which has six slave ports labeled S0 through S5. The bus matrix is connected to several slave components: M0 (ICODE and DCODE) leads to an ACCEL block, which is connected to Flash (Up to 1MB); M1 (DCODE) also leads to the ACCEL block; M2 (Main internal SRAM) leads to SRAM1 (256 KB); M3 (AHB periph. 1) leads to AHB periph. 1, which is connected to APB1 and APB2 bridges; M4 (AHB periph. 2) leads to AHB periph. 2; and M5 (FSMC external MemCtrl/QuadSPI) leads to the FSMC external MemCtrl/QuadSPI block. The diagram is labeled MSv37276V1 in the bottom right corner.

Figure 1. System architecture diagram showing the interconnection of masters and slaves via a bus matrix.

2.1.1 I-bus

This bus connects the Instruction bus of the Cortex®-M4 with FPU core to the BusMatrix. This bus is used by the core to fetch instructions. The target of this bus is a memory containing code (internal flash memory/SRAM1).

2.1.2 D-bus

This bus connects the databus of the Cortex®-M4 with FPU to the BusMatrix. This bus is used by the core for literal load and debug access. The target of this bus is a memory containing code or data (internal flash memory/SRAM1).

2.1.3 S-bus

This bus connects the system bus of the Cortex®-M4 with FPU core to a BusMatrix. This bus is used to access data located in a peripheral or in SRAM1. Instructions may also be fetch on this bus (less efficient than ICode). The targets of this bus are the internal SRAM1, the AHB1 peripherals including the APB peripherals, the AHB2 peripherals and the external memories through the FSMC and the QUADSPI.

2.1.4 DMA memory bus

This bus connects the DMA memory bus master interface to the BusMatrix. It is used by the DMA to perform transfer to/from memories. The targets of this bus are data memories: internal flash memory, internal SRAM1 and additionally for S4 the AHB1/AHB2 peripherals including the APB peripherals.

2.1.5 DMA peripheral bus

This bus connects the DMA peripheral master bus interface to the BusMatrix. This bus is used by the DMA to access AHB peripherals or to perform memory-to-memory transfers. The targets of this bus are the AHB and APB peripherals plus data memories: flash memory and internal SRAM1.

2.1.6 BusMatrix

The BusMatrix manages the access arbitration between masters. The arbitration uses a round-robin algorithm.

2.1.7 AHB/APB bridges (APB)

The two AHB/APB bridges, APB1 and APB2, provide full synchronous connections between the AHB and the two APB buses, allowing flexible selection of the peripheral frequency.

Refer to the device datasheets for more details on APB1 and APB2 maximum frequencies, and to Table 1 for the address mapping of AHB and APB peripherals.

After each device reset, all peripheral clocks are disabled (except for the SRAM and flash memory interface). Before using a peripheral you have to enable its clock in the RCC_AHBxENR or RCC_APBxENR register.

Note: When a 16- or an 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 various memory blocks and their addresses. The diagram is split into two main columns. The left column shows the physical address space from 0x0000 0000 to 0xFFFF FFFF, divided into 512-Mbyte blocks 0-7. Block 0 contains Flash memory, System memory, OTP area + lock, and Option bytes. Block 1 contains SRAM (256 KB aliased by bit-banding) and is also aliased to Flash, system, memory or SRAM on the BOOT pins. Block 2 contains Peripherals. Block 3 contains FSMC and QuadSPI. Block 4 is Reserved. Block 5 is 512-Mbyte block 6 Not used. Block 6 is 512-Mbyte block 7 internal Peripherals. Block 7 is Reserved. The right column shows the logical address space for internal peripherals, including AHB1, AHB2, AHB3, APB1, and APB2 buses, with their respective address ranges and reserved areas.
Physical Address RangeMemory Block / PeripheralLogical Address RangePeripheral / Bus
0x0000 0000 - 0x000F FFFFAliased to Flash, system, memory or SRAM depending, on the BOOT pins0x0000 0000 - 0x000F FFFF
0x0010 0000 - 0x007F FFFFReserved0x0010 0000 - 0x007F FFFF
0x0080 0000 - 0x008F FFFFFlash memory0x0080 0000 - 0x008F FFFF
0x0090 0000 - 0x009F FFFFReserved0x0090 0000 - 0x009F FFFF
0x00A0 0000 - 0x00FF FFFFSystem memory0x00A0 0000 - 0x00FF FFFF
0x0100 0000 - 0x010F FFFFReserved0x0100 0000 - 0x010F FFFF
0x0110 0000 - 0x011F FFFFOTP area + lock0x0110 0000 - 0x011F FFFF
0x0120 0000 - 0x012F FFFFReserved0x0120 0000 - 0x012F FFFF
0x0130 0000 - 0x013F FFFFOption bytes0x0130 0000 - 0x013F FFFF
0x0140 0000 - 0x014F FFFFReserved0x0140 0000 - 0x014F FFFF
0x0150 0000 - 0x015F FFFFSRAM (256 KB aliased by bit-banding)0x0150 0000 - 0x015F FFFF
0x0160 0000 - 0x016F FFFFReserved0x0160 0000 - 0x016F FFFF
0x0170 0000 - 0x017F FFFFReserved0x0170 0000 - 0x017F FFFF
0x0180 0000 - 0x018F FFFFReserved0x0180 0000 - 0x018F FFFF
0x0190 0000 - 0x019F FFFFReserved0x0190 0000 - 0x019F FFFF
0x01A0 0000 - 0x01AF FFFFReserved0x01A0 0000 - 0x01AF FFFF
0x01B0 0000 - 0x01BF FFFFReserved0x01B0 0000 - 0x01BF FFFF
0x01C0 0000 - 0x01CF FFFFReserved0x01C0 0000 - 0x01CF FFFF
0x01D0 0000 - 0x01DF FFFFReserved0x01D0 0000 - 0x01DF FFFF
0x01E0 0000 - 0x01EF FFFFReserved0x01E0 0000 - 0x01EF FFFF
0x01F0 0000 - 0x01FF FFFFReserved0x01F0 0000 - 0x01FF FFFF
0x0200 0000 - 0x0203 FFFFSRAM (256 KB aliased by bit-banding)0x0200 0000 - 0x0203 FFFF
0x0204 0000 - 0x020F FFFFReserved0x0204 0000 - 0x020F FFFF
0x0210 0000 - 0x021F FFFFReserved0x0210 0000 - 0x021F FFFF
0x0220 0000 - 0x022F FFFFReserved0x0220 0000 - 0x022F FFFF
0x0230 0000 - 0x023F FFFFReserved0x0230 0000 - 0x023F FFFF
0x0240 0000 - 0x024F FFFFReserved0x0240 0000 - 0x024F FFFF
0x0250 0000 - 0x025F FFFFReserved0x0250 0000 - 0x025F FFFF
0x0260 0000 - 0x026F FFFFReserved0x0260 0000 - 0x026F FFFF
0x0270 0000 - 0x027F FFFFReserved0x0270 0000 - 0x027F FFFF
0x0280 0000 - 0x028F FFFFReserved0x0280 0000 - 0x028F FFFF
0x0290 0000 - 0x029F FFFFReserved0x0290 0000 - 0x029F FFFF
0x02A0 0000 - 0x02AF FFFFReserved0x02A0 0000 - 0x02AF FFFF
0x02B0 0000 - 0x02BF FFFFReserved0x02B0 0000 - 0x02BF FFFF
0x02C0 0000 - 0x02CF FFFFReserved0x02C0 0000 - 0x02CF FFFF
0x02D0 0000 - 0x02DF FFFFReserved0x02D0 0000 - 0x02DF FFFF
0x02E0 0000 - 0x02EF FFFFReserved0x02E0 0000 - 0x02EF FFFF
0x02F0 0000 - 0x02FF FFFFReserved0x02F0 0000 - 0x02FF FFFF
0x0300 0000 - 0x030F FFFFReserved0x0300 0000 - 0x030F FFFF
0x0310 0000 - 0x031F FFFFReserved0x0310 0000 - 0x031F FFFF
0x0320 0000 - 0x032F FFFFReserved0x0320 0000 - 0x032F FFFF
0x0330 0000 - 0x033F FFFFReserved0x0330 0000 - 0x033F FFFF
0x0340 0000 - 0x034F FFFFReserved0x0340 0000 - 0x034F FFFF
0x0350 0000 - 0x035F FFFFReserved0x0350 0000 - 0x035F FFFF
0x0360 0000 - 0x036F FFFFReserved0x0360 0000 - 0x036F FFFF
0x0370 0000 - 0x037F FFFFReserved0x0370 0000 - 0x037F FFFF
0x0380 0000 - 0x038F FFFFReserved0x0380 0000 - 0x038F FFFF
0x0390 0000 - 0x039F FFFFReserved0x0390 0000 - 0x039F FFFF
0x03A0 0000 - 0x03AF FFFFReserved0x03A0 0000 - 0x03AF FFFF
0x03B0 0000 - 0x03BF FFFFReserved0x03B0 0000 - 0x03BF FFFF
0x03C0 0000 - 0x03CF FFFFReserved0x03C0 0000 - 0x03CF FFFF
0x03D0 0000 - 0x03DF FFFFReserved0x03D0 0000 - 0x03DF FFFF
0x03E0 0000 - 0x03EF FFFFReserved0x03E0 0000 - 0x03EF FFFF
0x03F0 0000 - 0x03FF FFFFReserved0x03F0 0000 - 0x03FF FFFF
0x0400 0000 - 0x0401 FFFFReserved0x0400 0000 - 0x0401 FFFF
0x0402 0000 - 0x0402 67FFReserved0x0402 0000 - 0x0402 67FF
0x0403 0000 - 0x0403 63FFReserved0x0403 0000 - 0x0403 63FF
0x0404 0000 - 0x0404 7400Reserved0x0404 0000 - 0x0404 7400
0x0405 0000 - 0x0405 73FFReserved0x0405 0000 - 0x0405 73FF
0x0406 0000 - 0x0406 7400Reserved0x0406 0000 - 0x0406 7400
0x0407 0000 - 0x0407 73FFReserved0x0407 0000 - 0x0407 73FF
0x0408 0000 - 0x0408 7400Reserved0x0408 0000 - 0x0408 7400
0x0409 0000 - 0x0409 73FFReserved0x0409 0000 - 0x0409 73FF
0x040A 0000 - 0x040A 7400Reserved0x040A 0000 - 0x040A 7400
0x040B 0000 - 0x040B 73FFReserved0x040B 0000 - 0x040B 73FF
0x040C 0000 - 0x040C 7400Reserved0x040C 0000 - 0x040C 7400
0x040D 0000 - 0x040D 73FFReserved0x040D 0000 - 0x040D 73FF
0x040E 0000 - 0x040E 7400Reserved0x040E 0000 - 0x040E 7400
0x040F 0000 - 0x040F 73FFReserved0x040F 0000 - 0x040F 73FF
0x0410 0000 - 0x0410 7400Reserved0x0410 0000 - 0x0410 7400
0x0411 0000 - 0x0411 73FFReserved0x0411 0000 - 0x0411 73FF
0x0412 0000 - 0x0412 7400Reserved0x0412 0000 - 0x0412 7400
0x0413 0000 - 0x0413 73FFReserved0x0413 0000 - 0x0413 73FF
0x0414 0000 - 0x0414 7400Reserved0x0414 0000 - 0x0414 7400
0x0415 0000 - 0x0415 73FFReserved0x0415 0000 - 0x0415 73FF
0x0416 0000 - 0x0416 7400Reserved0x0416 0000 - 0x0416 7400
0x0417 0000 - 0x0417 73FFReserved0x0417 0000 - 0x0417 73FF
0x0418 0000 - 0x0418 7400Reserved0x0418 0000 - 0x0418 7400
0x0419 0000 - 0x0419 73FFReserved0x0419 0000 - 0x0419 73FF
0x041A 0000 - 0x041A 7400Reserved0x041A 0000 - 0x041A 7400
0x041B 0000 - 0x041B 73FFReserved0x041B 0000 - 0x041B 73FF
0x041C 0000 - 0x041C 7400Reserved0x041C 0000 - 0x041C 7400
0x041D 0000 - 0x041D 73FFReserved0x041D 0000 - 0x041D 73FF
0x041E 0000 - 0x041E 7400Reserved0x041E 0000 - 0x041E 7400
0x041F 0000 - 0x041F 73FFReserved0x041F 0000 - 0x041F 73FF
0x0420 0000 - 0x0420 7400Reserved0x0420 0000 - 0x0420 7400
0x0421 0000 - 0x0421 73FFReserved0x0421 0000 - 0x0421 73FF
0x0422 0000 - 0x0422 7400Reserved0x0422 0000 - 0x0422 7400
0x0423 0000 - 0x0423 73FFReserved0x0423 0000 - 0x0423 73FF
0x0424 0000 - 0x0424 7400Reserved0x0424 0000 - 0x0424 7400
0x0425 0000 - 0x0425 73FFReserved0x0425 0000 - 0x0425 73FF
0x0426 0000 - 0x0426 7400Reserved0x0426 0000 - 0x0426 7400
0x0427 0000 - 0x0427 73FFReserved0x0427 0000 - 0x0427 73FF
0x0428 0000 - 0x0428 7400Reserved0x0428 0000 - 0x0428 7400
0x0429 0000 - 0x0429 73FFReserved0x0429 0000 - 0x0429 73FF
0x042A 0000 - 0x042A 7400Reserved0x042A 0000 - 0x042A 7400
0x042B 0000 - 0x042B 73FFReserved0x042B 0000 - 0x042B 73FF
0x042C 0000 - 0x042C 7400Reserved0x042C 0000 - 0x042C 7400
0x042D 0000 - 0x042D 73FFReserved0x042D 0000 - 0x042D 73FF
0x042E 0000 - 0x042E 7400Reserved0x042E 0000 - 0x042E 7400
0x042F 0000 - 0x042F 73FFReserved0x042F 0000 - 0x042F 73FF
0x0430 0000 - 0x0430 7400Reserved0x0430 0000 - 0x0430 7400
0x0431 0000 - 0x0431 73FFReserved0x0431 0000 - 0x0431 73FF
0x0432 0000 - 0x0432 7400Reserved0x0432 0000 - 0x0432 7400
0x0433 0000 - 0x0433 73FFReserved0x0433 0000 - 0x0433 73FF
0x0434 0000 - 0x0434 7400Reserved0x0434 0000 - 0x0434 7400
0x0435 0000 - 0x0435 73FFReserved0x0435 0000 - 0x0435 73FF
0x0436 0000 - 0x0436 7400Reserved0x0436 0000 - 0x0436 7400
0x0437 0000 - 0x0437 73FFReserved0x0437 0000 - 0x0437 73FF
0x0438 0000 - 0x0438 7400Reserved0x0438 0000 - 0x0438 7400
0x0439 0000 - 0x0439 73FFReserved0x0439 0000 - 0x0439 73FF
0x043A 0000 - 0x043A 7400Reserved0x043A 0000 - 0x043A 7400
0x043B 0000 - 0x043B 73FFReserved0x043B 0000 - 0x043B 73FF
0x043C 0000 - 0x043C 7400Reserved0x043C 0000 - 0x043C 7400
0x043D 0000 - 0x043D 73FFReserved0x043D 0000 - 0x043D 73FF
0x043E 0000 - 0x043E 7400Reserved0x043E 0000 - 0x043E 7400
0x043F 0000 - 0x043F 73FFReserved0x043F 0000 - 0x043F 73FF
0x0440 0000 - 0x0440 7400Reserved0x0440 0000 - 0x0440 7400
0x0441 0000 - 0x0441 73FFReserved0x0441 0000 - 0x0441 73FF
0x0442 0000 - 0x0442 7400Reserved0x0442 0000 - 0x0442 7400
0x0443 0000 - 0x0443 73FFReserved0x0443 0000 - 0x0443 73FF
0x0444 0000 - 0x0444 7400Reserved0x0444 0000 - 0x0444 7400
0x0445 0000 - 0x0445 73FFReserved0x0445 0000 - 0x0445 73FF
0x0446 0000 - 0x0446 7400Reserved0x0446 0000 - 0x0446 7400
0x0447 0000 - 0x0447 73FFReserved0x0447 0000 - 0x0447 73FF
0x0448 0000 - 0x0448 7400Reserved0x0448 0000 - 0x0448 7400
0x0449 0000 - 0x0449 73FFReserved0x0449 0000 - 0x0449 73FF
0x044A 0000 - 0x044A 7400Reserved0x044A 0000 - 0x044A 7400
0x044B 0000 - 0x044B 73FFReserved0x044B 0000 - 0x044B 73FF
0x044C 0000 - 0x044C 7400Reserved0x044C 0000 - 0x044C 7400
0x044D 0000 - 0x044D 73FFReserved0x044D 0000 - 0x044D 73FF
0x044E 0000 - 0x044E 7400Reserved0x044E 0000 - 0x044E 7400
0x044F 0000 - 0x044F 73FFReserved0x044F 0000 - 0x044F 73FF
0x0450 0000 - 0x0450 7400Reserved0x0450 0000 - 0x0450 7400
0x0451 0000 - 0x0451 73FFReserved0x0451 0000 - 0x0451 73FF
0x0452 0000 - 0x0452 7400Reserved0x0452 0000 - 0x0452 7400
0x0453 0000 - 0x0453 73FFReserved0x0453 0000 - 0x0453 73FF
0x0454 0000 - 0x0454 7400Reserved0x0454 0000 - 0x0454 7400
0x0455 0000 - 0x0455 73FFReserved0x0455 0000 - 0x0455 73FF
0x0456 0000 - 0x0456 7400Reserved0x0456 0000 - 0x0456 7400
0x0457 0000 - 0x0457 73FFReserved0x0457 0000 - 0x0457 73FF
0x0458 0000 - 0x0458 7400Reserved0x0458 0000 - 0x0458 7400
0x0459 0000 - 0x0459 73FFReserved0x0459 0000 - 0x0459 73FF
0x045A 0000 - 0x045A 7400Reserved0x045A 0000 - 0x045A 7400
0x045B 0000 - 0x045B 73FFReserved0x045B 0000 - 0x045B 73FF
0x045C 0000 - 0x045C 7400Reserved0x045C 0000 - 0x045C 7400
0x045D 0000 - 0x045D 73FFReserved0x045D 0000 - 0x045D 73FF
0x045E 0000 - 0x045E 7400Reserved0x045E 0000 - 0x045E 7400
0x045F 0000 - 0x045F 73FFReserved0x045F 0000 - 0x045F 73FF
0x0460 0000 - 0x0460 7400Reserved0x0460 0000 - 0x0460 7400
0x0461 0000 - 0x0461 73FFReserved0x0461 0000 - 0x0461 73FF
0x0462 0000 - 0x0462 7400Reserved0x0462 0000 - 0x0462 7400
0x0463 0000 - 0x0463 73FFReserved0x0463 0000 - 0x0463 73FF
0x0464 0000 - 0x0464 7400Reserved0x0464 0000 - 0x0464 7400
0x0465 0000 - 0x0465 73FFReserved0x0465 0000 - 0x0465 73FF
0x0466 0000 - 0x0466 7400Reserved0x0466 0000 - 0x0466 7400
0x0467 0000 - 0x0467 73FFReserved
Memory map diagram showing various memory blocks and their addresses. The diagram is split into two main columns. The left column shows the physical address space from 0x0000 0000 to 0xFFFF FFFF, divided into 512-Mbyte blocks 0-7. Block 0 contains Flash memory, System memory, OTP area + lock, and Option bytes. Block 1 contains SRAM (256 KB aliased by bit-banding) and is also aliased to Flash, system, memory or SRAM on the BOOT pins. Block 2 contains Peripherals. Block 3 contains FSMC and QuadSPI. Block 4 is Reserved. Block 5 is 512-Mbyte block 6 Not used. Block 6 is 512-Mbyte block 7 internal Peripherals. Block 7 is Reserved. The right column shows the logical address space for internal peripherals, including AHB1, AHB2, AHB3, APB1, and APB2 buses, with their respective address ranges and reserved areas.

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

Table 1. Register boundary addresses

BusBoundary addressPeripheral
-0xE010 0000 - 0xFFFF FFFFReserved
Cortex ® -M40xE000 0000 - 0xE00F FFFFCortex-M4 internal peripherals
AHB30xA000 2000 - 0xDFFF FFFFReserved
0xA000 1000 - 0xA000 1FFFQuadSPI control register
0xA000 0000 - 0xA000 0FFFFSMC control register
0x9000 0000 - 0x9FFF FFFFQUADSPI
0x7000 0000 - 0x8FFF FFFFReserved
0x6000 0000 - 0x6FFF FFFFFSMC
AHB20x5006 0C00 - 0x5FFF FFFFReserved
0x5006 0800 - 0x5006 0BFFRNG
0x5004 0000 - 0x5006 07FFReserved
0x5000 0000 - 0x5003 FFFFUSB OTG FS
AHB10x4002 6800 - 0x4FFF FFFFReserved
0x4002 6400 - 0x4002 67FFDMA2
0x4002 6000 - 0x4002 63FFDMA1
0x4002 5000 - 0x4002 4FFFReserved
0x4002 3C00 - 0x4002 3FFFFlash interface register
0x4002 3800 - 0x4002 3BFFRCC
0x4002 3400 - 0x4002 37FFReserved
0x4002 3000 - 0x4002 33FFCRC
0x4002 2000 - 0x4002 2FFFReserved
0x4002 1C00 - 0x4002 1FFFGPIOH
0x4002 1800 - 0x4002 1BFFGPIOG
0x4002 1400 - 0x4002 17FFGPIOF
0x4002 1000 - 0x4002 13FFGPIOE
0x4002 0C00 - 0x4002 0FFFGPIO D
0x4002 0800 - 0x4002 0BFFGPIO C
0x4002 0400 - 0x4002 07FFGPIO B
0x4002 0000 - 0x4002 03FFGPIO A

Table 1. Register boundary addresses (continued)

BusBoundary addressPeripheral
APB20x4001 6400 - 0x4001 FFFFReserved
0x4001 6000 - 0x4001 63FFDFSDM1
0x4001 5400 - 0x4001 5FFFReserved
0x4001 5000 - 0x4001 53FFSPI5/I2S5
0x4001 4800 - 0x4001 4BFFTIM11
0x4001 4400 - 0x4001 47FFTIM10
0x4001 4000 - 0x4001 43FFTIM9
0x4001 3C00 - 0x4001 3FFFEXTI
0x4001 3800 - 0x4001 3BFFSYSCFG
0x4001 3400 - 0x4001 37FFSPI4/I2S4
0x4001 3000 - 0x4001 33FFSPI1/I2S1
0x4001 2C00 - 0x4001 2FFFSDIO
0x4001 2400 - 0x4001 2BFFReserved
0x4001 2000 - 0x4001 23FFADC1
0x4001 1800 - 0x4001 1FFFReserved
0x4001 1400 - 0x4001 17FFUSART6
0x4001 1000 - 0x4001 13FFUSART1
0x4001 0800 - 0x4001 0FFFReserved
0x4001 0400 - 0x4001 07FFTIM8
0x4001 0000 - 0x4001 03FFTIM1
0x4000 7400 - 0x4000 FFFFReserved

Table 1. Register boundary addresses (continued)

BusBoundary addressPeripheral
APB10x4000 7000 - 0x4000 73FFPWR
0x4000 6C00 - 0x4000 6FFFReserved
0x4000 6800 - 0x4000 6BFFCAN2
0x4000 6400 - 0x4000 67FFCAN1
0x4000 6000 - 0x4000 63FFI2CFMP1
0x4000 5C00 - 0x4000 5FFFI2C3
0x4000 5800 - 0x4000 5BFFI2C2
0x4000 5400 - 0x4000 57FFI2C1
0x4000 4C00 - 0x4000 53FFReserved
0x4000 4800 - 0x4000 4BFFUSART3
0x4000 4400 - 0x4000 47FFUSART2
0x4000 4000 - 0x4000 3FFFI2S3ext
0x4000 3C00 - 0x4000 3FFFSPI3 / I2S3
0x4000 3800 - 0x4000 3BFFSPI2 / I2S2
0x4000 3400 - 0x4000 37FFI2S2ext
0x4000 3000 - 0x4000 33FFIWDG
0x4000 2C00 - 0x4000 2FFFWWDG
0x4000 2800 - 0x4000 2BFFRTC & BKP Registers
0x4000 2400 - 0x4000 27FFReserved
0x4000 2000 - 0x4000 23FFTIM14
0x4000 1C00 - 0x4000 1FFFTIM13
0x4000 1800 - 0x4000 1BFFTIM12
0x4000 1400 - 0x4000 17FFTIM7
0x4000 1000 - 0x4000 13FFTIM6
0x4000 0C00 - 0x4000 0FFFTIM5
0x4000 0800 - 0x4000 0BFFTIM4
0x4000 0400 - 0x4000 07FFTIM3
0x4000 0000 - 0x4000 03FFTIM2

2.3 Embedded SRAM

STM32F412xx devices feature 256 Kbytes of system SRAM.

The embedded SRAM can be accessed as bytes, half-words (16 bits) or full words (32 bits). Read and write operations are performed at CPU speed with 0 wait state.

The CPU can access the embedded SRAM1, through the System Bus or through the I-Code/D-Code buses when boot from SRAM is selected or when physical remap is selected

( Section 8.2.1: SYSCFG memory remap register (SYSCFG_MEMRMP) in the SYSCFG controller). To get the max performance on SRAM execution, physical remap should be selected (boot or software selection).

2.4 Flash memory overview

The flash memory interface manages CPU AHB I-Code and D-Code accesses to the flash memory. It implements the erase and program flash memory operations and the read and write protection mechanisms. It accelerates code execution with a system of instruction prefetch and cache lines.

The flash memory is organized as follows:

Refer to Section 3: Embedded flash memory interface for more details.

2.5 Bit banding

The Cortex ® -M4 with FPU memory map includes two bit-band regions. These regions map each word in an alias region of memory to a bit in a bit-band region of memory. Writing to a word in the alias region has the same effect as a read-modify-write operation on the targeted bit in the bit-band region.

In the STM32F412xx devices both the peripheral registers and the SRAM1 are mapped to a bit-band region, so that single bit-band write and read operations are allowed. The operations are only available for Cortex ® -M4 with FPU accesses, and not from other bus masters (e.g. DMA).

A mapping formula shows how to reference each word in the alias region to a corresponding bit in the bit-band region. The mapping formula is:

\[ bit\_word\_addr = bit\_band\_base + (byte\_offset \times 32) + (bit\_number \times 4) \]

where:

Example

The following example shows how to map bit 2 of the byte located at SRAM1 address 0x20000300 to the alias region:

\[ 0x22006008 = 0x22000000 + (0x300*32) + (2*4) \]

Writing to address 0x22006008 has the same effect as a read-modify-write operation on bit 2 of the byte at SRAM1 address 0x20000300.

Reading address 0x22006008 returns the value (0x01 or 0x00) of bit 2 of the byte at SRAM1 address 0x20000300 (0x01: bit set; 0x00: bit reset).

For more information on bit-banding, refer to the Cortex®-M4 with FPU programming manual (see Related documents on page 1 ).

2.6 Boot configuration

Due to its fixed memory map, the code area starts from address 0x0000 0000 (accessed through the ICode/DCode buses) while the data area (SRAM) starts from address 0x2000 0000 (accessed through the system bus). The Cortex®-M4 with FPU CPU always fetches the reset vector on the ICode bus, which implies to have the boot space available only in the code area (typically, flash memory). STM32F4xx microcontrollers implement a special mechanism to be able to boot from other memories (like the internal SRAM).

In the STM32F412xx, three different boot modes can be selected through the BOOT[1:0] pins as shown in Table 2 .

Table 2. Boot modes

Boot mode selection pinsBoot modeAliasing
BOOT1BOOT0
x0Main flash memoryMain flash memory is selected as the boot space
01System memorySystem memory is selected as the boot space
11Embedded SRAMEmbedded SRAM is selected as the boot space

The values on the BOOT pins are latched on the 4th rising edge of SYSCLK after a reset. It is up to the user to set the BOOT1 and BOOT0 pins after reset to select the required boot mode.

BOOT0 is a dedicated pin while BOOT1 is shared with a GPIO pin. Once BOOT1 has been sampled, the corresponding GPIO pin is free and can be used for other purposes.

The BOOT pins are also resampled when the device exits the Standby mode. Consequently, they must be kept in the required Boot mode configuration when the device is in the Standby mode. After this startup delay is over, the CPU fetches the top-of-stack value from address 0x0000 0000, then starts code execution from the boot memory starting from 0x0000 0004.

Note: When the device boots from SRAM, in the application initialization code, you have to relocate the vector table in SRAM using the NVIC exception table and the offset register.

Embedded bootloader

The embedded bootloader mode is used to reprogram the flash memory using one of the interface described in the table below. The availability of the interface is package dependent.

Table 3. Embedded bootloader interfaces

PackageUSART1
PA9/
PA10
USART2
PD6/
PD5
USART3
PB11/
PB10
I2C1
PB6/
PB7
I2C2
PF0/
PF1
I2C3
PA8/
PB4
I2C
FMP1
PB14/
PB15
SPI1
PA4/
PA5/
PA6/
PA7
SPI3
PA15/
PC10/
PC11/
PC12
SPI4
PE11/
PE12/
PE13/
PE14
CAN2
PB5/
PB13
USB
PA11
/P12
UFQFPN48Y--Y-YYY--YY
WLCSP64Y--Y-YYYY-YY
LQFP64Y--Y-YYYY-YY
LQFP100YY-Y-YYYYYYY
LQFP144YYYYYYYYYYYY
UFBGA100YYYY-YYYYYYY
UFBGA144YYYYYYYYYYYY

The USART peripherals operate at the internal 16 MHz oscillator (HSI) frequency, while the CAN and USB OTG FS require an external clock (HSE) multiple of 1 MHz (ranging from 4 to 26 MHz).

The embedded bootloader code is located in system memory. It is programmed by ST during production. For additional information, refer to application note AN2606.

Physical remap in STM32F412xx

Once the boot pins are selected, the application software can modify the memory accessible in the code area (in this way the code can be executed through the ICode bus in place of the System bus). This modification is performed by programming the Section 8.2.1: SYSCFG memory remap register (SYSCFG_MEMRMP) in the SYSCFG controller.

The following memories can thus be remapped:

Table 4. Memory mapping vs. Boot mode/physical remap in STM32F412xx

AddressesBoot/Remap in main flash memoryBoot/Remap in embedded SRAMBoot/Remap in System memory
0x2000 0000 - 0x2003 FFFFSRAM (256 KB)SRAM (256KB)SRAM (256KB)
0x1FFF 0000 - 0x1FFF 77FFSystem memorySystem memorySystem memory
0x0802 0000 - 0x1FFE FFFFReservedReservedReserved
0x0800 0000 - 0x080F FFFFFlash memoryFlash memoryFlash memory
Table 4. Memory mapping vs. Boot mode/physical remap in STM32F412xx
AddressesBoot/Remap in main flash memoryBoot/Remap in embedded SRAMBoot/Remap in System memory
0x0400 000 - 0x07FF FFFFReservedReservedReserved
0x0000 0000 - 0x0003 FFFF (1)Flash (1M) AliasedSRAM1 (256 KB) AliasedSystem memory (30 KB) Aliased
  1. 1. Even when aliased in the boot memory space, the related memory is still accessible at its original memory space.