8 Replies Latest reply on Jul 1, 2020 6:18 PM by MoTa_728816

    MTB 2.1 why I get same .o twice for the link?

    MoTa_728816

      Hi,

       

      Today I was trying to attack the problem of following discussion.

      Install CMSIS DSP for CY8CPROTO-062-4343W on ModusToolbox v2.1.0 on Windows (Still)

       

      What I did was

      (1) Created an empty project for CY8CPROTO-062-4343W, as "cmsis_dsp_test" in my WorkSpace200618.

      (2) Downloaded CMSIS_5-develop.zip from the git hub

      (3) Expanded CMSIS_5-develop.zip and copied only DSP/Source, DSP/Include, and DSP/PrivateInclude into the project folder

      So my WorkSpace200618\cmsis_dsp_test looks like

      000-proj-folder.JPG

      And in the DSP folder

      001-DSP-folder.JPG

      And in the Source folder

      002-Source-folder.JPG

      (4) Clean smsis_dsp_test Application

      (5) Build cmsis_dsp_test Application

      Up to Compiling main.c, everything seemed to be fine.

      Then I got the waterfall of errors,

      003-the-water-fall.JPG

       

      but they seem to be saying the same thing that there are multiple definition of `xxx`

      <project>/DSP/Source/<function>/xxx.o

      <project>/build/CY8CPROTO-062-4343W/Debug/DSP/Source/<function>/xxx.o

       

      I wonder why linker tries to link both xxx.o?

      I think that the staff in the Debug folder is the copy of the original source files so only linking the staff in the Debug folder seems to be enough.

       

      Attached is the console log of my build.

      I wonder if there is/are things I forgot/missed to setup correctly?

       

      moto

        • 1. Re: MTB 2.1 why I get same .o twice for the link?
          RodolfoG_11

          The psoc6pdl includes the cmsis headers. Refer to:

          libs/psoc6pdl/cmsis/include/

           

          However, it doesn't include the source files. So I think what you can do is to delete the DSP/Include folder. The compiler might be including the same header twice.

          • 2. Re: MTB 2.1 why I get same .o twice for the link?
            MoTa_728816

            Dear RodolfoG_11-san,

             

            Thank you very much for your answer.

             

            It is good to know that ModusToolbox 2.1 has included CMSIS.

             

            But simply deleting the "Include" folder did not work.

            As I compared the lib/psoc6pdl/cmsis/include and CMSIS_5_DSP/Include there are many headers

            existing only in one of the folder.

             

            I ran diff between the headers existing both in the CMSIS_5/DSP/Include and lib/psoc6pdl/cmsis/include

            and there were enough differences within the headers of the same names to make me resign.

             

            So the good news is yes we already have CMSIS in ModusToolbox 2.1.

            And the bad news is no we don't have CMSIS/DSP in ModusToolbox 2.1. (correct me if I'm wrong)

             

            And unless there is a compatible CMSIS/DSP provided from Cypress,

            porting the standard CMSIS/DSP may not be an easy task. (correct me if I'm wrong).

             

            Best Regards,

            19-Jun-2020

            Motoo Tanaka

            • 3. Re: MTB 2.1 why I get same .o twice for the link?
              RodolfoG_11

              The cmsis library is not included in the ModusToolbox, so you need to manually add it in your project.

               

              If you want to use your version of CMSIS, you could delete the cmsis/include folder and keep your files. Have you tried that?

               

              You might also refer to this post:

              Install CMSIS DSP for CY8CPROTO-062-4343W on ModusToolbox v2.1.0 on Windows

              • 4. Re: MTB 2.1 why I get same .o twice for the link?
                MoTa_728816

                Dear RodolfoG_11-san,

                 

                > The cmsis library is not included in the ModusToolbox, so you need to manually add it in your project.

                Oh, .. OK.

                 

                > If you want to use your version of CMSIS, you could delete the cmsis/include folder and keep your files.

                > Have you tried that?

                I have just tried it.

                And it ruined my project. >_<

                 

                I'm recreating a couple of projects, one to modify and one to keep.

                And trying to return one header at a time...

                 

                Best Regards,

                19-Jun-2020

                Motoo Tanaka

                • 5. Re: MTB 2.1 why I get same .o twice for the link?
                  MoTa_728816

                  Then, Finally I came back to the original problem,

                   

                  ================

                  <project>/build/CY8CPROTO-062-4343W/Debug/DSP/Source/BasicMathFunctions/arm_abs_f32.o: In function `arm_abs_f32':

                  <project>/DSP/Source/BasicMathFunctions/arm_abs_f32.c:181: multiple definition of `arm_abs_f32'

                  <project>/build/CY8CPROTO-062-4343W/Debug/DSP/Source/BasicMathFunctions/BasicMathFunctions.o:C:\Cypress\MTW\WorkSpace200618\cmsis_dsp_test/DSP/Source/BasicMathFunctions/arm_abs_f32.c:181: first defined here

                  ================

                   

                  It seems to me that at the time of link there were two instance of arm_abs_f32.o compiled from the same source file,

                  one in the folder of the source is located (<project>/DSP/Source)

                  another in the  counter part folder under "build" folder. (<project>/build/<board-name>/Debug/DSP/Source)

                   

                  I thought that the Makefile or build program does the following

                  (1) copy the source file under the "build" folder

                  (2) compile the source file to *.o

                  (3) link all *.o and lib to generate the application

                   

                  But from the error message, I suspect that it is doing

                  (1) compile the source code in its folder  (<project>/DSP/Source)

                  (2) copy the source and *.o to the counterpart folder under "build"  (<project>/build/<board-name>/Debug/DSP/Source)

                  (3) link all *.o and lib to generate the application

                  So the same xxx.o exist in the original source folder and the counterpart folder under "build".

                  I think by some reason the Makefile for build command failed to remove the *.o at the original source folder after (2) and before (3).

                  And this is the question, I originally posted this discussion.

                   

                  moto

                  • 6. Re: MTB 2.1 why I get same .o twice for the link?
                    MoTa_728816

                    Hi,

                     

                    A week has passed without any answer.

                    I hope I can get some conclusion on this.

                     

                    moto

                    • 7. Re: MTB 2.1 why I get same .o twice for the link?
                      DheerajK_81

                      Hello Moto,

                       

                      Sorry, I was looking into why the issue occurs. Please find the possible root cause for this mentioned in this discussion: Install CMSIS DSP for CY8CPROTO-062-4343W on ModusToolbox v2.1.0 on Windows (Still)

                       

                      Regards,
                      Dheeraj

                      • 8. Re: MTB 2.1 why I get same .o twice for the link?
                        MoTa_728816

                        Dear Dheeraj-san,

                         

                        Since the motivation of this was to help that thread,

                        let me close this discussion and I will follow the other discussion.

                        And I'm looking forward to your KBA for the resolution.

                         

                        Best Regards,

                        2-Jul-2020

                        Motoo Tanaka