How to add precompiled library to a SDK Segger embedded studio V5.60

Hi,

How add precompiled library to project and set optimization for size, whit segger V5.60

Thanks

Fausto

Parents
  • Hi Vidar


    I would like to understand which menu item should I select to insert the precompiled library.


    I tried with Project-> add existing file, but it inserts the library under zephyr / zephyr.elf and when linking it does not find the functions contained in the library.


    When I compile I have 4 errors, the library is libheart.a

    Best regards

    Fausto

  • Hi Fausto,

    Sorry, I assumed you were using the nRF5 SDK, and not the nRF connect SDK (NCS). With NCS, you have to add the library to your project's cmakelist.txt file as demonstrated by this sample: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.7.0/zephyr/samples/application_development/external_lib/README.html

    set_target_properties(mylib_lib PROPERTIES IMPORTED_LOCATION             ${MYLIB_LIB_DIR}/libmylib.a)
    set_target_properties(mylib_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${MYLIB_INCLUDE_DIR})

    target_link_libraries(app PUBLIC mylib_lib)
  • Hi Vidar.

    For simplicity I put the libheart.a library in the source folder.

    I have edited the CMakeLists.txt file, as below but I still get the same error. what is wrong.

    # SPDX-License-Identifier: Apache-2.0

    cmake_minimum_required(VERSION 3.13.1)
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(scan_adv)

    FILE(GLOB app_sources src/*.c)
    target_sources(app PRIVATE ${app_sources})

    zephyr_library_include_directories(${ZEPHYR_BASE}/samples/bluetooth)

    set_target_properties(mylib_lib PROPERTIES IMPORTED_LOCATION ${C:/Users/PCF/ncs/v1.6.0/zephyr/samples/bluetooth/SB_WatchTFT_P8_R1-2/src}/libheart.a)

    set_target_properties(mylib_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${C:/Users/PCF/ncs/v1.6.0/zephyr/samples/bluetooth/SB_WatchTFT_P8_R1-2/src})

    target_link_libraries(app PUBLIC mylib_lib)


    list(APPEND mcuboot_OVERLAY_CONFIG
    "${CMAKE_CURRENT_SOURCE_DIR}/child_image/mcuboot.conf"
    )

    No example is displayed at the example link.

    Thanks

    Fausto

  • Hi Fausto,

    Can you run arm-none-eabi-nm on the library to verify that it includes all the functions the linker claims are missing?

    > arm-none-eabi-nm libheart.a

    Best regards,

    Vidar

Reply Children
No Data
Related