Arm Mbed OS support forum

Renesas RA6M3 embed

I am currently following the guide here: https://www.pelion.com/docs/device-management/current/connecting/renesas-sdk.html for connecting my RA6M3 module to the Pelion Device Management.

But on the step for the execution of the imgtool.py,

python ../r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/imgtool.py sign --layout ../flash_layout/flash_layout.h --align 8 --header-size 0x400 __Renesas_EK_RA6M3/Release/mbedCloudClientExample.bin mbedCloudClientExample_signed.bin -k ../r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/Signing_Key/signingkey.pem

I am getting the following error:

Traceback (most recent call last):
File “…/r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/imgtool.py”, line 23, in
from imgtool_lib import image
File “/home/cris/Downloads/others/Hackster/element14/renesas_ra6m3/mbed/r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/imgtool_lib/image.py”, line 21, in
from . import boot_record as br
File “/home/cris/Downloads/others/Hackster/element14/renesas_ra6m3/mbed/r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/imgtool_lib/boot_record.py”, line 52
‘be even (key + value).’, file=sys.stderr)
^
SyntaxError: invalid syntax

I tried to correct it by eliminating the “file=sys.stderr” in the print commands.
But in that case, I get another error:

[INFO] Image version number set to 0.0.0+1
Traceback (most recent call last):
File “…/r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/imgtool.py”, line 216, in
args()
File “…/r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/imgtool.py”, line 213, in args
subcmdsargs.subcmd
File “…/r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/imgtool.py”, line 122, in do_sign
img.sign(sw_type, key, ram_load_address, args.dependencies)
File “/home/cris/Downloads/others/Hackster/element14/renesas_ra6m3/mbed/r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/imgtool_lib/image.py”, line 212, in sign
sig = key.sign(self.payload)
File “/home/cris/Downloads/others/Hackster/element14/renesas_ra6m3/mbed/r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/imgtool_lib/keys.py”, line 114, in sign
algorithm=SHA256()
File “/usr/lib/python2.7/dist-packages/cryptography/hazmat/backends/openssl/rsa.py”, line 413, in sign
self._backend, data, algorithm
File “/usr/lib/python2.7/dist-packages/cryptography/hazmat/backends/openssl/utils.py”, line 17, in _calculate_digest_and_algorithm
hash_ctx.update(data)
File “/usr/lib/python2.7/dist-packages/cryptography/hazmat/primitives/hashes.py”, line 92, in update
raise TypeError(“data must be bytes.”)
TypeError: data must be bytes.

I have also shared a post in the arm community: https://community.arm.com/developer/f/pelion-iot-platform/47587/renesas-ra6m3-embed

Kindly let me know how to proceed.

Hi @crisdeodates

The issue is caused by python2 . Could you use python3 to run the script instead?

Python2 is at end-of-life.

Br. Teemu