VS Code User Guide

Overview

The Ameba extension is a VS Code extension developed based on Cline. It retains all the native features of Cline while adding specialized functions for the Realtek Ameba series of chips, including development environment checks and automatic installation, SDK configuration, code compilation, firmware flashing, and serial monitoring. These features are provided through an intuitive button interface, simplifying the development workflow for the Ameba series.

Getting Started

  1. Installing the Extension

    In the VS Code Marketplace, search for Ameba and click install.

  2. Using Ameba-only Features

  • On the welcome page shown on first use, you can log in with a Cline account or use a custom API Key.

  • If you do not have a Cline account or API key, you can click the USE Ameba Only button to use only the Ameba-related features.

../_images/vsix_welcome.gif
  1. Ameba Feature Area

The red box in the figure below highlights the Ameba-related feature area.

../_images/vsix_ameba_area.png
  1. Environment Check and Auto-Installation

The extension automatically checks the following configurations:

  • Whether the opened folder or its subfolders contain the Ameba SDK. For SDK download, refer to FreeRTOS SDK Download .

  • Whether the prebuilts for the development environment are installed correctly. If not, two installation options will be provided in the bottom-right corner: Install from GitHub and Install from Aliyun (users in mainland China are recommended to use Aliyun). Click to automatically download and install the prebuilts, and the Python virtual environment will also be automatically created.

../_images/vsix_check_prebuilts.gif
  • If the prebuilts for the development environment are installed correctly, but the Python virtual environment for the SDK has not been created correctly, a notification will appear in the bottom-right corner. Click the Setup Now button to automatically create it.

../_images/vsix_check_venv.gif

The Ameba-related feature buttons will only be activated after all the above checks have passed.

  1. Debug Dependency Plugin Installation

The plugin will automatically check if the development environment has installed the plugin Realtek.ride-debug which is required for debug functionality.

  • If Realtek.ride-debug is not installed in the development environment, a prompt will appear in the lower right corner asking if you want to install it. Click the Install Ride Debugger button to automatically install it.

  • If Realtek.ride-debug is installed but the version is lower than 1.4.5, a prompt will appear in the lower right corner asking if you want to uninstall and reinstall it. Click the Uninstall and reinstall button to automatically uninstall and reinstall it.

  1. Chip Selection

Select the Ameba series chip you want to develop for from the dropdown menu.

../_images/vsix_ic_select.gif
  1. Serial Port Selection

The extension automatically scans and updates all available serial ports in the system. Select the corresponding serial port for your development board from the dropdown menu.

../_images/vsix_port_select.gif
  1. Example Selection

  • Select the corresponding application example from the dropdown menu.

  • After selecting an example, a preview of its corresponding README.md file will be opened.

  • By default, or by selecting None in the examples, the base project configuration will be compiled.

../_images/vsix_example_select.gif

Main Features

Optional Plugin Settings

Go to Settings > Extensions > Ameba to configure parameters. The plugin supports the following optional configurations:

Category

Parameter

Description

Debug

Adapter Speed

Sets the clock frequency of the debugging adapter (kHz), default value is 4000

Debug

Adapter Type

Specifies the type of debugging adapter:

  • Daplink (default)

  • Jlink

Debug

Request Type

Specifies the type of debug request:

  • Attach (default): Attach mode. Suitable for connecting to a running target chip. The chip will not be reset at the start of debugging; execution continues from the current location without disturbing the live system.

  • Launch: Launch mode. Suitable for regular development. The chip will be reset at the start of debugging; the program restarts from the specified entry function.

Debug

Run To Entry Point

Only effective in Launch mode. Specifies the function entry point where the program will automatically pause after start (e.g., main).

Debug

All Stop

  • All stop mode, specialized for multi-core debugging, enabled by default.

  • When any core is suspended due to hitting a breakpoint or pressing the pause button, all cores will automatically suspend.

Debug

Run Sync

  • Synchronous run, specialized for multi-core debugging, disabled by default.

  • When stepping over, stepping into, or pressing “continue,” all cores perform the respective actions synchronously. Must be used with All Stop.

Debug

Live Watch

Live monitoring. Configures whether to enable real-time variable refresh (without pausing the CPU).

Debug

Live Watch Core

Set when Live Watch is enabled. Specifies the target core for real-time monitoring.

Debug

Live Watch Samples Per Second

Set when Live Watch is enabled. Sets the refresh rate of live monitoring data, measured in samples per second.

Flash

Baud Rate

Sets the flashing baud rate, default value is 2000000 bps.

Flash

Include Vfs

Whether to include vfs.bin when flashing, not included by default.

