Skip to content

Commit 2214c95

Browse files
authored
Merge pull request #857 from bridadan/porting_guide_feedback
Feedback on porting guide
2 parents ec962a1 + 6bd8245 commit 2214c95

File tree

5 files changed

+112
-130
lines changed

5 files changed

+112
-130
lines changed

docs/porting/porting_full_process/built_in_tests.md

Lines changed: 34 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,17 @@ It's important to test your port at the end of each module porting, rather than
55
1. Using the Mbed OS built-in tests with [*Greentea*](../tools/greentea-testing-applications.html).
66
1. Using the Mbed OS built-in tests with *manual testing*.
77

8-
98
## Testing with the Greentea framework
109

11-
<!--does Greentea only work with eclipse?--><!--what if I'm not using eclipse?-->
12-
<!--From Jimmy: Greentea isn't designed to be used with Eclipse. Eclipse can do something, but it's designed to be run from the command-line.-->
13-
<!--did we actually ask people to install Greentea? I don't see it in the lists, unless it's bundled into Mbed CLI-->
14-
<!--From Jimmy: Mbed CLI will install Greentea for you, but that may change in the future.-->
15-
<!--We don't currently link to user docs for Greentea, but we really should - I'm just not sure which link to use-->
16-
17-
<!--I can only find eclipse content in debugging, not in testing, and not in the page covering Greentea-->
18-
<!--From Jimmy: Becuse Eclipse is unrelated-->
19-
<!--../tutorials/eclipse.html-->
20-
<!--[https://os.mbed.com/docs/latest/tools/greentea-testing-applications.html](../tools/greentea-testing-applications.html)-->
21-
2210
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-->
2411

2512
### Prerequisites
2613

2714
#### Minimum HAL module support
2815

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:
3017

31-
- DAPLink.
18+
- DAPLink or compatible interface firmware.
3219

3320
<span class="notes">If DAPLink is still under development, please [use manual tests](../porting/manual-testing.html).</span>
3421
- Low power ticker.
@@ -37,19 +24,16 @@ To run the Mbed OS built-in tests, you need to have ported and verified at least
3724

3825
#### mbedls
3926

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-
4427
The board under test needs to be supported in mbedls for automated tests to work.
4528

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):
4730

4831
1. Clone [https://github.com/ARMmbed/mbed-ls](https://github.com/ARMmbed/mbed-ls).
32+
1. [Add your target to the platform database](https://github.com/ARMmbed/mbed-ls#adding-platform-support)
4933
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.
5135

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:
5337

5438
```
5539
{
@@ -59,17 +43,20 @@ If the official mbedls pip package hasn't been released yet, you need to direct
5943
}
6044
```
6145
46+
Where `"33000000e062afa300000000000000000000000097969902"` is the correct target id.
47+
6248
### Compiling and running tests
6349
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`.
6652
- 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`.
6955
7056
7157
Here is an example of a successful run:
7258
59+
<!-- Needs to be updated with output from mbed-cli (mbed test) -->
7360
```
7461
mbedgt: greentea test automation tool ver. 1.4.0
7562
mbedgt: using multiple test specifications from current directory!
@@ -127,22 +114,21 @@ mbedgt: completed in 20.24 sec
127114
128115
## Manual testing
129116
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:
131118
132119
1. Find the test directory:
133120
134121
```
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
136123
```
137124
138125
1. Copy the source code to the project root directory:
139126
140127
```
141-
cd <root_dir>
128+
cd <separate folder from existing porting project>
142129
cp -R mbed-os-example-blinky/mbed-os/TESTS/mbed_hal/common_tickers .
143130
cd common_tickers
144-
mbed new .
145-
rm -rf mbed-os
131+
mbed new --create-only .
146132
```
147133
148134
1. Copy the `mbed-os` directory:
@@ -154,10 +140,10 @@ You may want to run manual tests, for example if DAPLink is still under developm
154140
1. Export to a makefile project:
155141
156142
```
157-
mbed export -i gcc_arm -m <new_target>
143+
mbed export -i <exporter> -m <new_target>
158144
```
159145
160-
1. Open the project with pyOCD (using the same configuration you used [when you initially set up pyOCD]( Creating GDB pyOCD debug configuration).
146+
1. Open the project with pyOCD (using the same configuration you used [when you initially set up pyOCD](#creating-GDB-pyOCD-debug-configuration).
161147
162148
1. Run the program:
163149
@@ -182,23 +168,17 @@ To build and run the Mbed OS tests:
182168
183169
1. Build the tests:
184170
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 -->
185172
```
186-
mbed test --compile -m <new_target> -t gcc_arm -c
173+
mbed test -m <new_target> -t gcc_arm --compile -c
187174
```
188175
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.
198177
178+
1. You can see the full list of built tests:
199179
200180
```
201-
mbed test --compile-list
181+
mbed test -m <new_target> -t gcc_arm --compile-list
202182
```
203183
204184
1. Test images are located under the following directory:
@@ -210,36 +190,29 @@ To build and run the Mbed OS tests:
210190
For example:
211191
212192
```
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*
224194
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
226201
```
227202
228203
In this example:
229204
230205
- The `common_tickers` test image is at `mbed-os-example-blinky/BUILD/tests/<new_target>/gcc_arm/mbed-os/TESTS/mbed_hal/common_tickers`.
231206
- 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.`
232207
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).
234209
235210
The easiest method is using the pyOCD flash tool:
236211
237212
```
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
240214
```
241215
242216
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.
243217
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).

