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:
-
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.
-
You can see the full list of built tests:
mbed test -m <new_target> -t gcc_arm --compile-list
-
Test images are located under the following directory:
mbed-os-example-blinky/BUILD/tests/<new_target>/gcc_arm/mbed-os/
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 atmbed-os-example-blinky/BUILD/tests/<new_target>/gcc_arm/mbed-os/TESTS/mbed_hal/common_tickers
. - The
common_tickers_freq
test image is atmbed-os-example-blinky/BUILD/tests/<new_target>/gcc_arm/mbed-os/TESTS/mbed_hal/common_tickers_freq.
- The
-
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
-
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.