Setting up the client binaries
Tip: If you cannot access some of the repositories referenced in this section, contact us to request access.
Prepare the client files
-
Clone the embedded application's GitHub repository:
mbed import https://github.com/PelionIoT/secure-device-access-client-example
-
Navigate to the application folder:
cd secure-device-access-client-example
Build the client for Mbed OS
If you are using developer credentials, build the target as described below. In production mode, skip steps 1 and 2, and provision and store your credentials on your target, as described in the provisioning documentation.
-
Overwrite the
mbed_cloud_dev_credentials.c
template file in thesecure-device-access-client-example
folder with thembed_cloud_dev_credentials.c
file that you downloaded from the Portal. -
From the
secure-device-access-client-example
folder, run the following command to overwrite thembed_cloud_trust_anchor_credentials.c
template file with your trust anchor:python create_trust_anchor_dev_cred.py -t "<trust anchor>"
For example:
python create_trust_anchor_dev_cred.py -t "-----BEGIN PUBLIC KEY-----MFkaEqYHKoZIzj0CAQYIKoZIzj0GAQcDHgAEbiRnZgdzoBpySFDPVPFp3J7yOmrOXJ09O5qVUMOD5knUjX7YbQBF0ueJWPz6tkTGbzORAwDzvRXYUA7vZpB+og==-----END PUBLIC KEY-----"
Note: Be sure to remove any line breaks (
\n
or\r
) in the trust anchor before runningcreate_trust_anchor_dev_cred.py
. -
Detect and configure the target device:
-
If your device is connected to your computer:
mbed detect mbed target auto
-
If your device is not connected to your computer:
mbed target <target>
Where
<target>
isK64F
. -
-
Set the toolchain:
mbed config <path to the toolchain binaries> mbed toolchain <toolchain>
<path to the toolchain binaries>
may beGCC_ARM_PATH
,ARM_PATH
orIAR_PATH
. You only need this if toolchain binaries are not in the path.<toolchain>
may beGCC_ARM
,ARM
orIAR
.
-
Compile the application:
mbed compile -DSDA_SERIAL_INTERFACE
Note: You must set
developer-mode
to1
in thembed_app.json
file to use developer mode. -
Flash the binary to the target:
- Connect the target to your computer using USB. The target is listed as a mass storage device.
- Drag and drop
secure-device-access-client-example/BUILD/K64F/GCC_ARM/secure-device-access-client-example.hex
to the target. The LED blinks rapidly; wait for it to finish. - Press the Reset button to restart the device.
Example for K64F and GCC_ARM
mbed import https://github.com/PelionIoT/secure-device-access-client-example
cd secure-device-access-client-example
mbed target K64F
mbed toolchain GCC_ARM
mbed compile -DSDA_SERIAL_INTERFACE