Flash

Memory Type

Specifies the type of Flash as Nor or Nand, default is Nor Flash.

Flash

Reset Board

Attempts to reboot the device after flashing, enabled by default.

Monitor

Enable Log

Whether to enable saving of monitoring logs, disabled by default.

Monitor

Log Directory

Specifies the folder path for saving logs, only effective when Enable Log is enabled.

Monitor

Reset Board

Attempts to reboot the device when monitoring is enabled, enabled by default.

SDK Menuconfig

  1. Select the target chip.

  2. Click the Ameba Menuconfig button to open the graphical SDK menuconfig.

  3. For more information on SDK menuconfig, refer to Configure SDK (menuconfig) .

  4. After finishing the SDK menuconfig, you must save and exit menuconfig interface correctly. If you do not save and exit correctly, it will affect the normal use of other functions. A notification will appear in the bottom-right corner to remind users.

../_images/vsix_config.gif

Project Clean

  1. Select the target chip.

  2. Click the Ameba Clean button to cleanup the project compilation products.

  3. The cleanup process will display detailed progress and log information in real-time.

../_images/vsix_clean.gif

Project Compilation

  1. Select the target chip.

  2. Click the Ameba Build button to compile the project.

  • If an application example has been selected in the dropdown menu, the specified example will be compiled.

  • If no application example is selected or None is selected in the examples, the basic project configuration will be compiled.

  1. The compilation process will display detailed progress and log information in real-time.

../_images/vsix_build.gif

Firmware Flashing

  1. Select the target chip and target serial port.

  2. Optional flashing configurations as described in Optional Plugin Settings.

  3. Click the Ameba Flash button to start the firmware flashing process.

  4. Flashing based on SDK configuration and Flash Layout Information .

  1. It provides real-time feedback on flashing progress and detailed logs.

../_images/vsix_flash.gif

Serial Monitor

  1. Select the target serial port.

  2. Optional monitoring configurations as described in Optional Plugin Settings.

  3. Click the Ameba Monitor button to open the integrated serial monitor, which automatically selects the baud rate and connects to the serial port.

  4. Display and receive serial data in real-time.

  5. Support sending AT commands through the serial port, with auto-completion based on the supported ATCMD List using the Tab key.

  6. Support history function, click the key to quickly view and select previously sent commands.

../_images/vsix_monitor.gif

Below is the English translation of your technical document, preserving professional terminology and structure.

Code Debugging

  1. Hardware Preparation

  • Debug adapter

    • Supports DAP-Link or J-Link (choose either one)

  • Target chip for debugging

  1. Connection Steps

  • Connect the adapter’s SWDIO (SWD) to the target chip’s SWD DATA

  • Connect the adapter’s SWCLK (CLK) to the target chip’s SWD CLK

  • Connect the adapter’s GND to the target chip’s GND to ensure common ground

  • Connect the adapter to the PC via USB

  1. Select the target chip for debugging in the extension

  2. Optional debugging configurations as described in Optional Plugin Settings (Debug)

  3. Click the Ameba Debug button to launch the integrated debugger and start code debugging

../_images/vsix_debug.gif

Note

  1. RTL8730E KM4 core debugging limitation:

  • Disable the tickless feature before debugging, otherwise it will affect debugging behavior.

  1. SWD pin differences:

  • The SWD pin positions may vary across chips/packages. Refer to the corresponding PINMUX table for confirmation.

  1. Connection stability:

  • If the target is not recognized after connection, first check whether the pin mapping is correct.

  • If the connection is unstable, consider lowering the SWD clock frequency.

Debugging Framework

The debugging framework is shown below:

../_images/debug_diagram_local.svg
  1. The target chip connects to the PC via a debug adapter.

  2. When debugging starts, OpenOCD (GDB server) is launched. You can view OpenOCD output logs and status in the VS Code terminal (gdb-server).

  3. The toolchain’s built-in GDB connects to OpenOCD, after which you can perform debugging operations.

Basic Debugging Tips

  1. Debug Toolbar

  • Continue: Resume program execution (default shortcut F5).

  • Pause: Pause the running program (default shortcut F6).

  • Step Over: Execute the current line without entering the function (default shortcut F10).

  • Step Into: Execute step by step and enter the function (default shortcut F11).

  • Step Out: Return from the current function to its caller (default shortcut Shift+F11).

../_images/vsix_debug_toolbar.gif
  1. Variables

This is the most frequently used view during debugging; it displays all data visible at the current stop location. The system automatically categorizes:

  • Local: Local variables within the current function’s scope.

  • Global: Global variables.

  • Static: Static variables within the current file.

  • Registers: Register values of the current CPU core.

