Skip to content
| Marketplace
Sign in
Visual Studio Code>Education>BBC micro:bit C++New to Visual Studio Code? Get it now.
BBC micro:bit C++

BBC micro:bit C++

carlosperate

|
2 installs
| (0) | Free
Build CODAL C++ programs for the BBC micro:bit, directly in VS Code without external compilers and toolchains needed.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

BBC micro:bit C++ VS Code Extension

Build C++ programs for the BBC micro:bit with CODAL, in VS Code (web and desktop) without any additional compilers or toolchains.

The Clang compiler, LLD and the LLVM binutils have been built to WebAssembly, and together with Arm Toolchain for Embedded's C and C++ libraries and a prebuilt CODAL, this extension includes everything internally to compile micro:bit C++ programmes.

🚧 Preview. It builds one fixed CODAL version in one fixed configuration. See the limits.

How To Use This Extension

  1. Open a workspace that holds a main.cpp
    1. Alternatively you can run the BBC micro:bit C++: Create C++ Project command to create it.
  2. Open the BBC micro:bit C++ icon in the Activity Bar, and press Build micro:bit C++ project.
  3. MICROBIT.hex and MICROBIT.map appear beside your sources, and the compiler's output is in the BBC micro:bit C++ output channel.
  4. Press Flash C++ project hex to build again and write it to a connected micro:bit V2, or copy MICROBIT.hex onto the MICROBIT drive yourself.
  5. Open serial terminal shows what the program prints.

Every button is also a command, so BBC micro:bit C++: Build C++ Project and BBC micro:bit C++: Flash C++ Project do the same from the Command Palette, which opens with Ctrl/Cmd+Shift+P or F1.

The board

Connecting, flashing and the serial terminal are managed by the BBC micro:bit Manager extension, which is installed together with this one. It creates a micro:bit item in the status bar, which lists this extension's commands too.

A build takes every .cpp, .cc and .cxx file under the workspace, and every header, excluding what's listed in the bbcmicrobit-cpp.build.exclude setting.

The C++ toolchain built into this extension

On a desktop computer, you normally have to install arm-none-eabi-gcc, CMake, Ninja, and Python; then clone microbit-v2-samples, and use the build script.

This extension carries the compiler in microbit-clang-wasm and CODAL with its build recipe in microbit-clang-wasm-codal, currently using CODAL v0.3.5. The recipe is captured from CODAL's own CMake build with the Clang toolchain, so the flags and codal.json are the default ones that build uses.

Limits of this preview

  • One CODAL version and one configuration. codal.json cannot be changed yet; the configuration is the microbit-v2-samples default, with the SoftDevice present and the BLE stack off.
  • micro:bit V2 only. CODAL builds for the V2's processor, so flashing refuses a V1 rather than writing an image it cannot run.
  • Errors are text in the output channel, not markers in the editor.
  • Memory. The compiler needs a bit less than 1 GB of RAM when it compiles, and keeps about half of that warm, so that later builds start and complete faster. On web close/reload the window to free up the memory back, and on desktop you can close/reopen the window.

Licence

This extension is MIT, see LICENSE. The compiler, its libraries and CODAL carry their own licences, and every notice ships inside the extension: see LICENSES.md.

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