Skip to content

Commit

Permalink
lib: update lib/stm32h7 to v1.9.0 for stm32h723
Browse files Browse the repository at this point in the history
Signed-off-by: Chen.BJ from BigTreeTech [email protected]
  • Loading branch information
bigtreetech authored and KevinOConnor committed Dec 2, 2022
1 parent c5d56f4 commit 50b2e2e
Show file tree
Hide file tree
Showing 23 changed files with 149,374 additions and 401 deletions.
2 changes: 1 addition & 1 deletion lib/README
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ taken from the Drivers/CMSIS/Device/ST/STM32L4xx/ directory.

The stm32h7 directory contains code from:
https://github.com/STMicroelectronics/STM32CubeH7
version v1.7.0 (79196b09acfb720589f58e93ccf956401b18a191). Contents
version v1.9.0 (ccb11556044540590ca6e45056e6b65cdca2deb2). Contents
taken from the Drivers/CMSIS/Device/ST/STM32H7xx/ directory.

The rp2040 directory contains code from the pico sdk:
Expand Down
24,234 changes: 24,234 additions & 0 deletions lib/stm32h7/include/stm32h723xx.h

Large diffs are not rendered by default.

24,246 changes: 24,246 additions & 0 deletions lib/stm32h7/include/stm32h725xx.h

Large diffs are not rendered by default.

24,725 changes: 24,725 additions & 0 deletions lib/stm32h7/include/stm32h730xx.h

Large diffs are not rendered by default.

24,737 changes: 24,737 additions & 0 deletions lib/stm32h7/include/stm32h730xxq.h

Large diffs are not rendered by default.

24,725 changes: 24,725 additions & 0 deletions lib/stm32h7/include/stm32h733xx.h

Large diffs are not rendered by default.

24,737 changes: 24,737 additions & 0 deletions lib/stm32h7/include/stm32h735xx.h

Large diffs are not rendered by default.

149 changes: 122 additions & 27 deletions lib/stm32h7/include/stm32h742xx.h

Large diffs are not rendered by default.

153 changes: 124 additions & 29 deletions lib/stm32h7/include/stm32h743xx.h

Large diffs are not rendered by default.

157 changes: 128 additions & 29 deletions lib/stm32h7/include/stm32h745xx.h

Large diffs are not rendered by default.

161 changes: 130 additions & 31 deletions lib/stm32h7/include/stm32h747xx.h

Large diffs are not rendered by default.

160 changes: 125 additions & 35 deletions lib/stm32h7/include/stm32h750xx.h

Large diffs are not rendered by default.

153 changes: 124 additions & 29 deletions lib/stm32h7/include/stm32h753xx.h

Large diffs are not rendered by default.

157 changes: 128 additions & 29 deletions lib/stm32h7/include/stm32h755xx.h

Large diffs are not rendered by default.

161 changes: 130 additions & 31 deletions lib/stm32h7/include/stm32h757xx.h

Large diffs are not rendered by default.

172 changes: 150 additions & 22 deletions lib/stm32h7/include/stm32h7a3xx.h

Large diffs are not rendered by default.

172 changes: 150 additions & 22 deletions lib/stm32h7/include/stm32h7a3xxq.h

Large diffs are not rendered by default.

178 changes: 150 additions & 28 deletions lib/stm32h7/include/stm32h7b0xx.h

Large diffs are not rendered by default.

178 changes: 150 additions & 28 deletions lib/stm32h7/include/stm32h7b0xxq.h

Large diffs are not rendered by default.

172 changes: 150 additions & 22 deletions lib/stm32h7/include/stm32h7b3xx.h

Large diffs are not rendered by default.

172 changes: 150 additions & 22 deletions lib/stm32h7/include/stm32h7b3xxq.h

Large diffs are not rendered by default.

33 changes: 26 additions & 7 deletions lib/stm32h7/include/stm32h7xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@

