Skip to content

Commit f2a128b

Browse files
author
Jamie Smith
authored
Update STM32H5 HAL driver, fix some DMA bugs (#344)
* Update STM32H5 HAL driver, fix some DMA bugs * Disable LL driver * Add scancode ignore rules
1 parent 2bc173e commit f2a128b

File tree

155 files changed

+49083
-3978
lines changed

Some content is hidden

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

155 files changed

+49083
-3978
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/**
2+
******************************************************************************
3+
* @file partition_stm32h5xx.h
4+
* @author MCD Application Team
5+
* @brief CMSIS STM32H5xx Device Header File for Initial Setup for Secure /
6+
* Non-Secure Zones for ARMCM33 based on CMSIS CORE partition_ARMCM33.h
7+
* Template.
8+
*
9+
* The file is included in system_stm32h5xx_s.c in secure application.
10+
* It includes the configuration section that allows to select the
11+
* STM32H5xx device partitioning file for system core secure attributes
12+
* and interrupt secure and non-secure assignment.
13+
*
14+
******************************************************************************
15+
* Copyright (c) 2009-2019 Arm Limited. All rights reserved.
16+
* Copyright (c) 2023 STMicroelectronics. All rights reserved.
17+
*
18+
* SPDX-License-Identifier: Apache-2.0
19+
*
20+
* Licensed under the Apache License, Version 2.0 (the License); you may
21+
* not use this file except in compliance with the License.
22+
* You may obtain a copy of the License at
23+
*
24+
* www.apache.org/licenses/LICENSE-2.0
25+
*
26+
* Unless required by applicable law or agreed to in writing, software
27+
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
28+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29+
* See the License for the specific language governing permissions and
30+
* limitations under the License.
31+
******************************************************************************
32+
*/
33+
34+
/** @addtogroup CMSIS
35+
* @{
36+
*/
37+
38+
/** @addtogroup stm32h5xx
39+
* @{
40+
*/
41+
42+
#ifndef PARTITION_STM32H5XX_H
43+
#define PARTITION_STM32H5XX_H
44+
45+
#ifdef __cplusplus
46+
extern "C" {
47+
#endif /* __cplusplus */
48+
49+
/** @addtogroup Secure_configuration_section
50+
* @{
51+
*/
52+
53+
#if defined(STM32H573xx)
54+
#include "partition_stm32h573xx.h"
55+
#elif defined(STM32H563xx)
56+
#include "partition_stm32h563xx.h"
57+
#elif defined(STM32H562xx)
58+
#include "partition_stm32h562xx.h"
59+
#elif defined(STM32H533xx)
60+
#include "partition_stm32h533xx.h"
61+
#elif defined(STM32H523xx)
62+
#include "partition_stm32h523xx.h"
63+
#else
64+
#error "Please select first the target STM32H5xx device used in your application (in stm32h5xx.h file)"
65+
#endif
66+
67+
68+
#ifdef __cplusplus
69+
}
70+
#endif /* __cplusplus */
71+
72+
#endif /* PARTITION_STM32H5XX_H */
73+
/**
74+
* @}
75+
*/
76+
77+
/**
78+
* @}
79+
*/

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

Lines changed: 95 additions & 513 deletions
Large diffs are not rendered by default.

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

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

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

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

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

Lines changed: 482 additions & 85 deletions
Large diffs are not rendered by default.

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

Lines changed: 482 additions & 85 deletions
Large diffs are not rendered by default.

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

Lines changed: 133 additions & 86 deletions
Large diffs are not rendered by default.

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

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
* is using in the C source code, usually in main.c. This file contains:
99
* - Configuration section that allows to select:
1010
* - 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
11+
* - To use or not the peripheral drivers in application code(i.e.
12+
* code will be based on direct access to peripherals' registers
1313
* rather than drivers API), this option is controlled by
1414
* "#define USE_HAL_DRIVER"
1515
*
@@ -57,12 +57,15 @@
5757
application
5858
*/
5959

60-
#if !defined (STM32H573xx) && !defined (STM32H563xx) \
61-
&& !defined (STM32H562xx) && !defined (STM32H503xx)
62-
/* #define STM32H573xx */ /*!< STM32H5753xx Devices */
60+
#if !defined (STM32H573xx) && !defined (STM32H563xx) \
61+
&& !defined (STM32H562xx) && !defined (STM32H503xx) \
62+
&& !defined (STM32H533xx) && !defined (STM32H523xx)
63+
/* #define STM32H573xx */ /*!< STM32H573xx Devices */
6364
/* #define STM32H563xx */ /*!< STM32H563xx Devices */
6465
/* #define STM32H562xx */ /*!< STM32H562xx Devices */
65-
/* #define STM32H503xx */ /*!< STM32H503xx Devices */
66+
/* #define STM32H503xx */ /*!< STM32H503xx Devices */
67+
/* #define STM32H533xx */ /*!< STM32H533xx Devices */
68+
/* #define STM32H523xx */ /*!< STM32H523xx Devices */
6669
#endif
6770

6871
/* Tip: To avoid modifying this file each time you need to switch between these
@@ -78,12 +81,12 @@
7881
#endif /* USE_HAL_DRIVER */
7982

8083
/**
81-
* @brief CMSIS Device version number 1.1.0
84+
* @brief CMSIS Device version number 1.3.0
8285
*/
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 */
86+
#define __STM32H5_CMSIS_VERSION_MAIN (0x01U) /*!< [31:24] main version */
87+
#define __STM32H5_CMSIS_VERSION_SUB1 (0x03U) /*!< [23:16] sub1 version */
88+
#define __STM32H5_CMSIS_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */
89+
#define __STM32H5_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */
8790
#define __STM32H5_CMSIS_VERSION ((__STM32H5_CMSIS_VERSION_MAIN << 24U)\
8891
|(__STM32H5_CMSIS_VERSION_SUB1 << 16U)\
8992
|(__STM32H5_CMSIS_VERSION_SUB2 << 8U )\
@@ -96,7 +99,6 @@
9699
/** @addtogroup Device_Included
97100
* @{
98101
*/
99-
100102
#if defined(STM32H573xx)
101103
#include "stm32h573xx.h"
102104
#elif defined(STM32H563xx)
@@ -105,6 +107,10 @@
105107
#include "stm32h562xx.h"
106108
#elif defined(STM32H503xx)
107109
#include "stm32h503xx.h"
110+
#elif defined(STM32H523xx)
111+
#include "stm32h523xx.h"
112+
#elif defined(STM32H533xx)
113+
#include "stm32h533xx.h"
108114
#else
109115
#error "Please select first the target STM32H5xx device used in your application (in stm32h5xx.h file)"
110116
#endif

targets/TARGET_STM/TARGET_STM32H5/STM32Cube_FW/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ target_sources(mbed-stm32h5cube-fw
9797
STM32H5xx_HAL_Driver/stm32h5xx_ll_fmc.c
9898
STM32H5xx_HAL_Driver/stm32h5xx_ll_gpio.c
9999
STM32H5xx_HAL_Driver/stm32h5xx_ll_i2c.c
100-
STM32H5xx_HAL_Driver/stm32h5xx_ll_i3c.c
101100
STM32H5xx_HAL_Driver/stm32h5xx_ll_icache.c
102101
STM32H5xx_HAL_Driver/stm32h5xx_ll_lptim.c
103102
STM32H5xx_HAL_Driver/stm32h5xx_ll_lpuart.c
@@ -114,6 +113,9 @@ target_sources(mbed-stm32h5cube-fw
114113
STM32H5xx_HAL_Driver/stm32h5xx_ll_usb.c
115114
STM32H5xx_HAL_Driver/stm32h5xx_ll_utils.c
116115
STM32H5xx_HAL_Driver/stm32h5xx_util_i3c.c
116+
117+
# NOTE: Don't compile stm32h5xx_ll_i3c.c, it does not build if the
118+
# HAL driver for i3c is enabled due to a circular include issue.
117119
)
118120

119121
target_include_directories(mbed-stm32h5cube-fw

targets/TARGET_STM/TARGET_STM32H5/STM32Cube_FW/Note_add_new_STM32_family.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
# How to add new STM32 family
22
1. In path mbed-os\targets\TARGET_STM\ add new family folder, in our my case TARGET_STM32H5, and also do not forget add same name into CmakeLists.txt in same folder level.
33
2. In path mbed-os\targets\TARGET_STM\TARGET_STM32H5\ prepare another folders. First is STM32Cube_FW and second CMSIS
4-
3. Visit https://github.com/STMicroelectronics. Select package for your family and chose latest tag. Then download it as a zip.
5-
For example https://github.com/STMicroelectronics/STM32CubeH5/tree/v1.1.0
6-
4. Exctract the STM32CubeH5-1.1.0.zip
7-
6. From STM32CubeH5-1.1.0\STM32CubeH5-1.1.0\Drivers\CMSIS\Device\ST\STM32H5xx\Source\Templates copy system_stm32h5xx.c into mbed-os\targets\TARGET_STM\TARGET_STM32H5\STM32Cube_FW\
8-
5. From STM32CubeH5-1.1.0\Drivers\CMSIS\Device\ST\STM32H5xx\Include\ copy all .h files into mbed-os\targets\TARGET_STM\TARGET_STM32H5\STM32Cube_FW\CMSIS\
9-
6. From STM32CubeH5-1.1.0\Drivers copy dolder STM32H5xx_HAL_Driver folder into mbed-os\targets\TARGET_STM\TARGET_STM32H5\STM32Cube_FW\
10-
8. In mbed-os\targets\TARGET_STM\TARGET_STM32H5\STM32Cube_FW\STM32H5xx_HAL_Driver could be deleted everyting exclude folders Include and Source.
11-
9. Whole content of folders Include and Source (from previous point) move to from their folder to one level up. Then delete both folders.
12-
10. From folder STM32Cube_FW\STM32H5xx_HAL_Driver move file stm32h5xx_hal_conf_template.h to one folder level up.
4+
3. Clone or download the [stm32h5xx_hal_driver](https://github.com/STMicroelectronics/stm32h5xx_hal_driver) repository
5+
4. Copy `stm32h5xx_hal_driver/*.h` and `stm32h5xx_hal_driver/*.c` (but not the _template files) into `mbed-os\targets\TARGET_STM\TARGET_STM32H5\STM32Cube_FW\STM32H5xx_HAL_Driver`
6+
5. Clone or download [cmsis_device_h5](https://github.com/STMicroelectronics/cmsis_device_h5/tree/main)
7+
6. Copy `cmsis_device_h5\Include\*.h` to mbed-os\targets\TARGET_STM\TARGET_STM32H5\STM32Cube_FW\CMSIS\
8+
6. From `cmsis_device_h5\Source\Templates` copy system_stm32h5xx.c into mbed-os\targets\TARGET_STM\TARGET_STM32H5\STM32Cube_FW\
9+
10. From `stm32h5xx_hal_driver\Inc` move file stm32h5xx_hal_conf_template.h to one folder level up.
1310
- Rest of templates could be deleted.
1411
- The moved file stm32h5xx_hal_conf_template.h should be renamed to stm32h5xx_hal_conf.h
1512
- inside of stm32h5xx_hal_conf_template.h file should be all macros #define USE_HAL_XXXXXXXXX covered by macro #if !defined(USE_HAL_XXXXXXXXX) statement

0 commit comments

Comments
 (0)