I am trying to run the crypto example code (GitHub - ARMmbed/mbed-os-example-mbed-crypto: Mbed Crypto example for Mbed OS 5) on NUCLEO-L152RE. The program is compiled correctly but I am getting error in linking as shown in the attached screenshots. Can someone please check it and let me know what is wrong? I think there is a problem in configuration.
Error Log
Compile [ 95.5%]: stm32l1xx_ll_i2c.c
Compile [ 95.7%]: stm32l1xx_ll_gpio.c
Compile [ 95.8%]: stm32l1xx_ll_opamp.c
Compile [ 95.9%]: stm32l1xx_ll_pwr.c
Compile [ 96.0%]: stm32l1xx_ll_rcc.c
Compile [ 96.1%]: stm32l1xx_ll_sdmmc.c
Compile [ 96.2%]: stm32l1xx_ll_spi.c
Compile [ 96.3%]: stm32l1xx_ll_rtc.c
Compile [ 96.5%]: stm32l1xx_ll_tim.c
Compile [ 96.6%]: system_stm32l1xx.c
Compile [ 96.7%]: stm32l1xx_ll_usart.c
Compile [ 96.8%]: stm32l1xx_ll_utils.c
Compile [ 96.9%]: USBPhy_STM32.cpp
Compile [ 97.0%]: flash_api.c
Compile [ 97.1%]: gpio_irq_device.c
Compile [ 97.3%]: pwmout_device.c
Compile [ 97.4%]: analogin_api.c
Compile [ 97.5%]: spi_api.c
Compile [ 97.6%]: analogout_api.c
Compile [ 97.7%]: can_api.c
Compile [ 97.8%]: serial_device.c
Compile [ 97.9%]: gpio_api.c
Compile [ 98.1%]: gpio_irq_api.c
Compile [ 98.2%]: hal_tick_overrides.c
Compile [ 98.3%]: qspi_api.c
Compile [ 98.4%]: mbed_crc_api.c
Compile [ 98.5%]: mbed_overrides.c
Compile [ 98.6%]: lp_ticker.c
Compile [ 98.7%]: pinmap.c
Compile [ 98.9%]: i2c_api.c
[Warning] i2c_api.c@565,19: unused variable ‘obj_s’ [-Wunused-variable]
Compile [ 99.0%]: port_api.c
Compile [ 99.1%]: trng_api.c
Compile [ 99.2%]: reset_reason.c
Compile [ 99.3%]: pwmout_api.c
Compile [ 99.4%]: sleep.c
Compile [ 99.5%]: rtc_api.c
Compile [ 99.7%]: serial_api.c
Compile [ 99.8%]: us_ticker.c
Compile [ 99.9%]: watchdog_api.c
Compile [100.0%]: stm_spi_api.c
[Warning] stm_spi_api.c@108,13: unused variable ‘pin’ [-Wunused-variable]
Link: getting-started
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_import_key_into_slot': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:743: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_sign_hash': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3333: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_cipher_generate_iv': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3811: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_generate_random': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5385: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5376: undefined reference to mbedtls_ctr_drbg_random' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o:D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5548: more undefined references to mbedtls_ctr_drbg_random’ follow
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function mbedtls_psa_crypto_free': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5612: undefined reference to mbedtls_ctr_drbg_free’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_crypto_init': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5679: undefined reference to mbedtls_ctr_drbg_init’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5681: undefined reference to mbedtls_ctr_drbg_seed' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5721: undefined reference to mbedtls_entropy_init’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5721: undefined reference to mbedtls_entropy_free' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5721: undefined reference to mbedtls_entropy_func’
collect2.exe: error: ld returned 1 exit status
[ERROR] c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_import_key_into_slot': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:743: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_sign_hash': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3333: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_cipher_generate_iv': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3811: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_generate_random': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5385: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5376: undefined reference to mbedtls_ctr_drbg_random' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o:D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5548: more undefined references to mbedtls_ctr_drbg_random’ follow
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function mbedtls_psa_crypto_free': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5612: undefined reference to mbedtls_ctr_drbg_free’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_crypto_init': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5679: undefined reference to mbedtls_ctr_drbg_init’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5681: undefined reference to mbedtls_ctr_drbg_seed' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5721: undefined reference to mbedtls_entropy_init’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5721: undefined reference to mbedtls_entropy_free' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5721: undefined reference to mbedtls_entropy_func’
collect2.exe: error: ld returned 1 exit status
[mbed] ERROR: “C:\Python27\python.exe” returned error.
Code: 1
Path: “D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started”
Command: “C:\Python27\python.exe -u D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started\mbed-os\tools\make.py -t GCC_ARM -m NUCLEO_L152RE --source . --build .\BUILD\NUCLEO_L152RE\GCC_ARM”
Tip: You could retry the last command with “-v” flag for verbose output
Please check if these are defined in getting-started/mbed-os/features/mbedtls/inc/mbedtls/config.h.
If not, you can define them in mbedtls_user_config.h as well.
If they are defined, please show symbols of ctr_drbg.o and entropy.o
Regards
This is probably because the debug symbols were stripped.
Pleasae try building with debug profile.( add the parameter --profile=mbed-os/tools/profiles/debug.json to your build command), and run the arm-none-eabi-nm command as well.
Regards
Hi Ron, I just compiled again by using debug profile. I am getting the same errors in linking. Here is the error log.
D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started>mbed compile --target NUCLEO_L152RE --toolchain GCC_ARM --profile=mbed-os\tools\profiles\debug.json
[mbed] Working path “D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started” (library)
[mbed] Program path “D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started”
Building project getting-started (NUCLEO_L152RE, GCC_ARM)
Scan: getting-started
[Warning] stm_spi_api.c@108,13: unused variable ‘pin’ [-Wunused-variable]
Link: getting-started
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_import_ec_private_key': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:655: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_rsa_sign': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3149: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_ecdsa_sign': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3278: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_cipher_generate_iv': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3811: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_generate_random': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5376: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o:D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5385: more undefined references to mbedtls_ctr_drbg_random' follow c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function mbedtls_psa_crypto_free’:
D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5612: undefined reference to mbedtls_ctr_drbg_free' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_crypto_init’:
D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5679: undefined reference to mbedtls_ctr_drbg_init' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5681: undefined reference to mbedtls_ctr_drbg_seed’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5659: undefined reference to mbedtls_entropy_func' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5659: undefined reference to mbedtls_entropy_init’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5659: undefined reference to `mbedtls_entropy_free’
collect2.exe: error: ld returned 1 exit status
[ERROR] c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function `psa_import_ec_private_key’:
D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:655: undefined reference to mbedtls_ctr_drbg_random' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_rsa_sign’:
D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3149: undefined reference to mbedtls_ctr_drbg_random' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_ecdsa_sign’:
D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3278: undefined reference to mbedtls_ctr_drbg_random' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_cipher_generate_iv’:
D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3811: undefined reference to mbedtls_ctr_drbg_random' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_generate_random’:
D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5376: undefined reference to mbedtls_ctr_drbg_random' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o:D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5385: more undefined references to mbedtls_ctr_drbg_random’ follow
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function mbedtls_psa_crypto_free': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5612: undefined reference to mbedtls_ctr_drbg_free’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_crypto_init': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5679: undefined reference to mbedtls_ctr_drbg_init’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5681: undefined reference to mbedtls_ctr_drbg_seed' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5659: undefined reference to mbedtls_entropy_func’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5659: undefined reference to mbedtls_entropy_init' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5659: undefined reference to mbedtls_entropy_free’
collect2.exe: error: ld returned 1 exit status
[mbed] ERROR: “C:\Python27\python.exe” returned error.
Code: 1
Path: “D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started”
Command: “C:\Python27\python.exe -u D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started\mbed-os\tools\make.py -t GCC_ARM -m NUCLEO_L152RE --profile mbed-os\tools\profiles\debug.json --source . --build .\BUILD\NUCLEO_L152RE\GCC_ARM-DEBUG”
Tip: You could retry the last command with “-v” flag for verbose output
After that I have also used ‘arm-none-eabi-nm’ on ctr_drbg.o and entropy.o
The generated symbols are as follows:
ctr_drbg.o
00000000 n wm4._default_types.h.15.247e5cd201eca3442cbf5404108c4935
00000000 n wm4._newlib_version.h.4.9ba035841e762c3308916a0ce96032e7
00000000 n wm4.0.13373c2a93e04b96ed7012d09ab0c769
00000000 n wm4.cdefs.h.49.6260d97adb8d27534cbdc0f868b8ea87
00000000 n wm4.confignoentropy.h.35.96eb0f6d7aaf3df1b8fc3fb7cd79a961
00000000 n wm4.features.h.22.fad1cec3bc7ff06488171438dbdcfd02
00000000 n wm4.limits.h.60.56a1ae353e2028a24298ec6463b8b593
00000000 n wm4.limits.h.9.70fb0ada6f71b16202a66baaa6d8ea70
00000000 n wm4.mbed_config.h.22.2ce16fc66137e8f33da69b29ea1c692f
00000000 n wm4.newlib.h.18.5e5ca3429233af402d406a202f1fc1ac
00000000 n wm4.platform_mbed.h.22.412e891783591d0749750919e850d197
00000000 n wm4.stddef.h.39.144cf5ddcd53cbfdac30259dc1a6c87f
00000000 n wm4.syslimits.h.38.a5cadcb164df32bfe95032c693331b67
entropy.o
00000000 n wm4._default_types.h.15.247e5cd201eca3442cbf5404108c4935
00000000 n wm4._newlib_version.h.4.9ba035841e762c3308916a0ce96032e7
00000000 n wm4.0.13373c2a93e04b96ed7012d09ab0c769
00000000 n wm4.cdefs.h.49.6260d97adb8d27534cbdc0f868b8ea87
00000000 n wm4.confignoentropy.h.35.96eb0f6d7aaf3df1b8fc3fb7cd79a961
00000000 n wm4.features.h.22.fad1cec3bc7ff06488171438dbdcfd02
00000000 n wm4.limits.h.60.56a1ae353e2028a24298ec6463b8b593
00000000 n wm4.limits.h.9.70fb0ada6f71b16202a66baaa6d8ea70
00000000 n wm4.mbed_config.h.22.2ce16fc66137e8f33da69b29ea1c692f
00000000 n wm4.newlib.h.18.5e5ca3429233af402d406a202f1fc1ac
00000000 n wm4.platform_mbed.h.22.412e891783591d0749750919e850d197
00000000 n wm4.stddef.h.39.144cf5ddcd53cbfdac30259dc1a6c87f
00000000 n wm4.syslimits.h.38.a5cadcb164df32bfe95032c693331b67
Hi @aisha,
If you need this for development and test purposes only, you could try adding MBEDTLS_TEST_NULL_ENTROPY in your mbedtls_user_config.h file. However, this is not secure.
Since the platform doesn’t have an entropy source, you could consider porting an NV seed
If this is not feasible, then you should consider using a different target.
Regards
Hi Ron, many thanks for your reply. Can you please recommend some targets which are suitable for running the Mbed Crypto and Mbed TLS. I want to work on a device with similar specs.