This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Failed to link crypto library

Hello,

I have the NCS v1.5.0 and would like to use AES (in different modes) in my non-secure application.

Looking at the crypto libraries available described here http://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.5.0/nrfxlib/nrf_security/README.html#nrf-security,

I decided for the Oberon library because it has all the algorithms I require and can be used in non-secure apps. 

I added the following configuration options to my application prj.conf:

# Crypto
CONFIG_NORDIC_SECURITY_BACKEND=y
CONFIG_OBERON_BACKEND=y
CONFIG_MBEDTLS_GCM_C=y
CONFIG_OBERON_MBEDTLS_AES_C=y
CONFIG_MBEDTLS_CIPHER_MODE_CBC=y

My code compiles correctly, but building the application fails at the linking step:

[337/343] Linking C executable zephyr\zephyr_prebuilt.elf
FAILED: zephyr/zephyr_prebuilt.elf
cmd.exe /C "cd . && C:\Nordic\v1.5.0\toolchain\opt\bin\arm-none-eabi-gcc.exe zephyr/CMakeFiles/zephyr_prebuilt.dir/misc/empty_file.c.obj -o zephyr\zephyr_prebuilt.elf -Wl,-T zephyr/linker.cmd -Wl,-Map=C:/workspace/repos/DNG/build/zephyr/zephyr_prebuilt.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a zephyr/arch/arch/arm/core/aarch32/cortex_m/mpu/libarch__arm__core__aarch32__cortex_m__mpu.a zephyr/arch/arch/arm/core/aarch32/cortex_m/cmse/libarch__arm__core__aarch32__cortex_m__cmse.a zephyr/lib/libc/newlib/liblib__libc__newlib.a zephyr/lib/posix/liblib__posix.a zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a zephyr/subsys/net/libsubsys__net.a zephyr/subsys/net/ip/libsubsys__net__ip.a zephyr/subsys/random/libsubsys__random.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/entropy/libdrivers__entropy.a modules/nrf/lib/nrf_modem_lib/lib..__nrf__lib__nrf_modem_lib.a modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a modules/nrf/subsys/fw_info/lib..__nrf__subsys__fw_info.a C:/Nordic/v1.5.0/nrfxlib/nrf_modem/lib/cortex-m33/hard-float/libmodem.a modules/nrfxlib/nrf_security/src/mbedtls/libmbedtls_base_vanilla.a modules/hal_nordic/libmodules__hal_nordic.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -L"c:/nordic/v1.5.0/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v8-m.main+fp/hard" -LC:/workspace/repos/DNG/build/zephyr -lgcc -Wl,--print-memory-usage ../mbus/build/libmbusStack.a ../dlms_server/build/libDlmsServer.a zephyr/arch/common/libisr_tables.a modules/nrfxlib/nrf_security/src/mbedtls/shared/libmbedcrypto_shared.a modules/nrfxlib/nrf_security/src/mbedtls/oberon/libmbedcrypto_oberon.a -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfpu=fpv5-sp-d16 -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -no-pie -Wl,-X -Wl,-N -Wl,--orphan-handling=warn spm/libspmsecureentries.a -lm -Wl,-lc -L"C:/Nordic/v1.5.0/toolchain/opt/arm-none-eabi"/lib/thumb/v8-m.main+fp/hard -Wl,-lgcc -lc -lgcc -specs=nano.specs modules/nrfxlib/nrf_security/src/mbedtls/libmbedtls_external.a -L && cd ."

arm-none-eabi-gcc.exe: error: missing argument to '-L'

There is a trailing -L option without any arguments. Is this a bug in the build system or my configuration options are not correct ?

Also, just to check, the hardware crypto module is only available on secure applications ? 

Related