Skip to content

Commit 96d8d89

Browse files
committed
system(H7): Update the system source file
Signed-off-by: Alexandre Bourdiol <[email protected]>
1 parent e97bce7 commit 96d8d89

File tree

2 files changed

+54
-26
lines changed

2 files changed

+54
-26
lines changed

system/STM32H7xx/stm32h7xx_hal_conf_default.h

+5-9
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
******************************************************************************
66
* @attention
77
*
8-
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
9-
* All rights reserved.</center></h2>
8+
* Copyright (c) 2017 STMicroelectronics.
9+
* All rights reserved.
1010
*
11-
* This software component is licensed by ST under BSD 3-Clause license,
12-
* the "License"; You may not use this file except in compliance with the
13-
* License. You may obtain a copy of the License at:
14-
* opensource.org/licenses/BSD-3-Clause
11+
* This software is licensed under terms that can be found in the LICENSE file
12+
* in the root directory of this software component.
13+
* If no LICENSE file comes with this software, it is provided AS-IS.
1514
*
1615
******************************************************************************
1716
*/
@@ -521,6 +520,3 @@ void assert_failed(uint8_t *file, uint32_t line);
521520
#endif
522521

523522
#endif /* __STM32H7xx_HAL_CONF_DEFAULT_H */
524-
525-
526-
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

system/STM32H7xx/system_stm32h7xx.c

+49-17
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@
2222
******************************************************************************
2323
* @attention
2424
*
25-
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
26-
* All rights reserved.</center></h2>
25+
* Copyright (c) 2017 STMicroelectronics.
26+
* All rights reserved.
2727
*
28-
* This software component is licensed by ST under BSD 3-Clause license,
29-
* the "License"; You may not use this file except in compliance with the
30-
* License. You may obtain a copy of the License at:
31-
* opensource.org/licenses/BSD-3-Clause
28+
* This software is licensed under terms that can be found in the LICENSE file
29+
* in the root directory of this software component.
30+
* If no LICENSE file comes with this software, it is provided AS-IS.
3231
*
3332
******************************************************************************
3433
*/
@@ -74,7 +73,45 @@
7473
#ifndef VECT_TAB_OFFSET
7574
#define VECT_TAB_OFFSET 0x00000000UL /*!< Vector Table base offset field.
7675
This value must be a multiple of 0x200. */
76+
#else
77+
78+
#define USER_VECT_TAB_ADDRESS
79+
7780
#endif
81+
82+
/* Note: Following vector table addresses must be defined in line with linker
83+
configuration. */
84+
/*!< Define USER_VECT_TAB_ADDRESS if you need to relocate the vector table
85+
86+
anywhere in Flash or Sram, else the vector table is kept at the automatic
87+
88+
remap of boot address selected */
89+
#if defined(USER_VECT_TAB_ADDRESS)
90+
#if defined(DUAL_CORE) && defined(CORE_CM4)
91+
/*!< Define VECT_TAB_SRAM if you need to relocate your vector Table
92+
93+
in Sram else user remap will be done in Flash. */
94+
#if defined(VECT_TAB_SRAM)
95+
#define VECT_TAB_BASE_ADDRESS D2_AXISRAM_BASE /*!< Vector Table base address field.
96+
This value must be a multiple of 0x200. */
97+
#else
98+
#define VECT_TAB_BASE_ADDRESS FLASH_BANK2_BASE /*!< Vector Table base address field.
99+
This value must be a multiple of 0x200. */
100+
#endif /* VECT_TAB_SRAM */
101+
#else
102+
/*!< Define VECT_TAB_SRAM if you need to relocate your vector Table
103+
104+
in Sram else user remap will be done in Flash. */
105+
#if defined(VECT_TAB_SRAM)
106+
#define VECT_TAB_BASE_ADDRESS D1_AXISRAM_BASE /*!< Vector Table base address field.
107+
This value must be a multiple of 0x200. */
108+
#else
109+
#define VECT_TAB_BASE_ADDRESS FLASH_BANK1_BASE /*!< Vector Table base address field.
110+
This value must be a multiple of 0x200. */
111+
#endif /* VECT_TAB_SRAM */
112+
#endif /* DUAL_CORE && CORE_CM4 */
113+
#endif /* USER_VECT_TAB_ADDRESS */
114+
78115
/******************************************************************************/
79116

80117
/**
@@ -235,11 +272,9 @@ void SystemInit (void)
235272

236273
#if defined(DUAL_CORE) && defined(CORE_CM4)
237274
/* Configure the Vector Table location add offset address for cortex-M4 ------------------*/
238-
#ifdef VECT_TAB_SRAM
239-
SCB->VTOR = D2_AXISRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
240-
#else
241-
SCB->VTOR = FLASH_BANK2_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
242-
#endif /* VECT_TAB_SRAM */
275+
#if defined(USER_VECT_TAB_ADDRESS)
276+
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal D2 AXI-RAM or in Internal FLASH */
277+
#endif /* USER_VECT_TAB_ADDRESS */
243278

244279
#else
245280

@@ -251,11 +286,9 @@ void SystemInit (void)
251286
FMC_Bank1_R->BTCR[0] = 0x000030D2;
252287

253288
/* Configure the Vector Table location add offset address for cortex-M7 ------------------*/
254-
#ifdef VECT_TAB_SRAM
255-
SCB->VTOR = D1_AXISRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal AXI-RAM */
256-
#else
257-
SCB->VTOR = FLASH_BANK1_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
258-
#endif
289+
#if defined(USER_VECT_TAB_ADDRESS)
290+
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal D1 AXI-RAM or in Internal FLASH */
291+
#endif /* USER_VECT_TAB_ADDRESS */
259292

260293
#endif /*DUAL_CORE && CORE_CM4*/
261294

@@ -407,4 +440,3 @@ void SystemCoreClockUpdate (void)
407440
/**
408441
* @}
409442
*/
410-
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

0 commit comments

Comments
 (0)