π Welcome to the GD32H7xx Demo Suites CMake Visual Studio Code repository! This project is designed to integrate the CMake build system with Visual Studio Code, providing a streamlined development environment for GD32H7xx Demo Suites V2.1.0.
- π¦ Comprehensive Integration: Pre-configured CMake and VS Code settings for seamless builds and debugging.
- π§ Toolchain Support: Default configuration for xPack GNU Arm Embedded GCC Toolchain and OpenOCD.
- βοΈ Customizability: Easily adapt paths and configurations for your preferred toolchain or target MCU.
- π§© Lightweight Templates: A structured and organized template for GD32H7xx microcontroller projects.
- π Rich Extension Support:
- π Recommended extensions like
ms-vscode.cmake-tools
,marus25.cortex-debug
, andxaver.clang-format
ensure enhanced functionality for CMake, debugging, and code formatting. - πΌοΈ Peripheral viewers, RTOS views, and other utilities provide an extensive debugging experience.
- π¨ The
vscode-icons-team.vscode-icons
extension offers visually improved folder and file navigation.
- π Recommended extensions like
- π οΈ Robust Debug Configuration:
- Pre-configured
launch.json
supports debugging with OpenOCD. - Features such as live watch, entry-point settings, and automated pre-launch build tasks streamline the debugging process.
- Fully compatible with SVD files for enhanced peripheral visualization and live memory updates.
- Pre-configured
- Version: xpack-arm-none-eabi-gcc-11.3.1-1.1
- Path:
Tools/xpack-arm-none-eabi-gcc-11.3.1-1.1
- Customization:
- Update the paths in these files:
Projects/<BoardName>/<ProjectName>/cmake/arm-none-eabi-gcc.cmake
(line 2):set(TOOLCHAIN_DIRECTORY "${CMAKE_SOURCE_DIR}/../../../Tools/xpack-arm-none-eabi-gcc-11.3.1-1.1/bin")
Projects/<BoardName>/<ProjectName>/.vscode/launch.json
(line 12):"gdbPath": "${workspaceFolder}/../../../Tools/xpack-arm-none-eabi-gcc-11.3.1-1.1/bin/arm-none-eabi-gdb.exe"
- Update the paths in these files:
- Download alternative versions here.
- Version: xpack-openocd-0.11.0-3
- Path:
Tools/xpack-openocd-0.11.0-3
- Notes:
- Extracted from Embedded Builder V1.4.1.23782.
β οΈ Avoid using other versions due to limited support for GD32 MCUs.- Update paths in these files if necessary:
Projects/<BoardName>/<ProjectName>/.vscode/launch.json
(lines 14, 17):"serverpath": "${workspaceFolder}/../../../Tools/xpack-openocd-0.11.0-3/bin/openocd.exe"
"${workspaceFolder}/../../../Tools/xpack-openocd-0.11.0-3/scripts/target/openocd_gdlink_gd32h7xx.cfg"
Projects/<BoardName>/<ProjectName>/.vscode/task.json
: Update all occurrences of:${workspaceFolder}/../../../Tools/xpack-openocd-0.11.0-3
- Version:
V6.1
- Path:
Drivers/CMSIS
- Version:
V1.4.0 (2025-01-24)
- Path:
Drivers/CMSIS/GD/GD32H7xx
- Extracted from
GD32H7xx Demo Suites V2.1.0
- Version:
V1.4.0 (2025-01-24)
- Path:
Drivers/GD32H7xx_standard_peripheral
- Version:
V1.4.0 (2025-01-24)
- Path:
Drivers/GD32H7xx_usbhs_library
- Version:
R0.15a (November 22, 2024)
- Path:
Middlewares/FatFs
- Version:
V10.3.1 (February, 18 2020)
- Path:
Middlewares/FreeRTOS
- Version:
STABLE-2.1.2 (2018-11-21)
- Path:
Middlewares/lwip
- Visual Studio Code: Download here.
- Git: Download here.
- If installed in a custom directory, update this path in
Projects/<BoardName>/<ProjectName>/.vscode/settings.json
(line 5):"path": "C:\Program Files\Git\bin\bash.exe"
- If installed in a custom directory, update this path in
cd C:/gd32-cmake
# Clone the repository recursively to include submodules
git clone --recursive https://github.com/burakenez/gd32h7xx-demo-suites-cmake-vscode.git
β οΈ Avoid long directory paths to prevent build issues.- If downloading as a ZIP, manually include submodules in the
Tools
folder:xpack-arm-none-eabi-gcc-11.3.1-1.1
xpack-openocd-0.11.0-3
- Open
Projects/<BoardName>/<ProjectName>
directly in Visual Studio Code.
- Extensions listed in
Projects/<BoardName>/<ProjectName>/.vscode/extensions.json
will be auto-installed.
- These tools will be downloaded automatically using
vcpkg-configuration.json
. - Update the vcpkg storage location in
Projects/<BoardName>/<ProjectName>/.vscode/settings.json
(line 15):"vcpkg.storageLocation": "C:\Dev\Tools\vcpkg"
- Add paths to environment variables:
cmake.exe
:C:\Dev\Tools\vcpkg\root\downloads\artifacts\vcpkg-artifacts-arm\tools.kitware.cmake\3.28.4\bin
ninja.exe
:C:\Dev\Tools\vcpkg\root\downloads\artifacts\vcpkg-artifacts-arm\tools.ninja.build.ninja\1.12.0
- Restart your computer after installation.
- Select Debug or Release from the CMake presets menu in VS Code.
- Build options:
- Click the Build button in the bottom panel.
- Press
[CTRL + SHIFT + P]
, search for CMake: Build, and run. - Press
[CTRL + SHIFT + B]
to open configured tasks and select Build.
- Output files are generated in
Projects/<BoardName>/<ProjectName>/Build/Debug/Application/
or.../Release/Application/
.
- Go to Run and Debug in VS Code.
- Select Debug with OpenOCD and press
[F5]
or click Start Debugging.
βββ Drivers # Contains low-level drivers for hardware abstraction and CMSIS compatibility.
βββ Middlewares # Houses middleware libraries and third-party integrations.
βββ Projects # Holds board-specific project examples.
β βββ <BoardName>
β βββ <ProjectName>
β βββ .vscode
β β βββ extensions.json # Specifies recommended VS Code extensions for automatic installation.
β β βββ launch.json # Debugging configuration, including paths to toolchain binaries.
β β βββ settings.json # Project-specific workspace settings, such as paths for external tools.
β β βββ tasks.json # Defines build tasks and automation scripts for the VS Code environment.
β βββ Application
β β βββ Core
β β β βββ Inc
β β β β βββ gd32h7xx_it.h # Interrupt handler declarations specific to GD32H7xx.
β β β β βββ gd32h7xx_libopt.h # Library options and configurations for efficient use.
β β β β βββ systick.h # Definitions and declarations related to the SysTick timer.
β β β βββ Src
β β β β βββ gd32h7xx_it.c # Interrupt service routine implementations.
β β β β βββ main.c # Entry point of the application, containing the main logic and system initialization.
β β β β βββ system_gd32h7xx.c # System initialization, clock setup, and core configurations.
β β β β βββ systick.c # SysTick timer setup and related functionalities.
β β βββ Startup
β β β βββ startup_gd32h7xx.s # Assembly code for initialization and vector table setup.
β β βββ User
β β β βββ syscalls.c # Implements low-level system calls and I/O retargeting for the project.
β β βββ CMakeLists.txt # CMake build instructions for the application.
β β βββ readme.txt # Brief notes and usage instructions for the application folder.
β βββ Build
β β βββ Debug
β β β βββ Application
β β β βββ Application.bin # Binary file ready for flashing to the device.
β β β βββ Application.elf # Executable and Linkable Format file with debugging symbols.
β β β βββ Application.hex # Intel HEX file format for programming the microcontroller.
β β β βββ Application.map # Memory map of the application.
β β β βββ Application.list # Assembly listing of the code.
β β β βββ Other files... # Includes additional build outputs such as symbol tables.
β βββ cmake
β β βββ arm-none-eabi-gcc.cmake # Specifies toolchain settings for ARM GCC.
β β βββ project.cmake # General project-wide CMake configurations.
β βββ Drivers
β β βββ BSP/GD32H757J_START # Board support package configurations and drivers for GD32H757J_START.
β β βββ CMSIS # CMSIS drivers for Cortex-M processors, supporting GD32H7xx.
β β βββ GD32H7xx_standard_peripheral # Peripheral library for GD32H7xx.
β βββ Middlewares # Additional middleware or third-party libraries used in the project.
β βββ Utilities # Utility scripts, tools, and additional helper files for development.
β βββ .clang-format # Code formatting rules for maintaining a consistent coding style.
β βββ CMakeLists.txt # Main CMake build file for the entire project.
β βββ CMakePresets.json # Preset configurations for easier CMake builds.
β βββ gd32h7xx_flash.ld # Linker script for defining memory regions and placements.
β βββ GD32H7xx.svd # System View Description file for debugging and register definitions.
βββ Tools # Compilers, debuggers, and other tools required for building and debugging.
βββ Utilities # Shared utilities and helper scripts applicable across projects.
Feel free to customize this template as per your project requirements. Contributions and feedback are always welcome!