<div dir="ltr"><div><div>Patch can also be found here: <a href="https://devel.rtems.org/ticket/4209#comment:3">https://devel.rtems.org/ticket/4209#comment:3</a> <br><br></div>Kind Regards<br></div>Robin<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 4 Jan 2021 at 16:12, Robin.Mueller <<a href="mailto:robin.mueller.m@gmail.com">robin.mueller.m@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I added the weak attribute to some configuration structs so users can can supply their own configuration<br>
structs (otherwise I got redeclaration linker errors).<br>
---<br>
 bsps/arm/stm32h7/console/console-usart3.c     | 23 ++++++++++++++++++-<br>
 bsps/arm/stm32h7/include/stm32h7xx_hal_conf.h |  8 +++++++<br>
 bsps/arm/stm32h7/include/stm32h7xx_hal_uart.h |  1 +<br>
 bsps/arm/stm32h7/start/stm32h7-config.c       | 11 ++++++---<br>
 bsps/arm/stm32h7/start/system_stm32h7xx.c     |  6 +++++<br>
 spec/build/bsps/arm/stm32h7/bspstm32h7.yml    |  2 ++<br>
 spec/build/bsps/arm/stm32h7/opth743nucleo.yml | 13 +++++++++++<br>
 7 files changed, 60 insertions(+), 4 deletions(-)<br>
 create mode 100644 spec/build/bsps/arm/stm32h7/opth743nucleo.yml<br>
<br>
diff --git a/bsps/arm/stm32h7/console/console-usart3.c b/bsps/arm/stm32h7/console/console-usart3.c<br>
index 6e0a10fe46..c84f6eb417 100644<br>
--- a/bsps/arm/stm32h7/console/console-usart3.c<br>
+++ b/bsps/arm/stm32h7/console/console-usart3.c<br>
@@ -25,13 +25,33 @@<br>
  * POSSIBILITY OF SUCH DAMAGE.<br>
  */<br>
<br>
+#ifdef __rtems__<br>
+#include <bspopts.h><br>
+#endif<br>
+<br>
 #ifdef HAVE_CONFIG_H<br>
 #include "config.h"<br>
 #endif<br>
<br>
 #include <stm32h7/hal.h><br>
