mbed OS on an Emulator(QEmu)

Introduce

mbed OS is released on Oct/2015. But it is a few supported boards.

mbed OS supported board list This note is "How to Run mbed OS on an Emulator(QEmu)"

Build mbed OS

Our build target of mbed OS is:

https://mbed-media.mbed.com/STM32F429ZI-DISCO_512.jpg

An Official Manual

"Running your first mbed OS application"

1, Create working directory

command line

$ mkdir blinky
$ cd blinky

2, Initialize of yotta

command line

$ yotta init
Enter the module name: <blinky> 
Enter the initial version: <0.0.0> 1.0.0
Is this an executable (instead of a re-usable library module)? <no> yes
Short description: My blinky example program
Author: Noritsuna Imamura
What is the license for this project (Apache-2.0, ISC, MIT etc.)?  <Apache-2.0> 

3, Setup a target board

Our Target Board:

  • stm32f429i-disco-gcc

command line

$ yotta target stm32f429i-disco-gcc

4, Install mbed driver

command line

$ yotta install mbed-drivers

5, Make a sample application

In the "./source" directory, create a file called "app.cpp" with the following contents:

Sample App:source/app.cpp

#include "mbed-drivers/mbed.h"

static void blinky(void) {
    static DigitalOut led1(LED1);
    static DigitalOut led2(LED2);
    led1 = 1;
    led2 = 1;
}

void app_start(int, char**) {
    while(1) {
        blinky();
    }
}
  • Timer(Scheduler) function does't work on the Emulator(QEmu)

6, Build mbed OS

command line

$ yotta build
info: generate for target: stm32f429i-disco-gcc 0.0.17 at /home/noritsuna/mbedos/blinky/yotta_targets/stm32f429i-disco-gcc
GCC version is: 4.9.3
suppressing warnings from mbed-hal-st-stm32cubef4
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/arm-none-eabi-gcc
-- Configuring done
-- Generating done
-- Build files have been written to: /home/noritsuna/mbedos/blinky/build/stm32f429i-disco-gcc
[159/159] Linking CXX executable source/blinky

7, Directory of output binary

command line

$ build/stm32f429i-disco-gcc/source/blinky.bin

Setup the Emulator(QEmu)

We use the Emulator(QEmu) of "The GNU ARM Eclipse QEMU".

Download the Emulator(QEmu)

Please download the Emulator(QEmu): QEmu for Cortex-M

After download it, Unpack the tarball of the Emulator(QEmu).

Run the Emulator(QEmu)

command line

$ ./qemu/2.4.50-201510290935-dev/bin/qemu-system-gnuarmeclipse -board STM32F429I-Discovery -mcu STM32F429ZI -image ./blinky/build/stm32f429i-disco-gcc/source/blinky.bin

Options:

  • -board STM32F429I-Discovery
  • -mcu STM32F429ZI
  • -image ./blinky/build/stm32f429i-disco-gcc/source/blinky.bin

/media/uploads/noritsuna/mbedos_emu_stm32.png

Build the Emulator(QEmu)

If you want to build the Emulator(QEmu) from source code, please see the following site:

How to Build the QEmu

Benefits:

  • You can analyze mbed OS on the QEmu(It is so hard to analyze it on a real board.).


3 comments on mbed OS on an Emulator(QEmu):

20 Jan 2016

Good tutorial! Thanks

15 Jan 2018

On execution of step no. 3 there is an error:

connection error: HTTPSConnectionPool(host='registry.yottabuild.org', port=443): Max retries exceeded with url: /targets/stm32f429i-disco-gcc/versions (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)) error: tuple index out of range

Please let me know how to solve the error.

12 Jul 2018

try this emulator - http://jumper.io/ Easier to use, no need to install anything. Just drag the binary on the board that shows up on the website. Supported the STM32F411.

Please log in to post comments.