PelionIoT / mbed-cloud-client-example

Reference example application using Izuma Device Management Client library
https://izumanetworks.com
Apache License 2.0
30 stars 97 forks source link

DeviceKey was not declared for RZ_A1H target #48

Closed gggekov closed 5 years ago

gggekov commented 5 years ago

Hello! I'm building the cloud-client-example for the rz_a1h target, I'm on the Release candidate for mbed-os-5.12.4(commit id 618297fac2e3057de8b1a7b0b4147093de8fe03e). The error I'm getting when building on Ubuntu is:

Compile [  8.4%]: pal_plat_rot.cpp
Compile: /home/george/Downloads/gcc-arm-none-eabi-8-2018-q4-major/bin/arm-none-eabi-g++ -std=gnu++98 -fno-rtti -Wvla -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -Os -g1 -DMBED_TRAP_ERRORS_ENABLED=1 -mcpu=cortex-a9 -mthumb-interwork -marm -march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard -mno-unaligned-access -DTARGET_RZA1H -DTARGET_MBRZA1H -D__FPU_PRESENT -DDEVICE_I2C=1 -DDEVICE_EMAC=1 -D__MBED__=1 -DDEVICE_USBDEVICE=1 -DTARGET_LIKE_MBED -DDEVICE_PORTINOUT=1 -DDEVICE_PORTIN=1 -DDEVICE_RTC=1 -DDEVICE_SERIAL_ASYNCH=1 -D__CMSIS_RTOS -DDEVICE_ETHERNET=1 -DCOMPONENT_SD=1 -D__EVAL -DTOOLCHAIN_GCC -DFEATURE_BOOTLOADER=1 -DTARGET_CORTEX_A -DDEVICE_CAN=1 -DARM_MATH_CA9 -DDEVICE_I2C_ASYNCH=1 -DCOMPONENT_PSA_SRV_EMUL=1 -D__MBED_CMSIS_RTOS_CA9 -DCOMPONENT_PSA_SRV_IMPL=1 -DTARGET_LIKE_CORTEX_A9 -DDEVICE_LPTICKER=1 -DDEVICE_PWMOUT=1 -DTARGET_RZ_A1_EMAC -DTARGET_CORTEX -DDEVICE_I2CSLAVE=1 -DDEVICE_PORTOUT=1 -DMBED_BUILD_TIMESTAMP=1560956233.19 -DTARGET_NAME=RZ_A1H -DDEVICE_STDIO_MESSAGES=1 -DDEVICE_SPI_ASYNCH=1 -DTARGET_RENESAS -DTARGET_FF_ARDUINO -DTARGET_RELEASE -DCOMPONENT_NSPE=1 -DDEVICE_SERIAL_FC=1 -DFEATURE_STORAGE=1 -DTARGET_A9 -D__CORTEX_A9 -DTARGET_RZ_A1H -DTARGET_RZ_A1XX -DDEVICE_SLEEP=1 -DTOOLCHAIN_GCC_ARM -DDEVICE_USTICKER=1 -DDEVICE_SPI=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_SPISLAVE=1 -DDEVICE_ANALOGIN=1 -DDEVICE_SERIAL=1 -DDEVICE_FLASH=1 @../BUILD/RZ_A1H/GCC_ARM/.includes_1f243d49f4034147d31a375b733f3129.txt -include ../BUILD/RZ_A1H/GCC_ARM/mbed_config.h -MD -MF ../BUILD/RZ_A1H/GCC_ARM/mbed-cloud-client/mbed-client-pal/Source/Port/Reference-Impl/OS_Specific/mbedOS/ROT/pal_plat_rot.d -o ../BUILD/RZ_A1H/GCC_ARM/mbed-cloud-client/mbed-client-pal/Source/Port/Reference-Impl/OS_Specific/mbedOS/ROT/pal_plat_rot.o ../mbed-cloud-client/mbed-client-pal/Source/Port/Reference-Impl/OS_Specific/mbedOS/ROT/pal_plat_rot.cpp
[Error] pal_plat_rot.cpp@67,5: 'DeviceKey' was not declared in this scope
[Error] pal_plat_rot.cpp@67,16: 'devkey' was not declared in this scope
[Error] pal_plat_rot.cpp@67,25: 'DeviceKey' is not a class or namespace
[Error] pal_plat_rot.cpp@81,22: 'DEVICEKEY_ALREADY_EXIST' was not declared in this scope
[DEBUG] Return: 1
[DEBUG] Output: ../mbed-cloud-client/mbed-client-pal/Source/Port/Reference-Impl/OS_Specific/mbedOS/ROT/pal_plat_rot.cpp: In function 'palStatus_t pal_plat_osSetRoT(uint8_t*, size_t)':
[DEBUG] Output: ../mbed-cloud-client/mbed-client-pal/Source/Port/Reference-Impl/OS_Specific/mbedOS/ROT/pal_plat_rot.cpp:67:5: error: 'DeviceKey' was not declared in this scope
[DEBUG] Output:      DeviceKey &devkey = DeviceKey::get_instance();
[DEBUG] Output:      ^~~~~~~~~
[DEBUG] Output: ../mbed-cloud-client/mbed-client-pal/Source/Port/Reference-Impl/OS_Specific/mbedOS/ROT/pal_plat_rot.cpp:67:16: error: 'devkey' was not declared in this scope
[DEBUG] Output:      DeviceKey &devkey = DeviceKey::get_instance();
[DEBUG] Output:                 ^~~~~~
[DEBUG] Output: ../mbed-cloud-client/mbed-client-pal/Source/Port/Reference-Impl/OS_Specific/mbedOS/ROT/pal_plat_rot.cpp:67:16: note: suggested alternative: 'key'
[DEBUG] Output:      DeviceKey &devkey = DeviceKey::get_instance();
[DEBUG] Output:                 ^~~~~~
[DEBUG] Output:                 key
[DEBUG] Output: ../mbed-cloud-client/mbed-client-pal/Source/Port/Reference-Impl/OS_Specific/mbedOS/ROT/pal_plat_rot.cpp:67:25: error: 'DeviceKey' is not a class or namespace
[DEBUG] Output:      DeviceKey &devkey = DeviceKey::get_instance();
[DEBUG] Output:                          ^~~~~~~~~
[DEBUG] Output: ../mbed-cloud-client/mbed-client-pal/Source/Port/Reference-Impl/OS_Specific/mbedOS/ROT/pal_plat_rot.cpp:81:22: error: 'DEVICEKEY_ALREADY_EXIST' was not declared in this scope
[DEBUG] Output:          if (error == DEVICEKEY_ALREADY_EXIST) {
[DEBUG] Output:                       ^~~~~~~~~~~~~~~~~~~~~~~
[DEBUG] Output: ../mbed-cloud-client/mbed-client-pal/Source/Port/Reference-Impl/OS_Specific/mbedOS/ROT/pal_plat_rot.cpp:81:22: note: suggested alternative: 'DEVICEKEY_ENABLED'
[DEBUG] Output:          if (error == DEVICEKEY_ALREADY_EXIST) {
[DEBUG] Output:                       ^~~~~~~~~~~~~~~~~~~~~~~
[DEBUG] Output:                       DEVICEKEY_ENABLED
Traceback (most recent call last):
  File "/home/george/repo/mbed-cloud-client-example/mbed-os/tools/make.py", line 78, in wrapped_build_project
    *args, **kwargs
  File "/home/george/repo/mbed-cloud-client-example/mbed-os/tools/build_api.py", line 598, in build_project
    objects = toolchain.compile_sources(resources, sorted(resources.get_file_paths(FileType.INC_DIR)))
  File "/home/george/repo/mbed-cloud-client-example/mbed-os/tools/toolchains/mbed_toolchain.py", line 458, in compile_sources
    return self.compile_queue(queue, objects)
  File "/home/george/repo/mbed-cloud-client-example/mbed-os/tools/toolchains/mbed_toolchain.py", line 531, in compile_queue
    raise ToolException(err)
ToolException: ../mbed-cloud-client/mbed-client-pal/Source/Port/Reference-Impl/OS_Specific/mbedOS/ROT/pal_plat_rot.cpp: In function 'palStatus_t pal_plat_osSetRoT(uint8_t*, size_t)':
../mbed-cloud-client/mbed-client-pal/Source/Port/Reference-Impl/OS_Specific/mbedOS/ROT/pal_plat_rot.cpp:67:5: error: 'DeviceKey' was not declared in this scope
     DeviceKey &devkey = DeviceKey::get_instance();
     ^~~~~~~~~
../mbed-cloud-client/mbed-client-pal/Source/Port/Reference-Impl/OS_Specific/mbedOS/ROT/pal_plat_rot.cpp:67:16: error: 'devkey' was not declared in this scope
     DeviceKey &devkey = DeviceKey::get_instance();
                ^~~~~~
../mbed-cloud-client/mbed-client-pal/Source/Port/Reference-Impl/OS_Specific/mbedOS/ROT/pal_plat_rot.cpp:67:16: note: suggested alternative: 'key'
     DeviceKey &devkey = DeviceKey::get_instance();
                ^~~~~~
                key
../mbed-cloud-client/mbed-client-pal/Source/Port/Reference-Impl/OS_Specific/mbedOS/ROT/pal_plat_rot.cpp:67:25: error: 'DeviceKey' is not a class or namespace
     DeviceKey &devkey = DeviceKey::get_instance();
                         ^~~~~~~~~
../mbed-cloud-client/mbed-client-pal/Source/Port/Reference-Impl/OS_Specific/mbedOS/ROT/pal_plat_rot.cpp:81:22: error: 'DEVICEKEY_ALREADY_EXIST' was not declared in this scope
         if (error == DEVICEKEY_ALREADY_EXIST) {
                      ^~~~~~~~~~~~~~~~~~~~~~~
../mbed-cloud-client/mbed-client-pal/Source/Port/Reference-Impl/OS_Specific/mbedOS/ROT/pal_plat_rot.cpp:81:22: note: suggested alternative: 'DEVICEKEY_ENABLED'
         if (error == DEVICEKEY_ALREADY_EXIST) {
                      ^~~~~~~~~~~~~~~~~~~~~~~
                      DEVICEKEY_ENABLED

[mbed] ERROR: "/usr/bin/python" returned error.
       Code: 1
       Path: "/home/george/repo/mbed-cloud-client-example/mbed-os"
       Command: "/usr/bin/python -u /home/george/repo/mbed-cloud-client-example/mbed-os/tools/make.py -t GCC_ARM -m rz_a1h --source .. --build ../BUILD/RZ_A1H/GCC_ARM -v"

Note also that TLS has been disabled.

Do you have suggestions how to fix this problem?

Many thanks! George

ciarmcom commented 5 years ago

ARM Internal Ref: IOTCLT-3553

teetak01 commented 5 years ago

Hi @gggekov

DEVICEKEY is a Mbed OS Crypto component that is known to have pretty complex configuration in relation to Client entropy injection features. The KVStore and PSA features are tied through some common APIs and the application flag-usage is not straightforward, especially in Mbed OS 5.12 or earlier.

I would recommend trying this in this order: 1) Update to Mbed OS 5.13.0-RC3 (Especially this fix https://github.com/ARMmbed/mbed-os/pull/10802)

If that does not help 2) define MBEDTLS_ENTROPY_NV_SEED.

If after those it still does not work, open a bug to Mbed OS.

gggekov commented 5 years ago

Thank you @teetak01 for the prompt reply. I've changed to Mbed OS 5.13.0-RC3 and have enabled MBEDTLS_ENTROPY_NV_SEED but still get the same error.

teetak01 commented 5 years ago

MBEDTLS_PSA_CRYPTO_C should be defined, but maybe you can try defining also that.

teetak01 commented 5 years ago

closing as duplicate of https://github.com/ARMmbed/mbed-os/issues/10876