Need help with mbed-simulator?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

150 Stars 50 Forks Other 252 Commits 11 Opened issues


Experimental simulator for Mbed OS 5 applications

Services available


Need anything else?

Contributors list

# 69,775
216 commits
# 209,313
4 commits
# 101,224
1 commit

New repository

I have left Arm (and started Edge Impulse!) and Arm has taken over development of the simulator. See ArmMbed/mbed-simulator for more information.

Experimental simulator for Mbed OS 5 applications



While we have worked hard to improve embedded development tooling in Mbed (e.g. via the Online Compiler), the development for microcontrollers is still very similar to how it was in the 90s. Compilation is slow, and flashing is even slower. When fixing a bug, you need to get the device into the exact state as before encountering the bug. This makes for a very slow feedback loop, which hinders productivity and often pulls you out of the zone.

To make this feedback loop much shorter, we're releasing an alpha version of the Mbed Simulator. The simulator allows you to run your Mbed OS 5 applications directly on your computer, so that you can quickly test and verify applications without flashing them on a real board. This is a valuable learning tool, as you quickly learn how Mbed works. It is also very useful for developing complex applications. Within Arm, we have been using the simulator for work on mbed-http, the Mbed LoRaWAN stack and uTensor.

Note: The Mbed Simulator is part of Mbed Labs. The Mbed Labs projects showcase interesting side projects developed by Mbed engineers. However, these projects are not actively supported by Arm, and may be added, removed or break at any time.

More information in the introductionary blog post




  1. Install Mbed CLI.
  2. Install Python 2.7 - not Python 3!.
  3. Install Git.
  4. Install Mercurial.
  5. Install Node.js v8 or higher.

Make sure that all of these are in your PATH. Verify this by opening a command prompt or terminal, and running:

$ where mbed

$ where node C:\Program Files\nodejs2\node.exe

$ where git C:\Program Files\Git\cmd\git.exe

$ where hg C:\Program Files\TortoiseHg\hg.exe

On Linux and macOS use

instead of

If one of the

commands does not yield a path, the utility is not in your PATH.

Installing Emscripten

To install the Emscripten cross-compilation toolchain, open a command prompt and:

  1. Clone the repository and install SDK version 1.38.21:

    $ git clone
    $ cd emsdk
    $ emsdk install emscripten-1.38.21
    $ emsdk install sdk-fastcomp-tag-1.38.21-64bit
    $ emsdk activate emscripten-1.38.21
    $ emsdk activate fastcomp-clang-tag-e1.38.21-64bit

    on Windows only:

    $ emsdk_env.bat --global

  2. Verify that the installation was successful:

    $ emcc -v
    emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.38.21
  3. Find the folder where emcc was installed:


    $ where emcc

    macOS and Linux

    $ which emcc
  4. Add this folder to your PATH.

    • On Windows:
      • Go to System Properties > Advanced > Environmental variables.
      • Find
      • Add the folder you found in the previous step, and add it prefixed by
        . E.g.:
    • On macOS / Linux:

      • Open
        and add:
  5. Open a new command prompt and verify that

    can still be found by running:
    $ where emcc
  6. All set!

Installing the simulator through npm

Last, install the simulator. Easiest is through npm:

  1. Install the simulator:

    $ npm install mbed-simulator -g
  2. Clone an Mbed OS example program:

    $ mbed import mbed-os-example-blinky
    $ cd mbed-os-example-blinky
  3. Run the simulator:

    $ mbed-simulator .

    Note that this will download all dependencies (including Mbed OS) and will build the common

    library so this'll take some time.

Installing the simulator from source

  1. Install the simulator through git:

    $ git clone
    $ cd mbed-simulator
    $ npm install
    $ npm install . -g
  2. Build your first example:

    $ node cli.js -i demos\blinky -o out --launch

    Note that this will download all dependencies (including Mbed OS) and will build the common

    library so this'll take some time.
  3. Done! The Mbed Simulator should now launch in your default browser.


Windows: [Error 87] The parameter is incorrect

This error is thrown on Windows systems when the path length limit is hit. Move the

folder to a folder closer to root (e.g.

How to run the hosted version

  1. Install all dependencies, and clone the repository from source (see above).
  2. Run:

    $ npm install


    $ build-demos.bat

    macOS / Linux

    $ sh

  3. Then, start a web server:

    $ node server.js
  4. Open http://localhost:7829 in your browser.

  5. Blinky runs!


The simulator comes with a CLI to run any Mbed OS 5 project under the simulator.


To run an Mbed OS 5 project:

$ mbed-simulator .

The project will build and a web browser window will open for you.

To see if your program runs in the simulator, check the


Running in headless mode

You can also run the simulator in headless mode, which is great for automated testing. All output (through

and traces) will be routed to your terminal. To run in headless mode, add the
option. You might also want to limit the amount of logging the server does through
to keep the output clean.

Changing mbed-simulator-hal

After changing anything in the simulator HAL, you need to recompile the libmbed library:

  1. Run:

    $ rm mbed-simulator-hal/libmbed.bc
  2. Rebuild your application. libmbed will automatically be generated.

Updating demo's

In the

folder a number of pre-built demos are listed. To upgrade them:

macOS and Linux

$ sh


$ build-demos.bat


  • viewer/img/controller_mbed.svg
    - created by Fritzing, licensed under Creative Commons Attribution-ShareALike 3.0 Unported.
  • Thermometer by Licensed under MIT.
  • LED icons from, Licensed under CC0 Creative Commons.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.