2020-05-03 14:35:01 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 Freie Universität Berlin
|
|
|
|
* 2016 Inria
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser General
|
|
|
|
* Public License v2.1. See the file LICENSE in the top level directory for more
|
|
|
|
* details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2020-05-03 17:17:54 +02:00
|
|
|
* @ingroup cpu_stm32
|
2020-05-03 14:35:01 +02:00
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief Implementation specific CPU configuration options
|
|
|
|
*
|
|
|
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
|
|
|
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CPU_CONF_H
|
|
|
|
#define CPU_CONF_H
|
|
|
|
|
|
|
|
#include "cpu_conf_common.h"
|
|
|
|
|
2020-05-26 21:42:43 +02:00
|
|
|
#if defined(CPU_LINE_STM32F030x4)
|
|
|
|
#include "vendor/stm32f030x4.h"
|
2020-08-03 00:37:59 +02:00
|
|
|
#elif defined(CPU_LINE_STM32MP157Cxx)
|
|
|
|
#include "vendor/stm32mp157cxx_cm4.h"
|
2020-05-26 21:42:43 +02:00
|
|
|
#elif CPU_FAM_STM32F0
|
|
|
|
#include "stm32f0xx.h"
|
2020-07-24 15:05:27 +02:00
|
|
|
#include "irqs/f0/irqs.h"
|
2020-05-03 14:35:01 +02:00
|
|
|
#elif CPU_FAM_STM32F1
|
2020-05-26 21:42:43 +02:00
|
|
|
#include "stm32f1xx.h"
|
2020-07-24 15:05:27 +02:00
|
|
|
#include "irqs/f1/irqs.h"
|
2020-05-03 14:35:01 +02:00
|
|
|
#elif CPU_FAM_STM32F2
|
2020-05-26 21:42:43 +02:00
|
|
|
#include "stm32f2xx.h"
|
2020-07-24 15:05:27 +02:00
|
|
|
#include "irqs/f2/irqs.h"
|
2020-05-03 14:35:01 +02:00
|
|
|
#elif CPU_FAM_STM32F3
|
2020-05-26 21:42:43 +02:00
|
|
|
#include "stm32f3xx.h"
|
2020-07-24 15:05:27 +02:00
|
|
|
#include "irqs/f3/irqs.h"
|
2020-05-03 14:35:01 +02:00
|
|
|
#elif CPU_FAM_STM32F4
|
2020-05-26 21:42:43 +02:00
|
|
|
#include "stm32f4xx.h"
|
2020-07-24 15:05:27 +02:00
|
|
|
#include "irqs/f4/irqs.h"
|
2020-05-03 14:35:01 +02:00
|
|
|
#elif CPU_FAM_STM32F7
|
2020-05-26 21:42:43 +02:00
|
|
|
#include "stm32f7xx.h"
|
2020-07-24 15:05:27 +02:00
|
|
|
#include "irqs/f7/irqs.h"
|
2020-05-03 22:22:10 +02:00
|
|
|
#elif CPU_FAM_STM32G0
|
|
|
|
#include "stm32g0xx.h"
|
2020-07-24 15:05:27 +02:00
|
|
|
#include "irqs/g0/irqs.h"
|
2020-05-23 17:26:54 +02:00
|
|
|
#elif CPU_FAM_STM32G4
|
2020-05-26 21:42:43 +02:00
|
|
|
#include "stm32g4xx.h"
|
2020-07-24 15:05:27 +02:00
|
|
|
#include "irqs/g4/irqs.h"
|
2020-05-03 14:35:01 +02:00
|
|
|
#elif CPU_FAM_STM32L0
|
2020-05-26 21:42:43 +02:00
|
|
|
#include "stm32l0xx.h"
|
2020-07-24 15:05:27 +02:00
|
|
|
#include "irqs/l0/irqs.h"
|
2020-05-03 14:35:01 +02:00
|
|
|
#elif CPU_FAM_STM32L1
|
2020-05-26 21:42:43 +02:00
|
|
|
#include "stm32l1xx.h"
|
2020-07-24 15:05:27 +02:00
|
|
|
#include "irqs/l1/irqs.h"
|
2020-05-03 14:35:01 +02:00
|
|
|
#elif CPU_FAM_STM32L4
|
2020-05-26 21:42:43 +02:00
|
|
|
#include "stm32l4xx.h"
|
2020-07-24 15:05:27 +02:00
|
|
|
#include "irqs/l4/irqs.h"
|
2020-09-28 15:57:01 +02:00
|
|
|
#elif CPU_FAM_STM32L5
|
|
|
|
#include "stm32l5xx.h"
|
|
|
|
#include "irqs/l5/irqs.h"
|
2020-05-03 14:35:01 +02:00
|
|
|
#elif CPU_FAM_STM32WB
|
2020-05-26 21:42:43 +02:00
|
|
|
#include "stm32wbxx.h"
|
2020-07-24 15:05:27 +02:00
|
|
|
#include "irqs/wb/irqs.h"
|
2020-05-03 14:35:01 +02:00
|
|
|
#else
|
|
|
|
#error Not supported CPU family
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief ARM Cortex-M specific CPU configuration
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
#define CPU_DEFAULT_IRQ_PRIO (1U)
|
2020-11-05 12:11:48 +01:00
|
|
|
/* STM32MP1 family has no flah */
|
|
|
|
#if !defined(CPU_FAM_STM32MP1)
|
2020-07-24 15:05:27 +02:00
|
|
|
#define CPU_FLASH_BASE FLASH_BASE
|
2020-11-05 12:11:48 +01:00
|
|
|
#endif
|
2020-07-24 15:05:27 +02:00
|
|
|
|
|
|
|
/* CPU_IRQ_NUMOF cannot be determined automatically from cmsis header */
|
|
|
|
#if defined(CPU_LINE_STM32F030x4)
|
2020-05-03 14:35:01 +02:00
|
|
|
#define CPU_IRQ_NUMOF (28U)
|
2020-08-03 00:39:59 +02:00
|
|
|
#elif defined(CPU_MODEL_STM32MP157CAC)
|
|
|
|
#define CPU_IRQ_NUMOF (150U)
|
2020-05-03 14:35:01 +02:00
|
|
|
#endif
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Flash page configuration
|
|
|
|
* @{
|
|
|
|
*/
|
2020-09-28 15:58:30 +02:00
|
|
|
#if defined(CPU_FAM_STM32WB)
|
2020-05-03 14:35:01 +02:00
|
|
|
#define FLASHPAGE_SIZE (4096U)
|
|
|
|
#elif defined(CPU_LINE_STM32F091xC) || defined(CPU_LINE_STM32F072xB) \
|
|
|
|
|| defined(CPU_LINE_STM32F030xC) || defined(CPU_LINE_STM32F103xE) \
|
2020-05-23 17:26:54 +02:00
|
|
|
|| defined(CPU_FAM_STM32F3) || defined(CPU_FAM_STM32L4) \
|
2020-09-28 15:58:30 +02:00
|
|
|
|| defined(CPU_FAM_STM32G4) || defined(CPU_FAM_STM32G0) \
|
|
|
|
|| defined(CPU_FAM_STM32L5)
|
2020-05-03 14:35:01 +02:00
|
|
|
#define FLASHPAGE_SIZE (2048U)
|
|
|
|
#elif defined(CPU_LINE_STM32F051x8) || defined(CPU_LINE_STM32F042x6) \
|
|
|
|
|| defined(CPU_LINE_STM32F070xB) || defined(CPU_LINE_STM32F030x8) \
|
2020-07-15 11:51:44 +02:00
|
|
|
|| defined(CPU_LINE_STM32F030x4) || defined(CPU_LINE_STM32F103xB) \
|
|
|
|
|| defined(CPU_LINE_STM32F031x6)
|
2020-05-03 14:35:01 +02:00
|
|
|
#define FLASHPAGE_SIZE (1024U)
|
|
|
|
#elif defined(CPU_FAM_STM32L1)
|
|
|
|
#define FLASHPAGE_SIZE (256U)
|
|
|
|
#elif defined(CPU_FAM_STM32L0)
|
|
|
|
#define FLASHPAGE_SIZE (128U)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define FLASHPAGE_NUMOF (STM32_FLASHSIZE / FLASHPAGE_SIZE)
|
|
|
|
|
|
|
|
/* The minimum block size which can be written depends on the family.
|
|
|
|
* However, the erase block is always FLASHPAGE_SIZE.
|
|
|
|
*/
|
2020-05-23 17:26:54 +02:00
|
|
|
#if defined(CPU_FAM_STM32L4) || defined(CPU_FAM_STM32WB) || \
|
2020-09-28 15:57:01 +02:00
|
|
|
defined(CPU_FAM_STM32G4) || defined(CPU_FAM_STM32G0) || \
|
|
|
|
defined(CPU_FAM_STM32L5)
|
2020-11-09 16:45:22 +01:00
|
|
|
#define FLASHPAGE_WRITE_BLOCK_SIZE (8U)
|
2020-05-03 14:35:01 +02:00
|
|
|
#elif defined(CPU_FAM_STM32L0) || defined(CPU_FAM_STM32L1)
|
2020-11-09 16:45:22 +01:00
|
|
|
#define FLASHPAGE_WRITE_BLOCK_SIZE (4U)
|
2020-05-03 14:35:01 +02:00
|
|
|
#else
|
2020-11-09 16:45:22 +01:00
|
|
|
#define FLASHPAGE_WRITE_BLOCK_SIZE (2U)
|
2020-05-03 14:35:01 +02:00
|
|
|
#endif
|
|
|
|
|
2020-05-23 17:26:54 +02:00
|
|
|
#if defined(CPU_FAM_STM32L4) || defined(CPU_FAM_STM32WB) || \
|
2020-09-28 15:57:01 +02:00
|
|
|
defined(CPU_FAM_STM32G4) || defined(CPU_FAM_STM32G0) || \
|
|
|
|
defined(CPU_FAM_STM32L5)
|
2020-11-09 16:45:22 +01:00
|
|
|
#define FLASHPAGE_WRITE_BLOCK_ALIGNMENT (8U)
|
2020-05-03 14:35:01 +02:00
|
|
|
#else
|
|
|
|
/* Writing should be always 4 bytes aligned */
|
2020-11-09 16:45:22 +01:00
|
|
|
#define FLASHPAGE_WRITE_BLOCK_ALIGNMENT (4U)
|
2020-05-03 14:35:01 +02:00
|
|
|
#endif
|
|
|
|
/** @} */
|
|
|
|
|
2020-07-14 22:35:22 +02:00
|
|
|
/**
|
|
|
|
* @brief Bit-Band configuration
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
#ifdef SRAM_BB_BASE
|
|
|
|
#define CPU_HAS_BITBAND 1
|
|
|
|
#endif
|
|
|
|
/** @} */
|
|
|
|
|
2020-05-03 14:35:01 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* CPU_CONF_H */
|
|
|
|
/** @} */
|