Skip to content
| Marketplace
Sign in
Visual Studio Code>AI>Nuvoton NuCodeGenNew to Visual Studio Code? Get it now.
Nuvoton NuCodeGen

Nuvoton NuCodeGen

Nuvoton

nuvoton.com
|
1,241 installs
| (1) | Free
Streamline your NuMicro firmware development with AI-powered interactive chat, NuMicro BSP-compatible code generation, and automated build testing.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Nuvoton NuCodeGen

Description

Nuvoton NuCodeGen is an AI-powered autonomous coding extension that generates code based on the library files of chip series and utilizes tools to edit files, build projects, retrieve functions or macros from the library files, and fix code errors.

Outline

  • Nuvoton NuCodeGen
    • Description
    • Outline
    • Features
    • Requirements
    • Commands
    • Getting Started
    • Manual Environment Setup for Non-CMSIS Projects
      • Method 1: Using Command Palette
      • Method 2: Using Context Menu
    • Custom Sub-Skills
    • Example Prompts
    • Troubleshooting
      • Shell Integration Unavailable
      • #githubRepo Tool Not Working
    • Disclaimer

Features

  • A chat extension for VSCode building on GitHub Copilot Chat.
    • Use a prompt to generate snippet code based on Nuvoton STDdriver API.
    • Use a prompt to query all kinds of information related to the NuMicro BSP standard driver.
  • Add a custom agent to Copilot Chat
    • Allows customization of how user requests are handled.
  • Add custom commands and tools
    • Support various peripherals
    • Helps with building and correcting bugs.

Requirements

  • Visual Studio Code: Version 1.127 or higher is recommended.
  • Install VS Code Extension: GitHub Copilot.
  • Need a GitHub Account to sign in to the Github Copilot extension.
  • Ensure that your corporate or personal firewall does not block VS Code's network access during the installation of extensions.

Commands

  1. Custom agent
    • Select NuCodeGen as the agent in the Copilot Chat interface.
    • NuCodeGen only appears in the agent list when specific conditions are met (see step 5 in Getting Started).
  2. Slash commands
    • /{peripheral_name}: handle issues related to the specified peripheral. For example,
      • /pdma: generate code for PDMA functionality
      • /clk: generate code for peripherals' clocks
      • /spi: what are limits for SPI_Open function?
      • /clk: how many clock sources does SPI0 have?
    • /{peripheral_name}-settings:
      • List the relevant settings for the specified peripheral
      • Example prompt format for settings
    • /build-project: build your project and try to fix any build errors
    • /debug-project: load your code and run the debugger
  3. VSCode commands
    • NuCodeGen:Add User-Defined Sub-Skill
      • Add a user-defined sub-skill defining rules and constraints for a specific peripheral in specific application scenarios to improve related code generation.
      • Added sub-skills will be stored in the ~/.copilot/skills/nucodegen/ directory.
    • NuCodeGen:Delete User-Defined Sub-Skill
      • Remove the user-defined sub-skill for a specific peripheral.
    • NuCodeGen:Open Sub-Skill
      • Open the sub-skill file for a specific peripheral to edit, including user-defined and default sub-skills.

