This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TMS320F28388D: Linker issue while integrating the custom run time library using single precision floating point division, div_f32.asm

Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE,

Tool/software: TI C/C++ Compiler

Hi TI,

I have created run time library using compiler v18.1.3.LTS and eabi output format using the following compiler flags:

-v28 -ml -mt --float_support=fpu32 --include_path="C:\ti\ccs1000\ccs\tools\compiler\ti-cgt-c2000_18.1.3.LTS\include" -k -al -- -g --gcc --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi

We require single precision floating point division. For that I am took the fpu32 support source file from the following path i:e; C:\ti\C2000Ware_3_03_00_00_Software\libraries\math\FPUfastRTS\c28\source\fpu32\div_f32.asm

WHen i included this file in my library and integrated with my project, I am getting the following undefined symbol error(linker issue):

undefined               first referenced
symbol                    in file
---------                    ----------------
__c28xabi_divf      ./Source/main.obj

Could you please tell me which support file is required to reslve this linking issue?

Also for fpu32 support, is this the following mentioned file, div_f32.asm, is good to use?

PS NOTE: We are not using TMU_SUPPORT, so kindly please suggest the correct file if required!

Thanks & Regards,

Gurusha

 

 

  • Hi Gurusha,

    You don't need to directly include that file. Simply including the library and setting the flags would do.

    The symbol, __c28xabi_divf is a reference to FS$$DIV, which is in the div)f32.asm file. Please refer the fastRTS docs and compare your project properties with the div32 example in the library.

    -Shantanu

  • Hi,

    Shanty said:
    You don't need to directly include that file. Simply including the library and setting the flags would do.

    We don't need to use TIs library, for certification we need to create the custom library and for that we need this functionality.

    So I am asking for fpu32 floating point division, which source file do we need to include.

    let me know if you have any doubt!

    In my earlier post, I have posted the questions regarding the run time library which we create to use in our application.

    Kindly please check if required.

    Thanks '

    Gurusha

  • Hi

    Shanty said:
    The symbol, __c28xabi_divf is a reference to FS$$DIV, which is in the div)f32.asm file. Please refer the fastRTS docs and compare your project properties with the div32 example in the library.

    We cannot use fastRTS because we are not using TMU_SUPPORT.

    Kindly please help us to resolve linker issue

  • Gurusha,

    If you add the div_f32.asm function to the project, enable fpu_support without TMU support, you will be able to use the function without including the library. I have attached a sample project and screenshot. 

     Division.zip

  • Hi,

    Okay if we test this way by including file in the build itself then it will work. I got it.

    But my main problem is isn't solved for which I have posted this question.

    Since we need to create our run time library and for div_d32.asm some support file is required to compile successfully with project(Please refer my 1st comment on this post).

    Please help me to resolve the linker issue which I have mentioned earlier.

    Thanks

    Regards

    Gurusha

  • Guruja,

    My point is that if you only need to add the files for it to be linked. You can try to build the FASTRTS library (<FASTRTS/c28/ccs/) without tmu_support and it builds without the linker error. There are no support files as such. 

    Under Resource Filters -> Linked resources, can you check if the correct address is provided? 

    If it is properly linked, then are you invoking the __c28xabi_divf  function elsewhere in the runtime library? Can you provide the source for the same? Also please provide the project properties files so I can have a look.

    -Shantanu

  • Hi,

    Kindly pls go through the following post, I have explained everything here.

    Thanks,

    regards

    Gurusha

  • Please consider this diagnostic from the first post ...

    gurusha nahar said:

    We require single precision floating point division. For that I am took the fpu32 support source file from the following path i:e; C:\ti\C2000Ware_3_03_00_00_Software\libraries\math\FPUfastRTS\c28\source\fpu32\div_f32.asm

    WHen i included this file in my library and integrated with my project, I am getting the following undefined symbol error(linker issue):

    undefined               first referenced
    symbol                    in file
    ---------                    ----------------
    __c28xabi_divf      ./Source/main.obj

    Please show the entire command use to build div_f32.asm and create div_f32.obj.  Please copy-and-paste the text, and do not use a screen shot.  Also show the output of this command ...

    % nm2000 div_f32.obj

    That command runs the names utility, and dumps out all the symbols defined or used in that object file.  The names utility is part of the compiler installation, in the \bin directory.

    Thanks and regards,

    -George

  • Hi George,

    C:\ti\ccs920\ccs\tools\compiler\ti-cgt-c2000_18.1.3.LTS\bin> nm2000 div_f32.obj
    00000000 u
    00000000 d .debug_abbrev
    00000000 d .debug_abbrev
    00000000 d .debug_aranges
    00000000 d .debug_info
    00000000 d .debug_info
    00000000 d .debug_line
    00000000 d .debug_line
    00000000 d .debug_pubnames
    00000000 t .text
    00000000 T __c28xabi_divf
    00000000 a div_f32.asm

    This is the expanded version of div_f32.obj which I extracted from my rtl library.

    I have a doubt, does it requires math.h header file to be included in the rtl file to run this file properly?

    Also, below is the following compiler options I have used to create my rtl including div_f32:

    -v28 -ml -mt --float_support=fpu32 --include_path="C:\ti\ccs1000\ccs\tools\compiler\ti-cgt-c2000_18.1.3.LTS\include" -k -al -g --gcc --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi

    then, I have created library using cl2000 and ar2000 commands.

    I have used the following source files for my rtl:

    _lock.c
    args_main.c
    sqrt_f32.asm
    ll_aox28.asm
    ll_cmp28.asm
    ll_div28.asm
    ll_mpy28.asm
    log_f32.asm
    errno.c
    exit.c
    s_frexp.c
    atol.c
    ctype.c
    u_div28.asm
    div_f32.asm
    boot28.asm
    ctype.h
    errno.h
    logtable_f32
    linkage.h
    autoinit.c
    startup.c
    pre_init.c
    copy_zero_init.c
    copy_decompress_none.c
    fs_div28.asm
    cpy_tbl.c

     

    I have removed fs_div28.asm for now.

    Thanks 

    Gurusha

  • Hi George, 

    I am sharing one dummy project, with the same compiler settings(--Tmu_support is strictly excluded) which we are using in our application project and also the run time library.

    Kindly look into it. I am getting the same linker issue in this project.

    Dummy_Proj.zip

    Thanks

    Regards

    Gurusha

  • Thank you for submitting the project.  I can reproduce the problem.  I can only partially explain what happened.

    This command shows the problem ...

    % nm2000 rts_TMS320F28388D_Flash.lib | findstr __c28xabi_divf
    00000000 t __c28xabi_divf

    This runs the names utility over the named library.  This is one of 3 libraries in the project. The findstr command filters out all the lines except the one that shows the string __c28xabi_divf.  That's the function named in the linker error diagnostic.  The important detail is the lower case t just before the symbol name.  It means this is a local symbol, and not a global symbol.  Compare that to the same line from this earlier use of the names utility ...

    gurusha nahar said:
    C:\ti\ccs920\ccs\tools\compiler\ti-cgt-c2000_18.1.3.LTS\bin> nm2000 div_f32.obj
    00000000 u
    00000000 d .debug_abbrev
    00000000 d .debug_abbrev
    00000000 d .debug_aranges
    00000000 d .debug_info
    00000000 d .debug_info
    00000000 d .debug_line
    00000000 d .debug_line
    00000000 d .debug_pubnames
    00000000 t .text
    00000000 T __c28xabi_divf
    00000000 a div_f32.asm

    Notice the upper case T before the symbol name.  This means the symbol is global, and not local.  Why don't we see that same output when running the names utility over the library?

    I can think of only one explanation.  I think this is unlikely.  But, I'll show it to you anyway.

    In your copy of the source file div_f32.asm, is this source line commented out or missing?

    		.global     FS$$DIV

    If that line is present, then the symbol __c28xabi_divf is global and not local.  In that case, nm2000 output shows T and not t.  And you will not get the linker error.

    If that line is present, and you still get the linker error, then I need to see the entire chain of events related to div_f32.asm.  Show all the source code in the file, exactly how it is built, and how it is archived into rts_TMS320F28388D_Flash.lib.  I realize that is a lot to ask.  But I do not see another way forward.

    Thanks and regards,

    -George

  • Hi George,

    George Mock said:
    In your copy of the source file div_f32.asm, is this source line commented out or missing?

    Yes it is present in the code file. We have not tempered the code.

    What we can do now is send you the source files for which the library is created.

    I have created the library using the batch script which is calling the cl2000 compiler and then achiever to form library from all object files.

    It is the same method of creating the static library from ccs.

    Please find the attached zip folder of the code files for the flash library:flash_lib.zip

    if you want I will send batch files also!

    Also I have one more issue, that for long long multiplication also,ll_mpy28.asm file, I am unable to see the status register(ST0) overflow flag getting set.

    The same file has been shared as a part of flash library. Please let me know if you get the issue? 

    Thanks

    Regards 

    Gurusha

  • I found the problem.  The fix is easy.  But the explanation is a bit long.

    This explanation focuses on the use of assembler directives.  To understand the details of a specific directive, please search the C28x assembly tools manual for it, in the chapter titled Assembler Directives.

    gurusha nahar said:
    We have not tempered the code.

    Unfortunately, the code was changed, and it caused the problem.  Here are the key lines from the source file div_f32.asm, as it is in C2000Ware ...

            .if __TI_EABI__
            .asg    __c28xabi_divf, FS$$DIV
            .endif
                    .global     FS$$DIV
    
    FS$$DIV:

    The .if is similar to #ifdef in C.  If the symbol __TI_EABI__ is present and has a non-zero value, then the lines from that point until an .endif are processed.  Otherwise, those lines are ignored.  Since you build with --abi=eabi, the symbol __TI_EABI__ is predefined to be 1, and the lines (just one line in this case) are processed.  The .asg is similar to #define in C.  It causes all instances of the text string FS$$DIV to be substituted with the text string __c28xabi_divf.  Thus, while the next few lines appear to make the symbol FS$$DIV global and define that symbol at the start of the function, it actually happens for the symbol __c28xabi_divf.

    Compare that to these same lines from your implementation of div_f32.asm ...

            .global     FS$$DIV
            .text
            .if __TI_EABI__
            .asg    __c28xabi_divf, FS$$DIV
            .endif
    
    ; several comments appear here
    
    FS$$DIV:

    Notice how the .global and .asg are in the opposite order.  Thus, the .global makes the wrong symbol global.  Move the .global to after the .asg, and everything will work.

    Thanks and regards,

    -George

  • Hi George,

    Thank you for your time!

    Yes I checked this file in the latest c2000ware software; 3_03. I was using May,2020 updated file, after that it again released in October,2020, which I didn't noticed.

    Thanks the issue is fixed for div_f32.asm.

    But same issue I am getting when using long long multiplication, ll_mpy28.asm. Could you please check for that also. why again I am not able to set the flag for exceptional handling.

    Regards
    Gurusha
  • gurusha nahar said:
    But same issue I am getting when using long long multiplication, ll_mpy28.asm. Could you please check for that also.

    I don't see the same problem.  Here is one way to check ...

    % nm2000 rts_TMS320F28388D_Flash.lib | findstr mpyll
    00000000 T __c28xabi_mpyll

    This uses the names utility nm2000 to look for symbols in same library that has div_f32.obj. The findstr command filters for any symbol that contains mpyll.  It finds __c28xabi_mpyll.  The capital T means it is a global symbol.  All of this is exactly as expected.

    gurusha nahar said:
    why again I am not able to set the flag for exceptional handling.

    I don't know what that means.

    Thanks and regards,

    -George

  • Hi 

    Thanks Geroge!

    It means I am unable to set the overflow flags when multiplying more than 64-bits integer values.

    ST0 register is not at all getting set.

    Even we tried with maximum value.

    Regards,

    Gurusha

  • This thread is now being discussed in private messages.  -George