From 069b724f8060e1c12c86835842fa1881c0ac6b5f Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Fri, 25 Sep 2020 15:15:40 +0300 Subject: [PATCH] Added Generic H743Vx Supersede #1192 Signed-off-by: Vladimir Kozlov Co-authored-by: Frederic Pillon --- README.md | 4 + boards.txt | 88 +++++++++ .../generic_clock.c | 64 ++++++- .../ldscript.ld | 175 ++++++++++++++++++ 4 files changed, 329 insertions(+), 2 deletions(-) create mode 100644 variants/STM32H7xx/H742V(G-I)_H743V(G-I)Hx_H743VGTx_H743VITx_H750VBTx_H753VI/ldscript.ld diff --git a/README.md b/README.md index e11ff14d2b..5ba5e96616 100644 --- a/README.md +++ b/README.md @@ -265,14 +265,18 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d | Status | Device(s) | Name | Release | Notes | | :----: | :-------: | ---- | :-----: | :---- | +| :yellow_heart: | STM32H742VG
STM32H742VI | Generic Board | **2.0.0** | | | :yellow_heart: | STM32H742ZG
STM32H742ZI | Generic Board | **2.0.0** | | | :yellow_heart: | STM32H743IG
STM32H743II | Generic Board | **2.0.0** | | +| :yellow_heart: | STM32H743VG
STM32H743VI | Generic Board | **2.0.0** | | | :yellow_heart: | STM32H743ZG
STM32H743ZI | Generic Board | **2.0.0** | | | :yellow_heart: | STM32H747AG
STM32H747AI | Generic Board | **2.0.0** | | | :yellow_heart: | STM32H747IG
STM32H747II | Generic Board | **2.0.0** | | | :yellow_heart: | STM32H750ZB | Generic Board | **2.0.0** | | | :yellow_heart: | STM32H750IB
STM32H750II | Generic Board | **2.0.0** | | | :green_heart: | STM32H750IB | [Daisy ](https://www.electro-smith.com/daisy/daisy) | *1.9.0* | | +| :yellow_heart: | STM32H750VB | Generic Board | **2.0.0** | | +| :yellow_heart: | STM32H753VI | Generic Board | **2.0.0** | | | :yellow_heart: | STM32H753ZI | Generic Board | **2.0.0** | | | :yellow_heart: | STM32H757AI | Generic Board | **2.0.0** | | | :yellow_heart: | STM32H757II | Generic Board | **2.0.0** | | diff --git a/boards.txt b/boards.txt index a3bec9779d..70d8f807bb 100644 --- a/boards.txt +++ b/boards.txt @@ -2473,6 +2473,38 @@ GenH7.menu.pnum.DAISY_SEED.build.variant=STM32H7xx/H743IG_H743II_H750IBKx_H753II GenH7.menu.pnum.DAISY_SEED.build.peripheral_pins=-DCUSTOM_PERIPHERAL_PINS GenH7.menu.pnum.DAISY_SEED.build.ldscript=DAISY_SEED.ld +# Generic H742VGHx +GenH7.menu.pnum.GENERIC_H742VGHX=Generic H742VGHx +GenH7.menu.pnum.GENERIC_H742VGHX.upload.maximum_size=1048576 +GenH7.menu.pnum.GENERIC_H742VGHX.upload.maximum_data_size=524288 +GenH7.menu.pnum.GENERIC_H742VGHX.build.board=GENERIC_H742VGHX +GenH7.menu.pnum.GENERIC_H742VGHX.build.product_line=STM32H742xx +GenH7.menu.pnum.GENERIC_H742VGHX.build.variant=STM32H7xx/H742V(G-I)_H743V(G-I)Hx_H743VGTx_H743VITx_H750VBTx_H753VI + +# Generic H742VIHx +GenH7.menu.pnum.GENERIC_H742VIHX=Generic H742VIHx +GenH7.menu.pnum.GENERIC_H742VIHX.upload.maximum_size=2097152 +GenH7.menu.pnum.GENERIC_H742VIHX.upload.maximum_data_size=524288 +GenH7.menu.pnum.GENERIC_H742VIHX.build.board=GENERIC_H742VIHX +GenH7.menu.pnum.GENERIC_H742VIHX.build.product_line=STM32H742xx +GenH7.menu.pnum.GENERIC_H742VIHX.build.variant=STM32H7xx/H742V(G-I)_H743V(G-I)Hx_H743VGTx_H743VITx_H750VBTx_H753V + +# Generic H742VGTx +GenH7.menu.pnum.GENERIC_H742VGTX=Generic H742VGTx +GenH7.menu.pnum.GENERIC_H742VGTX.upload.maximum_size=1048576 +GenH7.menu.pnum.GENERIC_H742VGTX.upload.maximum_data_size=524288 +GenH7.menu.pnum.GENERIC_H742VGTX.build.board=GENERIC_H742VGTX +GenH7.menu.pnum.GENERIC_H742VGTX.build.product_line=STM32H742xx +GenH7.menu.pnum.GENERIC_H742VGTX.build.variant=STM32H7xx/H742V(G-I)_H743V(G-I)Hx_H743VGTx_H743VITx_H750VBTx_H753VI + +# Generic H742VITx +GenH7.menu.pnum.GENERIC_H742VITX=Generic H742VITx +GenH7.menu.pnum.GENERIC_H742VITX.upload.maximum_size=2097152 +GenH7.menu.pnum.GENERIC_H742VITX.upload.maximum_data_size=524288 +GenH7.menu.pnum.GENERIC_H742VITX.build.board=GENERIC_H742VITX +GenH7.menu.pnum.GENERIC_H742VITX.build.product_line=STM32H742xx +GenH7.menu.pnum.GENERIC_H742VITX.build.variant=STM32H7xx/H742V(G-I)_H743V(G-I)Hx_H743VGTx_H743VITx_H750VBTx_H753VI + # Generic H742ZGTx GenH7.menu.pnum.GENERIC_H742ZGTX=Generic H742ZGTx GenH7.menu.pnum.GENERIC_H742ZGTX.upload.maximum_size=1048576 @@ -2521,6 +2553,38 @@ GenH7.menu.pnum.GENERIC_H743IITX.build.board=GENERIC_H743IITX GenH7.menu.pnum.GENERIC_H743IITX.build.product_line=STM32H743xx GenH7.menu.pnum.GENERIC_H743IITX.build.variant=STM32H7xx/H743IG_H743II_H750IBKx_H753II +# Generic H743VGHx +GenH7.menu.pnum.GENERIC_H743VGHX=Generic H743VGHx +GenH7.menu.pnum.GENERIC_H743VGHX.upload.maximum_size=1048576 +GenH7.menu.pnum.GENERIC_H743VGHX.upload.maximum_data_size=524288 +GenH7.menu.pnum.GENERIC_H743VGHX.build.board=GENERIC_H743VGHX +GenH7.menu.pnum.GENERIC_H743VGHX.build.product_line=STM32H743xx +GenH7.menu.pnum.GENERIC_H743VGHX.build.variant=STM32H7xx/H742V(G-I)_H743V(G-I)Hx_H743VGTx_H743VITx_H750VBTx_H753VI + +# Generic H743VIHx +GenH7.menu.pnum.GENERIC_H743VIHX=Generic H743VIHx +GenH7.menu.pnum.GENERIC_H743VIHX.upload.maximum_size=2097152 +GenH7.menu.pnum.GENERIC_H743VIHX.upload.maximum_data_size=524288 +GenH7.menu.pnum.GENERIC_H743VIHX.build.board=GENERIC_H743VIHX +GenH7.menu.pnum.GENERIC_H743VIHX.build.product_line=STM32H743xx +GenH7.menu.pnum.GENERIC_H743VIHX.build.variant=STM32H7xx/H742V(G-I)_H743V(G-I)Hx_H743VGTx_H743VITx_H750VBTx_H753VI + +# Generic H743VGTx +GenH7.menu.pnum.GENERIC_H743VGTX=Generic H743VGTx +GenH7.menu.pnum.GENERIC_H743VGTX.upload.maximum_size=1048576 +GenH7.menu.pnum.GENERIC_H743VGTX.upload.maximum_data_size=524288 +GenH7.menu.pnum.GENERIC_H743VGTX.build.board=GENERIC_H743VGTX +GenH7.menu.pnum.GENERIC_H743VGTX.build.product_line=STM32H743xx +GenH7.menu.pnum.GENERIC_H743VGTX.build.variant=STM32H7xx/H742V(G-I)_H743V(G-I)Hx_H743VGTx_H743VITx_H750VBTx_H753VI + +# Generic H743VITx +GenH7.menu.pnum.GENERIC_H743VITX=Generic H743VITx +GenH7.menu.pnum.GENERIC_H743VITX.upload.maximum_size=2097152 +GenH7.menu.pnum.GENERIC_H743VITX.upload.maximum_data_size=524288 +GenH7.menu.pnum.GENERIC_H743VITX.build.board=GENERIC_H743VITX +GenH7.menu.pnum.GENERIC_H743VITX.build.product_line=STM32H743xx +GenH7.menu.pnum.GENERIC_H743VITX.build.variant=STM32H7xx/H742V(G-I)_H743V(G-I)Hx_H743VGTx_H743VITx_H750VBTx_H753VI + # Generic H743ZGTx GenH7.menu.pnum.GENERIC_H743ZGTX=Generic H743ZGTx GenH7.menu.pnum.GENERIC_H743ZGTX.upload.maximum_size=1048576 @@ -2577,6 +2641,14 @@ GenH7.menu.pnum.GENERIC_H750IBKX.build.board=GENERIC_H750IBKX GenH7.menu.pnum.GENERIC_H750IBKX.build.product_line=STM32H750xx GenH7.menu.pnum.GENERIC_H750IBKX.build.variant=STM32H7xx/H743IG_H743II_H750IBKx_H753II +# Generic H750VBTx +GenH7.menu.pnum.GENERIC_H750VBTX=Generic H750VBTx +GenH7.menu.pnum.GENERIC_H750VBTX.upload.maximum_size=131072 +GenH7.menu.pnum.GENERIC_H750VBTX.upload.maximum_data_size=524288 +GenH7.menu.pnum.GENERIC_H750VBTX.build.board=GENERIC_H750VBTX +GenH7.menu.pnum.GENERIC_H750VBTX.build.product_line=STM32H750xx +GenH7.menu.pnum.GENERIC_H750VBTX.build.variant=STM32H7xx/H742V(G-I)_H743V(G-I)Hx_H743VGTx_H743VITx_H750VBTx_H753VI + # Generic H750ZBTx GenH7.menu.pnum.GENERIC_H750ZBTX=Generic H750ZBTx GenH7.menu.pnum.GENERIC_H750ZBTX.upload.maximum_size=131072 @@ -2601,6 +2673,22 @@ GenH7.menu.pnum.GENERIC_H753IITX.build.board=GENERIC_H753IITX GenH7.menu.pnum.GENERIC_H753IITX.build.product_line=STM32H753xx GenH7.menu.pnum.GENERIC_H753IITX.build.variant=STM32H7xx/H743IG_H743II_H750IBKx_H753II +# Generic H753VIHx +GenH7.menu.pnum.GENERIC_H753VIHX=Generic H753VIHx +GenH7.menu.pnum.GENERIC_H753VIHX.upload.maximum_size=2097152 +GenH7.menu.pnum.GENERIC_H753VIHX.upload.maximum_data_size=524288 +GenH7.menu.pnum.GENERIC_H753VIHX.build.board=GENERIC_H753VIHX +GenH7.menu.pnum.GENERIC_H753VIHX.build.product_line=STM32H753xx +GenH7.menu.pnum.GENERIC_H753VIHX.build.variant=STM32H7xx/H742V(G-I)_H743V(G-I)Hx_H743VGTx_H743VITx_H750VBTx_H753VI + +# Generic H753VITx +GenH7.menu.pnum.GENERIC_H753VITX=Generic H753VITx +GenH7.menu.pnum.GENERIC_H753VITX.upload.maximum_size=2097152 +GenH7.menu.pnum.GENERIC_H753VITX.upload.maximum_data_size=524288 +GenH7.menu.pnum.GENERIC_H753VITX.build.board=GENERIC_H753VITX +GenH7.menu.pnum.GENERIC_H753VITX.build.product_line=STM32H753xx +GenH7.menu.pnum.GENERIC_H753VITX.build.variant=STM32H7xx/H742V(G-I)_H743V(G-I)Hx_H743VGTx_H743VITx_H750VBTx_H753VI + # Generic H753ZITx GenH7.menu.pnum.GENERIC_H753ZITX=Generic H753ZITx GenH7.menu.pnum.GENERIC_H753ZITX.upload.maximum_size=2097152 diff --git a/variants/STM32H7xx/H742V(G-I)_H743V(G-I)Hx_H743VGTx_H743VITx_H750VBTx_H753VI/generic_clock.c b/variants/STM32H7xx/H742V(G-I)_H743V(G-I)Hx_H743VGTx_H743VITx_H750VBTx_H753VI/generic_clock.c index 2effde92f0..147bcf6708 100644 --- a/variants/STM32H7xx/H742V(G-I)_H743V(G-I)Hx_H743VGTx_H743VITx_H750VBTx_H753VI/generic_clock.c +++ b/variants/STM32H7xx/H742V(G-I)_H743V(G-I)Hx_H743VGTx_H743VITx_H750VBTx_H753VI/generic_clock.c @@ -25,8 +25,68 @@ */ WEAK void SystemClock_Config(void) { - /* SystemClock_Config can be generated by STM32CubeMX */ -#warning "SystemClock_Config() is empty. Default clock at reset is used." + RCC_OscInitTypeDef RCC_OscInitStruct = {}; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {}; + RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {}; + + /** Supply configuration update enable + */ + HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY); + /** Configure the main internal regulator output voltage + */ + __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE0); + + while (!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {} + /** Initializes the RCC Oscillators according to the specified parameters + * in the RCC_OscInitTypeDef structure. + */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48 | RCC_OSCILLATORTYPE_HSI; + RCC_OscInitStruct.HSIState = RCC_HSI_DIV1; + RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; + RCC_OscInitStruct.HSI48State = RCC_HSI48_ON; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; + RCC_OscInitStruct.PLL.PLLM = 4; + RCC_OscInitStruct.PLL.PLLN = 60; + RCC_OscInitStruct.PLL.PLLP = 2; + RCC_OscInitStruct.PLL.PLLQ = 4; + RCC_OscInitStruct.PLL.PLLR = 2; + RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_3; + RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE; + RCC_OscInitStruct.PLL.PLLFRACN = 0; + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { + Error_Handler(); + } + /** Initializes the CPU, AHB and APB buses clocks + */ + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK + | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2 + | RCC_CLOCKTYPE_D3PCLK1 | RCC_CLOCKTYPE_D1PCLK1; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2; + RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV2; + RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2; + RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2; + RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2; + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK) { + Error_Handler(); + } + + PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_QSPI | RCC_PERIPHCLK_SDMMC | RCC_PERIPHCLK_USB; + PeriphClkInitStruct.QspiClockSelection = RCC_QSPICLKSOURCE_D1HCLK; + PeriphClkInitStruct.SdmmcClockSelection = RCC_SDMMCCLKSOURCE_PLL; + PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_HSI48; + if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) { + Error_Handler(); + } + + + + /** Enable USB Voltage detector + */ + HAL_PWREx_EnableUSBVoltageDetector(); + } #endif /* ARDUINO_GENERIC_* */ diff --git a/variants/STM32H7xx/H742V(G-I)_H743V(G-I)Hx_H743VGTx_H743VITx_H750VBTx_H753VI/ldscript.ld b/variants/STM32H7xx/H742V(G-I)_H743V(G-I)Hx_H743VGTx_H743VITx_H750VBTx_H753VI/ldscript.ld new file mode 100644 index 0000000000..fe2f17eb50 --- /dev/null +++ b/variants/STM32H7xx/H742V(G-I)_H743V(G-I)Hx_H743VGTx_H743VITx_H750VBTx_H753VI/ldscript.ld @@ -0,0 +1,175 @@ +/* +****************************************************************************** +** +** File : LinkerScript.ld +** +** Author : STM32CubeIDE +** +** Abstract : Linker script for STM32H7 series +** 2048Kbytes FLASH and 192Kbytes RAM +** +** Set heap size, stack size and stack location according +** to application requirements. +** +** Set memory bank area and size if external memory is used. +** +** Target : STMicroelectronics STM32 +** +** Distribution: The file is distributed as is, without any warranty +** of any kind. +** +***************************************************************************** +** @attention +** +** Copyright (c) 2019 STMicroelectronics. +** All rights reserved. +** +** This software component is licensed by ST under BSD 3-Clause license, +** the "License"; You may not use this file except in compliance with the +** License. You may obtain a copy of the License at: +** opensource.org/licenses/BSD-3-Clause +** +**************************************************************************** +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = ORIGIN(RAM_D1) + LENGTH(RAM_D1); /* end of RAM_D1 */ +/* Generate a link error if heap and stack don't fit into RAM_D1 */ +_Min_Heap_Size = 0x200 ; /* required amount of heap */ +_Min_Stack_Size = 0x400 ; /* required amount of stack */ + +/* Specify the memory areas */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K + RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 512K + RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 288K + RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 64K + ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text : + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data goes into FLASH */ + .rodata : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >FLASH + + .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH + .ARM : { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >FLASH + + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } >FLASH + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } >FLASH + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections goes into RAM_D1, load LMA copy after code */ + .data : + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + *(.RamFunc) /* .RamFunc sections */ + *(.RamFunc*) /* .RamFunc* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + } >RAM_D1 AT> FLASH + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss secion */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM_D1 + + /* User_heap_stack section, used to check that there is enough RAM_D1 left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >RAM_D1 + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} + +