Getting Started

  1. Launch the VS Code application.

  2. Install the VS Code extension Nuvoton NuMicro Cortex-M Pack.

  3. Make sure GitHub Copilot is signed in.

    • If it isn’t: Command Palette (Ctrl+Shift+P) → “GitHub Copilot: Sign in”.
  4. Click the Chat button to open the Chat Panel.

    copilot icon

    Access `Chat Input Box` in `Chat Panel`
    • Recommended Language Model: Any coding-proficient model with strong reasoning abilities (such as the latest Claude, Gemini, or GPT series). Please check the GitHub Copilot plan for details on the free and subscription models.

    NOTE: The use of less capable language models can significantly compromise the quality of the code generation.

  5. select NuCodeGen as the agent in the Copilot Chat interface, which can appear and be used in workspaces that meet one of the following conditions:

    1. CMSIS-solution project (e.g. a BSP project): the workspace contains *.cproject.yml and *.csolution.yml files.
      • Follow the "Getting Started" section in the "Overview" of the Nuvoton NuMicro Cortex-M Pack.
      • Make sure you have downloaded the required NuMicro BSP in this step, and opened its VSCode directory in Visual Studio Code.
    2. Non-CMSIS project: the workspace's .vscode/settings.json contains the required NuCodeGen settings.
      • see Manual Environment Setup for Non-CMSIS Projects.

      gencode step1

  6. Generate your code:

    • Method 1: Repeatly get configurable settings and example prompts, then generate code based on user-adjusted settings.

      NOTE: This method guarantees high accuracy because you control all the parameters, but it requires more steps and manual tuning.

      1. Use /{peripheral_name}-settings to get configurable settings and an example prompt.

        gencode step1

        example prompt

      2. Based on the example prompt, use /{peripheral_name} to generate your code.

        • Each setting can be adjusted based on your needs.
        • Without clear configuration settings, the likelihood of generating incorrect configurations is higher.

        gencode step2

    • Method 2: Directly generate code by describing your needs in natural language.

      NOTE: This method feels more natural because you just state the goal, but it can miss key details and lead to inaccurate code generation.

      oneshot prompt example

    • Click Always Allow to enable automatic execution of command line operations.

      always allow

Manual Environment Setup for Non-CMSIS Projects

For non-CMSIS projects, you need to manually set up the environment by specifying the DFP path, device, Library path, and optionally the build and flash commands in the extension settings.

Method 1: Using Command Palette

  1. Open Command Palette (Ctrl+Shift+P) → Enter NuCodeGen: Configure Environment (DFP / Device / Library Path).
  2. Set the following fields:
    • Required (all three must be set; if any required field is empty, NuCodeGen cannot be enabled):
      • DFP Path: Path to the Device Family Pack (e.g. C:\Users\<USERNAME>\AppData\Local\Arm\Packs\Nuvoton\NuMicroM55_DFP\3.1.3).
      • Device: Target device name (e.g. M55M1H2LJAE).
      • Library Path: Path to the Library folder of the Board Support Package. For example,
        • C:\Nuvoton\M55M1BSP\Library
        • C:\Users\<USERNAME>\AppData\Local\Arm\Packs\Nuvoton\NuMicroM55_DFP\3.1.3\Library
        • C:\Users\<USERNAME>\AppData\Local\Arm\Packs\Nuvoton\NuMicroM33_DFP\1.0.5\Library\Device\Nuvoton\m3331
        • C:\Users\<USERNAME>\AppData\Local\Arm\Packs\Nuvoton\NuMicroM0_DFP\1.0.3\Device\M030G

        NOTE: This folder must directly contain a StdDriver subfolder (e.g. <Library Path>\StdDriver).

    • Optional:
      • Build Command: Command used to build the project.
      • Flash Command: Command used to flash the project.

Method 2: Using Context Menu

  1. Right-click in the editor → Focus on NuCodeGen → Select Configure Environment (DFP / Device / Library Path).

    configure paths

  2. Set the following fields:
    • Required (all three must be set; if any required field is empty, NuCodeGen cannot be enabled):
      • DFP Path: Path to the Device Family Pack (e.g. C:/Users/<USERNAME>/AppData/Local/Arm/Packs/Nuvoton/NuMicroM55_DFP/3.1.3).
      • Device: Target device name (e.g. M55M1H2LJAE).
      • Library Path: Path to the Library folder of the Board Support Package (e.g. C:/Nuvoton/M55M1BSP/Library).

        NOTE: This folder must directly contain a StdDriver subfolder (e.g. C:/Nuvoton/M55M1BSP/Library/StdDriver).

    • Optional:
      • Build Command: Command used to build the project.
      • Flash Command: Command used to flash the project.

These settings are saved in .vscode/settings.json.

gencode step1

