HT32 Project Assistant for VS Code
A complete ARM embedded development environment for Holtek HT32 microcontrollers inside VS Code. Converts Keil uVision and HT32-IDE projects to a Makefile workflow, or creates new projects from scratch — with one-click build, flash, and debug via the bundled OpenOCD and e-Link32 probe.
Features
| Feature |
Description |
| Create Project |
Wizard-driven project generator from HT32 FWLib (standard & 49x series) |
| Convert uVision |
Import Keil .uvprojx / .uvmpw projects — Makefile, linker script, clangd config auto-generated |
| Convert HT32-IDE |
Import Eclipse CDT .project/.cproject projects |
| Build / Clean |
One-click or toolbar buttons; compound post-build task support |
| Download (Flash) |
Flash firmware via bundled OpenOCD + e-Link32 Pro/Lite |
| Debug |
Cortex-Debug + bundled OpenOCD; SWO/ITM support for Cortex-M4 devices |
| HT32 Settings |
WebView panel for compiler flags, debug interface, post-build commands |
| Project File Tree |
Source groups view with add/remove files and groups |
| clangd / IntelliSense |
Auto-generates .clangd and merged compile_commands.json |
Requirements
- OS: Windows x64 (bundled OpenOCD and GNU Make are Windows x64 binaries)
- Toolchain:
arm-none-eabi-gcc — auto-detected from common install locations, or set manually in settings
- Debug probe: Holtek e-Link32 Pro or e-Link32 Lite (recommended); J-Link and ST-Link also supported
- FWLib: HT32 Firmware Library required for Create Project; not needed for Convert
Getting Started
Create a New Project
- Open VS Code with an empty folder as workspace
- Click the HT32 icon in the Activity Bar → Create Project (the
+ button)
- Follow the wizard:
- Select the HT32 FWLib root folder
- Choose MCU model
- Choose output type: Application or Library
- (Application only) Choose printf: Standard newlib-nano or eyalroz/printf (float support)
- Enter project name and folder
- The extension generates
src/, .vscode/build-gen/Makefile, tasks.json, launch.json, and clangd config
Convert a Keil uVision Project
- Click Convert uVision Project in the HT32 panel
- Select the
.uvprojx or .uvmpw file
- All Makefile, linker script, sources list, and VS Code config files are generated under
.vscode/build-gen/
Convert an HT32-IDE Project
- Click Convert HT32-IDE Project in the HT32 panel
- Select the
.project file (Eclipse CDT format)
- Same output as uVision conversion
Build, Flash & Debug
| Button |
Action |
| Build |
Run make (or compound Build + Post-Build task) |
| Debug |
Launch Cortex-Debug session via OpenOCD |
| Clean |
Delete the build/ directory |
| Download |
Flash firmware without starting a debug session |
| Settings |
Open HT32 Settings WebView |
Keyboard shortcuts
Use Ctrl+Shift+B to access VS Code tasks (Build, Build All, Clean, Download).
HT32 Settings
Open via the gear icon in the HT32 panel toolbar. Configurable per-project:
| Setting |
Description |
| Optimization |
-O0 / -Os / -O2 etc. |
| Float ABI |
soft / softfp / hard |
| FPU |
none / fpv4-sp-d16 (M4F) |
| C Runtime |
nano (newlib-nano, recommended) / standard |
| Extra CFLAGS |
Additional compiler flags |
| Extra LDFLAGS |
Additional linker flags (e.g. -u _printf_float if not using eyalroz/printf) |
| Debug Interface |
e-Link32 Pro / e-Link32 Lite / J-Link / ST-Link |
| Erase Mode |
erase_sector / erase_chip / none |
| Post-Build Command |
Shell command run after successful build (e.g. a .bat for CRC/encryption) |
Settings are stored in .vscode/build-gen/project.settings.json and take effect after saving (auto-saves after 3 seconds, or manually via the Save button).
Printf Support (eyalroz/printf)
When creating a new Application project, you can opt in to bundle eyalroz/printf instead of relying on newlib-nano's printf:
- Why: newlib-nano's
%f/%g float formatting requires -u _printf_float, which adds ~15–20 KB. eyalroz/printf includes full float support in ~5–8 KB.
- How it works:
printf.c and printf.h are copied into src/. A small ht32_putchar.c bridges the output to the existing HT32 retarget layer (_write() → SERIAL_PutChar()). The compile flag -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 makes printf(), sprintf(), snprintf() etc. resolve to the eyalroz implementation at link time — no source code changes needed.
- For existing (converted) projects, you can manually add
printf.c, printf.h, and ht32_putchar.c to src/, add PRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 to Extra CFLAGS in Settings, and add printf.c and ht32_putchar.c to sources.list.
Supported Devices
141 HT32 devices across 6 series, including:
| Core |
Series |
Examples |
| Cortex-M0+ |
HT32F5xxxx |
HT32F52352, HT32F52341, HT32F0008 |
| Cortex-M0+ |
HT32F5xxxx (extended) |
HT32F61352, HT32F62030, HT32F67232 |
| Cortex-M3 |
HT32F1xxxx |
HT32F12345, HT32F12366 |
| Cortex-M4 |
HT32F4xxxx |
HT32F40316, HT32F45369 |
| Cortex-M4 |
HT32F490x / 491x / 493x |
HT32F49163, HT32F49395 |
| Cortex-M33 |
HT32F675xx |
HT32F67575, HT32F67595 |
Flash/download support (via bundled OpenOCD + HLM loaders) is available for ~100 devices. Devices without an MCU cfg file can still be built and debugged with a custom OpenOCD configuration.
Bundled Assets
| Asset |
Description |
openocd/ |
OpenOCD 0.12.x Windows x64 + ~90 HT32 MCU .cfg files + HLM flash loaders |
bin/win32-x64/make.exe |
GNU Make 4.x Windows x64 |
dfp/Holtek/HT32_DFP/1.0.76/ |
CMSIS DFP v1.0.76 — 100 SVD files for peripheral register view |
templates/ |
Startup .s files, linker script templates, ht32_op.c |
templates/printf/ |
eyalroz/printf v6.3.0 source (printf.c, printf.h) |
Output Structure
After conversion or project creation:
<workspace>/
├── src/ ← User source files
│ ├── main.c
│ ├── ht32fxxxx_it.c
│ └── ...
└── .vscode/
├── tasks.json
├── launch.json
├── .clangd
├── compile_commands.json ← Symlink / merged for clangd
└── build-gen/
├── Makefile
├── linker_script.ld
├── startup_xxx.s
├── ht32_syscalls.c
├── ht32_retarget_gnu.c
├── compile_commands.json
├── sources.list
├── project.meta.json
├── project.settings.json
└── build.meta.json
Extension Settings
| Setting |
Default |
Description |
ht32.gccPath |
(auto) |
Path to arm-none-eabi-gcc. Auto-detected if empty. |
ht32.makePath |
(auto) |
Path to make. Auto-detected if empty. |
ht32.openocdPath |
(bundled) |
Override bundled OpenOCD path. |
ht32.svdFile |
(auto) |
SVD file for peripheral register view. Auto-detected from DFP. |
All project-specific settings (optimization, float ABI, debug interface, etc.) are stored in .vscode/build-gen/project.settings.json, not in VS Code workspace settings.
Commands (Ctrl+Shift+P → "HT32")
| Command |
Description |
HT32: Create Project |
Open Create Project wizard |
HT32: Open Project |
Open an existing HT32 project folder |
HT32: Convert uVision Project |
Import Keil .uvprojx / .uvmpw |
HT32: Convert HT32-IDE Project |
Import Eclipse CDT .project |
HT32: Build |
Run build task |
HT32: Download |
Flash firmware |
HT32: Debug |
Start debug session |
HT32: Clean |
Clean build output |
HT32: Open Settings |
Open HT32 Settings WebView |
HT32: Generate Build & Debug Config |
Regenerate tasks.json and launch.json |
Third-Party Licenses
See THIRD_PARTY_LICENSES.md for license information for bundled components (OpenOCD, GNU Make, HT32 DFP, eyalroz/printf, fast-xml-parser).
License
MIT — see LICENSE