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.

  • 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