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 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

  • HI Vidar

    I get these result:

    C:\Users\PCF\ncs\v1.6.0\toolchain\opt\bin>arm-none-eabi-nm C:\Users\PCF\ncs\v1.6.0\zephyr\samples\bluetooth\SB_WatchTFT_P8_R1-2\MyLib\libheart.a

    hrs3300_alg_dynamic.o:
    U __aeabi_d2uiz
    U __aeabi_i2d
    00000000 N __ARM_grp..debug_abbrev.group.2_Am0000_lbphKItke$2_000000
    00000000 N __ARM_grp..debug_info$hrs3300.h$.2_kj1000_Cv5Eeo9SaPe_d00000
    00000000 N __ARM_grp..debug_info$hrs3300_alg.h$.2_wn1000_LtMwJ7p2pL8_300000
    00000000 N __ARM_grp..debug_info$hrs3300_alg_dynamic.c$.2_gY4000_yMA4CEBAOq9_T00000
    00000000 N __ARM_grp..debug_info$hrs3300_alg_para.h$.2_sE1000_PDOF5YAnhw6_300000
    00000000 N __ARM_grp..debug_info$math.h$.2_zx3000_gdylXt3eVHa_700000
    00000000 N __ARM_grp..debug_info$stdbool.h$.2_Au0000_PW2pDSlH5af_300000
    00000000 N __ARM_grp..debug_info$stdint.h$.2_My1000_JEEZdU6hK_d_300000
    00000000 N __ARM_grp..debug_info$stdio.h$.2_8s1000__Bz0yMgukE9_700000
    00000000 N __ARM_grp..debug_info$stdlib.h$.2_wU0000_S7V2e4FJTF1_300000
    00000000 N __ARM_grp..debug_line$hrs3300.h$.2_kj1000_Cv5Eeo9SaPe_d00000
    00000000 N __ARM_grp..debug_line$hrs3300_alg.h$.2_wn1000_LtMwJ7p2pL8_300000
    00000000 N __ARM_grp..debug_line$hrs3300_alg_dynamic.c$.2_gY4000_yMA4CEBAOq9_T00000
    00000000 N __ARM_grp..debug_line$hrs3300_alg_para.h$.2_sE1000_PDOF5YAnhw6_300000
    00000000 N __ARM_grp..debug_line$math.h$.2_zx3000_gdylXt3eVHa_700000
    00000000 N __ARM_grp..debug_line$stdbool.h$.2_Au0000_PW2pDSlH5af_300000
    00000000 N __ARM_grp..debug_line$stdint.h$.2_My1000_JEEZdU6hK_d_300000
    00000000 N __ARM_grp..debug_line$stdio.h$.2_8s1000__Bz0yMgukE9_700000
    00000000 N __ARM_grp..debug_line$stdlib.h$.2_wU0000_S7V2e4FJTF1_300000
    00000000 N __ARM_grp..debug_macinfo$hrs3300.h$.2_kj1000_Cv5Eeo9SaPe_d00000
    00000000 N __ARM_grp..debug_macinfo$hrs3300_alg.h$.2_wn1000_LtMwJ7p2pL8_300000
    00000000 N __ARM_grp..debug_macinfo$hrs3300_alg_dynamic.c$.2_gY4000_yMA4CEBAOq9_T00000
    00000000 N __ARM_grp..debug_macinfo$hrs3300_alg_para.h$.2_sE1000_PDOF5YAnhw6_300000
    00000000 N __ARM_grp..debug_macinfo$math.h$.2_zx3000_gdylXt3eVHa_700000
    00000000 N __ARM_grp..debug_macinfo$stdbool.h$.2_Au0000_PW2pDSlH5af_300000
    00000000 N __ARM_grp..debug_macinfo$stdint.h$.2_My1000_JEEZdU6hK_d_300000
    00000000 N __ARM_grp..debug_macinfo$stdio.h$.2_8s1000__Bz0yMgukE9_700000
    00000000 N __ARM_grp..debug_macinfo$stdlib.h$.2_wU0000_S7V2e4FJTF1_300000
    00000000 N __ARM_grp..debug_pubnames$hrs3300_alg_dynamic.c$.2_gY4000_yMA4CEBAOq9_T00000
    00000000 N __ARM_grp..debug_pubnames$math.h$.2_zx3000_gdylXt3eVHa_700000
    00000000 N __ARM_grp..debug_pubnames$stdio.h$.2_8s1000__Bz0yMgukE9_700000
    00000000 N __ARM_grp.hrs3300.h.2_kj1000_Cv5Eeo9SaPe_d00000
    00000000 N __ARM_grp.hrs3300_alg.h.2_wn1000_LtMwJ7p2pL8_300000
    00000000 N __ARM_grp.hrs3300_alg_dynamic.c.2_gY4000_yMA4CEBAOq9_T00000
    00000000 N __ARM_grp.hrs3300_alg_para.h.2_sE1000_PDOF5YAnhw6_300000
    00000000 N __ARM_grp.math.h.2_zx3000_gdylXt3eVHa_700000
    00000000 N __ARM_grp.stdbool.h.2_Au0000_PW2pDSlH5af_300000
    00000000 N __ARM_grp.stdint.h.2_My1000_JEEZdU6hK_d_300000
    00000000 N __ARM_grp.stdio.h.2_8s1000__Bz0yMgukE9_700000
    00000000 N __ARM_grp.stdlib.h.2_wU0000_S7V2e4FJTF1_300000
    00000000 N __ARM_grp_.debug_frame$20
    00000000 N __ARM_grp_.debug_frame$27
    00000000 N __ARM_grp_.debug_frame$34
    00000000 N __ARM_grp_.debug_frame$41
    00000000 N __ARM_grp_.debug_frame$48
    00000000 N __ARM_grp_.debug_frame$55
    00000000 N __ARM_grp_.debug_frame$62
    00000000 N __ARM_grp_.debug_frame$69
    00000000 N __ARM_grp_.debug_frame$76
    00000000 N __ARM_grp_.debug_frame$83
    00000000 N __ARM_grp_.debug_info$16
    00000000 N __ARM_grp_.debug_info$2
    00000000 N __ARM_grp_.debug_info$23
    00000000 N __ARM_grp_.debug_info$30
    00000000 N __ARM_grp_.debug_info$37
    00000000 N __ARM_grp_.debug_info$44
    00000000 N __ARM_grp_.debug_info$51
    00000000 N __ARM_grp_.debug_info$58
    00000000 N __ARM_grp_.debug_info$65
    00000000 N __ARM_grp_.debug_info$72
    00000000 N __ARM_grp_.debug_info$79
    00000000 N __ARM_grp_.debug_info$9
    00000000 N __ARM_grp_.debug_line$1
    00000000 N __ARM_grp_.debug_line$15
    00000000 N __ARM_grp_.debug_line$22
    00000000 N __ARM_grp_.debug_line$29
    00000000 N __ARM_grp_.debug_line$36
    00000000 N __ARM_grp_.debug_line$43
    00000000 N __ARM_grp_.debug_line$50
    00000000 N __ARM_grp_.debug_line$57
    00000000 N __ARM_grp_.debug_line$64
    00000000 N __ARM_grp_.debug_line$71
    00000000 N __ARM_grp_.debug_line$78
    00000000 N __ARM_grp_.debug_loc$19
    00000000 N __ARM_grp_.debug_loc$26
    00000000 N __ARM_grp_.debug_loc$33
    00000000 N __ARM_grp_.debug_loc$40
    00000000 N __ARM_grp_.debug_loc$47
    00000000 N __ARM_grp_.debug_loc$54
    00000000 N __ARM_grp_.debug_loc$61
    00000000 N __ARM_grp_.debug_loc$68
    00000000 N __ARM_grp_.debug_loc$75
    00000000 N __ARM_grp_.debug_loc$82
    00000000 N __ARM_grp_.debug_macinfo$4
    00000000 N __ARM_grp_.debug_pubnames$10
    00000000 N __ARM_grp_.debug_pubnames$17
    00000000 N __ARM_grp_.debug_pubnames$24
    00000000 N __ARM_grp_.debug_pubnames$31
    00000000 N __ARM_grp_.debug_pubnames$38
    00000000 N __ARM_grp_.debug_pubnames$45
    00000000 N __ARM_grp_.debug_pubnames$52
    00000000 N __ARM_grp_.debug_pubnames$59
    00000000 N __ARM_grp_.debug_pubnames$66
    00000000 N __ARM_grp_.debug_pubnames$73
    00000000 N __ARM_grp_.debug_pubnames$80
    U __hardfp_sqrt
    00000000 b _alg_data
    00000001 d agc_status
    00000004 d alg_data
    000013d8 b alg_results
    00000000 d alg_status
    00000000 a BuildAttributes$$THM_ISAv4$E$P$D$K$B$S$7EM$VFPi3$EXTD16$VFPS$VFMA$PE$A:L22UL41UL21$X:L11$S22US41US21$IEEE1$IW$USESV6$~STKCKD$USESV7$~SHL$OSPACE$EBA8$REQ8$PRES8$EABIv2
    U hrs3300_accurate_first_shot
    00000000 T Hrs3300_agc
    U hrs3300_agc_init_stage
    00000000 T Hrs3300_alg_close
    00000000 T Hrs3300_alg_get_hr_internal
    00000000 T Hrs3300_alg_get_hrm_iir_data
    00000000 T Hrs3300_alg_get_results
    00000000 T Hrs3300_alg_open
    00000000 T Hrs3300_alg_send_data
    U Hrs3300_chip_disable
    U Hrs3300_chip_enable
    00000000 T Hrs3300_hlow_power
    00000000 T Hrs3300_low_power
    00000000 T Hrs3300_normal_power
    U hrs3300_up_factor
    U hrs3300_up_shift
    U Hrs3300_write_reg
    00000008 d iir_data_out
    w Lib$$Request$$armlib
    U rand
    U reg_0x7f
    U reg_0x80
    U reg_0x81
    U reg_0x82
    00000000 R sin_table

    hrs3300_alg_bp.o:
    00000000 N __ARM_grp..debug_abbrev.group.2_Am0000_lbphKItke$2_000000
    00000000 N __ARM_grp..debug_info$hrs3300.h$.2_kj1000_Cv5Eeo9SaPe_d00000
    00000000 N __ARM_grp..debug_info$hrs3300_alg.h$.2_wn1000_LtMwJ7p2pL8_300000
    00000000 N __ARM_grp..debug_info$hrs3300_alg_bp.c$.2__S4000_59F55vUkMM0_T00000
    00000000 N __ARM_grp..debug_info$hrs3300_alg_para.h$.2_sE1000_PDOF5YAnhw6_300000
    00000000 N __ARM_grp..debug_info$math.h$.2_zx3000_gdylXt3eVHa_700000
    00000000 N __ARM_grp..debug_info$stdbool.h$.2_Au0000_PW2pDSlH5af_300000
    00000000 N __ARM_grp..debug_info$stdint.h$.2_My1000_JEEZdU6hK_d_300000
    00000000 N __ARM_grp..debug_info$stdio.h$.2_8s1000__Bz0yMgukE9_700000
    00000000 N __ARM_grp..debug_info$stdlib.h$.2_wU0000_S7V2e4FJTF1_300000
    00000000 N __ARM_grp..debug_line$hrs3300.h$.2_kj1000_Cv5Eeo9SaPe_d00000
    00000000 N __ARM_grp..debug_line$hrs3300_alg.h$.2_wn1000_LtMwJ7p2pL8_300000
    00000000 N __ARM_grp..debug_line$hrs3300_alg_bp.c$.2__S4000_59F55vUkMM0_T00000
    00000000 N __ARM_grp..debug_line$hrs3300_alg_para.h$.2_sE1000_PDOF5YAnhw6_300000
    00000000 N __ARM_grp..debug_line$math.h$.2_zx3000_gdylXt3eVHa_700000
    00000000 N __ARM_grp..debug_line$stdbool.h$.2_Au0000_PW2pDSlH5af_300000
    00000000 N __ARM_grp..debug_line$stdint.h$.2_My1000_JEEZdU6hK_d_300000
    00000000 N __ARM_grp..debug_line$stdio.h$.2_8s1000__Bz0yMgukE9_700000
    00000000 N __ARM_grp..debug_line$stdlib.h$.2_wU0000_S7V2e4FJTF1_300000
    00000000 N __ARM_grp..debug_macinfo$hrs3300.h$.2_kj1000_Cv5Eeo9SaPe_d00000
    00000000 N __ARM_grp..debug_macinfo$hrs3300_alg.h$.2_wn1000_LtMwJ7p2pL8_300000
    00000000 N __ARM_grp..debug_macinfo$hrs3300_alg_bp.c$.2__S4000_59F55vUkMM0_T00000
    00000000 N __ARM_grp..debug_macinfo$hrs3300_alg_para.h$.2_sE1000_PDOF5YAnhw6_300000
    00000000 N __ARM_grp..debug_macinfo$math.h$.2_zx3000_gdylXt3eVHa_700000
    00000000 N __ARM_grp..debug_macinfo$stdbool.h$.2_Au0000_PW2pDSlH5af_300000
    00000000 N __ARM_grp..debug_macinfo$stdint.h$.2_My1000_JEEZdU6hK_d_300000
    00000000 N __ARM_grp..debug_macinfo$stdio.h$.2_8s1000__Bz0yMgukE9_700000
    00000000 N __ARM_grp..debug_macinfo$stdlib.h$.2_wU0000_S7V2e4FJTF1_300000
    00000000 N __ARM_grp..debug_pubnames$hrs3300_alg_bp.c$.2__S4000_59F55vUkMM0_T00000
    00000000 N __ARM_grp..debug_pubnames$math.h$.2_zx3000_gdylXt3eVHa_700000
    00000000 N __ARM_grp..debug_pubnames$stdio.h$.2_8s1000__Bz0yMgukE9_700000
    00000000 N __ARM_grp.hrs3300.h.2_kj1000_Cv5Eeo9SaPe_d00000
    00000000 N __ARM_grp.hrs3300_alg.h.2_wn1000_LtMwJ7p2pL8_300000
    00000000 N __ARM_grp.hrs3300_alg_bp.c.2__S4000_59F55vUkMM0_T00000
    00000000 N __ARM_grp.hrs3300_alg_para.h.2_sE1000_PDOF5YAnhw6_300000
    00000000 N __ARM_grp.math.h.2_zx3000_gdylXt3eVHa_700000
    00000000 N __ARM_grp.stdbool.h.2_Au0000_PW2pDSlH5af_300000
    00000000 N __ARM_grp.stdint.h.2_My1000_JEEZdU6hK_d_300000
    00000000 N __ARM_grp.stdio.h.2_8s1000__Bz0yMgukE9_700000
    00000000 N __ARM_grp.stdlib.h.2_wU0000_S7V2e4FJTF1_300000
    00000000 N __ARM_grp_.debug_frame$20
    00000000 N __ARM_grp_.debug_frame$27
    00000000 N __ARM_grp_.debug_frame$34
    00000000 N __ARM_grp_.debug_frame$41
    00000000 N __ARM_grp_.debug_frame$48
    00000000 N __ARM_grp_.debug_frame$55
    00000000 N __ARM_grp_.debug_frame$62
    00000000 N __ARM_grp_.debug_frame$69
    00000000 N __ARM_grp_.debug_info$16
    00000000 N __ARM_grp_.debug_info$2
    00000000 N __ARM_grp_.debug_info$23
    00000000 N __ARM_grp_.debug_info$30
    00000000 N __ARM_grp_.debug_info$37
    00000000 N __ARM_grp_.debug_info$44
    00000000 N __ARM_grp_.debug_info$51
    00000000 N __ARM_grp_.debug_info$58
    00000000 N __ARM_grp_.debug_info$65
    00000000 N __ARM_grp_.debug_info$9
    00000000 N __ARM_grp_.debug_line$1
    00000000 N __ARM_grp_.debug_line$15
    00000000 N __ARM_grp_.debug_line$22
    00000000 N __ARM_grp_.debug_line$29
    00000000 N __ARM_grp_.debug_line$36
    00000000 N __ARM_grp_.debug_line$43
    00000000 N __ARM_grp_.debug_line$50
    00000000 N __ARM_grp_.debug_line$57
    00000000 N __ARM_grp_.debug_line$64
    00000000 N __ARM_grp_.debug_loc$19
    00000000 N __ARM_grp_.debug_loc$26
    00000000 N __ARM_grp_.debug_loc$33
    00000000 N __ARM_grp_.debug_loc$40
    00000000 N __ARM_grp_.debug_loc$47
    00000000 N __ARM_grp_.debug_loc$54
    00000000 N __ARM_grp_.debug_loc$61
    00000000 N __ARM_grp_.debug_loc$68
    00000000 N __ARM_grp_.debug_macinfo$4
    00000000 N __ARM_grp_.debug_pubnames$10
    00000000 N __ARM_grp_.debug_pubnames$17
    00000000 N __ARM_grp_.debug_pubnames$24
    00000000 N __ARM_grp_.debug_pubnames$31
    00000000 N __ARM_grp_.debug_pubnames$38
    00000000 N __ARM_grp_.debug_pubnames$45
    00000000 N __ARM_grp_.debug_pubnames$52
    00000000 N __ARM_grp_.debug_pubnames$59
    00000000 N __ARM_grp_.debug_pubnames$66
    00000000 b _bp_alg_data
    0000054c B alg_bp_results
    00000008 d body_sign
    00000004 d bp_alg_data
    00000000 d bp_alg_status
    00000000 a BuildAttributes$$THM_ISAv4$E$P$D$K$B$S$7EM$VFPi3$EXTD16$VFPS$VFMA$PE$A:L22UL41UL21$X:L11$S22US41US21$IEEE1$IW$USESV6$~STKCKD$USESV7$~SHL$OSPACE$EBA8$REQ8$PRES8$EABIv2
    00000000 T Hrs3300_alg_get_bp_results
    U hrs3300_AMP_LTH
    00000000 T Hrs3300_bp_age_fn
    00000000 T Hrs3300_bp_alg_open
    00000000 T Hrs3300_bp_alg_send_data
    00000000 T Hrs3300_bp_con_notouch
    00000000 T Hrs3300_bp_low_power
    00000000 T Hrs3300_bp_normal_power
    U hrs3300_bp_power_grade
    U hrs3300_bp_timeout_grade
    U Hrs3300_read_reg
    00000000 T Hrs3300_set_exinf
    U Hrs3300_write_reg
    w Lib$$Request$$armlib
    U rand
    U reg_0x7f
    U reg_0x80
    U reg_0x81
    U reg_0x82

    C:\Users\PCF\ncs\v1.6.0\toolchain\opt\bin>

    Is Good?

    Thanks

    Fausto

  • Hi Fausto,

    Looks good, thanks. It seems to include the "missing" functions. Would you be able to share your project here or in a private ticket so I can give it a try?

    Best regards,

    Vidar

  • Hi Vidar

    I found this solution for cmake, but now I have errors that, I think, shouldn't be there, it doesn't find functions that are internal to the library. 

    Thanks for your help.

    This is my CMakeLists.txt

    # SPDX-License-Identifier: Apache-2.0
    cmake_minimum_required(VERSION 3.20.0)


    set(LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib)

    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})


    project(SB_WatchTFT_P8_R1-2)

    FILE(GLOB app_sources src/*.c)


    target_sources(app PRIVATE ${app_sources})

    zephyr_library_include_directories(${ZEPHYR_BASE}/samples/bluetooth)

    add_library(heart_lib STATIC IMPORTED GLOBAL)

    set_target_properties(heart_lib PROPERTIES IMPORTED_LOCATION ${LIB_DIR}/libheart.a)

    target_link_libraries(app PUBLIC heart_lib)

    These are the errors that now are displayed to me

  • HI Vidar,

    I solved the error. 

    They were variables outside the library.

    Thanks again for your help.

    Best Regards

    Fausto

Reply Children
No Data
Related