This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new b492cc25f54 boards/arm/stm32g0: Add initial support to WeAct STM32G0B1
b492cc25f54 is described below

commit b492cc25f549a016ef36d0d9df84ac341e309402
Author: iamadahn <[email protected]>
AuthorDate: Tue Nov 3 15:02:12 2026 +0300

    boards/arm/stm32g0: Add initial support to WeAct STM32G0B1
    
    WeAct STM32G0B1 initial support with nsh.
    
    Signed-off-by: iamadahn <[email protected]>
---
 .../arm/stm32g0/boards/weact-stm32g0b1/index.rst   |  58 ++++++
 .../boards/weact-stm32g0b1/weact-stm32g0b1.png     | Bin 0 -> 511478 bytes
 boards/Kconfig                                     |  13 ++
 boards/arm/stm32g0/weact-stm32g0b1/CMakeLists.txt  |  23 +++
 boards/arm/stm32g0/weact-stm32g0b1/Kconfig         |   8 +
 .../stm32g0/weact-stm32g0b1/configs/nsh/defconfig  |  51 ++++++
 boards/arm/stm32g0/weact-stm32g0b1/include/board.h | 195 +++++++++++++++++++++
 .../arm/stm32g0/weact-stm32g0b1/scripts/Make.defs  |  37 ++++
 .../arm/stm32g0/weact-stm32g0b1/scripts/ld.script  | 115 ++++++++++++
 .../arm/stm32g0/weact-stm32g0b1/src/CMakeLists.txt |  35 ++++
 boards/arm/stm32g0/weact-stm32g0b1/src/Make.defs   |  35 ++++
 .../stm32g0/weact-stm32g0b1/src/stm32_autoleds.c   |  81 +++++++++
 .../arm/stm32g0/weact-stm32g0b1/src/stm32_boot.c   |  83 +++++++++
 .../stm32g0/weact-stm32g0b1/src/stm32_bringup.c    |  94 ++++++++++
 .../stm32g0/weact-stm32g0b1/src/stm32_buttons.c    | 119 +++++++++++++
 .../stm32g0/weact-stm32g0b1/src/weact-stm32g0b1.h  |  79 +++++++++
 16 files changed, 1026 insertions(+)

diff --git 
a/Documentation/platforms/arm/stm32g0/boards/weact-stm32g0b1/index.rst 
b/Documentation/platforms/arm/stm32g0/boards/weact-stm32g0b1/index.rst
new file mode 100644
index 00000000000..d2fb52fda0f
--- /dev/null
+++ b/Documentation/platforms/arm/stm32g0/boards/weact-stm32g0b1/index.rst
@@ -0,0 +1,58 @@
+======================
+WeAct Studio STM32G0B1
+======================
+
+.. tags:: arch:arm, chip:stm32g0, vendor:st
+
+This page discusses issues unique to NuttX configurations for the
+WeAct STM32G0B1 board.
+
+.. figure:: weact-stm32g0b1.png
+   :align: center
+
+Board information
+=================
+
+The board features:
+
+- nRST reset button and BOOT0 ST BootROM entry button,
+- One user LED and one user push-button,
+- HSE 8 Mhz and LSE 32.768 kHz,
+- USB OTG FS with Type-C connector,
+- Serial Wire Debug header for use with an external SWD/JTAG adapter.
+
+LEDs
+====
+
+The WeAct STM32G0B1 board has only one software controllable LED on PC6.
+This LED can be used by the board port when CONFIG_ARCH_LEDS option is
+enabled.
+
+If enabled the LED is simply turned on when the board boots
+successfully, and is blinking on panic / assertion failed.
+
+Buttons
+=======
+
+The WeAct STM32G0B1 board has only one button on PC13.
+
+Serial Console
+==============
+
+The default console is on USART3:
+
+  ========== =====
+  UART/USART PINS
+  ========== =====
+  TX         PB8
+  RX         PB9
+  ========== =====
+
+Configurations
+==============
+
+nsh
+---
+
+Configures the NuttShell (nsh) located at apps/examples/nsh. This
+configuration enables a serial console on UART3.
diff --git 
a/Documentation/platforms/arm/stm32g0/boards/weact-stm32g0b1/weact-stm32g0b1.png
 
b/Documentation/platforms/arm/stm32g0/boards/weact-stm32g0b1/weact-stm32g0b1.png
new file mode 100644
index 00000000000..938a0dd0e52
Binary files /dev/null and 
b/Documentation/platforms/arm/stm32g0/boards/weact-stm32g0b1/weact-stm32g0b1.png
 differ