After all required fields are configured, NuCodeGen will appear in the Agent menu. If any required field is empty, NuCodeGen cannot be enabled.

gencode step1

Custom Sub-Skills

You can add your own sub-skill for a specific peripheral to improve code generation related to that peripheral to meet your specific application needs.

  1. Execute the NuCodeGen:Add User-Defined Sub-Skill.

    • Method 1: Open Command Palette (Ctrl+Shift+P) → Enter NuCodeGen:Add User-Defined Sub-Skill
    • Method 2: Right-click in editor → Focus on NuCodeGen → Select Add User-Defined Sub-Skill

      NuCodeGen menu

  2. Select the peripheral for which you want to add a sub-skill.

    • Select currently supported IPs will display a list of all supported peripherals of current chip.

    Select currently supported IPs

  3. Input the sub-skill's file name and press Enter.

    Input sub-skill file name

  4. Input the sub-skill's description and press Enter.

    Input sub-skill description

  5. The sub-skill file will be created in the ~/.copilot/skills/nucodegen/<peripheral_name>/<sub_skill_name> directory.

    Sub-skill file created

  6. The SKILL.md file in ~/.copilot/skills/nucodegen/<peripheral_name>/ is the main file for this peripheral. It contains the file paths and descriptions of all sub-skills.

    • AI will first read this SKILL.md file to understand the sub-skills available for the peripheral, and then it will read the corresponding sub-skill file to generate code based on the user's prompt.

    Skill file

  7. AI will use the sub-skill to generate code for the specified peripheral in specific application scenarios.

    Read sub-skill file

  8. You can also edit the sub-skill file to modify its content.

    • Method 1: Open Command Palette (Ctrl+Shift+P) → Enter NuCodeGen:Open Sub-Skill
    • Method 2: Right-click in editor → Focus on NuCodeGen → Select Open Sub-Skill
  9. You can delete the sub-skill file to remove it.

  • Method 1: Open Command Palette (Ctrl+Shift+P) → Enter NuCodeGen:Delete User-Defined Sub-Skill
  • Method 2: Right-click in editor → Focus on NuCodeGen → Select Delete User-Defined Sub-Skill

Example Prompts

  • NuCodeGen Example Prompts provide a collection of example prompts for various peripherals. These prompts can be used as references to help you generate code for your specific use cases.

Troubleshooting

Shell Integration Unavailable

  • During the process of building the code, you may encounter a Shell integration unavailable issue. shell integration unavailable

    • Solution 1. Enable Shell Integration

      1. Open VSCode
      2. Click Manage -> Settings

        settings

      3. Search terminal.integrated.shellIntegration.enabled
      4. Make sure this feature is turned on.

        enable shell integration

    • Solution 2. Configure VSCode to Use the Correct Shell

      1. Open VSCode
      2. Press Ctrl + Shift + P
      3. Type Terminal: Select Default Profile and choose it
      4. Select one of the supported shells: e.g. git bash, or PowerShell.
        • CMD (Command Prompt) does not support shell integration.
    • Solution 3. Update PowerShell

      If you still encounter the same issue when using PowerShell, upgrade PowerShell to version 7 or later.

      1. Check current PowerShell version by running: $PSVersionTable.PSVersion
      2. If your version is below 7, update PowerShell.

#githubRepo Tool Not Working

  • In the gencode step, the tool-calling mode may retrieve relevant code snippets from the OpenNuvoton GitHub repository.
  • If you encounter issues with the #githubRepo tool.

    #githubRepo tool not working

  • Please ensure that your internet connection is stable and try again.
  • If the problem persists, please use Copilot on the GitHub site to ask a question related to the repository.

    ask github copilot

Disclaimer

AI-Assisted Development Note

NuCodeGen is designed to accelerate your workflow and reduce boilerplate coding using AI. Like all tools powered by Large Language Models (LLMs), the generated code serves as a helpful draft and starting point. Please apply your engineering expertise to review, test, and verify the logic and security before compiling or deploying it to a production environment.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft