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.

Reply
  • 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.

Children
No Data
Related