External library(.a file) requires CMSIS-DSP, but it fail to build link error.

Hi.

I've been developing with nRF54L15DK.

I added below in prj.conf.

CONFIG_CMSIS_DSP=y
CONFIG_DSP=y

CONFIG_COMPILER_OPT="-DARM_TABLE_TWIDDLECOEF_F32_64 -DARM_TABLE_BITREVIDX_FLT_64 -DARM_TABLE_TWIDDLECOEF_RFFT_F32_128"

Indeed, I could confirm CMSIS-DSP function normally running in main.c.

In my goal, I would like to use .a library file, which requires CMSIS-DSP .

In the MDK-Arm environment, its default configuration does not activate 128 points FFT.
I would like to refer below explanation and adopt its configuration.

then, I placed the library(.a) and header file(.h) as below.
.a : src/app/lib
.c,.h : src/app

then, I wrote in CMakeLists.txt

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(led)
FILE(GLOB_RECURSE app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})

# 1. set lib and header path
set(MYLIB_LIB_DIR     ${CMAKE_CURRENT_SOURCE_DIR}/src/app/lib)
set(MYLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/app) #header

# 2. import lib
add_library(mylib_lib STATIC IMPORTED GLOBAL)
set_target_properties(mylib_lib PROPERTIES IMPORTED_LOCATION            ${MYLIB_LIB_DIR}/libepsonvital_hard_2_1_0_eval.a)
set_target_properties(mylib_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${MYLIB_INCLUDE_DIR})

# 3. link application to target
target_link_libraries(app PUBLIC mylib_lib)

target_include_directories(app PRIVATE src/app)
target_include_directories(app PRIVATE src)

and, I added "include "arm_math.h"" in header file for linking.

but, it failed to build , mainly found 'undefined reference to "arm math function" '.
(below is part of build error)

undefined reference to `arm_sin_f32'
undefined reference to `arm_mean_f32'
....


It seemes for me to require the CMSIS-DSP function, but I already set in prj.conf

How should I solve this confliction?

Best regards.

