Hello,
My environment is nrf SDK v1.5.1. The board im developing for is the nRF52840DK.
I'm trying to do some ECP-Calculations and therefore Ii want to use some function located in "mbedtls/ecp.h" and "mbedtls/bignum.h".
The functions from located in bignum seem to be fine. But for the functions in ecp I get a linker error.
The error:
====================[ Build | zephyr_final | ZDebug-nRF Connect SDK v1.5.1 ]====
/home/USER/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/211.6693.114/bin/cmake/linux/bin/cmake --build /home/USER/git/PROJECT/cmake-build-zdebug-nrf-connect-sdk-v151 --target zephyr_final
[1/6] Linking C executable zephyr/zephyr_prebuilt.elf
FAILED: zephyr/zephyr_prebuilt.elf
: && /home/USER/gnuarmemb/bin/arm-none-eabi-gcc zephyr/CMakeFiles/zephyr_prebuilt.dir/misc/empty_file.c.obj -o zephyr/zephyr_prebuilt.elf -Wl,-T zephyr/linker.cmd -Wl,-Map=/home/USER/git/PROJECT/cmake-build-zdebug-nrf-connect-sdk-v151/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/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/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.a zephyr/subsys/bluetooth/common/libsubsys__bluetooth__common.a zephyr/subsys/bluetooth/host/libsubsys__bluetooth__host.a zephyr/subsys/bluetooth/controller/libsubsys__bluetooth__controller.a zephyr/subsys/net/libsubsys__net.a zephyr/subsys/random/libsubsys__random.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/serial/libdrivers__serial.a zephyr/drivers/entropy/libdrivers__entropy.a modules/nrf/lib/dk_buttons_and_leds/lib..__nrf__lib__dk_buttons_and_leds.a modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a modules/nrf/drivers/hw_cc310/lib..__nrf__drivers__hw_cc310.a modules/hal_nordic/libmodules__hal_nordic.a modules/mbedtls/lib..__modules__crypto__mbedtls.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -L"/home/USER/gnuarmemb/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v7e-m/nofp" -L/home/USER/git/PROJECT/cmake-build-zdebug-nrf-connect-sdk-v151/zephyr -lgcc -Wl,--print-memory-usage zephyr/arch/common/libisr_tables.a /home/USER/nordic/ncs/v1.5.1/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/soft-float/no-interrupts/libnrf_cc310_platform_0.9.7.a -mcpu=cortex-m4 -mthumb -mabi=aapcs -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 -lm -Wl,-lc -L"/home/USER/gnuarmemb/arm-none-eabi"/lib/thumb/v7e-m/nofp -Wl,-lgcc -lc -specs=nano.specs && :
Memory region Used Size Region Size %age Used
FLASH: 198756 B 1 MB 18.95%
SRAM: 25872 B 256 KB 9.87%
IDT_LIST: 152 B 2 KB 7.42
/home/USER/gnuarmemb/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: app/libapp.a(main.c.obj): in function `cleanup_key_extraction':
/home/USER/git/PROJECT/cmake-build-zdebug-nrf-connect-sdk-v151/../src/main.c:98: undefined reference to `mbedtls_ecp_point_free'
/home/USER/gnuarmemb/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /home/USER/git/PROJECT/cmake-build-zdebug-nrf-connect-sdk-v151/../src/main.c:99: undefined reference to `mbedtls_ecp_group_free'
/home/USER/gnuarmemb/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: app/libapp.a(main.c.obj): in function `generate_new_key_pair':
/home/USER/git/PROJECT/cmake-build-zdebug-nrf-connect-sdk-v151/../src/main.c:138: undefined reference to `mbedtls_ecp_group_init'
/home/USER/gnuarmemb/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /home/USER/git/PROJECT/cmake-build-zdebug-nrf-connect-sdk-v151/../src/main.c:140: undefined reference to `mbedtls_ecp_group_load'
/home/USER/gnuarmemb/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /home/USER/git/PROJECT/cmake-build-zdebug-nrf-connect-sdk-v151/../src/main.c:206: undefined reference to `mbedtls_ecp_muladd'
/home/USER/gnuarmemb/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /home/USER/git/PROJECT/cmake-build-zdebug-nrf-connect-sdk-v151/../src/main.c:222: undefined reference to `mbedtls_ecp_point_write_binary'
collect2: error: ld returned 1 exit status
My config:
#
# Copyright (c) 2020 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
CONFIG_NCS_SAMPLES_DEFAULTS=y
CONFIG_DK_LIBRARY=y
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_NEWLIB_LIBC=y
CONFIG_BT=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Device"
# Use Zephyr Bluetooth LE Controller?
CONFIG_BT_LL_SW_SPLIT=y
# Enable bonding
#CONFIG_BT_SETTINGS=y
#CONFIG_FLASH=y
#CONFIG_FLASH_PAGE_LAYOUT=y
#CONFIG_FLASH_MAP=y
#CONFIG_NVS=y
#CONFIG_SETTINGS=y
# Needed for crypto lib
CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_BUILTIN=y
CONFIG_MBEDTLS_VANILLA_BACKEND=y
CONFIG_MBEDTLS_ECP_C=y
# Use RTT instead of UART for debug output (optional)
CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y
CONFIG_UART_CONSOLE=n
# Optimize for debug
CONFIG_DEBUG_OPTIMIZATIONS=y
CONFIG_MBEDTLS_DEBUG=y
Am I missing something in my config? Do I need to define some variable or some other config option to be able to access functions of "mebedtls/ecp.h"?
Regards
mort