25#include "cpu_conf_common.h"
27#if defined(CPU_LINE_STM32F030x4)
28#include "vendor/stm32f030x4.h"
29#elif defined(CPU_LINE_STM32MP157Cxx)
30#include "vendor/stm32mp157cxx_cm4.h"
33#include "irqs/f0/irqs.h"
36#include "irqs/f1/irqs.h"
39#include "irqs/f2/irqs.h"
42#include "irqs/f3/irqs.h"
45#include "irqs/f4/irqs.h"
48#include "irqs/f7/irqs.h"
51#include "irqs/g0/irqs.h"
54#include "irqs/c0/irqs.h"
57#include "irqs/g4/irqs.h"
60#include "irqs/l0/irqs.h"
63#include "irqs/l1/irqs.h"
66#include "irqs/l4/irqs.h"
69#include "irqs/l5/irqs.h"
72#include "irqs/u5/irqs.h"
76#include "irqs/wb/irqs.h"
79#include "irqs/wl/irqs.h"
81#error Not supported CPU family
85#if !defined(NUM_HEAPS) && CPU_HAS_BACKUP_RAM
101#define CORTEXM_ISB_REQUIRED_AFTER_WFI 1
107#define CPU_DEFAULT_IRQ_PRIO (1U)
109#if !defined(CPU_FAM_STM32MP1)
110#define CPU_FLASH_BASE FLASH_BASE
114#if defined(CPU_LINE_STM32F030x4)
115#define CPU_IRQ_NUMOF (28U)
116#elif defined(CPU_MODEL_STM32MP157CAC)
117#define CPU_IRQ_NUMOF (150U)
125#if defined(CPU_FAM_STM32U5)
126#define FLASHPAGE_SIZE (8192U)
127#elif defined(CPU_FAM_STM32WB)
128#define FLASHPAGE_SIZE (4096U)
129#elif defined(CPU_LINE_STM32F091xC) || defined(CPU_LINE_STM32F072xB) \
130 || defined(CPU_LINE_STM32F030xC) || defined(CPU_LINE_STM32F103xE) \
131 || defined(CPU_FAM_STM32F3) || defined(CPU_FAM_STM32L4) \
132 || defined(CPU_FAM_STM32G4) || defined(CPU_FAM_STM32G0) \
133 || defined(CPU_FAM_STM32L5) || defined(CPU_FAM_STM32WL) \
134 || defined(CPU_FAM_STM32C0)
135#define FLASHPAGE_SIZE (2048U)
136#elif defined(CPU_LINE_STM32F051x8) || defined(CPU_LINE_STM32F042x6) \
137 || defined(CPU_LINE_STM32F070xB) || defined(CPU_LINE_STM32F030x8) \
138 || defined(CPU_LINE_STM32F030x4) || defined(CPU_LINE_STM32F103xB) \
139 || defined(CPU_LINE_STM32F031x6)
140#define FLASHPAGE_SIZE (1024U)
141#elif defined(CPU_FAM_STM32L1)
142#define FLASHPAGE_SIZE (256U)
143#elif defined(CPU_FAM_STM32L0)
144#define FLASHPAGE_SIZE (128U)
147#if defined(CPU_FAM_STM32L0) || defined(CPU_FAM_STM32L1)
148#define FLASHPAGE_ERASE_STATE (0x00U)
152#define FLASHPAGE_NUMOF (STM32_FLASHSIZE / FLASHPAGE_SIZE)
155#if defined(CPU_FAM_STM32F2) || defined(CPU_FAM_STM32F4) || \
156 defined(CPU_FAM_STM32F7)
157#define PERIPH_FLASHPAGE_CUSTOM_PAGESIZES
158#define PERIPH_FLASHPAGE_NEEDS_FLASHPAGE_ADDR
171#if (defined(FLASH_OPTCR_DB1M) && (STM32_FLASHSIZE >= (1024 * 1024)))
172#define FLASHPAGE_DUAL_BANK 1
174#define FLASHPAGE_DUAL_BANK 0
178#if defined(CPU_FAM_STM32F7)
179#if defined(CPU_LINE_STM32F745xx) || \
180 defined(CPU_LINE_STM32F746xx) || \
181 defined(CPU_LINE_STM32F750xx) || \
182 defined(CPU_LINE_STM32F756xx) || \
183 defined(CPU_LINE_STM32F765xx) || \
184 defined(CPU_LINE_STM32F767xx) || \
185 defined(CPU_LINE_STM32F769xx) || \
186 defined(CPU_LINE_STM32F777xx) || \
187 defined(CPU_LINE_STM32F779xx)
188#define FLASHPAGE_MIN_SECTOR_SIZE (32 * 1024)
189#elif defined(CPU_LINE_STM32F722xx) || \
190 defined(CPU_LINE_STM32F723xx) || \
191 defined(CPU_LINE_STM32F730xx) || \
192 defined(CPU_LINE_STM32F732xx) || \
193 defined(CPU_LINE_STM32F733xx)
194#define FLASHPAGE_MIN_SECTOR_SIZE (16 * 1024)
197#error Unknown STM32F7 Line, unable to determine FLASHPAGE_MIN_SECTOR_SIZE
201#define FLASHPAGE_MIN_SECTOR_SIZE (16 * 1024)
204#if FLASHPAGE_DUAL_BANK
207#define FLASHPAGE_NUMOF ((STM32_FLASHSIZE / \
208 (8 * FLASHPAGE_MIN_SECTOR_SIZE)) + 8)
213#define FLASHPAGE_NUMOF ((STM32_FLASHSIZE / \
214 (8 * FLASHPAGE_MIN_SECTOR_SIZE)) + 4)
222#if defined(CPU_FAM_STM32L4) || defined(CPU_FAM_STM32WB) || \
223 defined(CPU_FAM_STM32G4) || defined(CPU_FAM_STM32G0) || \
224 defined(CPU_FAM_STM32L5) || defined(CPU_FAM_STM32U5) || \
225 defined(CPU_FAM_STM32WL) || defined(CPU_FAM_STM32C0)
226#define FLASHPAGE_WRITE_BLOCK_SIZE (8U)
227typedef uint64_t stm32_flashpage_block_t;
228#elif defined(CPU_FAM_STM32L0) || defined(CPU_FAM_STM32L1) || \
229 defined(CPU_FAM_STM32F2) || defined(CPU_FAM_STM32F4) || \
230 defined(CPU_FAM_STM32F7)
231#define FLASHPAGE_WRITE_BLOCK_SIZE (4U)
232typedef uint32_t stm32_flashpage_block_t;
234#define FLASHPAGE_WRITE_BLOCK_SIZE (2U)
235typedef uint16_t stm32_flashpage_block_t;
238#if defined(CPU_FAM_STM32L4) || defined(CPU_FAM_STM32WB) || \
239 defined(CPU_FAM_STM32G4) || defined(CPU_FAM_STM32G0) || \
240 defined(CPU_FAM_STM32L5) || defined(CPU_FAM_STM32U5) || \
241 defined(CPU_FAM_STM32WL) || defined(CPU_FAM_STM32C0)
242#define FLASHPAGE_WRITE_BLOCK_ALIGNMENT (8U)
245#define FLASHPAGE_WRITE_BLOCK_ALIGNMENT (4U)
254#define CPU_HAS_BITBAND 1