Skip to content

Commit eb231be

Browse files
authored
Add HAL for STM32H5 family into MbedCE (#172)
* Add HALs to MbedCE * HALs for i3c like an option * Update stm32h5xx.h because of UTF-8 check
1 parent 34d31bd commit eb231be

File tree

241 files changed

+417679
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

241 files changed

+417679
-0
lines changed

targets/TARGET_STM/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ add_subdirectory(TARGET_STM32F4 EXCLUDE_FROM_ALL)
99
add_subdirectory(TARGET_STM32F7 EXCLUDE_FROM_ALL)
1010
add_subdirectory(TARGET_STM32G0 EXCLUDE_FROM_ALL)
1111
add_subdirectory(TARGET_STM32G4 EXCLUDE_FROM_ALL)
12+
add_subdirectory(TARGET_STM32H5 EXCLUDE_FROM_ALL)
1213
add_subdirectory(TARGET_STM32H7 EXCLUDE_FROM_ALL)
1314
add_subdirectory(TARGET_STM32L0 EXCLUDE_FROM_ALL)
1415
add_subdirectory(TARGET_STM32L1 EXCLUDE_FROM_ALL)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright (c) 2023 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_subdirectory(STM32Cube_FW EXCLUDE_FROM_ALL)
5+
6+
add_library(mbed-stm32h5 INTERFACE)
7+
8+
target_sources(mbed-stm32h5
9+
INTERFACE
10+
)
11+
12+
target_include_directories(mbed-stm32h5
13+
INTERFACE
14+
.
15+
)
16+
17+
target_link_libraries(mbed-stm32h5 INTERFACE mbed-stm mbed-stm32h5cube-fw)

targets/TARGET_STM/TARGET_STM32H5/STM32Cube_FW/CMSIS/stm32h503xx.h

Lines changed: 14040 additions & 0 deletions
Large diffs are not rendered by default.

targets/TARGET_STM/TARGET_STM32H5/STM32Cube_FW/CMSIS/stm32h562xx.h

Lines changed: 21472 additions & 0 deletions
Large diffs are not rendered by default.

targets/TARGET_STM/TARGET_STM32H5/STM32Cube_FW/CMSIS/stm32h563xx.h

Lines changed: 23608 additions & 0 deletions
Large diffs are not rendered by default.

targets/TARGET_STM/TARGET_STM32H5/STM32Cube_FW/CMSIS/stm32h573xx.h

Lines changed: 24557 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
/**
2+
******************************************************************************
3+
* @file stm32h5xx.h
4+
* @author MCD Application Team
5+
* @brief CMSIS STM32H5xx Device Peripheral Access Layer Header File.
6+
*
7+
* The file is the unique include file that the application programmer
8+
* is using in the C source code, usually in main.c. This file contains:
9+
* - Configuration section that allows to select:
10+
* - The STM32H5xx device used in the target application
11+
* - To use or not the peripheral's drivers in application code(i.e.
12+
* code will be based on direct access to peripheral's registers
13+
* rather than drivers API), this option is controlled by
14+
* "#define USE_HAL_DRIVER"
15+
*
16+
******************************************************************************
17+
* @attention
18+
*
19+
* Copyright (c) 2023 STMicroelectronics.
20+
* All rights reserved.
21+
*
22+
* This software is licensed under terms that can be found in the LICENSE file
23+
* in the root directory of this software component.
24+
* If no LICENSE file comes with this software, it is provided AS-IS.
25+
*
26+
******************************************************************************
27+
*/
28+
29+
/** @addtogroup CMSIS
30+
* @{
31+
*/
32+
33+
/** @addtogroup stm32h5xx
34+
* @{
35+
*/
36+
37+
#ifndef STM32H5xx_H
38+
#define STM32H5xx_H
39+
#include "math.h"
40+
41+
#ifdef __cplusplus
42+
extern "C" {
43+
#endif /* __cplusplus */
44+
45+
/** @addtogroup Library_configuration_section
46+
* @{
47+
*/
48+
49+
/**
50+
* @brief STM32 Family
51+
*/
52+
#if !defined (STM32H5)
53+
#define STM32H5
54+
#endif /* STM32H5 */
55+
56+
/* Uncomment the line below according to the target STM32H5 device used in your
57+
application
58+
*/
59+
60+
#if !defined (STM32H573xx) && !defined (STM32H563xx) \
61+
&& !defined (STM32H562xx) && !defined (STM32H503xx)
62+
/* #define STM32H573xx */ /*!< STM32H5753xx Devices */
63+
/* #define STM32H563xx */ /*!< STM32H563xx Devices */
64+
/* #define STM32H562xx */ /*!< STM32H562xx Devices */
65+
/* #define STM32H503xx */ /*!< STM32H503xx Devices */
66+
#endif
67+
68+
/* Tip: To avoid modifying this file each time you need to switch between these
69+
devices, you can define the device in your toolchain compiler preprocessor.
70+
*/
71+
#if !defined (USE_HAL_DRIVER)
72+
/**
73+
* @brief Comment the line below if you will not use the peripherals drivers.
74+
In this case, these drivers will not be included and the application code will
75+
be based on direct access to peripherals registers
76+
*/
77+
/*#define USE_HAL_DRIVER */
78+
#endif /* USE_HAL_DRIVER */
79+
80+
/**
81+
* @brief CMSIS Device version number 1.1.0
82+
*/
83+
#define __STM32H5_CMSIS_VERSION_MAIN (0x01) /*!< [31:24] main version */
84+
#define __STM32H5_CMSIS_VERSION_SUB1 (0x01) /*!< [23:16] sub1 version */
85+
#define __STM32H5_CMSIS_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
86+
#define __STM32H5_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */
87+
#define __STM32H5_CMSIS_VERSION ((__STM32H5_CMSIS_VERSION_MAIN << 24U)\
88+
|(__STM32H5_CMSIS_VERSION_SUB1 << 16U)\
89+
|(__STM32H5_CMSIS_VERSION_SUB2 << 8U )\
90+
|(__STM32H5_CMSIS_VERSION_RC))
91+
92+
/**
93+
* @}
94+
*/
95+
96+
/** @addtogroup Device_Included
97+
* @{
98+
*/
99+
100+
#if defined(STM32H573xx)
101+
#include "stm32h573xx.h"
102+
#elif defined(STM32H563xx)
103+
#include "stm32h563xx.h"
104+
#elif defined(STM32H562xx)
105+
#include "stm32h562xx.h"
106+
#elif defined(STM32H503xx)
107+
#include "stm32h503xx.h"
108+
#else
109+
#error "Please select first the target STM32H5xx device used in your application (in stm32h5xx.h file)"
110+
#endif
111+
112+
113+
/**
114+
* @}
115+
*/
116+
117+
/** @addtogroup Exported_types
118+
* @{
119+
*/
120+
typedef enum
121+
{
122+
RESET = 0,
123+
SET = !RESET
124+
} FlagStatus, ITStatus;
125+
126+
typedef enum
127+
{
128+
DISABLE = 0,
129+
ENABLE = !DISABLE
130+
} FunctionalState;
131+
#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
132+
133+
typedef enum
134+
{
135+
SUCCESS = 0,
136+
ERROR = !SUCCESS
137+
} ErrorStatus;
138+
139+
/**
140+
* @}
141+
*/
142+
143+
144+
/** @addtogroup Exported_macros
145+
* @{
146+
*/
147+
#define SET_BIT(REG, BIT) ((REG) |= (BIT))
148+
149+
#define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
150+
151+
#define READ_BIT(REG, BIT) ((REG) & (BIT))
152+
153+
#define CLEAR_REG(REG) ((REG) = (0x0))
154+
155+
#define WRITE_REG(REG, VAL) ((REG) = (VAL))
156+
157+
#define READ_REG(REG) ((REG))
158+
159+
#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
160+
161+
/* Use of CMSIS compiler intrinsics for register exclusive access */
162+
/* Atomic 32-bit register access macro to set one or several bits */
163+
#define ATOMIC_SET_BIT(REG, BIT) \
164+
do { \
165+
uint32_t val; \
166+
do { \
167+
val = __LDREXW((__IO uint32_t *)&(REG)) | (BIT); \
168+
} while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
169+
} while(0)
170+
171+
/* Atomic 32-bit register access macro to clear one or several bits */
172+
#define ATOMIC_CLEAR_BIT(REG, BIT) \
173+
do { \
174+
uint32_t val; \
175+
do { \
176+
val = __LDREXW((__IO uint32_t *)&(REG)) & ~(BIT); \
177+
} while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
178+
} while(0)
179+
180+
/* Atomic 32-bit register access macro to clear and set one or several bits */
181+
#define ATOMIC_MODIFY_REG(REG, CLEARMSK, SETMASK) \
182+
do { \
183+
uint32_t val; \
184+
do { \
185+
val = (__LDREXW((__IO uint32_t *)&(REG)) & ~(CLEARMSK)) | (SETMASK); \
186+
} while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
187+
} while(0)
188+
189+
/* Atomic 16-bit register access macro to set one or several bits */
190+
#define ATOMIC_SETH_BIT(REG, BIT) \
191+
do { \
192+
uint16_t val; \
193+
do { \
194+
val = __LDREXH((__IO uint16_t *)&(REG)) | (BIT); \
195+
} while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
196+
} while(0)
197+
198+
/* Atomic 16-bit register access macro to clear one or several bits */
199+
#define ATOMIC_CLEARH_BIT(REG, BIT) \
200+
do { \
201+
uint16_t val; \
202+
do { \
203+
val = __LDREXH((__IO uint16_t *)&(REG)) & ~(BIT); \
204+
} while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
205+
} while(0)
206+
207+
/* Atomic 16-bit register access macro to clear and set one or several bits */
208+
#define ATOMIC_MODIFYH_REG(REG, CLEARMSK, SETMASK) \
209+
do { \
210+
uint16_t val; \
211+
do { \
212+
val = (__LDREXH((__IO uint16_t *)&(REG)) & ~(CLEARMSK)) | (SETMASK); \
213+
} while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
214+
} while(0)
215+
216+
#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
217+
218+
219+
/**
220+
* @}
221+
*/
222+
223+
#if defined (USE_HAL_DRIVER)
224+
#include "stm32h5xx_hal.h"
225+
#endif /* USE_HAL_DRIVER */
226+
227+
#ifdef __cplusplus
228+
}
229+
#endif /* __cplusplus */
230+
231+
#endif /* STM32H5xx_H */
232+
/**
233+
* @}
234+
*/
235+
236+
/**
237+
* @}
238+
*/
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/**
2+
******************************************************************************
3+
* @file system_stm32h5xx.h
4+
* @author MCD Application Team
5+
* @brief CMSIS Cortex-M33 Device System Source File for STM32H5xx devices.
6+
******************************************************************************
7+
* @attention
8+
*
9+
* Copyright (c) 2023 STMicroelectronics.
10+
* All rights reserved.
11+
*
12+
* This software is licensed under terms that can be found in the LICENSE file
13+
* in the root directory of this software component.
14+
* If no LICENSE file comes with this software, it is provided AS-IS.
15+
*
16+
******************************************************************************
17+
*/
18+
19+
/** @addtogroup CMSIS
20+
* @{
21+
*/
22+
23+
/** @addtogroup stm32h5xx_system
24+
* @{
25+
*/
26+
27+
#ifndef SYSTEM_STM32H5XX_H
28+
#define SYSTEM_STM32H5XX_H
29+
30+
#ifdef __cplusplus
31+
extern "C" {
32+
#endif
33+
34+
/** @addtogroup STM32H5xx_System_Includes
35+
* @{
36+
*/
37+
38+
/**
39+
* @}
40+
*/
41+
42+
/** @addtogroup STM32H5xx_System_Exported_Variables
43+
* @{
44+
*/
45+
/* The SystemCoreClock variable is updated in three ways:
46+
1) by calling CMSIS function SystemCoreClockUpdate()
47+
2) by calling HAL API function HAL_RCC_GetSysClockFreq()
48+
3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
49+
Note: If you use this function to configure the system clock; then there
50+
is no need to call the 2 first functions listed above, since SystemCoreClock
51+
variable is updated automatically.
52+
*/
53+
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
54+
55+
extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
56+
extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */
57+
58+
/**
59+
* @}
60+
*/
61+
62+
63+
/** @addtogroup STM32H5xx_System_Exported_Functions
64+
* @{
65+
*/
66+
67+
/**
68+
* @brief Setup the microcontroller system.
69+
*
70+
* Initialize the System and update the SystemCoreClock variable.
71+
*/
72+
extern void SystemInit (void);
73+
74+
75+
/**
76+
* @brief Update SystemCoreClock variable.
77+
*
78+
* Updates the SystemCoreClock with current core Clock retrieved from cpu registers.
79+
*/
80+
extern void SystemCoreClockUpdate (void);
81+
82+
83+
/**
84+
* @brief Update SystemCoreClock variable from secure application and return its value
85+
* when security is implemented in the system (Non-secure callable function).
86+
*
87+
* Returns the SystemCoreClock value with current core Clock retrieved from cpu registers.
88+
*/
89+
extern uint32_t SECURE_SystemCoreClockUpdate(void);
90+
91+
/**
92+
* @}
93+
*/
94+
95+
#ifdef __cplusplus
96+
}
97+
#endif
98+
99+
#endif /* SYSTEM_STM32H5XX_H */
100+
101+
/**
102+
* @}
103+
*/
104+
105+
/**
106+
* @}
107+
*/

0 commit comments

Comments
 (0)