diff --git a/boards/weact/stm32g030_core/Kconfig.defconfig b/boards/weact/stm32g030_core/Kconfig.defconfig new file mode 100644 index 0000000000000..9ce72a31a3514 --- /dev/null +++ b/boards/weact/stm32g030_core/Kconfig.defconfig @@ -0,0 +1,12 @@ +# STM32G030 Core V1.0 board configuration + +# Copyright (c) 2025 Siratul Islam +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_WEACT_STM32G030_CORE + +config SPI_STM32_INTERRUPT + default y + depends on SPI + +endif # BOARD_WEACT_STM32G030_CORE diff --git a/boards/weact/stm32g030_core/Kconfig.weact_stm32g030_core b/boards/weact/stm32g030_core/Kconfig.weact_stm32g030_core new file mode 100644 index 0000000000000..c4e4d385770c3 --- /dev/null +++ b/boards/weact/stm32g030_core/Kconfig.weact_stm32g030_core @@ -0,0 +1,5 @@ +# Copyright (c) 2025 Siratul Islam +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_WEACT_STM32G030_CORE + select SOC_STM32G030XX diff --git a/boards/weact/stm32g030_core/board.cmake b/boards/weact/stm32g030_core/board.cmake new file mode 100644 index 0000000000000..611111dc2cdc5 --- /dev/null +++ b/boards/weact/stm32g030_core/board.cmake @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 + +# keep first +board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw") +board_runner_args(jlink "--device=STM32G031K8" "--speed=4000") + +# keep first +include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake) +include(${ZEPHYR_BASE}/boards/common/openocd-stm32.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/weact/stm32g030_core/board.yml b/boards/weact/stm32g030_core/board.yml new file mode 100644 index 0000000000000..e4c00472d1553 --- /dev/null +++ b/boards/weact/stm32g030_core/board.yml @@ -0,0 +1,6 @@ +board: + name: weact_stm32g030_core + full_name: STM32G030 Core Board 1.0 + vendor: weact + socs: + - name: stm32g030xx diff --git a/boards/weact/stm32g030_core/doc/img/weact_stm32g030_core.webp b/boards/weact/stm32g030_core/doc/img/weact_stm32g030_core.webp new file mode 100644 index 0000000000000..d18052f4c03d9 Binary files /dev/null and b/boards/weact/stm32g030_core/doc/img/weact_stm32g030_core.webp differ diff --git a/boards/weact/stm32g030_core/doc/index.rst b/boards/weact/stm32g030_core/doc/index.rst new file mode 100644 index 0000000000000..5579d09833c1a --- /dev/null +++ b/boards/weact/stm32g030_core/doc/index.rst @@ -0,0 +1,138 @@ +.. zephyr:board:: weact_stm32g030_core + +Overview +******** +The WeAct Studio STM32G030 Core Board provides an affordable and flexible way for +users to try out new concepts and build prototypes with the STM32G030F6 +microcontroller. This compact development board is designed for space-constrained +applications while maintaining essential functionality. + +The board requires an external ST-LINK or compatible SWD programmer +for flashing and debugging, as it does not include an onboard debugger. + +Hardware +******** +WeAct STM32G030 provides the following hardware components: + +- STM32G030F6P6 microcontroller in TSSOP-20 package featuring 32 Kbytes of Flash + memory and 8 Kbytes of SRAM +- Compact form factor optimized for embedded applications +- Exposed SWD header for programming and debugging (SWDIO, SWCLK, GND, 3V3) +- One user LED connected to PA4 (blue LED) +- NRST button for manual reset +- Flexible board power supply: + + - External 3.3V supply via power pins + - 5V input with onboard regulator + +- All GPIO pins broken out for maximum flexibility + +More information about STM32G030F6 can be found in the +`STM32G0x0 reference manual`_ and `STM32G030x6 datasheet`_. + +Supported Features +================== + +.. zephyr:board-supported-hw:: + +Connections and IOs +=================== + +Each of the GPIO pins can be configured by software as output (push-pull or open-drain), +as input (with or without pull-up or pull-down), or as peripheral alternate function. +Most of the GPIO pins are shared with digital or analog alternate functions. All GPIOs +are high current capable except for analog inputs. + +Default Zephyr Peripheral Mapping: +---------------------------------- + +- UART_1 TX/RX : PB6/PB7 (Primary Console) +- UART_2 TX/RX : PA2/PA3 (Secondary UART) +- I2C2 SCL/SDA : PA11/PA12 +- SPI1 SCK/MISO/MOSI : PA1/PA6/PA7 +- User LED : PA4 (Blue LED) +- SWD Interface : PA13 (SWDIO), PA14 (SWCLK) + +System Clock +------------ + +The WeAct STM32G030 board is configured to use the internal HSI oscillator at 16 MHz +with PLL to generate a system clock of 64 MHz. The board also includes LSE crystal +support for RTC applications. + +Programming and Debugging +************************* + +.. zephyr:board-supported-runners:: + +WeAct STM32G030 board requires an external ST-LINK/V2 or compatible SWD debugger for +programming and debugging. Connect your debugger to the SWD header: + +- SWDIO (PA13) +- SWCLK (PA14) +- GND +- 3V3 (optional, for powering the board) + +Flashing +======== + +The board is configured to be flashed using west `STM32CubeProgrammer`_ runner, +so its :ref:`installation ` is required. + +Alternatively, OpenOCD or JLink can also be used to flash the board using +the ``--runner`` (or ``-r``) option: + +.. code-block:: console + + $ west flash --runner openocd + $ west flash --runner jlink + +Flashing an application to WeAct STM32G030 +------------------------------------------- + +Connect your ST-LINK or compatible programmer to the SWD header on the board. + +Here is an example for the :zephyr:code-sample:`blinky` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: weact_stm32g030_core + :goals: build flash + +You will see the blue LED on PA4 blinking every second. + +Debugging +========= + +You can debug an application in the usual way. Here is an example for the +:zephyr:code-sample:`hello_world` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: weact_stm32g030_core + :maybe-skip-config: + :goals: debug + +Serial Console +============== + +The primary serial console is available on USART1 (PB6/PB7) at 115200 baud. Connect +a USB-to-serial adapter to these pins to access the Zephyr shell and console output: + +- TX: PB6 +- RX: PB7 +- GND: GND + +References +********** + +.. target-notes:: + +.. _STM32G0x0 reference manual: + https://www.st.com/resource/en/reference_manual/rm0454-stm32g0x0-advanced-armbased-32bit-mcus-stmicroelectronics.pdf + +.. _STM32G030x6 datasheet: + https://www.st.com/resource/en/datasheet/stm32g030c6.pdf + +.. _STM32CubeProgrammer: + https://www.st.com/en/development-tools/stm32cubeprog.html diff --git a/boards/weact/stm32g030_core/support/openocd.cfg b/boards/weact/stm32g030_core/support/openocd.cfg new file mode 100644 index 0000000000000..0001c39855b0d --- /dev/null +++ b/boards/weact/stm32g030_core/support/openocd.cfg @@ -0,0 +1,7 @@ +source [find interface/stlink.cfg] + +transport select hla_swd + +source [find target/stm32g0x.cfg] + +reset_config srst_only diff --git a/boards/weact/stm32g030_core/weact_stm32g030_core.dts b/boards/weact/stm32g030_core/weact_stm32g030_core.dts new file mode 100644 index 0000000000000..4f921dbc8aeee --- /dev/null +++ b/boards/weact/stm32g030_core/weact_stm32g030_core.dts @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2025 Siratul Islam + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include +#include + +/ { + model = "WeAct Studio STM32G030 Core Board"; + compatible = "weact,stm32g030-core"; + + chosen { + zephyr,console = &usart1; + zephyr,shell-uart = &usart1; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + }; + + leds: leds { + compatible = "gpio-leds"; + + blue_led: blue_led { + gpios = <&gpioa 4 GPIO_ACTIVE_HIGH>; + label = "User LED"; + }; + }; + + aliases { + led0 = &blue_led; + }; +}; + +&clk_hsi { + status = "okay"; +}; + +&clk_lse { + status = "okay"; +}; + +&pll { + div-m = <1>; + mul-n = <8>; + div-r = <2>; + clocks = <&clk_hsi>; + status = "okay"; +}; + +&rcc { + clocks = <&pll>; + clock-frequency = ; + ahb-prescaler = <1>; + apb1-prescaler = <1>; +}; + +&usart1 { + pinctrl-0 = <&usart1_tx_pb6 &usart1_rx_pb7>; + pinctrl-names = "default"; + current-speed = <115200>; + status = "okay"; +}; + +&usart2 { + pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>; + pinctrl-names = "default"; + current-speed = <115200>; + status = "okay"; +}; + +&i2c2 { + pinctrl-0 = <&i2c2_scl_pa11 &i2c2_sda_pa12>; + pinctrl-names = "default"; + clock-frequency = ; + status = "okay"; +}; + +&spi1 { + pinctrl-0 = <&spi1_sck_pa1 &spi1_miso_pa6 &spi1_mosi_pa7>; + pinctrl-names = "default"; + status = "okay"; +}; diff --git a/boards/weact/stm32g030_core/weact_stm32g030_core.yaml b/boards/weact/stm32g030_core/weact_stm32g030_core.yaml new file mode 100644 index 0000000000000..f743ba82d4829 --- /dev/null +++ b/boards/weact/stm32g030_core/weact_stm32g030_core.yaml @@ -0,0 +1,14 @@ +identifier: weact_stm32g030_core +name: WeAct Studio STM32G030 Core Board +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb +supported: + - gpio + - i2c + - spi +ram: 8 +flash: 32 +vendor: weact diff --git a/boards/weact/stm32g030_core/weact_stm32g030_core_defconfig b/boards/weact/stm32g030_core/weact_stm32g030_core_defconfig new file mode 100644 index 0000000000000..c60dfffbc3b86 --- /dev/null +++ b/boards/weact/stm32g030_core/weact_stm32g030_core_defconfig @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: Apache-2.0 + +# Serial Drivers +CONFIG_SERIAL=y +CONFIG_UART_INTERRUPT_DRIVEN=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# GPIO Controller +CONFIG_GPIO=y