error while using lib generated

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

error while using lib generated

295 Views
zhangzhixing
Contributor III

i made a lib using S32DS for S32K,but when i using the lib ,got the following errors ,how can i fix it .:

reset board.bmp

Tags (1)
0 Kudos
Reply
1 Reply

251 Views
PavelL
NXP Employee
NXP Employee

Hello @zhangzhixing ,

You're seeing the following linker error when using a static library (libTESTLIB.a) in your S32DS project for S32K:

error: LpuartFlexio_Uart_Ip_Example_S32K396.elf uses VFP register arguments,
libTESTLIB.a(SchM_Port.o) does not
error: failed to merge target specific data
collect2.exe: error: ld returned 1 exit status

This means there's a mismatch in the floating-point ABI between your application and the library.

Your application is compiled with VFP (hardware floating-point) support, using VFP registers to pass arguments.
However, the library object file (SchM_Port.o) was compiled without VFP support — likely using softfp or soft ABI.

This ABI mismatch prevents the linker from combining the object files.

To fix this, ensure both your application and the library are compiled with the same ABI settings.

Option 1: Rebuild the library with VFP support

In S32DS:

  1. Go to Project PropertiesC/C++ BuildSettingsTool SettingsTarget Processor
  2. Set:
    • Floating Point Unit: FPv5-sp-d16 (or appropriate for your core)
    • Floating Point ABI: hard (to use VFP registers)

Make sure these settings match in both the main project and the library project.

Option 2: Change your main project to use softfp

If you cannot rebuild the library, you can change your main project to use softfp ABI:

  • Set Floating Point ABI to softfp in your project settings.

This allows compatibility with both hard and soft ABI, but may reduce performance.

PavelL_0-1760942436436.png

 

Best regards,

Pavel

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2188704%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Eerror%20while%20using%20lib%20generated%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2188704%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Ei%20made%20a%20lib%20using%20S32DS%20for%20S32K%2Cbut%20when%20i%20using%20the%20lib%20%2Cgot%20the%20following%20errors%20%2Chow%20can%20i%20fix%20it%20.%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22reset%20board.bmp%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22reset%20board.bmp%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F361507iEADD9BD666D62CE6%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22reset%20board.bmp%22%20alt%3D%22reset%20board.bmp%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E2%80%83%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2188955%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20error%20while%20using%20lib%20generated%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2188955%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F245816%22%20target%3D%22_blank%22%3E%40zhangzhixing%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3EYou're%20seeing%20the%20following%20linker%20error%20when%20using%20a%20static%20library%20(libTESTLIB.a)%20in%20your%20S32DS%20project%20for%20S32K%3A%3C%2FP%3E%0A%3CPRE%3E%3CCODE%3Eerror%3A%20LpuartFlexio_Uart_Ip_Example_S32K396.elf%20uses%20VFP%20register%20arguments%2C%0AlibTESTLIB.a(SchM_Port.o)%20does%20not%0Aerror%3A%20failed%20to%20merge%20target%20specific%20data%0Acollect2.exe%3A%20error%3A%20ld%20returned%201%20exit%20status%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThis%20means%20there's%20a%20%3CSTRONG%3Emismatch%20in%20the%20floating-point%20ABI%3C%2FSTRONG%3E%20between%20your%20application%20and%20the%20library.%3C%2FP%3E%0A%3CP%3EYour%20application%20is%20compiled%20with%20%3CSTRONG%3EVFP%20(hardware%20floating-point)%3C%2FSTRONG%3E%20support%2C%20using%20VFP%20registers%20to%20pass%20arguments.%3CBR%20%2F%3EHowever%2C%20the%20library%20object%20file%20(SchM_Port.o)%20was%20compiled%20without%20VFP%20support%20%E2%80%94%20likely%20using%20softfp%20or%20soft%20ABI.%3C%2FP%3E%0A%3CP%3EThis%20ABI%20mismatch%20prevents%20the%20linker%20from%20combining%20the%20object%20files.%3C%2FP%3E%0A%3CP%3ETo%20fix%20this%2C%20ensure%20%3CSTRONG%3Eboth%20your%20application%20and%20the%20library%20are%20compiled%20with%20the%20same%20ABI%20settings%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CH4%20id%3D%22toc-hId-179737180%22%20id%3D%22toc-hId-202851992%22%3EOption%201%3A%20Rebuild%20the%20library%20with%20VFP%20support%3C%2FH4%3E%0A%3CP%3EIn%20S32DS%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EGo%20to%20%3CSTRONG%3EProject%20Properties%3C%2FSTRONG%3E%20%E2%86%92%20%3CSTRONG%3EC%2FC%2B%2B%20Build%3C%2FSTRONG%3E%20%E2%86%92%20%3CSTRONG%3ESettings%3C%2FSTRONG%3E%20%E2%86%92%20%3CSTRONG%3ETool%20Settings%3C%2FSTRONG%3E%20%E2%86%92%20%3CSTRONG%3ETarget%20Processor%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3ESet%3A%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EFloating%20Point%20Unit%3C%2FSTRONG%3E%3A%20FPv5-sp-d16%20(or%20appropriate%20for%20your%20core)%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EFloating%20Point%20ABI%3C%2FSTRONG%3E%3A%20hard%20(to%20use%20VFP%20registers)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EMake%20sure%20these%20settings%20match%20in%20%3CSTRONG%3Eboth%3C%2FSTRONG%3E%20the%20main%20project%20and%20the%20library%20project.%3C%2FP%3E%0A%3CH4%20id%3D%22toc-hId--1627717283%22%20id%3D%22toc-hId--1604602471%22%3EOption%202%3A%20Change%20your%20main%20project%20to%20use%20softfp%3C%2FH4%3E%0A%3CP%3EIf%20you%20cannot%20rebuild%20the%20library%2C%20you%20can%20change%20your%20main%20project%20to%20use%20softfp%20ABI%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ESet%20%3CSTRONG%3EFloating%20Point%20ABI%3C%2FSTRONG%3E%20to%20softfp%20in%20your%20project%20settings.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThis%20allows%20compatibility%20with%20both%20hard%20and%20soft%20ABI%2C%20but%20may%20reduce%20performance.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22PavelL_0-1760942436436.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22PavelL_0-1760942436436.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F361581i6975F886EF0C541F%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22PavelL_0-1760942436436.png%22%20alt%3D%22PavelL_0-1760942436436.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBest%20regards%2C%3C%2FP%3E%0A%3CP%3EPavel%3C%2FP%3E%3C%2FLINGO-BODY%3E