../_images/vsix_debug_vars.gif
  1. Watch

The Watch panel allows you to monitor variables of interest. You can monitor in the following ways:

  • View variables:

    • In the code, right-click a variable and select Add to Watch, or click + in the panel and enter the variable name.

  • View any memory address:

    • Enter an address cast expression directly, such as (int)0x20000004, to view the value at that address.

    • Memory view: Press F1 and enter MemoryView to open a dedicated panel to inspect large memory regions in Hex.

  • Type casting:

    • Supports C-style casting; for example, (char*)my_var to view a string value.

../_images/vsix_debug_watch.gif
  1. Call Stack

When code logic is complex, the call stack clearly shows the program execution path.

  • Hierarchical navigation: The top frame is the current paused line, the next frame is the caller (parent function), and so on. Click different frames to jump and view the contextual variables at that time.

../_images/vsix_debug_callstack.gif
  • Multi-core Debug Control

After enabling multi-core debugging, the Call Stack view lists debug sessions for all cores. You can switch between the following collaboration modes via the buttons on the view’s title bar.

Mode

Description

Run Sync

  • Meaning: Synchronous run mode. While paused, issuing a debug command (e.g., Continue, Step Into) on any core will apply the same operation to all other associated cores.

  • Purpose: Keep multi-core execution synchronized on the timeline to avoid inconsistencies that could cause shared-memory communication issues or logic errors.

  • Action: Click the RS button to toggle.

All Stop

  • Meaning: Global stop mode. When any core hits a halt condition (e.g., breakpoint), all cores are forced to halt.

  • Purpose: Ensure global consistency of the debugging context; disabling this allows independent debugging per core.

  • Action: Click the AS button to toggle.

Note

The full implementation of Run Sync typically relies on the All Stop mechanism. Their relationship is as follows:

  • With All Stop enabled, Pause/Continue and stepping actions are synchronized across all cores.

  • With All Stop disabled, each core behaves independently, suitable for single-core troubleshooting.

../_images/vsix_debug_rs.gif
  1. RTOS-Aware

When RTOS-Aware is enabled, the debugger recognizes the operating system’s internal structures. When halted, the debugger displays all existing threads in the RTOS. It also allows you to inspect stacks, registers, and variables of other inactive threads.

In multi-core debugging, this needs to be controlled per core. Toggle it by clicking the RA button in the Call Stack view.

../_images/vsix_debug_ra.gif
  1. Breakpoint Management

Breakpoints are the most commonly used tool during debugging. When execution reaches a breakpoint, it pauses automatically, allowing you to inspect current variables or register information.

Method

Management

Gutter click

  • Add: Click the blank area to the left of the line number in the editor (a red dot will appear).

  • View: Use the Breakpoints panel on the left to list all breakpoints.

  • Remove: Click the red dot again to remove the breakpoint.

Context menu

  • Add: Right-click in the code area and select Add Hardware Breakpoint.

  • View: Use the Breakpoints panel on the left to list all breakpoints.

  • Remove: Use the Breakpoints panel to delete selected breakpoints.

Debug console

  • Add: Enter GDB commands in the debug console

    • b function_name (example: b main, pause at function entry)

    • b function_name thread ID (example: b shared_func thread 8, trigger when thread ID 8 enters)

    • b line_number (example: b 100, pause at line 100 of the current file)

    • b file:line (example: b main.c:50)

  • View: info b

  • Remove: d breakpoint_id

Note

Different chip architectures have a limited number of hardware breakpoints. Exceeding this limit may result in breakpoints being ineffective or falling back to software breakpoints.

../_images/vsix_debug_bp.gif

Advanced Debug Features

  1. Live Watch

The Variables and Watch views require the program to be paused to refresh, whereas Live Watch allows observing variable changes in real-time while the program runs at full speed.

  • Watch types: Global variables or static variables.

  • How to add:

    • Monitor variable values in the LIVE WATCH view. Click + and enter the variable name.

    • While paused, any variable in the Variables view can be added to Live Watch via right-click and selecting Add to live watch.

    • Any register in the XPERIPHERALS view can be added to Live Watch via right-click and selecting Add to live watch.

Note

You need to configure Live Watch parameters before starting a debugging session.

  1. Peripheral Registers

The XPERIPHERALS view allows you to view the values of on-chip peripheral registers.

  • Principle: Based on the chip’s SVD (System View Description) file to parse register addresses and bitfields.

Note

This view will be empty if the SVD file path is not configured correctly.

  1. RTOS Views

