The aim of this guide is to walk you through using the Mbed OS greentea testing tools to run automated tests on the Arm MPS2.
For more information, the main greentea page is here: Arm Mbed greentea on GitHub
Before starting, ensure the following:
These instructions use the virtual environment 'virtualenv' which is optional. System installations under virtualenv are non-persistent, thus allowing you to avoid lasting modifications to your computers system.
If you wish to install and run the virtual environment, run the following commands in the directory you wish to set up the tests in:
> pip install virtualenv> virtualenv venv
Activate the virtual environment.
- On Windows: > .\venv\Scripts\activate
.\venv\Scripts\activate
- On Linux/Mac : > source venv/bin/activate
source venv/bin/activate
From the same directory, run the following commands, in the order given, to install the necessary tools and Mbed OS
> pip install mbed-cli mbed-ls> pip install -U mbed-greentea> pip install -U mbed-host-tests> git clone https://github.com/ARMmbed/mbed-os> cd mbed-os
Now that the tools are installed, we need to find your MPS2's unique 'target id'. Run the following:
> mbedls
This should produce output similar to this:
+---------------+----------------------+-------------+-------------+--------------------------+-----------------+| platform_name | platform_name_unique | mount_point | serial_port | target_id | daplink_version |+---------------+----------------------+-------------+-------------+--------------------------+-----------------+| ARM_CM3DS_MPS2| ARM_CM3DS_MPS2[0] | E: | unknown | 50040200074D652F3828F333 | 0001 |+---------------+----------------------+-------------+-------------+--------------------------+-----------------+
Notice how the 'serial_port' is showing up as 'unknown'. We need to tell mbedls which serial port to use.
Create a 'mbedls.json' file within the 'mbed-os' directory you are currently in. Add the following:
{ "50040200074D652F3828F333": { "serial_port": "COM11" }}
Where the 24 figure number should match the 'target_id' that was listed when running 'mbedls'.
You'll also need to change 'COM11' to the correct serial port. You should have found this earlier, please see the "Preparation" steps above for more information.
After saving the file, if the platform name is unknown in the output from mbedls, then run the following
> mbedls --mock 5004:ARM_CM3DS_MPS2
where the 4 figure number is the first four digits from the 'target id' that we see when we run 'mbedls'
Finally, run 'mbedls' again and you should see that the serial port and platform are correctly set (example below):
+---------------+----------------------+-------------+-------------+--------------------------+-----------------+| platform_name | platform_name_unique | mount_point | serial_port | target_id | daplink_version |+---------------+----------------------+-------------+-------------+--------------------------+-----------------+| ARM_CM3DS_MPS2| ARM_CM3DS_MPS2[0] | E: | COM11 |50040200074D652F3828F333 | 0001 |+---------------+----------------------+-------------+-------------+--------------------------+-----------------+
Building and running tests
From the mbed-os directory run the following:
> mbed test -m ARM_CM3DS_MPS2 -t ARM
You should see the tests build (if not already done) then start seeing tests run.
It will take approximately 30 minutes to complete.