STM MATLAB Simulator
Loading...
Searching...
No Matches
stm32f407xx_matlab_memory.h
Go to the documentation of this file.
1/**
2**************************************************************************
3* @file stm32f407xx_matlab_memory.h
4* @brief Заголовочный файл для определения памяти МК STM32F4xx.
5**************************************************************************
6@details
7В данном файле переопределяются дефайны памяти STM32 таким образом, чтобы
8к ним можно было обратиться в MATLAB.
9
10Конкретно, создается структуруа имитирующая память, и далее дефайны определяются
11так, чтобы обращаться к этой структуре, а не по абсолютному адресу.
12**************************************************************************/
13/**
14 \defgroup CMSIS_core_base Core Definitions
15 \brief Definitions for base addresses, unions, and structures.
16 @{
17 */
18
19 /* Memory mapping of Core Hardware */
20#define SCS_BASE_SHIFT (0x0000E000UL) /*!< System Control Space Base Address */
21#define ITM_BASE_SHIFT (0x00000000UL) /*!< ITM Base Address */
22#define DWT_BASE_SHIFT (0x00001000UL) /*!< DWT Base Address */
23#define TPI_BASE_SHIFT (0x00040000UL) /*!< TPI Base Address */
24#define CoreDebug_BASE_SHIFT (0x0000EDF0UL) /*!< Core Debug Base Address */
25
26typedef struct _cortex_memory
27{
28 uint8_t CORTEX_PERIPH_BASE[0xE0100000 - 0xE0000000];
31
32#define SCS_BASE (MCU_CORTEX_MEM.CORTEX_PERIPH_BASE) + SCS_BASE_SHIFT /*!< System Control Space Base Address */
33#define ITM_BASE (MCU_CORTEX_MEM.CORTEX_PERIPH_BASE) + SCS_BASE_SHIFT /*!< ITM Base Address */
34#define DWT_BASE (MCU_CORTEX_MEM.CORTEX_PERIPH_BASE) + SCS_BASE_SHIFT /*!< DWT Base Address */
35#define TPI_BASE (MCU_CORTEX_MEM.CORTEX_PERIPH_BASE) + SCS_BASE_SHIFT /*!< TPI Base Address */
36#define CoreDebug_BASE (MCU_CORTEX_MEM.CORTEX_PERIPH_BASE) + SCS_BASE_SHIFT /*!< Core Debug Base Address */
37#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
38#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
39#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
40
41#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
42#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
43#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
44#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
45#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */
46#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
47#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
48
49#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
50#define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
51#define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
52#endif
53
54#define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */
55#define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */
56
57/**
58 * @}
59 */
60
61
62
63/** @ingroup CMSIS_core_base
64 * @addtogroup Peripheral_memory_map Peripheral Memory Map
65 * @{
66 */
67
68#define FLASH_BASE_SHIFT 0x08000000UL /*!< FLASH(up to 1 MB) base address in the alias region */
69#define FLASH_END_SHIFT 0x080FFFFFUL /*!< FLASH end address */
70#define CCMDATARAM_BASE_SHIFT 0x10000000UL /*!< CCM(core coupled memory) data RAM(64 KB) base address in the alias region */
71#define CCMDATARAM_END_SHIFT 0x1000FFFFUL /*!< CCM data RAM end address */
72#define FLASH_OTP_BASE_SHIFT 0x1FFF7800UL /*!< Base address of : (up to 528 Bytes) embedded FLASH OTP Area */
73#define FLASH_OTP_END_SHIFT 0x1FFF7A0FUL /*!< End address of : (up to 528 Bytes) embedded FLASH OTP Area */
74#define SRAM1_BASE_SHIFT 0x20000000UL /*!< SRAM1(112 KB) base address in the alias region */
75#define SRAM2_BASE_SHIFT 0x2001C000UL /*!< SRAM2(16 KB) base address in the alias region */
76#define SRAM1_BB_BASE_SHIFT 0x22000000UL /*!< SRAM1(112 KB) base address in the bit-band region */
77#define SRAM2_BB_BASE_SHIFT 0x22380000UL /*!< SRAM2(16 KB) base address in the bit-band region */
78#define PERIPH_BASE_SHIFT 0x40000000UL /*!< Peripheral base address in the alias region */
79#define BKPSRAM_BASE_SHIFT 0x40024000UL /*!< Backup SRAM(4 KB) base address in the alias region */
80#define PERIPH_BB_BASE_SHIFT 0x42000000UL /*!< Peripheral base address in the bit-band region */
81#define BKPSRAM_BB_BASE_SHIFT 0x42480000UL /*!< Backup SRAM(4 KB) base address in the bit-band region */
82#define FSMC_R_BASE_SHIFT 0xA0000000UL /*!< FSMC registers base address */
83
84#define MCU_MEM_END 0xA0000FFFUL /*!< CCM data RAM end address */
85
86#define CCMDATARAM_SIZE 0x10000UL /* (64 KB) */
87#define SRAM1_SIZE 0x1C000UL /* (112 KB) */
88#define SRAM2_SIZE 0x4000UL /* (16 KB) */
89#define BKPSRAM_SIZE 0x1000UL /* (4 KB) */
90
91#define FLASH_SIZE (CCMDATARAM_BASE_SHIFT - FLASH_BASE_SHIFT)
92 //#define CCMDATARAM_SIZE (FLASH_OTP_BASE_SHIFT - CCMDATARAM_BASE_SHIFT)
93#define FLASH_OTP_SIZE (SRAM1_BASE_SHIFT - FLASH_OTP_BASE_SHIFT)
94//#define SRAM1_SIZE (SRAM2_BASE_SHIFT - SRAM1_BASE_SHIFT)
95//#define SRAM2_SIZE (SRAM1_BB_BASE_SHIFT - SRAM2_BASE_SHIFT)
96#define SRAM1_BB_SIZE (SRAM2_BB_BASE_SHIFT - SRAM1_BB_BASE_SHIFT)
97#define SRAM2_BB_SIZE (PERIPH_BASE_SHIFT - SRAM2_BB_BASE_SHIFT)
98#define PERIPH_SIZE (BKPSRAM_BASE_SHIFT - PERIPH_BASE_SHIFT)
99//#define BKPSRAM_SIZE (PERIPH_BB_BASE_SHIFT - BKPSRAM_BASE_SHIFT)
100#define PERIPH_BB_SIZE (BKPSRAM_BB_BASE_SHIFT - PERIPH_BB_BASE_SHIFT)
101//#define BKPSRAM_BB_SIZE (FSMC_R_BASE_SHIFT - BKPSRAM_BB_BASE_SHIFT)
102#define FSMC_R_SIZE (MCU_MEM_END - FSMC_R_BASE_SHIFT)
103#define DEBUG_MCU_SIZE (2)
104
105
125
126#define FLASH_BASE (MCU_MEM.CCMDATARAM_BASE) /*!< FLASH(up to 1 MB) base address in the alias region */
127#define CCMDATARAM_BASE (MCU_MEM.CCMDATARAM_BASE) /*!< CCM(core coupled memory) data RAM(64 KB) base address in the alias region */
128#define SRAM1_BASE (MCU_MEM.SRAM1_BASE) /*!< SRAM1(112 KB) base address in the alias region */
129#define SRAM2_BASE (MCU_MEM.SRAM2_BASE) /*!< SRAM2(16 KB) base address in the alias region */
130#define PERIPH_BASE (MCU_MEM.PERIPH_BASE) /*!< Peripheral base address in the alias region */
131#define BKPSRAM_BASE (MCU_MEM.BKPSRAM_BASE) /*!< Backup SRAM(4 KB) base address in the alias region */
132#define FSMC_R_BASE (MCU_MEM.FSMC_R_BASE) /*!< FSMC registers base address */
133#define SRAM1_BB_BASE (MCU_MEM.SRAM1_BB_BASE) /*!< SRAM1(112 KB) base address in the bit-band region */
134#define SRAM2_BB_BASE (MCU_MEM.SRAM2_BB_BASE) /*!< SRAM2(16 KB) base address in the bit-band region */
135#define PERIPH_BB_BASE (MCU_MEM.PERIPH_BB_BASE) /*!< Peripheral base address in the bit-band region */
136#define BKPSRAM_BB_BASE (MCU_MEM.BKPSRAM_BB_BASE) /*!< Backup SRAM(4 KB) base address in the bit-band region */
137#define FLASH_END (MCU_MEM.FLASH_END) /*!< FLASH end address */
138#define FLASH_OTP_BASE (MCU_MEM.FLASH_OTP_BASE) /*!< Base address of : (up to 528 Bytes) embedded FLASH OTP Area */
139#define FLASH_OTP_END (MCU_MEM.FLASH_OTP_END) /*!< End address of : (up to 528 Bytes) embedded FLASH OTP Area */
140#define CCMDATARAM_END (MCU_MEM.CCMDATARAM_END) /*!< CCM data RAM end address */
141
142/*!< Debug MCU registers base address */
143#define DBGMCU_BASE (MCU_MEM.DEBUG_MCU_BASE)
144/**
145 * @}
146 */
struct _cortex_memory MCU_CortexMemoryTypeDef
MCU_CortexMemoryTypeDef MCU_CORTEX_MEM
#define PERIPH_BB_SIZE
struct _memory MCU_MemoryTypeDef
#define FSMC_R_SIZE
#define DEBUG_MCU_SIZE
#define CCMDATARAM_SIZE
#define FLASH_OTP_SIZE
#define SRAM1_SIZE
#define SRAM2_SIZE
#define FLASH_SIZE
MCU_MemoryTypeDef MCU_MEM
#define PERIPH_SIZE
#define BKPSRAM_SIZE
uint8_t CORTEX_PERIPH_BASE[0xE0100000 - 0xE0000000]
uint8_t DEBUG_MCU_BASE[DEBUG_MCU_SIZE]
uint8_t PERIPH_BASE[PERIPH_SIZE]
uint8_t SRAM2_BASE[SRAM2_SIZE]
uint8_t SRAM2_BB_BASE[SRAM2_SIZE]
uint8_t FLASH_BASE[FLASH_SIZE]
uint8_t BKPSRAM_BB_BASE[BKPSRAM_SIZE]
uint8_t PERIPH_BB_BASE[PERIPH_BB_SIZE]
uint8_t SRAM1_BASE[SRAM1_SIZE]
uint8_t SRAM1_BB_BASE[SRAM1_SIZE]
uint8_t CCMDATARAM_BASE[CCMDATARAM_SIZE]
uint8_t FLASH_OTP_BASE[FLASH_OTP_SIZE]
uint8_t BKPSRAM_BASE[BKPSRAM_SIZE]
uint8_t FSMC_R_BASE[FSMC_R_SIZE]