diff --git a/boards/Kconfig b/boards/Kconfig
index 42fdfde24f4..f431ca30d79 100644
--- a/boards/Kconfig
+++ b/boards/Kconfig
@@ -2174,6 +2174,15 @@ config ARCH_BOARD_NUCLEO_G0B1RE
                This is a minimal configuration that supports low-level test of 
the
                Nucleo G0B1RE in the NuttX source tree.
 
+config ARCH_BOARD_WEACT_STM32G0B1
+       bool "WeAct Studio STM32G0B1"
+       depends on ARCH_CHIP_STM32G0B1CB
+       select ARCH_HAVE_LEDS
+       select ARCH_HAVE_BUTTONS
+       select ARCH_HAVE_IRQBUTTONS
+       ---help---
+               This is WeAct STM32G0B1 Core (STM32G0B1CBT6) board.
+
 config ARCH_BOARD_WEACT_STM32H743
        bool "WeAct Studio STM32H743"
        depends on ARCH_CHIP_STM32H743VI
@@ -4293,6 +4302,7 @@ config ARCH_BOARD
        default "nucleo-g070rb"                if ARCH_BOARD_NUCLEO_G070RB
        default "nucleo-g071rb"                if ARCH_BOARD_NUCLEO_G071RB
        default "nucleo-g0b1re"                if ARCH_BOARD_NUCLEO_G0B1RE
+       default "weact-stm32g0b1"              if ARCH_BOARD_WEACT_STM32G0B1
        default "weact-stm32h743"              if ARCH_BOARD_WEACT_STM32H743
        default "weact-stm32h750"              if ARCH_BOARD_WEACT_STM32H750
        default "nucleo-h723zg"                if ARCH_BOARD_NUCLEO_H723ZG
@@ -5061,6 +5071,9 @@ endif
 if ARCH_BOARD_NUCLEO_G0B1RE
 source "boards/arm/stm32g0/nucleo-g0b1re/Kconfig"
 endif
+if ARCH_BOARD_WEACT_STM32G0B1
+source "boards/arm/stm32g0/weact-stm32g0b1/Kconfig"
+endif
 if ARCH_BOARD_NUCLEO_L073RZ
 source "boards/arm/stm32l0/nucleo-l073rz/Kconfig"
 endif