Parents
  • Hi,

     

    Based on your compiler errors, it sounds like you are missing these two kconfigs:

    CONFIG_CMSIS_DSP_FASTMATH=y
    CONFIG_CMSIS_DSP_STATISTICS=y

     

    Could you try adding these and see if it works now?

     

    Kind regards,

    Håkon

  • Hi,thank you for replying.

    Based on your compiler errors, it sounds like you are missing these two kconfigs:

    I tried them,but the build still remains error.

    I'll show whole undefined reference as below.
    If you know, could you tell me ant information in order to properly set CMSIS-DSP configuration.

    If this problem does NOT result from the lack of configuration,
    I will worry about its dependency order between library(.a) and CMSIS-DSP.

    arm_fill_f32
    arm_rfft_fast_f32
    arm_rfft_fast_init_f32
    arm_copy_f32
    arm_cmplx_conj_f32
    arm_cmplx_dot_prod_f32
    arm_copy_q31
    arm_copy_q15
    arm_cmplx_mag_f32
    arm_rfft_fast_init_f32
    arm_rfft_fast_f32
    arm_mat_trans_f32
    arm_mat_mult_f32
    arm_mat_add_f32
    arm_mat_inverse_f32
    arm_cmplx_mag_squared_f32

    Best regards.

  • Hi,

     

    Good that the FPU issue is now gone.

    It looks like you're now lacking several CMSIS DSP configs:

    CONFIG_CMSIS_DSP_TRANSFORM=y
    CONFIG_CMSIS_DSP_SUPPORT=y
    CONFIG_CMSIS_DSP_COMPLEXMATH=y

     

    You may lack more configs as well. You can see here which ones are enabling what feature:

    https://github.com/nrfconnect/sdk-zephyr/tree/v4.0.99-ncs1/modules/cmsis-dsp

     

    Kind regards,

    Håkon

  • Thank you for replying.

    It looks like you're now lacking several CMSIS DSP configs:

    Indeed, reference error output 'arm_fill_f32','arm_rfft_fast_f32', `arm_copy_f32' , 'arm_cmplx_conj_f32' and others vanished.

    Still, some references 'arm_mat_mult_f32' and other remains undefined.

    I'll put them.

    Building led
    C:\WINDOWS\system32\cmd.exe /d /s /c "west build --build-dir c:/Users/shibuta/pj_25/led/build c:/Users/shibuta/pj_25/led"
    
    [0/1] Re-running CMake...
    Loading Zephyr default modules (Zephyr base (cached)).
    -- Application: C:/Users/shibuta/pj_25/led
    -- CMake version: 3.21.0
    -- Cache files will be written to: C:/ncs/v3.0.0/zephyr/.cache
    -- Zephyr version: 4.0.99 (C:/ncs/v3.0.0/zephyr)
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: nrf54l15dk, qualifiers: nrf54l15/cpuapp/ns
    -- Found host-tools: zephyr 0.17.0 (C:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.17.0 (C:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk)
    -- Found BOARD.dts: C:/ncs/v3.0.0/zephyr/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns.dts
    -- Found devicetree overlay: C:/Users/shibuta/pj_25/led/nrf54l15dk_nrf54l15_cpuapp_ns.overlay
    -- Generated zephyr.dts: C:/Users/shibuta/pj_25/led/build/led/zephyr/zephyr.dts
    -- Generated pickled edt: C:/Users/shibuta/pj_25/led/build/led/zephyr/edt.pickle
    -- Generated zephyr.dts: C:/Users/shibuta/pj_25/led/build/led/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: C:/Users/shibuta/pj_25/led/build/led/zephyr/include/generated/zephyr/devicetree_generated.h
    -- Including generated dts.cmake file: C:/Users/shibuta/pj_25/led/build/led/zephyr/dts.cmake
    
    warning: Experimental symbol TFM_EXPERIMENTAL is enabled.
    
    Parsing C:/ncs/v3.0.0/zephyr/Kconfig
    Loaded configuration 'C:/ncs/v3.0.0/zephyr/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns_defconfig'
    Merged configuration 'C:/Users/shibuta/pj_25/led/prj.conf'
    Merged configuration 'C:/Users/shibuta/pj_25/led/build/led/zephyr/.config.sysbuild'
    Configuration saved to 'C:/Users/shibuta/pj_25/led/build/led/zephyr/.config'
    Kconfig header saved to 'C:/Users/shibuta/pj_25/led/build/led/zephyr/include/generated/zephyr/autoconf.h'
    =========== Generating psa_crypto_config ===============
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Backup: CONFIG_MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT: False
    Backup: CONFIG_MBEDTLS_THREADING: False
    Backup: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== Checkpoint: backup ===============
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Restore: CONFIG_MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT: False
    Restore: CONFIG_MBEDTLS_THREADING: False
    Restore: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== End psa_crypto_config ===============
    =========== Generating psa_crypto_library_config ===============
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Backup: CONFIG_MBEDTLS_USE_PSA_CRYPTO: True
    Backup: CONFIG_MBEDTLS_PLATFORM_PRINTF_ALT: False
    Backup: CONFIG_MBEDTLS_THREADING: False
    Backup: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== Checkpoint: backup ===============
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Restore: CONFIG_MBEDTLS_USE_PSA_CRYPTO: True
    Restore: CONFIG_MBEDTLS_PLATFORM_PRINTF_ALT: False
    Restore: CONFIG_MBEDTLS_THREADING: False
    Restore: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== End psa_crypto_library_config ===============
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/Users/shibuta/pj_25/led/build/led
    [0/1] Re-running CMake...
    -- Found Python3: C:/ncs/toolchains/0b393f9e1b/opt/bin/python.exe (found version "3.12.4") found components: Interpreter 
    -- Found Python3: C:/ncs/toolchains/0b393f9e1b/opt/bin/python.exe (found suitable version "3.12.4", minimum required is "3.10") found components: Interpreter 
    -- Cache files will be written to: C:/ncs/v3.0.0/zephyr/.cache
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/Users/shibuta/pj_25/led/build/led/tfm
    [205/209] Linking C executable bin\tfm_s.axf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       77780 B       256 KB     29.67%
                 RAM:       55336 B        76 KB     71.10%
    [63/550] Building C object CMakeFiles/app.dir/src/app/app_calc.c.obj
    C:/Users/shibuta/pj_25/led/src/app/app_calc.c: In function 'app_test_cmsis_included':
    C:/Users/shibuta/pj_25/led/src/app/app_calc.c:58:37: warning: the comparison will always evaluate as 'false' for the address of 'sqrt' will never be NULL [-Waddress]
       58 |                 if(ARM_MATH_SUCCESS == sqrt){
          |                                     ^~
    In file included from C:/ncs/v3.0.0/modules/lib/cmsis-dsp/Include/arm_math_types.h:110,
                     from C:/ncs/v3.0.0/modules/lib/cmsis-dsp/Include/arm_math.h:31,
                     from C:/Users/shibuta/pj_25/led/src/app/app_calc.h:15,
                     from C:/Users/shibuta/pj_25/led/src/app/app_calc.c:12:
    c:\ncs\toolchains\0b393f9e1b\opt\zephyr-sdk\arm-zephyr-eabi\picolibc\include\math.h:135:15: note: 'sqrt' declared here
      135 | extern double sqrt (double);
          |               ^~~~
    C:/Users/shibuta/pj_25/led/src/app/app_calc.c:59:25: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
       59 |                         printf("sqrt_in(%d) = %f => sqrt_out = %f \n",n,sqrt_in[n],sqrt_out[n]);
          |                         ^~~~~~
    C:/Users/shibuta/pj_25/led/src/app/app_calc.c:13:1: note: include '<stdio.h>' or provide a declaration of 'printf'
       12 | #include <app_calc.h>
      +++ |+#include <stdio.h>
       13 | /********************************************************************/
    C:/Users/shibuta/pj_25/led/src/app/app_calc.c:59:25: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
       59 |                         printf("sqrt_in(%d) = %f => sqrt_out = %f \n",n,sqrt_in[n],sqrt_out[n]);
          |                         ^~~~~~
    C:/Users/shibuta/pj_25/led/src/app/app_calc.c:59:25: note: include '<stdio.h>' or provide a declaration of 'printf'
    C:/Users/shibuta/pj_25/led/src/app/app_calc.c:59:80: warning: implicit conversion from 'float32_t' {aka 'float'} to 'double' when passing argument to function [-Wdouble-promotion]
       59 |                         printf("sqrt_in(%d) = %f => sqrt_out = %f \n",n,sqrt_in[n],sqrt_out[n]);
          |                                                                         ~~~~~~~^~~
    C:/Users/shibuta/pj_25/led/src/app/app_calc.c:59:92: warning: implicit conversion from 'float32_t' {aka 'float'} to 'double' when passing argument to function [-Wdouble-promotion]
       59 |                         printf("sqrt_in(%d) = %f => sqrt_out = %f \n",n,sqrt_in[n],sqrt_out[n]);
          |                                                                                    ~~~~~~~~^~~
    C:/Users/shibuta/pj_25/led/src/app/app_calc.c:64:25: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
       64 |                         printf("failed sqrt (n=%d), reason = %d",n,stat);
          |                         ^~~~~~
    C:/Users/shibuta/pj_25/led/src/app/app_calc.c:64:25: note: include '<stdio.h>' or provide a declaration of 'printf'
    [65/550] Building C object CMakeFiles/app.dir/src/app/wellness_sample.c.obj
    C:/Users/shibuta/pj_25/led/src/app/wellness_sample.c: In function 'wellness_get_version':
    C:/Users/shibuta/pj_25/led/src/app/wellness_sample.c:476:25: warning: unused variable 'error_code' [-Wunused-variable]
      476 |     vital_error_t error_code = vital_get_version(&version);
          |                         ^~~~~~~~~~
    [80/550] Building C object CMakeFiles/app.dir/src/main.c.obj
    C:/Users/shibuta/pj_25/led/src/main.c:78:12: warning: 'configure_grtc' defined but not used [-Wunused-function]
       78 | static int configure_grtc(void)
          |            ^~~~~~~~~~~~~~
    [545/550] Linking C executable zephyr\zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map C:/Users/shibuta/pj_25/led/build/led/zephyr/zephyr_pre0.map 
    cmd.exe /C "cd . && C:\ncs\toolchains\0b393f9e1b\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe  -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr\zephyr_pre0.elf  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  tfm/api_ns/interface/lib/s_veneers.o  -T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=C:/Users/shibuta/pj_25/led/build/led/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/libarch__arm__core.a  zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a  zephyr/arch/arch/arm/core/cortex_m/cmse/libarch__arm__core__cortex_m__cmse.a  zephyr/arch/arch/arm/core/mpu/libarch__arm__core__mpu.a  zephyr/lib/libc/picolibc/liblib__libc__picolibc.a  zephyr/lib/libc/common/liblib__libc__common.a  zephyr/soc/soc/nrf54l15/libsoc__nordic.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/i2c/libdrivers__i2c.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  modules/nrf/subsys/nrf_security/src/zephyr/libmbedtls_zephyr.a  modules/nrf/modules/trusted-firmware-m/lib..__nrf__modules__trusted-firmware-m.a  modules/nrf/modules/trusted-firmware-m/libtfm_api_nrf.a  modules/trusted-firmware-m/libtfm_api.a  modules/cmsis-dsp/libmodules__cmsis-dsp.a  modules/hal_nordic/modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -LC:/Users/shibuta/pj_25/led/build/led/zephyr  ../../src/app/lib/libvital_hard_2_1_0_eval.a  zephyr/arch/common/libisr_tables.a  -mcpu=cortex-m33  -mthumb  -mabi=aapcs  -mfpu=fpv5-sp-d16  -mfloat-abi=hard  -mfp16-format=ieee  -mtp=soft  -fuse-ld=bfd  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn  -Wl,-no-pie  -specs=picolibc.specs  -DPICOLIBC_DOUBLE_PRINTF_SCANF  modules/nrf/subsys/nrf_security/src/libmbedcrypto.a  modules/nrf/subsys/nrf_security/src/libmbedcrypto_base.a  modules/nrf/subsys/nrf_security/src/libnrf_security_utils.a  zephyr/kernel/libkernel.a  C:/ncs/v3.0.0/nrfxlib/crypto/nrf_oberon/lib/cortex-m33/hard-float/liboberon_mbedtls_3.0.16.a  C:/ncs/v3.0.0/nrfxlib/crypto/nrf_oberon/lib/cortex-m33/hard-float/liboberon_3.0.16.a -L"c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v8-m.main+fp/hard" -lc -lgcc && cmd.exe /C "cd /D C:\Users\shibuta\pj_25\led\build\led\zephyr && C:\ncs\toolchains\0b393f9e1b\opt\bin\cmake.exe -E true""
    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: ../../src/app/lib/libvital_hard_2_1_0_eval.a(heart_rate_kalman_filter.c.obj): in function `heart_rate_kalman_filter_correct':
    heart_rate_kalman_filter.c:(.text.heart_rate_kalman_filter_correct+0x36): undefined reference to `arm_mat_trans_f32'
    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: heart_rate_kalman_filter.c:(.text.heart_rate_kalman_filter_correct+0x5e): undefined reference to `arm_mat_mult_f32'
    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: heart_rate_kalman_filter.c:(.text.heart_rate_kalman_filter_correct+0x7a): undefined reference to `arm_mat_mult_f32'
    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: heart_rate_kalman_filter.c:(.text.heart_rate_kalman_filter_correct+0xd4): undefined reference to `arm_mat_add_f32'
    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: heart_rate_kalman_filter.c:(.text.heart_rate_kalman_filter_correct+0xee): undefined reference to `arm_mat_inverse_f32'
    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: heart_rate_kalman_filter.c:(.text.heart_rate_kalman_filter_correct+0x110): undefined reference to `arm_mat_mult_f32'
    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: heart_rate_kalman_filter.c:(.text.heart_rate_kalman_filter_correct+0x138): undefined reference to `arm_mat_mult_f32'
    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: heart_rate_kalman_filter.c:(.text.heart_rate_kalman_filter_correct+0x16e): undefined reference to `arm_mat_mult_f32'
    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: heart_rate_kalman_filter.c:(.text.heart_rate_kalman_filter_correct+0x1ae): undefined reference to `arm_mat_mult_f32'
    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: ../../src/app/lib/libvital_hard_2_1_0_eval.a(sensing_math_pca.c.obj): in function `sensing_math_calculate_pca':
    sensing_math_pca.c:(.text.sensing_math_calculate_pca+0x1e): undefined reference to `arm_mat_init_f32'
    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: sensing_math_pca.c:(.text.sensing_math_calculate_pca+0x112): undefined reference to `arm_mat_init_f32'
    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: sensing_math_pca.c:(.text.sensing_math_calculate_pca+0x11e): undefined reference to `arm_mat_init_f32'
    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: sensing_math_pca.c:(.text.sensing_math_calculate_pca+0x42a): undefined reference to `arm_mat_init_f32'
    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: sensing_math_pca.c:(.text.sensing_math_calculate_pca+0x536): undefined reference to `arm_mat_init_f32'
    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: ../../src/app/lib/libvital_hard_2_1_0_eval.a(sensing_math_pca.c.obj):sensing_math_pca.c:(.text.sensing_math_calculate_pca+0x54e): more undefined references to `arm_mat_init_f32' follow
    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: ../../src/app/lib/libvital_hard_2_1_0_eval.a(sensing_math_pca.c.obj): in function `sensing_math_calculate_pca':
    sensing_math_pca.c:(.text.sensing_math_calculate_pca+0x558): undefined reference to `arm_mat_mult_f32'
    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: sensing_math_pca.c:(.text.sensing_math_calculate_pca+0x5d2): undefined reference to `arm_mat_init_f32'
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    FAILED: _sysbuild/sysbuild/images/led-prefix/src/led-stamp/led-build C:/Users/shibuta/pj_25/led/build/_sysbuild/sysbuild/images/led-prefix/src/led-stamp/led-build 
    cmd.exe /C "cd /D C:\Users\shibuta\pj_25\led\build\led && C:\ncs\toolchains\0b393f9e1b\opt\bin\cmake.exe --build ."
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\0b393f9e1b\opt\bin\cmake.EXE' --build C:/Users/shibuta/pj_25/led/build

    You may lack more configs as well. You can see here which ones are enabling what feature:

    https://github.com/nrfconnect/sdk-zephyr/tree/v4.0.99-ncs1/modules/cmsis-dsp

    I'll try it.

    Best regards.

  • Hi,

     

    Glad to hear that more and more symbols are being found!

    Looks like the arm_mat_* functions require CONFIG_CMSIS_DSP_MATRIX to be set.

     

    Kind regards,

    Håkon

  • Hi.

    Thanks to your help,it seemed the all build log to vanish.

    But, my application fails when my application goes to static library function.

    I'll put this log.(CONFIG_LOG=y)
    COM1

    Pins have been configured as secure.
    GPIO port: 0x00000000
    Pin: 0x00000000
    Pin: 0x00000001
    Booting TF-M v2.1.1-ncs4
    [Sec Thread] Secure image initializing!
    TF-M Float ABI: Hard
    Lazy stacking enabled
    [INF][PS] Encryption alg: 0x5500200
    

    COM2

    *** Booting nRF Connect SDK v3.0.0-3bfc46578e42 ***
    *** Using Zephyr OS v4.0.99-3e0ce7636fa6 ***
    [00:00:00.001,978] <inf> led: Timer status: enabled
    main passed
    [00:00:00.093,104] <err> os: ***** USAGE FAULT *****
    [00:00:00.093,120] <err> os:   Stack overflow (context area not valid)
    [00:00:00.093,135] <err> os: r0/a1:  0x2001b7a8  r1/a2:  0x2001b7b0  r2/a3:  0x2001b7b8
    [00:00:00.093,142] <err> os: r3/a4:  0x2001b7c4 r12/ip:  0x2001d490 r14/lr:  0x000558d3
    [00:00:00.093,146] <err> os:  xpsr:  0x61000200
    [00:00:00.093,154] <err> os: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x00000000  s[ 3]:  0x00000000
    [00:00:00.093,161] <err> os: s[ 4]:  0x00000000  s[ 5]:  0x00000000  s[ 6]:  0x00000000  s[ 7]:  0x00000000
    [00:00:00.093,168] <err> os: s[ 8]:  0x00000000  s[ 9]:  0x00000000  s[10]:  0x20021cec  s[11]:  0x20021cee
    [00:00:00.093,175] <err> os: s[12]:  0x20021cf0  s[13]:  0x20021cf2  s[14]:  0x20021cf4  s[15]:  0x20021cf8
    [00:00:00.093,180] <err> os: fpscr:  0x00000000
    [00:00:00.093,194] <err> os: Faulting instruction address (r15/pc): 0x00060e1e
    [00:00:00.093,213] <err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
    [00:00:00.093,227] <err> os: Current thread: 0x200137f0 (unknown)
    [00:00:00.197,052] <err> os: Halting system

    Do you have any clues to solve this problem?

    Best regards.

  • Hi,

     

    You are getting a stack overflow.

    Check what thread is running on this address via the build-folder/application-name/zephyr/zephyr.map:

    [00:00:00.093,227] <err> os: Current thread: 0x200137f0 (unknown)

    Or enable CONFIG_THREAD_NAME=y to get the thread name printed in the assertion log.

     

    Normally, this is your main thread, which can be adjusted via CONFIG_MAIN_STACK_SIZE configuration.

     

    Kind regards,

    Håkon

Reply
  • Hi,

     

    You are getting a stack overflow.

    Check what thread is running on this address via the build-folder/application-name/zephyr/zephyr.map:

    [00:00:00.093,227] <err> os: Current thread: 0x200137f0 (unknown)

    Or enable CONFIG_THREAD_NAME=y to get the thread name printed in the assertion log.

     

    Normally, this is your main thread, which can be adjusted via CONFIG_MAIN_STACK_SIZE configuration.

     

    Kind regards,

    Håkon

Children
  • Hi.
    Thank you for replying.
    I'll put the log after putting 'CONFIG_THREAD_NAME=y'.

    *** Booting nRF Connect SDK v3.0.0-3bfc46578e42 ***
    *** Using Zephyr OS v4.0.99-3e0ce7636fa6 ***
    [00:00:00.001,986] <inf> led: Timer status: enabled
    [00:00:00.091,993] <err> os: ***** USAGE FAULT *****
    [00:00:00.092,010] <err> os:   Stack overflow (context area not valid)
    [00:00:00.092,024] <err> os: r0/a1:  0x2001b828  r1/a2:  0x2001b830  r2/a3:  0x2001b838
    [00:00:00.092,031] <err> os: r3/a4:  0x2001b844 r12/ip:  0x2001d510 r14/lr:  0x00055917
    [00:00:00.092,035] <err> os:  xpsr:  0x61000200
    [00:00:00.092,043] <err> os: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x00000000  s[ 3]:  0x00000000
    [00:00:00.092,050] <err> os: s[ 4]:  0x00000000  s[ 5]:  0x00000000  s[ 6]:  0x00000000  s[ 7]:  0x00000000
    [00:00:00.092,057] <err> os: s[ 8]:  0x00000000  s[ 9]:  0x00000000  s[10]:  0x20021d6c  s[11]:  0x20021d6e
    [00:00:00.092,065] <err> os: s[12]:  0x20021d70  s[13]:  0x20021d72  s[14]:  0x20021d74  s[15]:  0x20021d78
    [00:00:00.092,069] <err> os: fpscr:  0x00000000
    [00:00:00.092,082] <err> os: Faulting instruction address (r15/pc): 0x00060e62
    [00:00:00.092,102] <err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
    [00:00:00.092,118] <err> os: Current thread: 0x20013830 (main)
    [00:00:00.195,551] <err> os: Halting system

    [00:00:00.092,118] <err> os: Current thread: 0x20013830 (main)

    Normally, this is your main thread, which can be adjusted via CONFIG_MAIN_STACK_SIZE configuration.

    Indeed, I saw the main thread failure as you said.

    After debugging it, I solved finally, it resulted from missing some library inside.

    Thank you very much for your kindly help!

    I'll close this issue.

    Thanks, Mr. Håkon.

Related