Mistake on this page?
Report an issue in GitHub or email us

Mbed OS built-in tests - detailed procedure

Whether you're using Greentea or performing manual tests, the procedure for using the built-in Mbed OS tests is the same.

To build and run the Mbed OS tests:

  1. Build the tests:

    mbed test -m <new_target> -t gcc_arm --compile

    If you see some build errors, it means that some HAL modules required to run the tests are missing and need porting.

  2. You can see the full list of built tests:

    mbed test -m <new_target> -t gcc_arm --compile-list
  3. Test images are located under the following directory:


    For example:

    $ mbed test -m <new_target> -t gcc_arm --compile-list -n *tickers*
    Test Case:
        Name: tests-mbed_hal-common_tickers
        Path: ./TESTS/mbed_hal/common_tickers
    Test Case:
        Name: tests-mbed_hal-common_tickers_freq
        Path: ./TESTS/mbed_hal/common_tickers_freq

    In this example:

    • The common_tickers test image is at mbed-os-example-blinky/BUILD/tests/<new_target>/gcc_arm/mbed-os/TESTS/mbed_hal/common_tickers.
    • The common_tickers_freq test image is at mbed-os-example-blinky/BUILD/tests/<new_target>/gcc_arm/mbed-os/TESTS/mbed_hal/common_tickers_freq.
  4. You need to flash the test image to the board. You can use pyOCD (from the command line or IDE), or you could use IAR and Keil (if they already support the new target).

    The easiest method is using the pyOCD flash tool:

    pyocd-flashtool BUILD/mbed-os-example-blinky.bin    # Use the .hex file if appropriate
  5. Before you begin the test run, please make sure the serial port is not already opened by programs like Screen or Teraterm (close them if they're open). In addition, verify mbedls lists the new target device.

    If your test run doesn't start, please read about troubleshooting Greentea.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.