Skip to content

Commit 2edb24d

Browse files
author
Irit Arkin
committed
Test and debug section
1 parent e673fd7 commit 2edb24d

18 files changed

+191
-765
lines changed

docs.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,31 @@
7878
{"type": "markdown", "url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/compile/exporter_instruct.md"}
7979
]
8080
},
81+
{
82+
"title": "Test and debug",
83+
"description": "Test and debug applications using mbed OS and third party tools",
84+
"slug": "mbed-os-test",
85+
"type": "markdown",
86+
"sources": [
87+
{"type": "markdown", "url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/test_debug/debugging_mbed_os_apps.md"},
88+
{"type": "markdown", "url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/test_debug/DAP.md"},
89+
{"type": "markdown", "url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/test_debug/local_debugging_toolchain.md"},
90+
{"type": "markdown", "url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/test_debug/debug_builds_cli.md"},
91+
{"type": "markdown", "url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/test_debug/keil_uvision.md"},
92+
{"type": "markdown", "url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/test_debug/eclipse_pyocd.md"},
93+
{"type": "markdown", "url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/test_debug/vs_code.md"},
94+
{"type": "markdown", "url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/test_debug/other_ides.md"},
95+
{"type": "markdown", "url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/test_debug/.md"},
96+
{"type": "markdown", "url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/test_debug/build_script.md"},
97+
{"type": "markdown", "url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/test_debug/testing.md"},
98+
{"type": "markdown", "url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/test_debug/greentea.md"},
99+
{"type": "markdown", "url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/test_debug/utest.md"},
100+
{"type": "markdown", "url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/test_debug/printf.md"},
101+
{"type": "markdown", "url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/test_debug/compile_time_errors.md"},
102+
{"type": "markdown", "url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/test_debug/lights_of_dead.md"},
103+
{"type": "markdown", "url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/test_debug/microbit.md"}
104+
]
105+
},
81106
{
82107
"title": "mbed OS API refrences",
83108
"description": "References to the mbed OS APIs",

docs/advanced/build_script.md

Lines changed: 0 additions & 600 deletions
This file was deleted.
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
# DAPLink
1+
## DAPLink
22

33
DAPlink is an open source project that implements the embedded firmware required for a Cortex debug probe. The project is hosted on GitHub and is published under an Apache 2.0 license, making it attractive for commercial developments.
44

55
The software project is complemented by a series of reference designs for creating the DAPLink debug probe hardware, which is available [here](https://docs.mbed.com/docs/mbed-hardware-development-kit/en/latest/).
66

7-
## DAPLink features
7+
### DAPLink features
88

99
A DAPLink debug probe connects to your host computer through USB and connects to your target system (the one to be programmed and debugged) through a standard [Cortex debug connector](http://infocenter.arm.com/help/topic/com.arm.doc.faqs/attached/13634/cortex_debug_connectors.pdf). It provides three main features - all over a single USB connection.
1010

11-
### HID interface
11+
#### HID interface
1212

13-
The driver-less HID interface provides a channel over which the CMSIS-DAP debug protocol runs. This enables all the leading industry standard toolchains to program and debug the target system.
13+
The driver-less HID interface provides a channel over which the CMSIS-DAP debug protocol runs. This enables all the leading industry standard toolchains to program and debug the target system.
1414

1515
Supported tools include:
1616

1717
* Keil MDK.
1818
* IAR Workbench.
1919
* pyOCD.
2020

21-
### USB disk drag and drop programming
21+
#### USB disk drag and drop programming
2222

2323
DAPLink debug probes appear on the host computer as a USB disk. Program files in binary (``.bin``) and hex (``.hex``) formats can be copied onto the USB disk, which then programs them into the memory of the target system.
2424

2525
<span class="notes">**Note:** The DAPLink probe needs to contain the programming algorithms specific to the target system. Therefore, the version of the DAPLink firmware you use must match the target system.</span>
2626

27-
## USB serial port
27+
### USB serial port
2828

2929
The DAPLink debug probe also provides a USB serial port, which can be bridged through to a TTL UART on the target system.
3030
The USB serial port will appear on a Windows machine as a COM port, or on a Linux machine as a /dev/tty interface.
3131

3232
For more information on configuring your host computer to use this feature, please [see here](../getting_started/serial_communication.md).
3333

34-
## Further reading
34+
### Further reading
3535

3636
* [The DAPLink GitHub repo](https://github.com/ARMmbed/DAPLink/blob/master/README.md).
3737
* [Debug probes built with DAPLink](https://developer.mbed.org/platforms/SWDAP-LPC11U35).

docs/test_debug/build_script.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## The build script environment
2+
3+
[needs to be rewritten]

docs/test_debug/compile_time.md renamed to docs/test_debug/compile_time_errors.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Compile time errors
1+
## Compile time errors
22

33
Compile time errors and warnings that incorrect syntax, or misuse of variables or functions, causes. An error prevents the compile process from completing (and therefore no binary file will be created). A warning does not prevent the binary from being created, but you should still review the warning because it may mean that your code is not going to do what you had intended.
44

@@ -9,4 +9,4 @@ Common errors are:
99
* Missing quotes or brackets (`""`, `()`, `[]` or `{}`). These are used in pairs to contain various types of statement. The compiler reports an error if you have not used them in correct pairings.
1010
* Always tackle the first reported error because later errors may be as a result of the first one and will disappear you correct the first one.
1111

12-
If you see a compile time error or warning that you do not understand, you can usually find explanations of the error message on Google, or post to the [mbed forums](https://developer.mbed.org/questions/).
12+
If you see a compile time error or warning that you do not understand, you can usually find explanations of the error message on Google, or post to the [mbed forums](https://developer.mbed.org/questions/).

docs/test_debug/debug_builds.md renamed to docs/test_debug/debug_builds_cli.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Producing debug builds with mbed CLI
1+
## Producing debug builds with mbed CLI
22

33
After you've set up your [local debug toolchain](toolchain.md), you'll need firmware that includes program symbols (an `.elf` file). Because the Online Compiler only produces binaries that omit the program symbols, you need to compile locally using [mbed CLI](https://docs.mbed.com/docs/mbed-os-handbook/en/latest/dev_tools/cli/).
44

55
<span class="notes">**Note:** Make sure to do a clean build when switching to and from debug and release by removing the `BUILD` folder.</span>
66

7-
## Compile commands
7+
### Compile commands
88

99
**mbed OS 5.2 and later**
1010

@@ -24,7 +24,7 @@ $ mbed compile -o debug-info
2424
$ mbed compile --profile .temp/tools/profiles/debug.json
2525
```
2626

27-
## Exporting with debug symbols
27+
### Exporting with debug symbols
2828

2929
You can also enable debug symbols when [exporting your project](https://docs.mbed.com/docs/mbed-os-handbook/en/latest/dev_tools/cli/#exporting-to-desktop-ides) by using:
3030

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# Debugging mbed OS applications
1+
## Debugging mbed OS applications
22

33
At the heart of mbed is the [Online Compiler](https://docs.mbed.com/docs/mbed-os-handbook/en/latest/dev_tools/online_comp/). While that is incredibly convenient for getting a project started or while prototyping, chances are that at some point you'll miss a debugger, or you'll want to develop while not having an active internet connection. Through debugging, you can do things such as set breakpoints, set watchpoints, view registers, view disassembly, browse memory and examine the callstack. These docs will help you debug your applications.
44

55
The simplest way to debug your code is to augment your code with log statements, which can be observed from your computer. To set this up, read [Debugging with printf() calls](printf.md).
66

7-
## Compile time and runtime errors
7+
### Compile time and runtime errors
88

99
If your program will not compile, first read [Debugging compile time errors](compile_time.md).
1010

1111
If your development board blinks very fast, or shows 'siren lights', see [Lights of dead](lights_of_dead.md).
1212

13-
## Debugging from an IDE
13+
### Debugging from an IDE
1414

1515
Keil uVision natively supports debugging mbed OS applications. To set up uVision, read [Debugging with Keil uVision](Keil.md).
1616

@@ -21,7 +21,7 @@ mbed also supports debugging using any IDE that supports GDB. To set up the debu
2121
1. Debugging with [Visual Studio Code](vscode.md).
2222
1. Debugging with [other IDEs that support GDB](other_ides.md).
2323

24-
## Links to other sources
24+
### Links to other sources
2525

2626
* [Using CMSIS-DAP to debug a device after it crashes](https://developer.mbed.org/blog/entry/Post-mortem-debugging-with-ARM-mbed/).
2727
* [Debugging the micro:bit with pyOCD and GDB](debugging_microbit.md).

docs/test_debug/debugging_eclipse_pyocd.md renamed to docs/test_debug/eclipse_pyocd.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Debugging mbed OS 5 applications with Eclipse
1+
## Debugging mbed OS 5 applications with Eclipse
22

33
This document explains how to build and debug mbed OS applications using Eclipse. Before starting, please [configure your local debug toolchain](toolchain.md).
44

5-
## Installing Eclipse
5+
### Installing Eclipse
66

77
You need to install Eclipse CDT with the GNU ARM Eclipse plugins to begin:
88

@@ -20,11 +20,11 @@ You need to install Eclipse CDT with the GNU ARM Eclipse plugins to begin:
2020
1. Click **Next** repeatedly, and accept the license agreements.
2121
1. Click **Finish**. If prompted to restart Eclipse, click **Yes**.
2222

23-
## Exporting a project
23+
### Exporting a project
2424

2525
To export your project to Eclipse, you can use either the mbed Online Compiler or mbed CLI.
2626

27-
### Online compiler
27+
#### Online compiler
2828

2929
1. Right click on your project.
3030
1. Select *Export Program...*.
@@ -35,7 +35,7 @@ To export your project to Eclipse, you can use either the mbed Online Compiler o
3535

3636
![Exporting to Eclipse](Images/eclipse1.png)
3737

38-
### mbed CLI
38+
#### mbed CLI
3939

4040
In your project folder, run:
4141

@@ -46,7 +46,7 @@ In your project folder, run:
4646
$ mbed export -i eclipse_gcc_arm -m K64F --profile mbed-os/tools/profiles/debug.json
4747
```
4848

49-
## Importing the project in Eclipse
49+
### Importing the project in Eclipse
5050

5151
1. Open Eclipse.
5252
1. On the *Welcome* screen, select *Import a project with a working Makefile*.
@@ -58,7 +58,7 @@ $ mbed export -i eclipse_gcc_arm -m K64F --profile mbed-os/tools/profiles/debug.
5858
1. Dismiss the Welcome screen.
5959
1. Select *Project > Build Project* to build the project.
6060

61-
<span class="notes">**Note:** If build fails with error
61+
<span class="notes">**Note:** If build fails with error
6262
1. `make[1]: arm-none-eabi-g++: No such file or directory`, you need to configure Eclipse's PATH (not your OS PATH).
6363
1. `Program "make" not found in PATH`, install [GNU-Make utility](http://gnuwin32.sourceforge.net/packages/make.htm), and configure Eclipse's PATH.
6464

@@ -75,7 +75,7 @@ Steps to update Eclipse's PATH
7575

7676
Once the project builds, you can configure the debugger. The configuration depends on the debug server you're using: pyOCD or OpenOCD.
7777

78-
### pyOCD
78+
#### pyOCD
7979

8080
1. Select *Run > Debug Configurations...*.
8181
1. If no configuration exists under *GDB pyOCD Debugging*, click on *New launch configuration*.
@@ -92,7 +92,7 @@ Once the project builds, you can configure the debugger. The configuration depen
9292
1. Click *Apply*.
9393
1. Click *Debug* to start debugging.
9494

95-
### OpenOCD
95+
#### OpenOCD
9696

9797
1. Select *Run > Debug Configurations...*.
9898
1. If a configuration already exists under *GDB pyOCD Debugging*, please remove it.
@@ -113,7 +113,7 @@ Once the project builds, you can configure the debugger. The configuration depen
113113

114114
![Debugging an mbed OS 5 application in Eclipse](Images/eclipse9.png)
115115

116-
## Building with mbed CLI
116+
### Building with mbed CLI
117117

118118
We build using Make, but you can also use mbed CLI for building from Eclipse:
119119

docs/advanced/greentea.md renamed to docs/test_debug/greentea.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
[![Circle CI](https://circleci.com/gh/ARMmbed/greentea.svg?style=svg)](https://circleci.com/gh/ARMmbed/greentea)
2-
[![Coverage Status](https://coveralls.io/repos/github/ARMmbed/greentea/badge.svg?branch=master)](https://coveralls.io/github/ARMmbed/greentea?branch=master)
3-
[![PyPI version](https://badge.fury.io/py/mbed-greentea.svg)](https://badge.fury.io/py/mbed-greentea)
41

5-
# Greentea - test automation for mbed
2+
## Greentea - test automation for mbed
3+
64
_**G**eneric **re**gression **en**vironment for **te**st **a**utomation_
75

8-
## Introduction
6+
### Introduction
97

108
Greentea is the automated testing tool for mbed OS development. It automates the process of flashing mbed boards, driving the test and accumulating test results into test reports. Developers use it for local development as well as for automation in a Continuous Integration environment.
119

1210
This document should help you start using Greentea. Please see the [htrun documentation](https://github.com/ARMmbed/htrun), the tool Greentea uses to drive tests, for the technical details of the interactions between the platform and the host machine.
1311

14-
### Prerequistes
12+
#### Prerequisites
1513

1614
Greentea requires [Python version 2.7](https://www.python.org/downloads/). It supports the following OSes:
1715

1816
- Windows
1917
- Linux (Ubuntu preferred)
2018
- OS X (experimental)
2119

22-
### Installing
20+
#### Installing
2321

2422
Tools that depend on Greentea usually install it. Determine if Greentea is already installed by running:
2523
```
@@ -33,15 +31,15 @@ You can also install it manually via pip.
3331
pip install mbed-greentea
3432
```
3533

36-
## Test specification JSON format
34+
### Test specification JSON format
3735

3836
The Greentea test specification format decouples the tool from your build system. It provides important data, such as test names, paths to test binaries and the platform on which the binaries should run.
3937

4038
Greentea automatically looks for files called `test_spec.json` in your working directory. You can also use the `--test-spec` argument to direct Greentea to a specific test specification file.
4139

4240
When you use the `-t` / `--target` argument with the `--test-spec` argument, you can select which "build" should be used. In the example below, you could provide the arguments `--test-spec test_spec.json -t K64F-ARM` to only run that build's tests.
4341

44-
### Example of test specification file
42+
#### Example of test specification file
4543

4644
In the below example, there are two defined builds:
4745
* Build `K64F-ARM` for NXP `K64F` platform compiled with `ARMCC` compiler.
@@ -96,12 +94,12 @@ In the below example, there are two defined builds:
9694

9795
The examples below use the above test specification file.
9896

99-
## Command-line usage
97+
### Command-line usage
10098
This section highlights a few of the capabilities of the Greentea command-line interface. For a full list of the available options, please run `mbedgt --help`.
10199

102100
Assume for the examples below that the above `test_spec.json` file is in the current directory.
103101

104-
### Listing all tests
102+
#### Listing all tests
105103
You can use the `-l` argument to list all available tests:
106104

107105
```
@@ -117,7 +115,7 @@ mbedgt: available tests for built 'K64F-ARM', location 'BUILD/tests/K64F/ARM'
117115
test 'tests-mbedmicro-rtos-mbed-mail'
118116
```
119117

120-
### Executing all tests
118+
#### Executing all tests
121119
The default action of Greentea is to execute all tests that were found.
122120
```
123121
$ mbedgt
@@ -531,7 +529,7 @@ mbedgt: completed in 53.59 sec
531529
532530
```
533531

534-
### Limiting tests
532+
#### Limiting tests
535533
You can select test cases by name using the `-n` argument. This command executes all tests named `tests-mbedmicro-rtos-mbed-mail` from all builds in the test specification:
536534
```
537535
$ mbedgt -n tests-mbedmicro-rtos-mbed-mail
@@ -553,7 +551,7 @@ You can use a comma (`,`) to separate test names (argument `-n`) and build names
553551
$ mbedgt -n tests-mbedmicro-rtos-mbed-mail,tests-mbed_drivers-c_strings -t K64F-ARM,K64F-GCC_ARM
554552
```
555553

556-
### Selecting platforms
554+
#### Selecting platforms
557555
You can limit which boards Greentea uses for testing by using the `--use-tids` argument.
558556

559557
```
@@ -576,39 +574,41 @@ $ mbedls
576574
```
577575
In this case, you won't test one target, the LPC1768.
578576

579-
### Creating reports
577+
#### Creating reports
580578
Greentea supports a number of report formats.
581579

582-
#### HTML
580+
##### HTML
583581
This creates an interactive HTML page with test results and logs.
584582
```
585583
mbedgt --report-html html_report.html
586584
```
587585

588-
#### JUnit
586+
##### JUnit
589587
This creates an XML JUnit report, which you can use with popular Continuous Integration software, such as [Jenkins](https://jenkins.io/index.html).
590588
```
591589
mbedgt --report-junit junit_report.xml
592590
```
593591

594-
#### JSON
592+
##### JSON
595593
This creates a general JSON report.
596594
```
597595
mbedgt --report-json json_report.json
598596
```
599597

600-
#### Plain text
598+
##### Plain text
601599
This creates a human-friendly text summary of the test run.
602600
```
603601
mbedgt --report-text text_report.text
604602
```
605603

606-
## Host test detection
604+
### Host test detection
607605
When developing with mbed OS, Greentea detects host tests automatically if you place them in the correct location. All tests in mbed OS are placed under a `TESTS` directory. You may place custom host test scripts in a folder named `host_tests` in this folder. For more information about the mbed OS test directory structure, please see the [mbed CLI documentation](https://docs.mbed.com/docs/mbed-os-handbook/en/latest/dev_tools/cli/#test-directory-structure).
608606

609-
## Common issues
607+
### Common issues
608+
609+
#### `IOERR_SERIAL` errors
610610

611-
### `IOERR_SERIAL` errors
612611
Possible causes:
612+
613613
- Another program is using the serial port. Be sure all terminals and other instances of Greentea are closed before trying again.
614614
- The mbed interface firmware is out of date. Please see the platform's page on [developer.mbed.org](https://developer.mbed.org/) for details about how to update it.

0 commit comments

Comments
 (0)