Skip to content

boards/arm/ht32f491x3: Add support for the HT32F49163 Starter Kit board#18573

Open
FelipeMdeO wants to merge 3 commits intoapache:masterfrom
FelipeMdeO:feature/ht32f49xx_port
Open

boards/arm/ht32f491x3: Add support for the HT32F49163 Starter Kit board#18573
FelipeMdeO wants to merge 3 commits intoapache:masterfrom
FelipeMdeO:feature/ht32f49xx_port

Conversation

@FelipeMdeO
Copy link
Contributor

@FelipeMdeO FelipeMdeO commented Mar 21, 2026

Summary

This PR improves the existing HT32F491x3 ESK32 board support.

Changes included:

  • enable board bring-up for esk32:nsh
  • mount /bin and /proc
  • enable hello, ostest, dumpstack, and leds in esk32:nsh
  • add HT32F491x3 internal GPIO helpers
  • add ESK32 user LED support and register /dev/userleds
  • add ESK32 board documentation

Impact

  • Is new feature added? Yes
  • Impact on user: esk32:nsh now provides /bin, /proc, /dev/userleds, and useful built-in apps
  • Impact on build: No global build changes
  • Impact on hardware: Yes, ARM/HT32F491x3 ESK32 board support
  • Impact on documentation: Yes
  • Impact on security: No

Testing

  • ./tools/configure.sh -l esk32:nsh
  • make -j
  • make -C Documentation html

Hardware tested on HT32F49163 Starter Kit:

  • NSH boot on USART1
  • /bin and /proc mounted
  • /dev/userleds registered
  • hello, ostest, dumpstack, and leds executed successfully
  • LED2, LED3, and LED4 toggled correctly

@github-actions github-actions bot added Area: Build system Arch: arm Issues related to ARM (32-bit) architecture Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. Board: arm labels Mar 21, 2026
@FelipeMdeO FelipeMdeO force-pushed the feature/ht32f49xx_port branch 2 times, most recently from 8050202 to 1e40242 Compare March 21, 2026 22:16
@FelipeMdeO
Copy link
Contributor Author

Hello @acassis , @linguini1 , @xiaoxiang781216 , can you give me some tips before open PR officially, please?

@lupyuen
Copy link
Member

lupyuen commented Mar 22, 2026

@FelipeMdeO Can you Rebase with Master Branch to trigger the CI Build? We just fixed the CI Build. Thanks :-)

@acassis
Copy link
Contributor

acassis commented Mar 23, 2026

@FelipeMdeO nice work, please divide this PR in three commits: arch support, board support, documentation

@FelipeMdeO FelipeMdeO force-pushed the feature/ht32f49xx_port branch from 1e40242 to a63d9ad Compare March 25, 2026 00:20
Add initial HT32F491x3 support with startup, IRQ handling,
serial console, GPIO helpers, custom vectors, and CMake build files.

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
@FelipeMdeO FelipeMdeO force-pushed the feature/ht32f49xx_port branch from 98c405a to 48beede Compare March 25, 2026 00:54
@FelipeMdeO FelipeMdeO marked this pull request as ready for review March 25, 2026 01:13
@FelipeMdeO FelipeMdeO requested a review from simbit18 March 25, 2026 01:13
@FelipeMdeO
Copy link
Contributor Author

@lupyuen , can you review this PR also, please?

@xiaoxiang781216
Copy link
Contributor

please fix:

====================================================================================
Configuration/Tool: esk32/nsh,CONFIG_ARM_TOOLCHAIN_GNU_EABI
2026-03-25 02:01:58
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Disabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Enabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Building NuttX...
  [1/1] Normalize esk32/nsh