<br>
-static const stm32h7_uart_config stm32h7_usart3_config = {<br>
+#if STM32H743ZI_NUCLEO == 1<br>
+__attribute__((weak)) static const stm32h7_uart_config stm32h7_usart3_config = {<br>
+  .gpio = {<br>
+    .regs = GPIOD,<br>
+    .config = {<br>
+      .Pin = GPIO_PIN_8 | GPIO_PIN_9,<br>
+      .Mode = GPIO_MODE_AF_PP,<br>
+      .Pull = GPIO_NOPULL,<br>
+      .Speed = GPIO_SPEED_FREQ_LOW,<br>
+      .Alternate = GPIO_AF7_USART3<br>
+    }<br>
+  },<br>
+  .irq = USART3_IRQn,<br>
+  .device_index = 2<br>
+};<br>
+#else<br>
+__attribute__((weak)) static const stm32h7_uart_config stm32h7_usart3_config = {<br>
   .gpio = {<br>
     .regs = GPIOB,<br>
     .config = {<br>
@@ -45,6 +65,7 @@ static const stm32h7_uart_config stm32h7_usart3_config = {<br>
   .irq = USART3_IRQn,<br>
   .device_index = 2<br>
 };<br>
+#endif<br>
<br>
 stm32h7_uart_context stm32h7_usart3_instance = {<br>
   .uart = {<br>
diff --git a/bsps/arm/stm32h7/include/stm32h7xx_hal_conf.h b/bsps/arm/stm32h7/include/stm32h7xx_hal_conf.h<br>
index d423e4f782..7dd73075ba 100644<br>
--- a/bsps/arm/stm32h7/include/stm32h7xx_hal_conf.h<br>
+++ b/bsps/arm/stm32h7/include/stm32h7xx_hal_conf.h<br>
@@ -21,6 +21,9 @@<br>
 #ifndef __STM32H7xx_HAL_CONF_H<br>
 #define __STM32H7xx_HAL_CONF_H<br>
<br>
+#ifdef __rtems__<br>
+#include <bspopts.h><br>
+#endif /* __rtems__ */<br>
 #ifdef __cplusplus<br>
  extern "C" {<br>
 #endif<br>
@@ -103,7 +106,12 @@<br>
   *        (when HSE is used as system clock source, directly or through the PLL).  <br>
   */<br>
 #if !defined  (HSE_VALUE) <br>
+#if STM32H743ZI_NUCLEO == 1<br>
+// HSE for the STM32H743ZI Nucleo<br>
+#define HSE_VALUE    ((uint32_t)8000000)<br>
+#else<br>
 #define HSE_VALUE    ((uint32_t)25000000) /*!< Value of the External oscillator in Hz : FPGA case fixed to 60MHZ */<br>
+#endif<br>
 #endif /* HSE_VALUE */<br>
<br>
 #if !defined  (HSE_STARTUP_TIMEOUT)<br>
diff --git a/bsps/arm/stm32h7/include/stm32h7xx_hal_uart.h b/bsps/arm/stm32h7/include/stm32h7xx_hal_uart.h<br>
index e9fecc4aa0..b171f7dac7 100644<br>
--- a/bsps/arm/stm32h7/include/stm32h7xx_hal_uart.h<br>
+++ b/bsps/arm/stm32h7/include/stm32h7xx_hal_uart.h<br>
@@ -27,6 +27,7 @@ extern "C" {<br>
<br>
 /* Includes ------------------------------------------------------------------*/<br>
 #include "stm32h7xx_hal_def.h"<br>
+#include "stm32h7xx_hal_dma.h"<br>
<br>
 /** @addtogroup STM32H7xx_HAL_Driver<br>
   * @{<br>
diff --git a/bsps/arm/stm32h7/start/stm32h7-config.c b/bsps/arm/stm32h7/start/stm32h7-config.c<br>
index 874ad047db..22422f2c38 100644<br>
--- a/bsps/arm/stm32h7/start/stm32h7-config.c<br>
+++ b/bsps/arm/stm32h7/start/stm32h7-config.c<br>
@@ -29,12 +29,17 @@<br>
 #include "config.h"<br>
 #endif<br>
<br>
+#ifdef __rtems__<br>
+#include <bspopts.h><br>
+#endif<br>
+<br>
 #include <stm32h7/hal.h><br>
<br>
+<br>
 const uint32_t stm32h7_config_pwr_regulator_voltagescaling =<br>
   PWR_REGULATOR_VOLTAGE_SCALE0;<br>
<br>
-const RCC_OscInitTypeDef stm32h7_config_oscillator = {<br>
+__attribute__((weak)) const RCC_OscInitTypeDef stm32h7_config_oscillator = {<br>
   .OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE<br>
     | RCC_OSCILLATORTYPE_LSE | RCC_OSCILLATORTYPE_HSI48,<br>
   .HSEState = RCC_HSE_ON,<br>
@@ -54,7 +59,7 @@ const RCC_OscInitTypeDef stm32h7_config_oscillator = {<br>
   .PLL.PLLFRACN = 0<br>
 };<br>
<br>
-const RCC_ClkInitTypeDef stm32h7_config_clocks = {<br>
+__attribute__((weak)) const RCC_ClkInitTypeDef stm32h7_config_clocks = {<br>
   .ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK<br>
     | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2<br>
     | RCC_CLOCKTYPE_D3PCLK1 | RCC_CLOCKTYPE_D1PCLK1,<br>
@@ -69,7 +74,7 @@ const RCC_ClkInitTypeDef stm32h7_config_clocks = {<br>
<br>
 const uint32_t stm32h7_config_flash_latency = FLASH_LATENCY_4;<br>
<br>
-const RCC_PeriphCLKInitTypeDef stm32h7_config_peripheral_clocks = {<br>
+__attribute__((weak)) const RCC_PeriphCLKInitTypeDef stm32h7_config_peripheral_clocks = {<br>
   .PeriphClockSelection = RCC_PERIPHCLK_RTC | RCC_PERIPHCLK_USART3<br>
     | RCC_PERIPHCLK_FDCAN | RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_I2C1<br>
     | RCC_PERIPHCLK_USB | RCC_PERIPHCLK_FMC | RCC_PERIPHCLK_RNG,<br>
diff --git a/bsps/arm/stm32h7/start/system_stm32h7xx.c b/bsps/arm/stm32h7/start/system_stm32h7xx.c<br>
index 092d853720..65c5a65ef0 100644<br>
--- a/bsps/arm/stm32h7/start/system_stm32h7xx.c<br>
+++ b/bsps/arm/stm32h7/start/system_stm32h7xx.c<br>
@@ -48,10 +48,16 @@<br>
 #include "stm32h7xx.h"<br>
 #include <math.h><br>
 #ifdef __rtems__<br>
+#include <bspopts.h><br>
 #include <bsp/linker-symbols.h><br>
 #endif /* __rtems__ */<br>
+<br>
 #if !defined  (HSE_VALUE)<br>
+#if STM32H743ZI_NUCLEO<br>
+#define HSE_VALUE    ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */<br>
+#else<br>
 #define HSE_VALUE    ((uint32_t)25000000) /*!< Value of the External oscillator in Hz */<br>
+#endif<br>
 #endif /* HSE_VALUE */<br>
<br>
 #if !defined  (CSI_VALUE)<br>
diff --git a/spec/build/bsps/arm/stm32h7/bspstm32h7.yml b/spec/build/bsps/arm/stm32h7/bspstm32h7.yml<br>
index 835247316c..cd3446d1d4 100644<br>
--- a/spec/build/bsps/arm/stm32h7/bspstm32h7.yml<br>
+++ b/spec/build/bsps/arm/stm32h7/bspstm32h7.yml<br>
@@ -244,6 +244,8 @@ links:<br>
   uid: ../../optconsolebaud<br>
 - role: build-dependency<br>
   uid: ../../optconsoleirq<br>
+- role: build-dependency<br>
+  uid: opth743nucleo<br>
 - role: build-dependency<br>
   uid: ../grp<br>
 - role: build-dependency<br>
diff --git a/spec/build/bsps/arm/stm32h7/opth743nucleo.yml b/spec/build/bsps/arm/stm32h7/opth743nucleo.yml<br>
new file mode 100644<br>
index 0000000000..3e68455893<br>
--- /dev/null<br>
+++ b/spec/build/bsps/arm/stm32h7/opth743nucleo.yml<br>
@@ -0,0 +1,13 @@<br>
+actions:<br>
+- get-boolean: null<br>
+- define-condition: null<br>
+build-type: option<br>
+default: false<br>
+default-by-variant: []<br>
+enabled-by: true<br>
+format: '{}'<br>
+links: []<br>
+name: STM32H743ZI_NUCLEO<br>
+description: |<br>
+  Nucleo board. Use 8 MHz HSE external clock.<br>
+type: build<br>
-- <br>
2.25.1<br>
<br>
<br>
>From 4e2645f7586508b0f68e2fb19f888e92d4ac5530 Mon Sep 17 00:00:00 2001<br>
From: "Robin.Mueller" <<a href="mailto:robin.mueller.m@gmail.com" target="_blank">robin.mueller.m@gmail.com</a>><br>
Date: Mon, 4 Jan 2021 16:00:46 +0100<br>
Subject: [PATCH 2/3] functions made public<br>
<br>
---<br>
 bsps/arm/stm32h7/console/console-usart3.c | 4 ++--<br>
 1 file changed, 2 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/bsps/arm/stm32h7/console/console-usart3.c b/bsps/arm/stm32h7/console/console-usart3.c<br>
index c84f6eb417..555669436e 100644<br>
--- a/bsps/arm/stm32h7/console/console-usart3.c<br>
+++ b/bsps/arm/stm32h7/console/console-usart3.c<br>
@@ -36,7 +36,7 @@<br>
 #include <stm32h7/hal.h><br>
<br>
 #if STM32H743ZI_NUCLEO == 1<br>
-__attribute__((weak)) static const stm32h7_uart_config stm32h7_usart3_config = {<br>
+__attribute__((weak)) const stm32h7_uart_config stm32h7_usart3_config = {<br>
   .gpio = {<br>
     .regs = GPIOD,<br>
     .config = {<br>
@@ -51,7 +51,7 @@ __attribute__((weak)) static const stm32h7_uart_config stm32h7_usart3_config = {<br>
   .device_index = 2<br>
 };<br>
 #else<br>
-__attribute__((weak)) static const stm32h7_uart_config stm32h7_usart3_config = {<br>
+__attribute__((weak)) const stm32h7_uart_config stm32h7_usart3_config = {<br>
   .gpio = {<br>
     .regs = GPIOB,<br>
     .config = {<br>
-- <br>
2.25.1<br>
<br>
<br>
>From 0cb2f4f4deb0015f96866bc00869095b2e637437 Mon Sep 17 00:00:00 2001<br>
From: "Robin.Mueller" <<a href="mailto:robin.mueller.m@gmail.com" target="_blank">robin.mueller.m@gmail.com</a>><br>
Date: Mon, 4 Jan 2021 16:04:03 +0100<br>
Subject: [PATCH 3/3] better help output<br>
<br>
---<br>
 spec/build/bsps/arm/stm32h7/opth743nucleo.yml | 2 +-<br>
 1 file changed, 1 insertion(+), 1 deletion(-)<br>
<br>
diff --git a/spec/build/bsps/arm/stm32h7/opth743nucleo.yml b/spec/build/bsps/arm/stm32h7/opth743nucleo.yml<br>
index 3e68455893..2c4176bf00 100644<br>
--- a/spec/build/bsps/arm/stm32h7/opth743nucleo.yml<br>
+++ b/spec/build/bsps/arm/stm32h7/opth743nucleo.yml<br>
@@ -9,5 +9,5 @@ format: '{}'<br>
 links: []<br>
 name: STM32H743ZI_NUCLEO<br>
 description: |<br>
-  Nucleo board. Use 8 MHz HSE external clock.<br>
+  Nucleo board. Use 8 MHz HSE external clock and different pins for the UART console.<br>
 type: build<br>
-- <br>
2.25.1<br>
<br>
</blockquote></div>