Documentation

Mistake on this page? Email us

Command-line tutorial for Renesas SDK with Pelion Device Management

This tutorial shows how to securely connect and update a Renesas EK-RA6M3 device to Device Management built with Renesas SDK over an IP connection.

This tutorial is for Linux PC (64-bit Ubuntu/XUbuntu OS desktop environment).

Prerequisites

For all other requirements, see the tools and account section. See also the Mbed CLI instructions.

  • Configure MACRO for the compiler, for example:

    export ARMGCC_DIR=/usr/local/gcc-arm-none-eabi-9-2019-q4-major
    
  • An API key with Administrators group privileges for your Device Management account.

Configuring Device Management Client

  1. Open a terminal, and import the example repository to a convenient location in your development environment:

    mbed import https://github.com/ARMmbed/mbed-cloud-client-example
    
  2. Download the developer certificate:

    1. Log in to Device Management Portal.
    2. Navigate to Device identity > Certificates.
    3. Click Actions > Create a developer certificate.
    4. Add a name and optional description to the certificate, and click Create certificate.
    5. Click Download Developer C file to download the file mbed_cloud_dev_credentials.c.
  3. Copy the mbed_cloud_dev_credentials.c file to the root folder of the example.

  4. Initialize the firmware-update-specific resources.

    manifest-tool init -a <API key> -d arm.com -m example-app --force -q
    

    Replace the <API key> with your own API key.

  5. Deploy remaining dependencies and configuration:

    python pal-platform/pal-platform.py deploy --target Renesas_EK_RA6M3 generate
    

    Note: There is a known issue in the deployment of CMSIS_5 package. If pal-platform fails with returned non-zero exit status 128 error, try disabling Git-LFS smudge filter by defining the environmental variable GIT_LFS_SKIP_SMUDGE=1.

Compiling and flashing Device Management Client

  1. Run CMake and Make to compile the application:

    cd __Renesas_EK_RA6M3
    cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=./../pal-platform/SDK/Renesas_EK_RA6M3/ARMGCC.cmake -DEXTERNAL_DEFINE_FILE=./../define_Renesas_EK_RA6M3_update.txt -DUPDATE_LINKING=1
    make mbedCloudClientExample.elf
    cd ..
    
  2. Combine the image with Renesas SecureBoot:

    Note: Execute this command in the root folder of the repository.

    • imgtool.py and flash_layout.h are part of the Secure boot example.
    • imgtool.py has been tested with cryptography==2.8.0.
python imgtool.py sign --layout ../../../../platform/ext/target/ek-ra6m3/flash_layout.h --align 8 --header-size 0x400 /work/signing/mbedCloudClientExample_unsigned.bin /work/signing/mbedCloudClientExample_signed.bin -k /work/mbed-cloud-client-example/pal-platform/SDK/Renesas_EK_RA6M3/tools/root-rsa-2048.pem

/work/signing/mbedCloudClientExample_unsigned.bin is the output image from make. /work/signing/mbedCloudClientExample_signed.bin is the output created by imgtool.py. /work/mbed-cloud-client-example/pal-platform/SDK/Renesas_EK_RA6M3/tools/root-rsa-2048.pem is delivered as part of the mbed-cloud-client-example repository.

  1. Flash with J-Link:

    1. Download JLink for your operating system from Segger.

    2. SecureBoot_pdmc.bin is precompiled as part of the application repository. (./pal-platform/SDK/Renesas_EK_RA6M3/tools/SecureBoot_pdmc.bin)

    3. Open in one terminal:

      JLinkExe -device R7FA6M3AH -AutoConnect 1 -if SWD -speed auto
      
    4. Execute in JlinkExe command-line:

      Note the address for the application image.

      >loadfile SecureBoot_pdmc.bin
      >loadfile mbedCloudClientExample_signed.bin 0x10000
      
    5. Start in second terminal to access device logs:

      JLinkRTTViewer -d R7FA6M3AH -ct sess -a
      

When the client has successfully connected, the terminal shows:

Client registered
Endpoint Name: <Endpoint name>
Device ID: <Device ID>

To verify the connection with Device Management Portal:

  1. Log in to Device Management Portal.
  2. Select Device directory from the menu on the left.
  3. When your device is listed on the Devices page, it is connected and available.

Your device is now connected and ready for firmware update. For development devices, the Endpoint name and Device ID are identical.

Updating the firmware

To update the firmware on your device, run:

manifest-tool update device -p __Renesas_EK_RA6M3/Release/mbedCloudClientExample.bin -D <Device ID>

When the update starts, the client tracing log shows:

Firmware download requested
Authorization granted
...
Downloading: 100 %
Download completed
Firmware install requested
Authorization granted

After this, the device reboots automatically and registers to Device Management.