4,7c4,6
< # 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.
---
> # 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.
13,14d11
< # CONFIG_NSH_DISABLE_IFCONFIG is not set
< # CONFIG_NSH_DISABLE_PS is not set
25d21
< CONFIG_EXAMPLES_LEDS=y
26a23
> CONFIG_EXAMPLES_LEDS=y
30d26
< CONFIG_HT32F491X3_PCLK2_FREQUENCY=150000000
32d27
< CONFIG_HT32F491X3_USART1_SERIALDRIVER=y
50a46
> CONFIG_TASK_NAME_SIZE=0
54,59d49
< CONFIG_TASK_NAME_SIZE=0
< CONFIG_USERLED=y
< CONFIG_USERLED_LOWER=y
< CONFIG_USART1_BAUD=115200
< CONFIG_USART1_BITS=8
< CONFIG_USART1_PARITY=0
62a53,54
> CONFIG_USERLED=y
> CONFIG_USERLED_LOWER=y
Saving the new configuration file
HEAD detached at pull/18573/merge
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   boards/arm/ht32f491x3/esk32/configs/nsh/defconfig
```
by ./tools/refresh.sh --silent esk32/nsh @FelipeMdeO 

@simbit18
Copy link
Contributor

Hi @FelipeMdeO I think we need to change the title

boards/arm/ht32f491x3: Add support for the HT32F49163 Starter Kit board

https://www.bestmodulescorp.com/en/esk32-31402.html?srsltid=AfmBOoqVKM-qHVVYK9N7h2s0Mgthe3-KJbZConuKTtdMiuU-q2g0dxVN

This is a new board

@FelipeMdeO FelipeMdeO changed the title boards/arm/ht32f491x3: improve ESK32 nsh bring-up and userled support boards/arm/ht32f491x3: Add support for the HT32F49163 Starter Kit board Mar 25, 2026
Add the ESK32 board with nsh configuration, linker script,
board bring-up, flashing helper, and user LED support.

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
@FelipeMdeO FelipeMdeO force-pushed the feature/ht32f49xx_port branch from 48beede to 9bf613f Compare March 25, 2026 11:25
@FelipeMdeO
Copy link
Contributor Author

please fix:

====================================================================================
Configuration/Tool: esk32/nsh,CONFIG_ARM_TOOLCHAIN_GNU_EABI
2026-03-25 02:01:58
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Disabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Enabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Building NuttX...
  [1/1] Normalize esk32/nsh
4,7c4,6
< # 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.
---
> # 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.
13,14d11
< # CONFIG_NSH_DISABLE_IFCONFIG is not set
< # CONFIG_NSH_DISABLE_PS is not set
25d21
< CONFIG_EXAMPLES_LEDS=y
26a23
> CONFIG_EXAMPLES_LEDS=y
30d26
< CONFIG_HT32F491X3_PCLK2_FREQUENCY=150000000
32d27
< CONFIG_HT32F491X3_USART1_SERIALDRIVER=y
50a46
> CONFIG_TASK_NAME_SIZE=0
54,59d49
< CONFIG_TASK_NAME_SIZE=0
< CONFIG_USERLED=y
< CONFIG_USERLED_LOWER=y
< CONFIG_USART1_BAUD=115200
< CONFIG_USART1_BITS=8
< CONFIG_USART1_PARITY=0
62a53,54
> CONFIG_USERLED=y
> CONFIG_USERLED_LOWER=y
Saving the new configuration file
HEAD detached at pull/18573/merge
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   boards/arm/ht32f491x3/esk32/configs/nsh/defconfig

by ./tools/refresh.sh --silent esk32/nsh @FelipeMdeO

done

@linguini1
Copy link
Contributor

Hello @acassis , @linguini1 , @xiaoxiang781216 , can you give me some tips before open PR officially, please?

Some logs/artifacts from your testing would be great to include!

@FelipeMdeO
Copy link
Contributor Author

Hello @acassis , @linguini1 , @xiaoxiang781216 , can you give me some tips before open PR officially, please?

Some logs/artifacts from your testing would be great to include!

Hello @linguini1 , I am adding log showing ostest and other tests.
teraterm.log

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds/extends NuttX support for the Holtek HT32F491x3 family and the ESK32 (HT32F49163 Starter Kit) board, enabling a usable esk32:nsh configuration with board bring-up, user LEDs, and documentation.

Changes:

  • Adds an HT32F491x3 ARM chip port (startup, IRQ, SysTick timer, GPIO, USART, vector table, and hardware register headers).
  • Adds the ESK32 board port (clock config, bring-up mounting /bin + /proc, user LED support via /dev/userleds, build scripts, and a nsh defconfig).
  • Adds flashing helper scripts (Windows PowerShell + WSL bash) and Sphinx documentation for the platform/board.

Reviewed changes

Copilot reviewed 44 out of 45 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
boards/arm/ht32f491x3/esk32/tools/flash.sh WSL flashing backend using Holtek OpenOCD package.
boards/arm/ht32f491x3/esk32/tools/flash.py Host wrapper to dispatch to Windows/WSL flashing backends.
boards/arm/ht32f491x3/esk32/tools/flash.ps1 Native Windows flashing backend using Holtek OpenOCD package.
boards/arm/ht32f491x3/esk32/src/ht32_userleds.c Implements board_userled* APIs for ESK32 LEDs and /dev/userleds support.
boards/arm/ht32f491x3/esk32/src/ht32_boot.c Board clock setup for 150 MHz via HEXT->PLL sequence.
boards/arm/ht32f491x3/esk32/src/ht32_appinit.c Board bring-up: registers user LEDs and mounts /bin + /proc.
boards/arm/ht32f491x3/esk32/src/Makefile Adds board source compilation rules.
boards/arm/ht32f491x3/esk32/src/CMakeLists.txt Adds board sources for CMake builds and sets LD script.
boards/arm/ht32f491x3/esk32/scripts/ld.script Linker script for HT32F49163 (256K flash / 48K SRAM).
boards/arm/ht32f491x3/esk32/scripts/Make.defs Board toolchain/link settings.
boards/arm/ht32f491x3/esk32/include/board.h Board pin mapping for USART1 and LEDs; board prototypes.
boards/arm/ht32f491x3/esk32/configs/nsh/defconfig Enables NSH, binfs/procfs mounts, userleds, and test apps for ESK32.
boards/arm/ht32f491x3/esk32/Kconfig Board-specific Kconfig notes.
boards/arm/ht32f491x3/esk32/CMakeLists.txt Adds ESK32 board subdirectory for CMake.
boards/Kconfig Registers ARCH_BOARD_ESK32 and default board name mapping.
arch/arm/src/ht32f491x3/ht32f491x3_timerisr.c SysTick setup and timer ISR for HT32F491x3.
arch/arm/src/ht32f491x3/ht32f491x3_start.h Startup hooks prototypes for HT32F491x3.
arch/arm/src/ht32f491x3/ht32f491x3_start.c Reset entry/startup, .bss clear, .data init, then nx_start().
arch/arm/src/ht32f491x3/ht32f491x3_serial.h USART init and pinmux hook prototypes.
arch/arm/src/ht32f491x3/ht32f491x3_serial.c USART driver implementation (console + ttyS devices).
arch/arm/src/ht32f491x3/ht32f491x3_lowputc.h Early console and UART config prototypes.
arch/arm/src/ht32f491x3/ht32f491x3_lowputc.c Early low-level console setup and board pinmux dispatch for USART.
arch/arm/src/ht32f491x3/ht32f491x3_irq.c NVIC/exception/IRQ enable/disable/prioritize implementation.
arch/arm/src/ht32f491x3/ht32f491x3_gpio.h Public internal GPIO helper API for the HT32F491x3 port.
arch/arm/src/ht32f491x3/ht32f491x3_gpio.c GPIO helper implementation (mode/AF/pull/drive + read/write).
arch/arm/src/ht32f491x3/ht32f491x3_config.h Consolidates HAVE_UART/HAVE_CONSOLE feature flags.
arch/arm/src/ht32f491x3/hardware/ht32f491x3_uart.h UART register offsets/bitfields for HT32F491x3.
arch/arm/src/ht32f491x3/hardware/ht32f491x3_pwc.h PWC register/bit definitions (LDO output select).
arch/arm/src/ht32f491x3/hardware/ht32f491x3_memorymap.h Memory map base addresses for HT32F491x3.
arch/arm/src/ht32f491x3/hardware/ht32f491x3_gpio.h GPIO register offsets and bitfield helper macros.
arch/arm/src/ht32f491x3/hardware/ht32f491x3_flash.h Flash interface register definitions (wait states).
arch/arm/src/ht32f491x3/hardware/ht32f491x3_crm.h CRM register offsets/bitfields (clock tree setup).
arch/arm/src/ht32f491x3/chip.h Chip glue (memory map include, IRQ include, interrupt count).
arch/arm/src/ht32f491x3/arm_vectors.c Custom vector table layout matching Holtek reserved slots and FWID entry.
arch/arm/src/ht32f491x3/Make.defs Adds HT32F491x3 chip sources to the ARM build.
arch/arm/src/ht32f491x3/Kconfig Chip selection + clock frequency config + USART1 serial driver option.
arch/arm/src/ht32f491x3/CMakeLists.txt Adds HT32F491x3 chip sources to the ARM CMake build.
arch/arm/src/Makefile Makes clean/distclean resilient if the chip dirlink/Make.defs is missing.
arch/arm/include/ht32f491x3/irq.h Top-level IRQ definitions for HT32F491x3 include tree.
arch/arm/include/ht32f491x3/ht32f491x3_irq.h External interrupt numbering table for HT32F491x3.
arch/arm/include/ht32f491x3/chip.h Chip-wide constants (flash size variants, SRAM size, clock macros, NVIC priorities).
arch/arm/Kconfig Registers ARCH_CHIP_HT32F491X3 and sources the chip Kconfig.
Documentation/platforms/arm/ht32f491x3/index.rst Adds platform documentation index and board toctree.
Documentation/platforms/arm/ht32f491x3/boards/esk32/index.rst Adds ESK32 board documentation (features, pinout, build/flash/testing).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Document the HT32F491x3 ESK32 board, build steps,
flashing flow, and validation commands. Add WSL and
PowerShell flash backends plus a Python wrapper.

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
@FelipeMdeO FelipeMdeO force-pushed the feature/ht32f49xx_port branch from c9b7689 to 981ca61 Compare March 26, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm Issues related to ARM (32-bit) architecture Area: Build system Board: arm Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants