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.ctemplate file in thesecure-device-access-client-examplefolder with thembed_cloud_dev_credentials.cfile that you downloaded from the Portal. -
From the
secure-device-access-client-examplefolder, run the following command to overwrite thembed_cloud_trust_anchor_credentials.ctemplate 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 (
\nor\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_PATHorIAR_PATH. You only need this if toolchain binaries are not in the path.<toolchain>may beGCC_ARM,ARMorIAR.
-
Compile the application:
mbed compile -DSDA_SERIAL_INTERFACENote: You must set
developer-modeto1in thembed_app.jsonfile 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.hexto 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