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.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Read the following page to understand how tests are structured:
23
-
<!--From Jimmy: Don't export tests to Eclipse or at all. It's not supported, AKA not in CI-->
24
11
25
12
### Prerequisites
26
13
27
14
#### Minimum HAL module support
28
15
29
-
To run the Mbed OS built-in tests, you need to have ported and verified at least these modules:
16
+
To run the Mbed OS built-in tests, you need to have ported and verified at least these HAL modules:
30
17
31
-
- DAPLink.
18
+
- DAPLink or compatible interface firmware.
32
19
33
20
<spanclass="notes">If DAPLink is still under development, please [use manual tests](../porting/manual-testing.html).</span>
34
21
- Low power ticker.
@@ -37,19 +24,16 @@ To run the Mbed OS built-in tests, you need to have ported and verified at least
37
24
38
25
#### mbedls
39
26
40
-
<!--did we ask them to install that? I don't think we've mentioned it. We need a section that discusses the testing tools
41
-
Get Brian to confirm whether it's part of the Mbed OS installation or whether we need a new bit in the installation list to cover Greentea and mbedls-->
42
-
<!--From Jimmy: Mbed CLI automatically installs mbed ls, yes, but that may change in the future-->
43
-
44
27
The board under test needs to be supported in mbedls for automated tests to work.
45
28
46
-
If the official mbedls pip package hasn't been released yet, you need to direct pip to use your local directory (which includes the code changes to support the new board):
29
+
If an updated mbedls pip package hasn't been released yet, you need to direct pip to use your local directory (which includes the code changes to support the new board):
1.[Add your target to the platform database](https://github.com/ARMmbed/mbed-ls#adding-platform-support)
49
33
1. Run `pip install --editable <your_local_root_to_mbed-ls>`.
50
-
1.Create an `mbedls.json` file. This file allows you to override and specify the FTDI USB port.
34
+
1.If you're using an external serial probe (like an FTDI USB cable), create an `mbedls.json` file and specify the serial port.
51
35
52
-
The serial port path varies in different operation systems. On **Windows**, you can find it through Device Manager; it will usually be something like `COM#`. On **Mac OS**and Linux, you can use `ls /dev/tty.usb*`:
36
+
The serial port path varies in different operation systems. On **Windows**, you can find it through Device Manager; it will usually be something like `COM#`. On **Mac OS** you can use `ls /dev/tty.usb*`. On Linux you can use `ls /dev/ttyACM*`. The format of `mbedls.json` is as follows:
53
37
54
38
```
55
39
{
@@ -59,17 +43,20 @@ If the official mbedls pip package hasn't been released yet, you need to direct
59
43
}
60
44
```
61
45
46
+
Where `"33000000e062afa300000000000000000000000097969902"` is the correct target id.
47
+
62
48
### Compiling and running tests
63
49
64
-
1. Compile your tests:
65
-
- To compile all tests, run `mbed test -compile`.
50
+
1. Compile the tests:
51
+
- To compile all tests, run `mbed test --compile`.
66
52
- To see the list of compiled tests, run `mbed test --compile-list`.
67
-
- To compile a specific test, run `mbed test -compile -n <test_name>`. For example: `mbed test --compile -n tests-concurrent-gpio)`.
68
-
1. To run your tests, run `mbedgt`.
53
+
- To compile a specific test, run `mbed test --compile -n <test_name>`. For example: `mbed test --compile -n mbed-os-tests-concurrent-gpio)`.
54
+
1. To run your tests, run `mbed test --run`.
69
55
70
56
71
57
Here is an example of a successful run:
72
58
59
+
<!-- Needs to be updated with output from mbed-cli (mbed test) -->
73
60
```
74
61
mbedgt: greentea test automation tool ver. 1.4.0
75
62
mbedgt: using multiple test specifications from current directory!
@@ -127,22 +114,21 @@ mbedgt: completed in 20.24 sec
127
114
128
115
## Manual testing
129
116
130
-
You may want to run manual tests, for example if DAPLink is still under development. You will need to export your tests from Greentea and import them to your IDE. For example, to work with Eclipse:
117
+
You may want to run manual tests, for example if DAPLink is still under development. You will need to export your tests from Greentea and import them to your IDE. For example:
131
118
132
119
1. Find the test directory:
133
120
134
121
```
135
-
mbed test --compile-list -n mbed-os-tests-mbed_hal-common_ticker
122
+
mbed test -m <new_target> -t gcc_arm --compile-list -n mbed-os-tests-mbed_hal-common_ticker
136
123
```
137
124
138
125
1. Copy the source code to the project root directory:
139
126
140
127
```
141
-
cd <root_dir>
128
+
cd <separate folder from existing porting project>
@@ -154,10 +140,10 @@ You may want to run manual tests, for example if DAPLink is still under developm
154
140
1. Export to a makefile project:
155
141
156
142
```
157
-
mbed export -i gcc_arm -m <new_target>
143
+
mbed export -i <exporter> -m <new_target>
158
144
```
159
145
160
-
1. Open the project with pyOCD (using the same configuration you used [when you initially set up pyOCD]( Creating GDBpyOCDdebugconfiguration).
146
+
1. Open the project with pyOCD (using the same configuration you used [when you initially set up pyOCD](#creating-GDB-pyOCD-debug-configuration).
161
147
162
148
1. Run the program:
163
149
@@ -182,23 +168,17 @@ To build and run the Mbed OS tests:
182
168
183
169
1. Build the tests:
184
170
171
+
<!-- any reason why we're doing a clean build here everytime? I'd really recommend dropping this one, build times will be very high -->
185
172
```
186
-
mbed test --compile -m <new_target> -t gcc_arm -c
173
+
mbed test -m <new_target> -t gcc_arm --compile -c
187
174
```
188
175
189
-
You'll see some build errors. These errors should reduce and eventually disappear as more HAL components are ported.
190
-
191
-
1. To run the tests, go to the `mbed-os` directory.
192
-
193
-
```
194
-
cd mbed-os
195
-
```
196
-
197
-
You can see the full list of built tests:
176
+
If you see some build errors, it means that some HAL modules required to run the tests are missing and need porting.
198
177
178
+
1. You can see the full list of built tests:
199
179
200
180
```
201
-
mbed test --compile-list
181
+
mbed test -m <new_target> -t gcc_arm --compile-list
202
182
```
203
183
204
184
1. Test images are located under the following directory:
@@ -210,36 +190,29 @@ To build and run the Mbed OS tests:
210
190
For example:
211
191
212
192
```
213
-
$ mbed test --compile-list | grep common_tickers
214
-
215
-
Test Case:
216
-
217
-
Name: tests-mbed_hal-common_tickers
218
-
219
-
Path: ./TESTS/mbed_hal/common_tickers
220
-
221
-
Test Case:
222
-
223
-
Name: tests-mbed_hal-common_tickers_freq
193
+
$ mbed test -m <new_target> -t gcc_arm --compile-list -n *tickers*
224
194
225
-
Path: ./TESTS/mbed_hal/common_tickers_freq
195
+
Test Case:
196
+
Name: tests-mbed_hal-common_tickers
197
+
Path: ./TESTS/mbed_hal/common_tickers
198
+
Test Case:
199
+
Name: tests-mbed_hal-common_tickers_freq
200
+
Path: ./TESTS/mbed_hal/common_tickers_freq
226
201
```
227
202
228
203
In this example:
229
204
230
205
- The `common_tickers` test image is at `mbed-os-example-blinky/BUILD/tests/<new_target>/gcc_arm/mbed-os/TESTS/mbed_hal/common_tickers`.
231
206
- 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.`
232
207
233
-
1. You need to flash the test image to the board. You can use either DAPLink or Eclipe IDE. You may also be able to use IAR and Keil (if they already support the new target).
208
+
1. You need to flash the test image to the board. You can use either pyOCD or the Eclipe IDE. You may also be able to use IAR and Keil (if they already support the new target).
234
209
235
210
The easiest method is using the pyOCD flash tool:
236
211
237
212
```
238
-
pyocd-flashtool BUILD/mbed-os-example-blinky.bin or
239
-
pyocd-flashtool BUILD/mbed-os-example-blinky.hex
213
+
pyocd-flashtool BUILD/mbed-os-example-blinky.bin # Use the .hex file if appropriate
240
214
```
241
215
242
216
1. 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.
243
217
244
-
If your test run doesn't start, read [the Greentea documentation for troubleshooting](https://github.com/armmbed/greentea).
245
-
<!--do we have this within the docs, rather than on GitHub? Answer: We think it's this: https://github.com/armmbed/greentea#common-issues We can add this to our docs.-->
218
+
If your test run doesn't start, please read about [troubleshooting Greentea](https://github.com/armmbed/greentea#common-issues).
1. If your target has not been merged into `mbed-os`, replace `mbed-os` with your fork. (Change the URL to match your repository.)
17
18
18
-
1. Open a text editor and change the link in `mbed-os.lib` to `https://github.com/ARMmbed/mbed-os-new-target`, if you haven't done this already while porting.
19
-
20
-
Skip this step if `mbed-os-new-target` has been merged into `mbed-os`.
1. Again, if you have not merged your target into `mbed-os` you will need to add your fork.
63
63
1. [Set up a Pelion account](https://cloud.mbed.com/docs/current/account-management/users.html).
64
64
1. [Generate an API key](https://cloud.mbed.com/docs/current/integrate-web-app/api-keys.html) from the [Device Management Portal](https://portal.mbedcloud.com//login).
65
65
1. In the `mbed-cloud-client-example` clone on your machine, run the following command with the generated API key:
0 commit comments