Skip to content

Commit 7b828b3

Browse files
committed
Update readme
1 parent 6b8a85a commit 7b828b3

File tree

1 file changed

+27
-37
lines changed

1 file changed

+27
-37
lines changed

README.md

Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,46 @@
1-
# HTTPS File Download Example for TLS Client
1+
# HTTPS File Download Example for TLS Client on mbed OS
22

33
This application downloads a file from an HTTPS server (developer.mbed.org) and looks for a specific string in that file.
44

5-
This example is implemented as a logic class (HelloHTTPS) wrapping a TCP socket and a TLS context. The logic class handles all events, leaving the main loop to just check if the process has finished.
5+
## Required hardware
66

7-
## Pre-requisites
8-
9-
To build and run this example you must have:
10-
11-
* A computer with the following software installed:
12-
* [CMake](http://www.cmake.org/download/).
13-
* [The ARM GCC toolchain](https://launchpad.net/gcc-arm-embedded).
14-
* A serial terminal emulator (Like screen, pySerial and cu).
15-
* An [FRDM-K64F](http://developer.mbed.org/platforms/FRDM-K64F/) development board, or another board supported by mbed OS (in which case you'll have to substitute frdm-k64f-gcc with the appropriate target in the instructions below).
7+
* An [FRDM-K64F](http://developer.mbed.org/platforms/FRDM-K64F/) development board.
168
* A micro-USB cable.
17-
* An Ethernet connection to the internet.
18-
* An Ethernet cable.
19-
* If your OS is Windows, please follow the installation instructions [for the serial port driver](https://developer.mbed.org/handbook/Windows-serial-configuration).
9+
* An Ethernet cable and connection to the internet.
10+
11+
## Required software
12+
* [mbed-cli](https://github.com/ARMmbed/mbed-cli) - to build the example program. To learn how to build mbed OS applications with mbed-cli, see the [user guide](https://github.com/ARMmbed/mbed-cli/blob/master/README.md)
13+
* [Serial port monitor](https://developer.mbed.org/handbook/SerialPC#host-interface-and-terminal-applications).
2014

2115
## Getting started
2216

23-
1. Connect the FRDM-K64F to the internet using the Ethernet cable.
17+
1. Clone [this](https://github.com/ARMmbed/mbed-tls-sample) repository.
2418

25-
2. Connect the FRDM-K64F to the computer with the micro-USB cable, being careful to use the "OpenSDA" connector on the target board.
19+
2. Open a command line tool and navigate to the project’s directory.
2620

27-
3. Navigate to the mbedtls directory supplied with your release and open a terminal.
21+
3. Update mbed-os sources using the `mbed update` command.
2822

29-
4. Set the yotta target:
23+
4. Build the application by selecting the hardware board and build the toolchain using the command `mbed compile -m K64F -t GCC_ARM -c -j0`. mbed-cli builds a binary file under the project’s `.build` directory.
3024

31-
```
32-
yotta target frdm-k64f-gcc
33-
```
25+
5. Connect the FRDM-K64F to the internet using the Ethernet cable.
3426

35-
5. Build mbedtls and the examples. This will take a long time if it is the first time:
27+
6. Connect the FRDM-K64F to the computer with the micro-USB cable, being careful to use the **OpenSDA** connector on the target board. The board is listed as a mass-storage device.
3628

37-
```
38-
$ yotta build
39-
```
29+
7. Drag the binary `.build/K64F/GCC_ARM/mbed-tls-sample.bin` to the board to flash the application.
4030

41-
6. Copy `build/frdm-k64f-gcc/test/mbedtls-test-example-tls-client.bin` to your mbed board and wait until the LED next to the USB port stops blinking.
31+
8. The board is automatically programmed with the new binary. A flashing LED on it indicates that it is still working. When the LED stops blinking, the board is ready to work.
4232

43-
7. Start the serial terminal emulator and connect to the virtual serial port presented by FRDM-K64F.
33+
9. Press the **RESET** button on the board to run the program.
4434

45-
Use the following settings:
35+
## Monitoring the application
4636

47-
* 115200 baud (not 9600).
48-
* 8N1.
49-
* No flow control.
37+
The application prints debug messages over the serial port, so you can monitor its activity with a serial terminal emulator. Start the [serial terminal emulator](https://developer.mbed.org/handbook/Terminals) and connect to the [virtual serial port](https://developer.mbed.org/handbook/SerialPC#host-interface-and-terminal-applications) presented by FRDM-K64F. Use the following settings:
5038

51-
8. Press the Reset button on the board.
39+
* 115200 baud (not 9600).
40+
* 8N1.
41+
* No flow control.
5242

53-
9. The output in the terminal window should look similar to this:
43+
After pressing the **RESET** button on the board, the output in the terminal window should look similar to this:
5444

5545
```
5646
{{timeout;120}}
@@ -109,8 +99,6 @@ To build and run this example you must have:
10999

110100
## Debugging the TLS connection
111101

112-
If you are experiencing problems with this example, you should first rule out network issues by making sure the [simple HTTP file downloader example](https://github.com/ARMmbed/mbed-example-network-private/tree/master/test/helloworld-tcpclient) for the TCP module works as expected. If not, please follow the debug instructions for the HTTP file example before proceeding with the instructions below.
113-
114102
To print out more debug information about the TLS connection, edit the file `source/main.cpp` and change the definition of `DEBUG_LEVEL` (near the top of the file) from 0 to a positive number:
115103

116104
* Level 1 only prints non-zero return codes from SSL functions and information about the full certificate chain being verified.
@@ -129,6 +117,8 @@ If the TLS connection is failing with an error similar to:
129117
Failed to fetch /media/uploads/mbed_official/hello.txt from developer.mbed.org:443
130118
```
131119

132-
it probably means you need to update the contents of the `SSL_CA_PEM` constant (this can happen if you modify `HTTPS_SERVER_NAME`, or when `developer.mbed.org` switches to a new CA when updating its certificate).
120+
it probably means you need to update the contents of the `SSL_CA_PEM` constant (this can happen if you modify `HTTPS_SERVER_NAME`, or when `developer.mbed.org` switches to a new CA when updating its certificate).
121+
122+
Another reason for this error may be a proxy providing a different certificate. Proxies can be used in some network configurations or for performing man-in-the-middle attacks. If you choose to ignore this error and proceed with the connection anyway, you can change the definition of `UNSAFE` near the top of the file from 0 to 1.
133123

134-
Another reason for this error may be a proxy providing a different certificate. Proxies can be used in some network configurations or for performing man-in-the-middle attacks. If you choose to ignore this error and proceed with the connection anyway, you can change the definition of `UNSAFE` near the top of the file from 0 to 1. **Warning:** this removes all security against a possible active attacker, therefore use at your own risk, or for debugging only!
124+
**Warning:** this removes all security against a possible active attacker, therefore use at your own risk, or for debugging only!

0 commit comments

Comments
 (0)