diff --git a/boards/realtek/rtl8777g_dongle/Kconfig.defconfig b/boards/realtek/rtl8777g_dongle/Kconfig.defconfig new file mode 100644 index 0000000000000..f3d59942b2d43 --- /dev/null +++ b/boards/realtek/rtl8777g_dongle/Kconfig.defconfig @@ -0,0 +1,47 @@ +# Copyright (c) 2025 Realtek Semiconductor Corp. +# SPDX-License-Identifier: Apache-2.0 +if BOARD_RTL8777G_DONGLE + +config BOARD + default "rtl8777g_dongle" + +if BT +config NUM_METAIRQ_PRIORITIES + default 1 + +config MAIN_STACK_SIZE + default 2048 + +config COMMON_LIBC_MALLOC_ARENA_SIZE + default 1024 + +config BT_CTLR + default n + +config REALTEK_BT + default y + +config BT_L2CAP_TX_MTU + default 247 + +config BT_BUF_EVT_RX_COUNT + default 8 + +config BT_BUF_EVT_RX_SIZE + default 255 + +config BT_BUF_ACL_TX_SIZE + default 251 + +config BT_BUF_ACL_RX_SIZE + default 255 + +config BT_BUF_ACL_RX_COUNT + default 7 + +endif # BT + +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + +endif # BOARD_RTL8777G_DONGLE diff --git a/boards/realtek/rtl8777g_dongle/Kconfig.rtl8777g_dongle b/boards/realtek/rtl8777g_dongle/Kconfig.rtl8777g_dongle new file mode 100644 index 0000000000000..b4ea58f1c0999 --- /dev/null +++ b/boards/realtek/rtl8777g_dongle/Kconfig.rtl8777g_dongle @@ -0,0 +1,4 @@ +# Copyright (c) 2025 Realtek Semiconductor Corp. +# SPDX-License-Identifier: Apache-2.0 +config BOARD_RTL8777G_DONGLE + select SOC_RTL8777G diff --git a/boards/realtek/rtl8777g_dongle/board.cmake b/boards/realtek/rtl8777g_dongle/board.cmake new file mode 100644 index 0000000000000..b0fdd3ded1d02 --- /dev/null +++ b/boards/realtek/rtl8777g_dongle/board.cmake @@ -0,0 +1,3 @@ +board_runner_args(jlink "--device=RTL87X2G" "--speed=4000") + +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/realtek/rtl8777g_dongle/board.yml b/boards/realtek/rtl8777g_dongle/board.yml new file mode 100644 index 0000000000000..f0dbffa2afde8 --- /dev/null +++ b/boards/realtek/rtl8777g_dongle/board.yml @@ -0,0 +1,5 @@ +board: + name: rtl8777g_dongle + vendor: realtek + socs: + - name: rtl8777g diff --git a/boards/realtek/rtl8777g_dongle/doc/index.rst b/boards/realtek/rtl8777g_dongle/doc/index.rst new file mode 100644 index 0000000000000..673d422ed7f64 --- /dev/null +++ b/boards/realtek/rtl8777g_dongle/doc/index.rst @@ -0,0 +1,105 @@ +.. _rtl8777g_dongle: + +RTL8777G Dongle Evaluation Board +################################# + +Overview +******** + +The RTL8777G Dongle Evaluation Board provides a hardware environment for user development, including: + +- 1x Reset button +- 4x Buttons +- 3x LEDs +- 1x Micro USB-B port (connected to FT232RL USB-to-UART chip) +- 1x USB-A connector +- 25x Exposed pins (user-configurable) +- On-board ceramic antenna and IPEX socket (for optional external antenna) +- 5V to 3.3V LDO +- UART programming interface + +The RTL8777G Dongle Evaluation Board features the RTL8777G SoC. +RTL8777G is an ultra-low power wireless microcontroller that supports Bluetooth 5.3/Zigbee/Thread/Matter protocols. + +.. note:: + The RTL8777G is part of the RTL87x2G series chip family (despite the naming inconsistency). + +Hardware +******** + +SoC Series +========== + +The RTL8777G/RTL87x2G series comprises various chip types, each supporting different hardware features. + +Below are the common hardware features: + +- Realtek KM4 core compatible with Arm Cortex-M55, running at 40MHz (Maximum 125MHz) +- M-profile Vector Extension (MVE) for vector computation +- 32KB I-Cache, 16KB D-Cache, and 384KB SRAM +- Hardware Keyscan / Quad Decode +- Flash On-The-Fly Decryption +- Embedded IR TX/RX +- ISO7816 Interface +- SPIC/SPI_m/SPI_s/SDIO/SD (eMMC) +- Low Power Comparator +- 8-Channel AUXADC +- CAN Bus +- I2S/DAC/AMIC/DMIC/PDM +- USB 2.0 High-Speed Interface + +Connections and IOs +=================== + +The UART2 console uses P3_0 (TX) and P3_1 (RX), connected through the on-board FT232RL +USB-to-UART converter accessible via the Micro USB-B port. + +LEDs: + +- LED D1 Blue: GPIOA_21 (P2_0), active high +- LED D2 Red: GPIOA_18 (P8_2, XO32K), active high +- LED D3 Green: GPIOA_17 (P8_1, XI32K), active high + +Buttons (active low, internal pull-up): + +- SW1: GPIOB_22 (P9_1) +- SW2: GPIOB_21 (P9_0) +- SW3: GPIOB_8 (P4_3) +- SW4: GPIOB_7 (P4_2) + +System Clock +============ + +The RTL8777G SoC is configured to use the internal 32KHz clock as a source for the +system clock, with the CPU running at 40MHz. + +Serial Port +=========== + +The RTL8777G SoC has 6 UARTs. By default, UART2 is configured for the console and +log output at 115200 baud. + +Programming and Debugging +************************* + +Flashing +======== + +Before flashing, ensure the SoC is in download mode: + +1. Use a jumper to connect the LOG pin (P0_3) with GND. +2. Press the RST button once to reboot the SoC and enter download mode. +3. Flash using mpcli or JLink. +4. Remove the jumper and press RST to enter normal mode. + +To build and flash the :zephyr:code-sample:`hello_world` sample: + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: rtl8777g_dongle + :goals: build flash + +References +********** + +- `RTL87x2G Introduction `_ diff --git a/boards/realtek/rtl8777g_dongle/rtl8777g_dongle-pinctrl.dtsi b/boards/realtek/rtl8777g_dongle/rtl8777g_dongle-pinctrl.dtsi new file mode 100644 index 0000000000000..f3604c6458222 --- /dev/null +++ b/boards/realtek/rtl8777g_dongle/rtl8777g_dongle-pinctrl.dtsi @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2025 Realtek Semiconductor Corp. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&pinctrl { + uart2_default: uart2_default { + group1 { + psels = , + ; + }; + }; +}; diff --git a/boards/realtek/rtl8777g_dongle/rtl8777g_dongle.dts b/boards/realtek/rtl8777g_dongle/rtl8777g_dongle.dts new file mode 100644 index 0000000000000..a448229c67759 --- /dev/null +++ b/boards/realtek/rtl8777g_dongle/rtl8777g_dongle.dts @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2025 Realtek Semiconductor Corp. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include +#include "rtl8777g_dongle-pinctrl.dtsi" + +/ { + model = "Realtek RTL8777G Dongle Evaluation Board"; + compatible = "realtek,rtl8777g_dongle"; + + chosen { + zephyr,sram = &tcm0; + zephyr,flash = &flash; + zephyr,code-partition = &app_partition; + zephyr,itcm = &tcm1; + zephyr,console = &uart2; + zephyr,shell-uart = &uart2; + zephyr,flash-controller = &fmc; + zephyr,bt-hci = &bee_bt_hci; + zephyr,entropy = &trng; + }; + + aliases { + led0 = &led0; + sw0 = &button0; + sw1 = &button1; + sw2 = &button2; + sw3 = &button3; + }; + + leds { + compatible = "gpio-leds"; + + led0: led0 { + gpios = <&gpioa 21 GPIO_ACTIVE_HIGH>; + label = "LED D1 Blue"; + }; + + led1: led1 { + gpios = <&gpioa 18 GPIO_ACTIVE_HIGH>; + label = "LED D2 Red"; + }; + + led2: led2 { + gpios = <&gpioa 17 GPIO_ACTIVE_HIGH>; + label = "LED D3 Green"; + }; + }; + + buttons { + compatible = "gpio-keys"; + status = "okay"; + + button0: button_0 { + gpios = <&gpiob 22 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "SW1"; + zephyr,code = ; + }; + + button1: button_1 { + gpios = <&gpiob 21 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "SW2"; + zephyr,code = ; + }; + + button2: button_2 { + gpios = <&gpiob 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "SW3"; + zephyr,code = ; + }; + + button3: button_3 { + gpios = <&gpiob 7 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "SW4"; + zephyr,code = ; + }; + }; + +}; + +&flash { + reg = <0x4000000 DT_SIZE_K(4096)>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + reserved: partition@0 { + label = "reserved-image"; + reg = <0x0 DT_SIZE_K(4)>; + }; + config_file: partition@1000 { + label = "config-file-image"; + reg = <0x1000 DT_SIZE_K(4)>; + }; + boot_patch_0: partition@2000 { + label = "boot-patch-0-image"; + reg = <0x2000 DT_SIZE_K(32)>; + }; + boot_patch_1: partition@a000 { + label = "boot-patch-1-image"; + reg = <0xA000 DT_SIZE_K(32)>; + }; + ota_header: partition@12000 { + label = "ota-header-image"; + reg = <0x12000 DT_SIZE_K(4)>; + }; + system_patch: partition@13000 { + label = "system-patch-image"; + reg = <0x13000 DT_SIZE_K(32)>; + }; + stack_patch: partition@1b000 { + label = "stack-patch-image"; + reg = <0x1B000 DT_SIZE_K(72)>; + }; + app_partition: partition@2d000 { + label = "app-image"; + reg = <0x2D000 DT_SIZE_K(3900)>; + }; + storage_partition: partition@3fc000 { + label = "storage"; + reg = <0x3FC000 DT_SIZE_K(16)>; + }; + }; +}; + +&cpu { + clock-frequency = <40000000>; +}; + +&gpioa { + status = "okay"; +}; + +&gpiob { + status = "okay"; +}; + +&uart2 { + pinctrl-0 = <&uart2_default>; + pinctrl-names = "default"; + status = "okay"; + current-speed = <115200>; + parity = "none"; + stop-bits = "1"; + data-bits = <8>; +}; + +&bee_bt_hci { + status = "okay"; +}; diff --git a/boards/realtek/rtl8777g_dongle/rtl8777g_dongle.yaml b/boards/realtek/rtl8777g_dongle/rtl8777g_dongle.yaml new file mode 100644 index 0000000000000..30f15f9cb2934 --- /dev/null +++ b/boards/realtek/rtl8777g_dongle/rtl8777g_dongle.yaml @@ -0,0 +1,33 @@ +identifier: rtl8777g_dongle +name: RTL8777G Dongle Evaluation Board +type: mcu +arch: arm +ram: 100 +flash: 4096 +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - gpio + - uart + - entropy + - ble + # TODO: to be tested + # - adc + # - counter + # - dma + # - i2c + # - kscan + # - nvs + # - pwm + # - spi + # - usb_device + # - watchdog +testing: + ignore_tags: + - net + - hwinfo + - ipc + - pm +vendor: realtek diff --git a/boards/realtek/rtl8777g_dongle/rtl8777g_dongle_defconfig b/boards/realtek/rtl8777g_dongle/rtl8777g_dongle_defconfig new file mode 100644 index 0000000000000..a2b2419b0b501 --- /dev/null +++ b/boards/realtek/rtl8777g_dongle/rtl8777g_dongle_defconfig @@ -0,0 +1,18 @@ +# Console Driver +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# UART Driver +CONFIG_SERIAL=y +CONFIG_UART_INTERRUPT_DRIVEN=y +# CONFIG_UART_ASYNC_API=y + +# Build a secure image by default +CONFIG_TRUSTED_EXECUTION_SECURE=y +CONFIG_ARM_SECURE_BUSFAULT_HARDFAULT_NMI=y + +# DISASSEMBLY +CONFIG_OUTPUT_DISASSEMBLY=y + +# Enable HW stack protection +CONFIG_HW_STACK_PROTECTION=y