#if !defined (STM32H743xx) && !defined (STM32H753xx) && !defined (STM32H750xx) && !defined (STM32H742xx) && \
!defined (STM32H745xx) && !defined (STM32H755xx) && !defined (STM32H747xx) && !defined (STM32H757xx) && \
!defined (STM32H7A3xx) && !defined (STM32H7A3xxQ) && !defined (STM32H7B3xx) && !defined (STM32H7B3xxQ) && !defined (STM32H7B0xx) && !defined (STM32H7B0xxQ)
!defined (STM32H7A3xx) && !defined (STM32H7A3xxQ) && !defined (STM32H7B3xx) && !defined (STM32H7B3xxQ) && !defined (STM32H7B0xx) && !defined (STM32H7B0xxQ) && \
!defined (STM32H735xx) && !defined (STM32H733xx) && !defined (STM32H730xx) && !defined (STM32H730xxQ) && !defined (STM32H725xx) && !defined (STM32H723xx)
/* #define STM32H742xx */ /*!< STM32H742VI, STM32H742ZI, STM32H742AI, STM32H742II, STM32H742BI, STM32H742XI Devices */
/* #define STM32H743xx */ /*!< STM32H743VI, STM32H743ZI, STM32H743AI, STM32H743II, STM32H743BI, STM32H743XI Devices */
/* #define STM32H753xx */ /*!< STM32H753VI, STM32H753ZI, STM32H753AI, STM32H753II, STM32H753BI, STM32H753XI Devices */
Expand All @@ -74,6 +75,12 @@
/* #define STM32H7A3xxQ */ /*!< STM32H7A3QIY6Q, STM32H7A3IIK6Q, STM32H7A3IIT6Q, STM32H7A3LIH6Q, STM32H7A3VIH6Q, STM32H7A3VIT6Q, STM32H7A3AII6Q, STM32H7A3ZIT6Q */
/* #define STM32H7B3xx */ /*!< STM32H7B3IIK6, STM32H7B3IIT6, STM32H7B3NIH6, STM32H7B3RIT6, STM32H7B3VIH6, STM32H7B3VIT6, STM32H7B3ZIT6 */
/* #define STM32H7B3xxQ */ /*!< STM32H7B3QIY6Q, STM32H7B3IIK6Q, STM32H7B3IIT6Q, STM32H7B3LIH6Q, STM32H7B3VIH6Q, STM32H7B3VIT6Q, STM32H7B3AII6Q, STM32H7B3ZIT6Q */
/* #define STM32H735xx */ /*!< STM32H735AGI6, STM32H735IGK6, STM32H735RGV6, STM32H735VGT6, STM32H735VGY6, STM32H735ZGT6 Devices */
/* #define STM32H733xx */ /*!< STM32H733VGH6, STM32H733VGT6, STM32H733ZGI6, STM32H733ZGT6, Devices */
/* #define STM32H730xx */ /*!< STM32H730VBH6, STM32H730VBT6, STM32H730ZBT6, STM32H730ZBI6 Devices */
/* #define STM32H730xxQ */ /*!< STM32H730IBT6Q, STM32H730ABI6Q, STM32H730IBK6Q Devices */
/* #define STM32H725xx */ /*!< STM32H725AGI6, STM32H725IGK6, STM32H725IGT6, STM32H725RGV6, STM32H725VGT6, STM32H725VGY6, STM32H725ZGT6, STM32H725REV6, SM32H725VET6, STM32H725ZET6, STM32H725AEI6, STM32H725IET6, STM32H725IEK6 Devices */
/* #define STM32H723xx */ /*!< STM32H723VGH6, STM32H723VGT6, STM32H723ZGI6, STM32H723ZGT6, STM32H723VET6, STM32H723VEH6, STM32H723ZET6, STM32H723ZEI6 Devices */
#endif

/* Tip: To avoid modifying this file each time you need to switch between these
Expand All @@ -94,16 +101,16 @@
#endif /* USE_HAL_DRIVER */

/**
* @brief CMSIS Device version number V1.8.0
* @brief CMSIS Device version number V1.10.0
*/
#define __STM32H7xx_CMSIS_DEVICE_VERSION_MAIN (0x01) /*!< [31:24] main version */
#define __STM32H7xx_CMSIS_DEVICE_VERSION_SUB1 (0x08) /*!< [23:16] sub1 version */
#define __STM32H7xx_CMSIS_DEVICE_VERSION_SUB1 (0x0A) /*!< [23:16] sub1 version */
#define __STM32H7xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
#define __STM32H7xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
#define __STM32H7xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
|(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\
|(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\
|(__CMSIS_DEVICE_HAL_VERSION_RC))
#define __STM32H7xx_CMSIS_DEVICE_VERSION ((__STM32H7xx_CMSIS_DEVICE_VERSION_MAIN << 24)\
|(__STM32H7xx_CMSIS_DEVICE_VERSION_SUB1 << 16)\
|(__STM32H7xx_CMSIS_DEVICE_VERSION_SUB2 << 8 )\
|(__STM32H7xx_CMSIS_DEVICE_VERSION_RC))