The RTOS kernel views comprehensively display various kernel objects managed by the RTOS. These objects are fundamental components for task management, synchronization, and communication in embedded systems. Note that these views are only available during a debugging session.

  • RTOS-TASK:

    • Displays the state of all tasks (Running, Ready, Blocked, Suspended).

    • Shows task name, address, stack usage/remaining stack space (useful for stack overflow diagnosis), runtime, and priority.

  • RTOS-QUEUE:

    • Displays queue name, capacity, current message count, and the list of tasks waiting on the queue.

  • RTOS-SOFTWARE TIMER:

    • Displays timer name, address, status (Active/Inactive, One-shot/Autoreload, Static/Dynamic), period, and callback function name and address.

  • RTOS-HEAP:

    • Displays the dynamic memory address range, allocation details, remaining heap size, and utilization.

  • RTOS-TASK NOTIFICATION:

    • Displays task name, address, the number of received and pending notifications.

Online Documentation

Click the Ameba Doc button to open the default browser and navigate to the official Realtek Ameba website.

../_images/vsix_doc.gif

Advanced Features

If your local machine is a Windows system, the development board is connected to it, but you choose to have the SDK on a Linux server and develop using the VS Code Remote-SSH extension, you can follow these steps:

  1. Download AmebaRemoteService and run it on your local Windows machine. By default, it starts without a password. If security is a concern, you can right-click the software icon to configure a password.

  2. In VS Code, press F1, type ameba: Remote Servers, and click the corresponding option.

  3. Click the Add New Remote Server option.

Server Name:

Enter a custom name for the server.

Server Address:

Enter the IP address of your local Windows machine.

Server Password:

If you have configured a password for the server software, enter it here. Otherwise, press Enter to skip.

  1. After successful configuration, if VS Code is connected to the Ameba SDK via Remote-SSH, the serial port list will be updated with remote serial port information.

  2. Pressing F1 again in VS Code and entering ameba: Remote Servers allows you to view existing server information. You can click on an existing server to delete it.

../_images/vsix_remote_server.gif

Remote Serial Port Flashing

  1. Select the target chip and target remote serial port.

  2. Optional flashing configurations as described in Optional Plugin Settings (Flash).

  3. Click the Ameba Flash button to start the firmware flashing process.

  4. It provides real-time feedback on flashing progress and detailed logs.

Remote Serial Port Monitoring

  1. Select the target remote serial port.

  2. Optional monitoring configurations as described in Optional Plugin Settings (Monitor).

  3. Click the Ameba Monitor button to open the integrated serial monitor, which automatically selects the baud rate and connects to the serial port.

  4. Display and receive serial data in real-time.

Remote Debugging

Remote debugging framework is illustrated as follows:

../_images/debug_diagram_remote.svg
  1. The target chip is connected to the local Windows PC via a debug adapter.

  2. VS Code installed on the Windows PC connects to the remote server via SSH.

  3. When debugging starts, OpenOCD (GDB server) is launched on the local Windows PC by AmebaRemoteService. You can view OpenOCD output logs and status in the AmebaRemoteService window.

  4. The toolchain’s built-in GDB running on the remote server connects to the locally launched OpenOCD, after which debugging operations can proceed.

Startup steps for debugging:

  1. Complete hardware connections and basic configuration as required in Code Debugging.

  2. In the extension, select the target chip for debugging and the remote serial port.

  3. Click the Ameba Debug button to launch the integrated debugger.

  4. Start code debugging; tips and techniques are the same as described in Code Debugging.

../_images/vsix_debug_remote.gif

Troubleshooting

When encountering issues while using the Ameba extension, you can follow these troubleshooting steps:

Extension Installation Failure

Issue: Extension cannot be installed properly or fails to start after installation

Solution: Check system environment version requirements and ensure the following minimum versions are met:

  • VS Code version ≥ 1.84.0

  • Node.js version ≥ 18.16.0

You can check version information through the following methods:

  • Menu bar Help About to view version number

../_images/vsix_vscode_version.png

If the versions do not meet the requirements, please upgrade to the corresponding versions first and then reinstall the extension.

Toolchain Path Modification Issues

Issue: After modifying the toolchain installation path, the extension cannot properly recognize the development environment or functions abnormally

Solution: If you have modified the toolchain installation path (refer to Installing Toolchain ), you need to perform the following steps:

  • Completely close VS Code (ensure all VS Code windows are closed, simply reloading the window is not sufficient)

  • Restart VS Code and open the Ameba SDK project

  • The extension will automatically re-detect the development environment configuration and update the relevant path information