Skip to content
Experimental simulator for Mbed OS 5 applications
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
build-tools Ignore mbed-lora-radio-drv by default Jan 12, 2019
demos
docs Update architecture document Dec 7, 2018
img Remove black border in Chrome Nov 28, 2017
mbed-simulator-hal
out Add out placeholder dir Oct 24, 2018
server Add headless mode with Puppeteer Dec 26, 2018
viewer
.gitignore Does this remove simple-mbed-cloud-client from npm?? Jan 12, 2019
.mbed
LICENSE
README.md Add headless mode with Puppeteer Dec 26, 2018
build-demos.bat
build-demos.sh
cli.js Add headless mode with Puppeteer Dec 26, 2018
package.json
server.js

README.md

Experimental simulator for Mbed OS 5 applications

Demo: https://labs.mbed.com/simulator

Screenshot

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

Docs

How to run the hosted version

  1. Install a recent version of node.js.

  2. Install Mbed CLI.

  3. Install the Emscripten SDK v1.38.21 - and make sure emcc is in your PATH.

  4. Run:

    $ npm install
    $ sh build-demos.sh
    
  5. Then, start a web server:

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

  7. Blinky runs!

CLI

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

Installation

  1. Install a recent version of node.js.
  2. Install Mbed CLI.
  3. Install the Emscripten SDK v1.38.21 - and make sure emcc is in your PATH.

Then, install the simulator via:

$ npm install mbed-simulator -g

Or if you cloned the project, via:

$ npm install /path/to/simulator -g

This will create a new mbed-simulator binary somewhere in your PATH.

Running

Then run from 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 TARGET_SIMULATOR macro.

Running in headless mode

You can also run the simulator in headless mode, which is great for automated testing. All output (through printf and traces) will be routed to your terminal. To run in headless mode, add the --launch-headless option. You might also want to limit the amount of logging the server does through --disable-runtime-logs 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 out folder a number of pre-built demos are listed. To upgrade them:

macOS and Linux

$ sh build-demos.sh

Windows

$ build-demos.bat

Attribution

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.