docs/porting/porting_full_process/demo_testing.md

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@ You can use two applications to test your port:
88
### mbed-os-example-blinky
99

1010
1. Application repository: [https://github.com/ARMmbed/mbed-os-example-blinky](https://github.com/ARMmbed/mbed-os-example-blinky).
11-
1. Clone the repo, if you haven't done this already while porting:
11+
1. Import the repo, if you haven't done this already while porting:
1212

1313
```
14-
git clone https://github.com/ARMmbed/mbed-os-example-blinky.git
14+
mbed import https://github.com/ARMmbed/mbed-os-example-blinky.git
1515
cd mbed-os-example-blinky
1616
```
17+
1. If your target has not been merged into `mbed-os`, replace `mbed-os` with your fork. (Change the URL to match your repository.)
1718
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`.
19+
```
20+
mbed remove mbed-os
21+
mbed add https://github.com/ARMmbed/mbed-os-new-target mbed-os
22+
```
2123
2224
1. Build the image:
2325
2426
```
25-
vi mbed-os.lib
26-
mbed deploy
27-
mbed compile --target <new_target> --toolchain GCC_ARM
27+
mbed compile -m <new_target> -t gcc_arm
2828
```
29-
1. Flash the image (.bin or.hex) to the board.
30-
1. Verify the designated LED flashes every 0.5 second. You can use an oscilloscope.
29+
1. Flash the image (.bin or .hex) to the board.
30+
1. Verify the designated LED flashes every 0.5 second. You can use an oscilloscope for accurate measurement.
3131
3232
3333
### mbed-cloud-client-example
@@ -36,12 +36,11 @@ Start with building the bootloader, which you will need for the firmware update
3636
3737
3838
1. Application repository: [https://github.com/armmbed/mbed-bootloader](https://github.com/armmbed/mbed-bootloader).
39+
1. If your target is not merged into `mbed-os` yet you will need to follow the same process as detailed above for adding your fork.
3940
1. Build the image:
4041
4142
```
42-
cd mbed-os-bootloader
43-
mbed deploy
44-
mbed compile --target <new_target> --toolchain GCC_ARM --profile=tiny.json
43+
mbed compile -m <new_target> -t gcc_arm --profile=tiny.json
4544
```
4645
4746
1. Flash the image (.bin or .hex) to the board.
@@ -60,22 +59,21 @@ Start with building the bootloader, which you will need for the firmware update
6059
Then, test connectivity and firmware update:
6160
6261
1. Application repository:[https://github.com/armmbed/mbed-cloud-client-example](https://github.com/armmbed/mbed-cloud-client-example).
62+
1. Again, if you have not merged your target into `mbed-os` you will need to add your fork.
6363
1. [Set up a Pelion account](https://cloud.mbed.com/docs/current/account-management/users.html).
6464
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).
6565
1. In the `mbed-cloud-client-example` clone on your machine, run the following command with the generated API key:
6666
6767
```
6868
$ mbed config -G CLOUD_SDK_API_KEY <API_KEY>
6969
$ mbed target <new_target>
70-
$ mbed toolchain GCC_ARM
70+
$ mbed toolchain gcc_arm
7171
$ mbed dm init -d "<company domain name>" --model-name <new_target>
7272
```
7373
7474
This creates two files: `update_default_resources.c` and `mbed_cloud_dev_credentials.c`. Add these files to your build.
7575
76-
1. You need to customize four files before building:
77-
78-
- Modify `mbed-os.lib` by changing the URL to `https://github.com/ARMmbed/mbed-os-new-target`.
76+
1. You need to customize three files before building:
7977
- Add the new target to `mbed-cloud-client-example/mbed_app.json`. For example, the code block below adds `CC3220SF`:
8078
8179
```
@@ -111,9 +109,7 @@ Then, test connectivity and firmware update:
111109
1. Build the image:
112110
113111
```
114-
cd mbed-cloud-client-example
115-
mbed deploy
116-
mbed compile --target <new_target> --toolchain GCC_ARM
112+
mbed compile -m <new_target> -t gcc_arm
117113
```
118114
119115
1. Flash the image (.bin or .hex) to the board.
@@ -182,7 +178,7 @@ Then, test connectivity and firmware update:
182178
```
183179
184180
1. Verify that the device is registered by finding it in the [Device Management Portal](https://portal.mbedcloud.com//login).
185-
1. Make change in the Device Management Client and rebuild the firmware.
181+
1. Make change in the application, and rebuild the firmware.
186182
1. Perform a firmware update:
187183
188184
```

0 commit comments

Comments
 (0)