How to compile a static library into 4-byte aligned format in NCS project?

Hello, I am debugging a program running on the FLPR core on the nRF54L15 development board. I need to call a static library (. a file) on the FLPR core. I use the project created by the nRF Connect SDK to generate a static library, and then call it in the main function of the project.


This is the code for generating a static library in the CMakeLists.txt file:


target_sources(app PRIVATE
    src/flpr_lib_src.c
)
include_directories(${PROJECT_SOURCE_DIR}/include)
set(CMAKE_SYSTEM_PROCESSOR riscv)
set(CMAKE_TOOLCHAIN_FILE ${ZEPHYR_BASE}/cmake/toolchain/riscv.cmake)
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_LIST_DIR}/lib)
set(SOURCES
    src/flpr_lib_src.c
)
add_library(flpr STATIC ${SOURCES})


And this is the CMakeLists.txt code when I compile the static library into hex:


target_sources(app PRIVATE ${app_sources})
target_link_libraries(app PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/lib/libflpr.a
)


When compiling the static library into hex, the following errors was reported:
"error: ../lib/libflpr.a(flpr_lib_src.c.obj) use 16-byte stack aligned but the output use 4-byte stack aligned"

"error: ../lib/libflpr.a(flpr_lib_src.c.obj): mis-matched ISA string to merge 'i' and 'e'"


How can I compile a static library into 4-byte aligned format?

Or is there any other way to solve these error problem?

Related