diff --git a/boards/arm/stm32g0/weact-stm32g0b1/CMakeLists.txt 
b/boards/arm/stm32g0/weact-stm32g0b1/CMakeLists.txt
new file mode 100644
index 00000000000..cde79dc5820
--- /dev/null
+++ b/boards/arm/stm32g0/weact-stm32g0b1/CMakeLists.txt
@@ -0,0 +1,23 @@
+# 
##############################################################################
+# boards/arm/stm32g0/weact-stm32g0b1/CMakeLists.txt
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more 
contributor
+# license agreements.  See the NOTICE file distributed with this work for
+# additional information regarding copyright ownership.  The ASF licenses this
+# file to you under the Apache License, Version 2.0 (the "License"); you may 
not
+# use this file except in compliance with the License.  You may obtain a copy 
of
+# the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations under
+# the License.
+#
+# 
##############################################################################
+
+add_subdirectory(src)
diff --git a/boards/arm/stm32g0/weact-stm32g0b1/Kconfig 
b/boards/arm/stm32g0/weact-stm32g0b1/Kconfig
new file mode 100644
index 00000000000..2721332369a
--- /dev/null
+++ b/boards/arm/stm32g0/weact-stm32g0b1/Kconfig
@@ -0,0 +1,8 @@
+#
+# For a description of the syntax of this configuration file,
+# see the kconfig-language reference.
+#
+
+if ARCH_BOARD_WEACT_STM32G0B1
+
+endif # ARCH_BOARD_WEACT_STM32G0B1
diff --git a/boards/arm/stm32g0/weact-stm32g0b1/configs/nsh/defconfig 
b/boards/arm/stm32g0/weact-stm32g0b1/configs/nsh/defconfig
new file mode 100644
index 00000000000..58220d1f089
--- /dev/null
+++ b/boards/arm/stm32g0/weact-stm32g0b1/configs/nsh/defconfig
@@ -0,0 +1,51 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed 
.config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that 
includes your
+# modifications.
+#
+# CONFIG_NSH_ARGCAT is not set
+CONFIG_ARCH="arm"
+CONFIG_ARCH_BOARD="weact-stm32g0b1"
+CONFIG_ARCH_BOARD_COMMON=y
+CONFIG_ARCH_BOARD_WEACT_STM32G0B1=y
+CONFIG_ARCH_CHIP="stm32g0"
+CONFIG_ARCH_CHIP_STM32=y
+CONFIG_ARCH_CHIP_STM32G0=y
+CONFIG_ARCH_CHIP_STM32G0B1CB=y
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_BOARD_LOOPSPERMSEC=4164
+CONFIG_BUILTIN=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y
+CONFIG_EXAMPLES_HELLO=y
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INIT_STACKSIZE=1536
+CONFIG_INTELHEX_BINARY=y
+CONFIG_LINE_MAX=64
+CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=64
+CONFIG_NSH_READLINE=y
+CONFIG_NUNGET_CHARS=0
+CONFIG_POSIX_SPAWN_DEFAULT_STACKSIZE=1536
+CONFIG_PTHREAD_MUTEX_UNSAFE=y
+CONFIG_PTHREAD_STACK_DEFAULT=1536
+CONFIG_RAM_SIZE=147456
+CONFIG_RAM_START=0x20000000
+CONFIG_RAW_BINARY=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_WAITPID=y
+CONFIG_START_DAY=19
+CONFIG_START_MONTH=5
+CONFIG_START_YEAR=2013
+CONFIG_STDIO_DISABLE_BUFFERING=y
+CONFIG_STM32_PWR=y
+CONFIG_STM32_USART3=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_USART3_SERIAL_CONSOLE=y
diff --git a/boards/arm/stm32g0/weact-stm32g0b1/include/board.h 
b/boards/arm/stm32g0/weact-stm32g0b1/include/board.h
new file mode 100644
index 00000000000..033ea7ffbde
--- /dev/null
+++ b/boards/arm/stm32g0/weact-stm32g0b1/include/board.h
@@ -0,0 +1,195 @@
+/****************************************************************************
+ * boards/arm/stm32g0/weact-stm32g0b1/include/board.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_ARM_STM32F0L0G0_WEACT_STM32G0B1RE_INCLUDE_BOARD_H
+#define __BOARDS_ARM_STM32F0L0G0_WEACT_STM32G0B1RE_INCLUDE_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#ifndef __ASSEMBLY__
+#  include <stdint.h>
+#  include <stdbool.h>
+#endif
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Clocking *****************************************************************/
+
+/* HSI - Internal 16 MHz RC Oscillator
+ * LSI - 32 KHz RC
+ * HSE - 8 MHz from MCO output of ST-LINK (disabled by default)
+ * LSE - 32.768 kHz
+ */
+
+#define STM32_BOARD_XTAL        8000000ul
+
+#define STM32_HSI_FREQUENCY     16000000ul
+#define STM32_LSI_FREQUENCY     32000            /* Between 30kHz and 60kHz */
+#define STM32_HSE_FREQUENCY     STM32_BOARD_XTAL
+#define STM32_LSE_FREQUENCY     32768            /* X2 on board */
+
+/* Main PLL Configuration.
+ *
+ * PLL source is HSE = 8,000,000
+ *
+ * PLL_VCOx = (STM32_HSE_FREQUENCY / PLLM) * PLLN
+ * Subject to:
+ *
+ *     1 <= PLLM <= 8
+ *     8 <= PLLN <= 86
+ *   4 MHz <= PLL_IN <= 16MHz
+ *   64 MHz <= PLL_VCO <= 344MHz
+ * SYSCLK  = PLLRCLK = PLL_VCO / PLLR
+ *
+ */
+
+/* PLL source is HSE, PLLN=16, PLLM=1
+ * PLLP enable, PLLQ enable, PLLR enable
+ *
+ *   2 <= PLLP <= 32
+ *   2 <= PLLQ <= 8
+ *   2 <= PLLR <= 8
+ *
+ *   PLLR <= 64MHz
+ *   PLLQ <= 64MHz
+ *   PLLP <= 64MHz
+ *
+ *   PLL_VCO = (8,000,000 / 2) * 32 = 128 MHz
+ *
+ *   PLLP = PLL_VCO/2 = 128 MHz / 2 = 64 MHz
+ *   PLLQ = PLL_VCO/2 = 128 MHz / 2 = 64 MHz
+ *   PLLR = PLL_VCO/2 = 128 MHz / 2 = 64 MHz
+ */
+
+#define STM32_PLLCFG_PLLSRC     RCC_PLLCFG_PLLSRC_HSE
+#define STM32_PLLCFG_PLLCFG     (RCC_PLLCFG_PLLPEN | \
+                                 RCC_PLLCFG_PLLQEN | \
+                                 RCC_PLLCFG_PLLREN)
+
+#define STM32_PLLCFG_PLLM       RCC_PLLCFG_PLLM(1)
+#define STM32_PLLCFG_PLLN       RCC_PLLCFG_PLLN(16)
+#define STM32_PLLCFG_PLLP       RCC_PLLCFG_PLLP(2)
+#define STM32_PLLCFG_PLLQ       RCC_PLLCFG_PLLQ(2)
+#define STM32_PLLCFG_PLLR       RCC_PLLCFG_PLLR(2)
+
+#define STM32_VCO_FREQUENCY     ((STM32_HSE_FREQUENCY / 2) * 32)
+#define STM32_PLLP_FREQUENCY    (STM32_VCO_FREQUENCY / 2)
+#define STM32_PLLQ_FREQUENCY    (STM32_VCO_FREQUENCY / 2)
+#define STM32_PLLR_FREQUENCY    (STM32_VCO_FREQUENCY / 2)
+
+/* Use the PLL and set the SYSCLK source to be the PLLR (64MHz) */
+
+#define STM32_SYSCLK_SW         RCC_CFGR_SW_PLL
+#define STM32_SYSCLK_SWS        RCC_CFGR_SWS_PLL
+#define STM32_SYSCLK_FREQUENCY  (STM32_PLLR_FREQUENCY)
+
+/* AHB clock (HCLK) is SYSCLK (64MHz) */
+
+#define STM32_RCC_CFGR_HPRE     RCC_CFGR_HPRE_SYSCLK
+#define STM32_HCLK_FREQUENCY    STM32_SYSCLK_FREQUENCY
+
+/* APB1 clock (PCLK1) is HCLK/2 (32MHz) */
+
+#define STM32_RCC_CFGR_PPRE1    RCC_CFGR_PPRE1_HCLKd2
+#define STM32_PCLK1_FREQUENCY   (STM32_HCLK_FREQUENCY/2)
+
+/* Timers will receive PCLK1 * 2 */
+
+#define STM32_TIM1_CLKIN   (2 * STM32_PCLK1_FREQUENCY)
+#define STM32_TIM2_CLKIN   (2 * STM32_PCLK1_FREQUENCY)
+#define STM32_TIM3_CLKIN   (2 * STM32_PCLK1_FREQUENCY)
+#define STM32_TIM4_CLKIN   (2 * STM32_PCLK1_FREQUENCY)
+#define STM32_TIM6_CLKIN   (2 * STM32_PCLK1_FREQUENCY)
+#define STM32_TIM7_CLKIN   (2 * STM32_PCLK1_FREQUENCY)
+#define STM32_TIM14_CLKIN  (2 * STM32_PCLK1_FREQUENCY)
+#define STM32_TIM15_CLKIN  (2 * STM32_PCLK1_FREQUENCY)
+#define STM32_TIM16_CLKIN  (2 * STM32_PCLK1_FREQUENCY)
+#define STM32_TIM17_CLKIN  (2 * STM32_PCLK1_FREQUENCY)
+
+/* LED definitions **********************************************************/
+
+/* The board has 1 user LED that could be used this diagnostic LED too.
+ *
+ * If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in
+ * any way.
+ * The following definitions are used to access individual LEDs.
+ */
+
+/* LED index values for use with board_userled() */
+
+#define BOARD_LED1        0
+#define BOARD_NLEDS       1
+
+/* LED bits for use with board_userled_all() */
+
+#define BOARD_LED1_BIT   (1 << BOARD_LED1)
+
+/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the LED on board
+ * the WeAct-STM32G0B1. The following definitions describe how NuttX controls
+ * the LED:
+ *
+ *   SYMBOL              Meaning                  LED1 state
+ *   ------------------  -----------------------  ----------
+ *   LED_STARTED         NuttX has been started   OFF
+ *   LED_HEAPALLOCATE    Heap has been allocated  OFF
+ *   LED_IRQSENABLED     Interrupts enabled       OFF
+ *   LED_STACKCREATED    Idle stack created       ON
+ *   LED_INIRQ           In an interrupt          No change
+ *   LED_SIGNAL          In a signal handler      No change
+ *   LED_ASSERTION       An assertion failed      No change
+ *   LED_PANIC           The system has crashed   Blinking
+ *   LED_IDLE            STM32 is in sleep mode   Not used
+ */
+
+#define LED_STARTED      0
+#define LED_HEAPALLOCATE 0
+#define LED_IRQSENABLED  0
+#define LED_STACKCREATED 1
+#define LED_INIRQ        2
+#define LED_SIGNAL       2
+#define LED_ASSERTION    2
+#define LED_PANIC        1
+
+/* Button definitions *******************************************************/
+
+/* The WeAct-STM32G0B1 has one button.
+ */
+
+#define BUTTON_USER      0
+#define NUM_BUTTONS      1
+
+#define BUTTON_USER_BIT  (1 << BUTTON_USER)
+
+/* Alternate function pin selections ****************************************/
+
+/* USART */
+
+#define GPIO_USART3_RX (GPIO_USART3_RX_3|GPIO_SPEED_HIGH) /* PB9 */
+#define GPIO_USART3_TX (GPIO_USART3_TX_3|GPIO_SPEED_HIGH) /* PB8 */
+
+#endif /* __BOARDS_ARM_STM32F0L0G0_WEACT_STM32G0B1_INCLUDE_BOARD_H */
diff --git a/boards/arm/stm32g0/weact-stm32g0b1/scripts/Make.defs 
b/boards/arm/stm32g0/weact-stm32g0b1/scripts/Make.defs
new file mode 100644
index 00000000000..943ed97e21c
--- /dev/null
+++ b/boards/arm/stm32g0/weact-stm32g0b1/scripts/Make.defs
@@ -0,0 +1,37 @@
+############################################################################
+# boards/arm/stm32g0/weact-stm32g0b1/scripts/Make.defs
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+include $(TOPDIR)/.config
+include $(TOPDIR)/tools/Config.mk
+include $(TOPDIR)/arch/arm/src/armv6-m/Toolchain.defs
+
+LDSCRIPT = ld.script
+ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
+
+CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) 
$(ARCHDEFINES) $(EXTRAFLAGS)
+CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) 
$(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
+CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
+AFLAGS := $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) 
-T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
diff --git a/boards/arm/stm32g0/weact-stm32g0b1/scripts/ld.script 
b/boards/arm/stm32g0/weact-stm32g0b1/scripts/ld.script
new file mode 100644
index 00000000000..14e804d76bb
--- /dev/null
+++ b/boards/arm/stm32g0/weact-stm32g0b1/scripts/ld.script
@@ -0,0 +1,115 @@
+/****************************************************************************
+ * boards/arm/stm32g0/weact-stm32g0b1/scripts/ld.script
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* The STM32GOB1CB has 128Kb of FLASH beginning at address 0x0800:0000.
+ * 128Kb (with parity) or 144Kb (without parity) of SRAM
+ *
+ * When booting from FLASH, FLASH memory is aliased to address 0x0000:0000
+ * where the code expects to begin execution by jumping to the entry point in
+ * the 0x0800:0000 address range.
+ */
+
+MEMORY
+{
+  flash (rx) : ORIGIN = 0x08000000, LENGTH = 128K
+  sram (rwx) : ORIGIN = 0x20000000, LENGTH = 144K
+}
+
+OUTPUT_ARCH(arm)
+EXTERN(_vectors)
+ENTRY(_stext)
+SECTIONS
+{
+    .text : {
+        _stext = ABSOLUTE(.);
+        *(.vectors)
+        *(.text .text.*)
+        *(.fixup)
+        *(.gnu.warning)
+        *(.rodata .rodata.*)
+        *(.gnu.linkonce.t.*)
+        *(.glue_7)
+        *(.glue_7t)
+        *(.got)
+        *(.gcc_except_table)
+        *(.gnu.linkonce.r.*)
+        _etext = ABSOLUTE(.);
+    } > flash
+
+    .init_section : ALIGN(4) {
+        _sinit = ABSOLUTE(.);
+        KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) 
SORT_BY_INIT_PRIORITY(.ctors.*)))
+        KEEP(*(.init_array EXCLUDE_FILE(*crtbegin.o *crtbegin?.o *crtend.o 
*crtend?.o) .ctors))
+        _einit = ABSOLUTE(.);
+    } > flash
+
+    .ARM.extab : ALIGN(4) {
+        *(.ARM.extab*)
+    } > flash
+
+    .ARM.exidx : ALIGN(4) {
+        __exidx_start = ABSOLUTE(.);
+        *(.ARM.exidx*)
+        __exidx_end = ABSOLUTE(.);
+    } > flash
+
+    _eronly = ABSOLUTE(.);
+
+    /* The RAM vector table (if present) should lie at the beginning of SRAM */
+
+    .ram_vectors : {
+        *(.ram_vectors)
+    } > sram
+
+    .data : ALIGN(4) {
+        _sdata = ABSOLUTE(.);
+        *(.data .data.*)
+        *(.gnu.linkonce.d.*)
+        CONSTRUCTORS
+        . = ALIGN(4);
+        _edata = ABSOLUTE(.);
+    } > sram AT > flash
+
+    .bss : ALIGN(4) {
+        _sbss = ABSOLUTE(.);
+        *(.bss .bss.*)
+        *(.gnu.linkonce.b.*)
+        *(COMMON)
+        . = ALIGN(8);
+        _ebss = ABSOLUTE(.);
+    } > sram
+
+    /* Stabs debugging sections. */
+
+    .stab 0 : { *(.stab) }
+    .stabstr 0 : { *(.stabstr) }
+    .stab.excl 0 : { *(.stab.excl) }
+    .stab.exclstr 0 : { *(.stab.exclstr) }
+    .stab.index 0 : { *(.stab.index) }
+    .stab.indexstr 0 : { *(.stab.indexstr) }
+    .comment 0 : { *(.comment) }
+    .debug_abbrev 0 : { *(.debug_abbrev) }
+    .debug_info 0 : { *(.debug_info) }
+    .debug_line 0 : { *(.debug_line) }
+    .debug_pubnames 0 : { *(.debug_pubnames) }
+    .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/boards/arm/stm32g0/weact-stm32g0b1/src/CMakeLists.txt 
b/boards/arm/stm32g0/weact-stm32g0b1/src/CMakeLists.txt
new file mode 100644
index 00000000000..bd46f7f541a
--- /dev/null
+++ b/boards/arm/stm32g0/weact-stm32g0b1/src/CMakeLists.txt
@@ -0,0 +1,35 @@
+# 
##############################################################################
+# boards/arm/stm32g0/weact-stm32g0b1/src/CMakeLists.txt
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more 
contributor
+# license agreements.  See the NOTICE file distributed with this work for
+# additional information regarding copyright ownership.  The ASF licenses this
+# file to you under the Apache License, Version 2.0 (the "License"); you may 
not
+# use this file except in compliance with the License.  You may obtain a copy 
of
+# the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations under
+# the License.
+#
+# 
##############################################################################
+
+set(SRCS stm32_boot.c stm32_bringup.c)
+
+if(CONFIG_ARCH_LEDS)
+  list(APPEND SRCS stm32_autoleds.c)
+endif()
+
+if(CONFIG_ARCH_BUTTONS)
+  list(APPEND SRCS stm32_buttons.c)
+endif()
+
+target_sources(board PRIVATE ${SRCS})
+
+set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/ld.script")
diff --git a/boards/arm/stm32g0/weact-stm32g0b1/src/Make.defs 
b/boards/arm/stm32g0/weact-stm32g0b1/src/Make.defs
new file mode 100644
index 00000000000..35bcefdd03a
--- /dev/null
+++ b/boards/arm/stm32g0/weact-stm32g0b1/src/Make.defs
@@ -0,0 +1,35 @@
+############################################################################
+# boards/arm/stm32g0/weact-stm32g0b1/src/Make.defs
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+CSRCS = stm32_boot.c stm32_bringup.c
+
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += stm32_autoleds.c
+endif
+
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += stm32_buttons.c
+endif
+
+DEPPATH += --dep-path board
+VPATH += :board
+CFLAGS += 
${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board
diff --git a/boards/arm/stm32g0/weact-stm32g0b1/src/stm32_autoleds.c 
b/boards/arm/stm32g0/weact-stm32g0b1/src/stm32_autoleds.c
new file mode 100644
index 00000000000..492d2f115e7
--- /dev/null
+++ b/boards/arm/stm32g0/weact-stm32g0b1/src/stm32_autoleds.c
@@ -0,0 +1,81 @@
+/****************************************************************************
+ * boards/arm/stm32g0/weact-stm32g0b1/src/stm32_autoleds.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <nuttx/debug.h>
+
+#include <nuttx/board.h>
+
+#include "stm32_gpio.h"
+#include "weact-stm32g0b1.h"
+
+#include <arch/board/board.h>
+
+#ifdef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_autoled_initialize
+ ****************************************************************************/
+
+void board_autoled_initialize(void)
+{
+  /* Configure LED1 GPIO for output */
+
+  stm32_configgpio(GPIO_LED1);
+}
+
+/****************************************************************************
+ * Name: board_autoled_on
+ ****************************************************************************/
+
+void board_autoled_on(int led)
+{
+  if (led == BOARD_LED1)
+    {
+      stm32_gpiowrite(GPIO_LED1, true);
+    }
+}
+
+/****************************************************************************
+ * Name: board_autoled_off
+ ****************************************************************************/
+
+void board_autoled_off(int led)
+{
+  if (led == BOARD_LED1)
+    {
+      stm32_gpiowrite(GPIO_LED1, false);
+    }
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/boards/arm/stm32g0/weact-stm32g0b1/src/stm32_boot.c 
b/boards/arm/stm32g0/weact-stm32g0b1/src/stm32_boot.c
new file mode 100644
index 00000000000..a9b187d89e8
--- /dev/null
+++ b/boards/arm/stm32g0/weact-stm32g0b1/src/stm32_boot.c
@@ -0,0 +1,83 @@
+/****************************************************************************
+ * boards/arm/stm32g0/weact-stm32g0b1/src/stm32_boot.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+
+#include <nuttx/board.h>
+#include <nuttx/irq.h>
+#include <arch/board/board.h>
+
+#include "arm_internal.h"
+#include "weact-stm32g0b1.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ *   All STM32 architectures must provide the following entry point.  This
+ *   entry point is called early in the initialization -- after all memory
+ *   has been configured and mapped but before any devices have been
+ *   initialized.
+ *
+ ****************************************************************************/
+
+void stm32_boardinitialize(void)
+{
+#ifdef CONFIG_ARCH_LEDS
+  /* Configure on-board LEDs if LED support has been selected. */
+
+  board_autoled_initialize();
+#endif
+}
+
+/****************************************************************************
+ * Name: board_late_initialize
+ *
+ * Description:
+ *   If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
+ *   initialization call will be performed in the boot-up sequence to a
+ *   function called board_late_initialize().  board_late_initialize() will
+ *   be called immediately after up_initialize() is called and just before
+ *   the initial application is started.  This additional initialization
+ *   phase may be used, for example, to initialize board-specific device
+ *   drivers.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_BOARD_LATE_INITIALIZE
+void board_late_initialize(void)
+{
+  /* Perform board-specific initialization */
+
+  stm32_bringup();
+}
+#endif
diff --git a/boards/arm/stm32g0/weact-stm32g0b1/src/stm32_bringup.c 
b/boards/arm/stm32g0/weact-stm32g0b1/src/stm32_bringup.c
new file mode 100644
index 00000000000..91725d71e76
--- /dev/null
+++ b/boards/arm/stm32g0/weact-stm32g0b1/src/stm32_bringup.c
@@ -0,0 +1,94 @@
+/****************************************************************************
+ * boards/arm/stm32g0/weact-stm32g0b1/src/stm32_bringup.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/mount.h>
+#include <sys/types.h>
+#include <syslog.h>
+#include <nuttx/debug.h>
+
+#include <nuttx/board.h>
+#include <nuttx/input/buttons.h>
+#include <nuttx/leds/userled.h>
+#include <arch/board/board.h>
+
+#include "weact-stm32g0b1.h"
+#include "board_common.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#undef HAVE_LEDS
+
+#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER)
+#  define HAVE_LEDS 1
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_bringup
+ *
+ * Description:
+ *   Perform architecture-specific initialization
+ *
+ *   CONFIG_BOARD_LATE_INITIALIZE=y :
+ *     Called from board_late_initialize().
+ *
+ ****************************************************************************/
+
+int stm32_bringup(void)
+{
+  int ret;
+
+  /* Initialize the board features common to all STM32 boards */
+
+  ret = stm32_common_initialize();
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: stm32_common_initialize() failed: %d\n",
+             ret);
+    }
+
+#ifdef HAVE_LEDS
+  /* Register the LED driver */
+
+  ret = userled_lower_initialize(LED_DRIVER_PATH);
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n",
+             ret);
+      return ret;
+    }
+#endif
+
+  UNUSED(ret);
+  return OK;
+}
diff --git a/boards/arm/stm32g0/weact-stm32g0b1/src/stm32_buttons.c 
b/boards/arm/stm32g0/weact-stm32g0b1/src/stm32_buttons.c
new file mode 100644
index 00000000000..d2dc57acbdd
--- /dev/null
+++ b/boards/arm/stm32g0/weact-stm32g0b1/src/stm32_buttons.c
@@ -0,0 +1,119 @@
+/****************************************************************************
+ * boards/arm/stm32g0/weact-stm32g0b1/src/stm32_buttons.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <errno.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/board.h>
+
+#include "stm32_gpio.h"
+#include "weact-stm32g0b1.h"
+
+#include <arch/board/board.h>
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_button_initialize
+ *
+ * Description:
+ *   board_button_initialize() must be called to initialize button resources.
+ *   After that, board_buttons() may be called to collect the current state
+ *   of all buttons or board_button_irq() may be called to register button
+ *   interrupt handlers.
+ *
+ ****************************************************************************/
+
+uint32_t board_button_initialize(void)
+{
+  /* Configure the single button as an input.  NOTE that EXTI interrupts are
+   * also configured for the pin.
+   */
+
+  stm32_configgpio(GPIO_BTN_USER);
+  return NUM_BUTTONS;
+}
+
+/****************************************************************************
+ * Name: board_buttons
+ ****************************************************************************/
+
+uint32_t board_buttons(void)
+{
+  /* Check that state of each USER button. A LOW value means that the key is
+   * pressed.
+   */
+
+  bool released = stm32_gpioread(GPIO_BTN_USER);
+
+  return !released;
+}
+
+/****************************************************************************
+ * Button support.
+ *
+ * Description:
+ *   board_button_initialize() must be called to initialize button resources.
+ *   After that, board_buttons() may be called to collect the current state
+ *   of all buttons or board_button_irq() may be called to register button
+ *   interrupt handlers.
+ *
+ *   After board_button_initialize() has been called, board_buttons() may be
+ *   called to collect the state of all buttons.  board_buttons() returns an
+ *   32-bit bit set with each bit associated with a button.  See the
+ *   BUTTON_*_BIT definitions in board.h for the meaning of each bit.
+ *
+ *   board_button_irq() may be called to register an interrupt handler that
+ *   will be called when a button is depressed or released. The ID value is a
+ *   button enumeration value that uniquely identifies a button resource. See
+ *   the BUTTON_* definitions in board.h for the meaning of enumeration
+ *   value.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+int board_button_irq(int id, xcpt_t irqhandler, void *arg)
+{
+  int ret = -EINVAL;
+
+  if (id == BUTTON_USER)
+    {
+      ret = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true,
+                               irqhandler, arg);
+    }
+
+  return ret;
+}
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/boards/arm/stm32g0/weact-stm32g0b1/src/weact-stm32g0b1.h 
b/boards/arm/stm32g0/weact-stm32g0b1/src/weact-stm32g0b1.h
new file mode 100644
index 00000000000..ab4367f876e
--- /dev/null
+++ b/boards/arm/stm32g0/weact-stm32g0b1/src/weact-stm32g0b1.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+ * boards/arm/stm32g0/weact-stm32g0b1/src/weact-stm32g0b1.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_ARM_STM32F0L0G0_WEACT_STM32G0B1_SRC_WEACT_STM32G0B1_H
+#define __BOARDS_ARM_STM32F0L0G0_WEACT_STM32G0B1_SRC_WEACT_STM32G0B1_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* LEDS
+ *
+ * The WeAct STM32G0B1 board has only one Blue LED controlled by GPIO.
+ * LED: connected to PC6
+ */
+
+#define GPIO_LED1      (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_HIGH | \
+                        GPIO_OUTPUT_CLEAR | GPIO_PORTC | GPIO_PIN6)
+
+#define LED_DRIVER_PATH "/dev/userleds"
+
+/* BUTTONS
+ *
+ * The pushbutton is connected to GPIO PC13.
+ */
+
+#define MIN_IRQBUTTON  BUTTON_USER
+#define MAX_IRQBUTTON  BUTTON_USER
+#define NUM_IRQBUTTONS 1
+
+#define GPIO_BTN_USER  (GPIO_INPUT | GPIO_FLOAT | GPIO_EXTI | GPIO_PORTC | 
GPIO_PIN13)
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_bringup
+ *
+ * Description:
+ *   Perform architecture-specific initialization
+ *
+ *   CONFIG_BOARD_LATE_INITIALIZE=y :
+ *     Called from board_late_initialize().
+ *
+ ****************************************************************************/
+
+int stm32_bringup(void);
+
+#endif /* __BOARDS_ARM_STM32F0L0G0_WEACT_STM32G0B1_SRC_WEACT_STM32G0B1_H */

Reply via email to