/**
* @}
Expand Down Expand Up @@ -141,6 +148,18 @@
#include "stm32h7a3xxq.h"
#elif defined(STM32H7B3xxQ)
#include "stm32h7b3xxq.h"
#elif defined(STM32H735xx)
#include "stm32h735xx.h"
#elif defined(STM32H733xx)
#include "stm32h733xx.h"
#elif defined(STM32H730xx)
#include "stm32h730xx.h"
#elif defined(STM32H730xxQ)
#include "stm32h730xxq.h"
#elif defined(STM32H725xx)
#include "stm32h725xx.h"
#elif defined(STM32H723xx)
#include "stm32h723xx.h"
#else
#error "Please select first the target STM32H7xx device used in your application (in stm32h7xx.h file)"
#endif
Expand Down
41 changes: 32 additions & 9 deletions lib/stm32h7/system_stm32h7xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,29 @@ void SystemInit (void)
SCB->CPACR |= ((3UL << (10*2))|(3UL << (11*2))); /* set CP10 and CP11 Full Access */
#endif
/* Reset the RCC clock configuration to the default reset state ------------*/

/* Increasing the CPU frequency */
if(FLASH_LATENCY_DEFAULT > (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY)))
{
/* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */
MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, (uint32_t)(FLASH_LATENCY_DEFAULT));
}

/* Set HSION bit */
RCC->CR |= RCC_CR_HSION;

/* Reset CFGR register */
RCC->CFGR = 0x00000000;

/* Reset HSEON, CSSON , CSION,RC48ON, CSIKERON PLL1ON, PLL2ON and PLL3ON bits */
/* Reset HSEON, HSECSSON, CSION, HSI48ON, CSIKERON, PLL1ON, PLL2ON and PLL3ON bits */
RCC->CR &= 0xEAF6ED7FU;

/* Decreasing the number of wait states because of lower CPU frequency */
if(FLASH_LATENCY_DEFAULT < (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY)))
{
/* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */
MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, (uint32_t)(FLASH_LATENCY_DEFAULT));
}

#if defined(D3_SRAM_BASE)
/* Reset D1CFGR register */
Expand All @@ -177,23 +192,23 @@ void SystemInit (void)
RCC->SRDCFGR = 0x00000000;
#endif
/* Reset PLLCKSELR register */
RCC->PLLCKSELR = 0x00000000;
RCC->PLLCKSELR = 0x02020200;

/* Reset PLLCFGR register */
RCC->PLLCFGR = 0x00000000;
RCC->PLLCFGR = 0x01FF0000;
/* Reset PLL1DIVR register */
RCC->PLL1DIVR = 0x00000000;
RCC->PLL1DIVR = 0x01010280;
/* Reset PLL1FRACR register */
RCC->PLL1FRACR = 0x00000000;

/* Reset PLL2DIVR register */
RCC->PLL2DIVR = 0x00000000;
RCC->PLL2DIVR = 0x01010280;

/* Reset PLL2FRACR register */

RCC->PLL2FRACR = 0x00000000;
/* Reset PLL3DIVR register */
RCC->PLL3DIVR = 0x00000000;
RCC->PLL3DIVR = 0x01010280;

/* Reset PLL3FRACR register */
RCC->PLL3FRACR = 0x00000000;
Expand Down Expand Up @@ -231,13 +246,20 @@ void SystemInit (void)
#if defined(DUAL_CORE) && defined(CORE_CM4)
/* Configure the Vector Table location add offset address for cortex-M4 ------------------*/
#ifdef VECT_TAB_SRAM
SCB->VTOR = D2_AHBSRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
SCB->VTOR = D2_AXISRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
#else
SCB->VTOR = FLASH_BANK2_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
#endif /* VECT_TAB_SRAM */

#else

/*
* Disable the FMC bank1 (enabled after reset).
* This, prevents CPU speculation access on this bank which blocks the use of FMC during
* 24us. During this time the others FMC master (such as LTDC) cannot use it!
*/
FMC_Bank1_R->BTCR[0] = 0x000030D2;

/* Configure the Vector Table location add offset address for cortex-M7 ------------------*/
#ifdef VECT_TAB_SRAM
SCB->VTOR = D1_AXISRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal AXI-RAM */
Expand Down Expand Up @@ -339,7 +361,8 @@ void SystemCoreClockUpdate (void)
break;

default:
pllvco = ((float_t)CSI_VALUE / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR & RCC_PLL1DIVR_N1) + (fracn1/(float_t)0x2000) +(float_t)1 );
hsivalue = (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV)>> 3)) ;
pllvco = ((float_t)hsivalue / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR & RCC_PLL1DIVR_N1) + (fracn1/(float_t)0x2000) +(float_t)1 );
break;
}
pllp = (((RCC->PLL1DIVR & RCC_PLL1DIVR_P1) >>9) + 1U ) ;
Expand All @@ -352,7 +375,7 @@ void SystemCoreClockUpdate (void)
break;

default:
common_system_clock = CSI_VALUE;
common_system_clock = (uint32_t) (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV)>> 3));
break;
}

Expand Down

0 comments on commit 50b2e2e

Please sign in to comment.