12 Replies Latest reply on Jul 29, 2020 2:04 PM by NiBu_4687336

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

    NiBu_4687336

      I've reposted this since my previous attempt to get an answer has been locked.

      Unfortunately, it took me a while to cycle back around to dealing with this issue, so I did not respond in a timely manner.

      Here's the question I posed, which included references to several non-answers that I had already investigated.

      This question has been asked a few times, but never given a satisfactory answer.

      What steps are required to use the CMSIS DSP library with the CY8CPROTO-062-4343W board, using Eclipse/ModusToolbox v2.x on Windows?

       

      This discussion assumes ModusToolbox 1.x and depends on facilities not available in MT 2.x.

      This discussion follows much of the same path as I did, but ends without a resolution.

      This discussion never got an answer.

      The first response asked if I had tried #2, above, which I had already indicated I had tried. Following those instructions results in an error.

      The second response simply repeated the instructions from #2. Not surprisingly, the result was the same.

       

      So back to square one.

       

      The instructions given in #2 above result in exactly the problem reported in #2 above. That is,

       

      CMSIS_5/CMSIS/DSP/DSP_Lib_TestSuite/Common/platform/startup_generic.S:62:6: error: #error "No appropriate startup file found!"

      Because the instructions included some vague and undefined terms, I had to make a few assumptions, so I may not have set things up correctly.

      In particular, the instruction, "Extract it and place it one level below the application directory," is problematic.

      I assumed that "it" referred to the top-level directory of the extracted .ZIP file, CMSIS_5.

      I assumed that the "application directory" referred to the workspace directory, since Eclipse has no concept of an "application" directory.

      I assumed that "one level below," actually meant to place the folder in the workspace directory, since placing it one level below would require creating an intermediate directory, and no name was mentioned for such a directory.

       

      Also, the suggestion that placing the files "one level below" would somehow shield them from the auto-discovery process conflicts with my experience. I have found that auto-discovery finds everything below the workspace directory, at any level. This is borne out by the auto-discovery report in the console output, which shows a very large number of files found:

      Auto-discovery in progress...

      -> Found 1486 .c file(s)

      -> Found 79 .S file(s)

      -> Found 109 .s file(s)

      -> Found 132 .cpp file(s)

      -> Found 0 .o file(s)

      -> Found 0 .a file(s)

      -> Found 1361 .h file(s)

      -> Found 0 .hpp file(s)

      -> Found 0 resource file(s)

      Applying filters...

      Auto-discovery complete

       

       

      At any rate, the question remains unanswered and unchanged: how do I use the CMSIS library with ModusToolbox 2.x?

      Thanks,

       

      -Nick

      Auto-discovery in progress...-> Found 1486 .c file(s)-> Found 79 .S file(s)-> Found 109 .s file(s)-> Found 132 .cpp file(s)-> Found 0 .o file(s)-> Found 0 .a file(s)-> Found 1361 .h file(s)-> Found 0 .hpp file(s)-> Found 0 resource file(s)Applying filters...Auto-discovery complete

        • 1. Re: Install CMSIS DSP for CY8CPROTO-062-4343W on ModusToolbox v2.1.0 on Windows (Still)
          DheerajK_81

          Hello Nick,

           

          Yes, your previous thread was locked due to inactivity.

           

          The error message "CMSIS_5/CMSIS/DSP/DSP_Lib_TestSuite/Common/platform/startup_generic.S:62:6: error: #error "No appropriate startup file found!" occurs if you place the entire CMSIS_5 directly inside the application directory. Here the application directory is the directory which contains the Makefile. To remove confusion, I will refer to it as a Makefile directory. Since the auto-discovery considers all files placed inside the Makefile directory, you see these errors.

           

          In particular, the instruction, "Extract it and place it one level below the application directory," is problematic.

          I assumed that "it" referred to the top-level directory of the extracted .ZIP file, CMSIS_5.

          I am going to illustrate this to provide clarity.  My Workspace directory is called "cmsis_dsp" and my application name is "cmsis_dsp_example". I have extracted the CMSIS Library Zip inside my workspace directory i.e one level above the application directory. Sorry, I mistyped it as below. But your assumption was right. Please see the figure below:

           

          Also, the suggestion that placing the files "one level below" would somehow shield them from the auto-discovery process conflicts with my experience. I have found that auto-discovery finds everything below the workspace directory, at any level

          As I mentioned previously, the library has a lot of unnecessary files, libraries, example codes that we don't want to be compiled as part of the application, and plus it won't build if you include them. Like the startup errors you encountered. You could, however, take the folders that should be part of the application like the DSP folder and place them in the Makefile directory for the build to consider it.

           

          Or you could edit the Makefile and include the folders/libs to be considered by the build manually. This gives better control over what gets built.

           

          Open the Makefile and add the following:

          (1) Create a new variable pointing to the DSP Directory:

          DSP_DIR=../CMSIS_5/CMSIS/DSP/

           

          (2) Add the header files of the DSP using the INCLUDES variable:

          INCLUDES=$(DSP_DIR)/Include

           

          (3) If you want to use a DSP library of hardfp variant then add the appropriate VFP as shown:

          VFP_SELECT=hardfp

           

          (4) Include the library:

          LDLIBS=$(wildcard -l$(DSP_DIR)/Lib/GCC/libarm_cortexM4lf_math.a)

           

          (5) Add the header file to main.c to make use of the DSP functions:

          #include "arm_math.h"

           

          You can now click build and it should build and link successfully.

           

          Regards,

          Dheeraj

          1 of 1 people found this helpful
          • 2. Re: Install CMSIS DSP for CY8CPROTO-062-4343W on ModusToolbox v2.1.0 on Windows (Still)
            NiBu_4687336

            Hi DheerajK_81.

             

            Thanks - as they say, a picture is worth a thousand words. At least now I have the correct location. ARES is my project folder:

            Unfortunately, this appears to have no effect. I've changed the Makefile per your instructions, but the DSP files are neither discovered nor compiled, and no library is created. I get the same error as I did before making any changes:

             

                undefined reference to `arm_cmplx_mag_f32'

             

            I've also tried your alternative method, and made the DSP directory a child of the project directory:

            then I get the same "No appropriate startup file found!" error as before:

             

            DSP/DSP_Lib_TestSuite/Common/platform/startup_generic.S:62:6: error: #error "No appropriate startup file found!"

                #error "No appropriate startup file found!"

                  ^~~~~

             

            Here is my Makefile:

             

            ################################################################################

            # \file Makefile

            # \version 1.0

            #

            # \brief

            # Top-level application make file.

            #

            ################################################################################

            # \copyright

            # Copyright 2018-2019 Cypress Semiconductor Corporation

            # SPDX-License-Identifier: Apache-2.0

            #

            # Licensed under the Apache License, Version 2.0 (the "License");

            # you may not use this file except in compliance with the License.

            # You may obtain a copy of the License at

            #

            #    http://www.apache.org/licenses/LICENSE-2.0

            #

            # Unless required by applicable law or agreed to in writing, software

            # distributed under the License is distributed on an "AS IS" BASIS,

            # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

            # See the License for the specific language governing permissions and

            # limitations under the License.

            ################################################################################

             

             

             

             

            ################################################################################

            # Basic Configuration

            ################################################################################

             

             

            # Target board/hardware

            TARGET=CY8CPROTO-062-4343W

            # Name of application (used to derive name of final linked file).

            APPNAME=ares

             

             

            # Name of toolchain to use. Options include:

            #

            # GCC_ARM -- GCC 7.2.1, provided with ModusToolbox IDE

            # ARM    -- ARM Compiler (must be installed separately)

            # IAR    -- IAR Compiler (must be installed separately)

            #

            # See also: CY_COMPILER_PATH below

            TOOLCHAIN=GCC_ARM

             

             

            # Default build configuration. Options include:

            #

            # Debug  -- build with minimal optimizations, focus on debugging.

            # Release -- build with full optimizations

            CONFIG=Debug

             

             

            # If set to "true" or "1", display full command-lines when building.

            VERBOSE=

             

             

            # CMSIS DSP directory 2020.06.17:NEB

            DSP_DIR=../CMSIS_5/CMSIS/DSP/

             

             

            ################################################################################

            # Advanced Configuration

            ################################################################################

             

             

            # Enable optional code that is ordinarily disabled by default.

            #

            # Available components depend on the specific targeted hardware and firmware

            # in use. In general, if you have

            #

            #    COMPONENTS=foo bar

            #

            # ... then code in directories named COMPONENT_foo and COMPONENT_bar will be

            # added to the build

            #

            COMPONENTS=FREERTOS PSOC6HAL LWIP MBEDTLS

             

             

            # Add connectivity device based on the TARGET board

            ifeq ($(TARGET), CY8CPROTO-062-4343W)

            COMPONENTS+=4343W

            else ifeq ($(TARGET), CY8CKIT-062S2-43012)

            COMPONENTS+=43012

            else ifeq ($(TARGET), CY8CKIT-062-WIFI-BT)

            COMPONENTS+=4343W

            endif

             

             

            # Like COMPONENTS, but disable optional code that was enabled by default.

            DISABLE_COMPONENTS=

             

             

            # By default the build system automatically looks in the Makefile's directory

            # tree for source code and builds it. The SOURCES variable can be used to

            # manually add source code to the build process from a location not searched

            # by default, or otherwise not found by the build system.

            SOURCES=

             

             

            # Like SOURCES, but for include directories. Value should be paths to

            # directories (without a leading -I).

            INCLUDES=$(DSP_DIR)/Include

             

             

            # Custom configuration of mbedtls library.

            MBEDTLSFLAGS = MBEDTLS_USER_CONFIG_FILE='"configs/mbedtls_user_config.h"'

             

             

            # Add additional defines to the build process (without a leading -D).

            DEFINES=$(MBEDTLSFLAGS) CYBSP_WIFI_CAPABLE CY_RETARGET_IO_CONVERT_LF_TO_CRLF ARM_MATH_CM4 __FPU_PRESENT=1

             

             

            # CY8CPROTO-062-4343W board shares the same GPIO for the user button (USER BTN1)

            # and the CYW4343W host wake up pin. Since this example uses the GPIO for

            # interfacing with the user button, the SDIO interrupt to wake up the host is

            # disabled by setting CY_WIFI_HOST_WAKE_SW_FORCE to '0'.

            ifeq ($(TARGET), CY8CPROTO-062-4343W)

            DEFINES+=CY_WIFI_HOST_WAKE_SW_FORCE=0

            endif

             

             

            # Select softfp or hardfp floating point. Default is softfp.

            VFP_SELECT=hardfp

             

             

            # Additional / custom C compiler flags.

            #

            # NOTE: Includes and defines should use the INCLUDES and DEFINES variable

            # above.

            CFLAGS=

             

             

            # Additional / custom C++ compiler flags.

            #

            # NOTE: Includes and defines should use the INCLUDES and DEFINES variable

            # above.

            CXXFLAGS=

             

             

            # Additional / custom assembler flags.

            #

            # NOTE: Includes and defines should use the INCLUDES and DEFINES variable

            # above.

            ASFLAGS=

             

             

            # Additional / custom linker flags.

            LDFLAGS=

             

             

            # Additional / custom libraries to link in to the application.

            LDLIBS=$(wildcard -l$(DSP_DIR)/Lib/GCC/libarm_cortexM4lf_math.a)

             

             

            # Path to the linker script to use (if empty, use the default linker script).

            LINKER_SCRIPT=

             

             

            # Custom pre-build commands to run.

            PREBUILD=

             

             

            # Custom post-build commands to run.

            POSTBUILD=

             

             

            ################################################################################

            # Paths

            ################################################################################

             

             

            # Relative path to the project directory (default is the Makefile's directory).

            #

            # This controls where automatic source code discovery looks for code.

            CY_APP_PATH=

             

             

            # Relative path to the "base" library. It provides the core makefile build

            # infrastructure.

            CY_BASELIB_PATH=libs/psoc6make

             

             

            # Absolute path to the compiler's "bin" directory.

            #

            # The default depends on the selected TOOLCHAIN (GCC_ARM uses the ModusToolbox

            # IDE provided compiler by default).

            CY_COMPILER_PATH=

             

             

             

             

            # Locate ModusToolbox IDE helper tools folders in default installation

            # locations for Windows, Linux, and macOS.

            CY_WIN_HOME=$(subst \,/,$(USERPROFILE))

            CY_TOOLS_PATHS ?= $(wildcard \

                $(CY_WIN_HOME)/ModusToolbox/tools_* \

                $(HOME)/ModusToolbox/tools_* \

                /Applications/ModusToolbox/tools_*)

             

             

            # If you install ModusToolbox IDE in a custom location, add the path to its

            # "tools_X.Y" folder (where X and Y are the version number of the tools

            # folder).

            CY_TOOLS_PATHS+=

             

             

            # Default to the newest installed tools folder, or the users override (if it's

            # found).

            CY_TOOLS_DIR=$(lastword $(sort $(wildcard $(CY_TOOLS_PATHS))))

             

             

            ifeq ($(CY_TOOLS_DIR),)

            $(error Unable to find any of the available CY_TOOLS_PATHS -- $(CY_TOOLS_PATHS))

            endif

             

             

            $(info Tools Directory: $(CY_TOOLS_DIR))

             

             

            include $(CY_TOOLS_DIR)/make/start.mk

             

             

            Clearly there is more required than the steps you have outlined.

            What is my next step?

            Thanks,

             

            -Nick

            • 3. Re: Install CMSIS DSP for CY8CPROTO-062-4343W on ModusToolbox v2.1.0 on Windows (Still)
              NiBu_4687336

              DheerajK_81

              WinstonF_61

              Just a reminder - I've had no success with the procedure outlined above. I'm giving the thread a poke to keep it from meeting the same fate as my last attempt to get an answer to this question.

              Thanks,

               

              -Nick

              • 4. Re: Install CMSIS DSP for CY8CPROTO-062-4343W on ModusToolbox v2.1.0 on Windows (Still)
                MoTa_728816

                Dear Nick-san,

                 

                FYI, no help though, I tried it by myself and encountered another set of problem.

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

                 

                Best Regards,

                26-Jun-2020

                Motoo Tanaka

                • 5. Re: Install CMSIS DSP for CY8CPROTO-062-4343W on ModusToolbox v2.1.0 on Windows (Still)
                  NiBu_4687336

                  Hi MoTa_728816-san!

                   

                  Thanks for the link to your thread. I had tried the same thing - just adding what I thought was the minimum set of CMSIS directories - and got the same result.

                  One issue is that Cypress includes part of the CMSIS library - the headers (from an old version) - in the ModusToolbox distribution. The headers are included, but the source and libraries are not. This strikes me as a Very Bad Idea. The legitimate use cases for this kind of setup are few, if indeed they exist at all, and the failure modes are many.

                  It is theoretically possible to build the CMSIS library using only the resources provided by the ARM CMSIS project, but my attempts along those lines have failed as well. It might be worth attempting to get some help from the CMSIS maintainers directly, but I haven't had time to pursue that option.

                  Good luck - hopefully we'll get an answer someday!

                  Thanks,

                   

                  -Nick

                  • 6. Re: Install CMSIS DSP for CY8CPROTO-062-4343W on ModusToolbox v2.1.0 on Windows (Still)
                    DheerajK_81

                    Hello Nick,

                     

                    I think I know why the unresolved error comes up. In the steps I mentioned, the .a binaries that we were adding do not seem to valid ones. They all seem to be just 1KB and when you open them up in an editor, it seems to have some text message. Confirm if you observe this on your side.

                     

                    From the documentation, I expected these to be pre-built binaries that one can use directly in their application. But looks like these binaries need to built and then used in the project. The steps to do so are mentioned in the README.md file at this path: "CMSIS_5\CMSIS\DSP\"

                     

                    I will be writing a KBA and sharing it soon detailing these steps. Will add the link here.

                     

                    Regards,
                    Dheeraj

                    • 7. Re: Install CMSIS DSP for CY8CPROTO-062-4343W on ModusToolbox v2.1.0 on Windows (Still)
                      NiBu_4687336

                      Hi DheerajK_81.

                       

                      I mentioned much of that in my original post. I've attempted to follow the instructions for building the CMSIS library, and those for downloading the pre-built binaries, but have had no success with either.

                       

                      Please do not assume the published CMSIS documentation is correct - it appears not to have been maintained on a regular basis and the instructions are, at best, incomplete.

                       

                      I hope you will have a working solution soon.

                      Thanks,

                       

                      -Nick

                      • 11. Re: Install CMSIS DSP for CY8CPROTO-062-4343W on ModusToolbox v2.1.0 on Windows (Still)
                        DheerajK_81

                        Hello Nick and MoTa_728816,

                         

                        Apologies for the delay.

                         

                        I was searching for the easiest way this could be done.

                         

                        Some History on why things were breaking and why we were seeing issues:

                        Historically, CMSIS guys checked in binary files to the development repo and updated regularly at each release.

                        https://github.com/ARM-software/CMSIS_5/commit/ebfaa07175aaf0932993e255d6d740d3d2ebbc2e

                        https://github.com/ARM-software/CMSIS_5/commit/10babd87bc1f537d81603a9d8b40b6103a96f5df

                        (you can see each *.lib files is > 10 MB)

                         

                        Eventually they got tired by the large size of the git repo and decided to use git-lfs:

                        https://github.com/ARM-software/CMSIS_5/commit/41d9e3577cd61c0380f5c1fa5f3008dd5803f30e

                         

                        So they released CMSIS 5.7.0 with LFS enabled. Unfortunately, this broke the tarballs downloabable as “Source code” from https://github.com/ARM-software/CMSIS_5/releases/tag/5.7.0 (the ZIP files contain the Git LFS placeholders instead of real binary files).

                        dsp.png

                         

                        Note that the CMSIS pack (ARM.CMSIS.5.7.0.pack) contains the proper files since this is a custom artifact created from a proper LFS-enabled git tree, manually by ARM developer or dedicated CI system – not by GitHub.

                         

                        Then, the CMSIS team realized the git LFS service as provided by GitHub has limitations – specifically, there is 1GB limit of the repo size:

                        https://docs.github.com/en/github/managing-large-files/about-storage-and-bandwidth-usage#storage-quota

                         

                        So, after CMSIS 5.7.0 release, the ARM team dropped Git LFS support:

                        https://github.com/ARM-software/CMSIS_5/commit/17ccd4d72edde713ca7e74896ef4236b843b37f3

                         

                        For more information on the issues mentioned here, refer this: Cannot clone this repository · Issue #903 · ARM-software/CMSIS_5 · GitHub

                         

                        So in summary there are two methods to get this to work.

                        • Using CMSIS Pack Custom Artifact
                        • By cloning CMSIS version 5.7.0 with Git LFS initialized

                         

                        But I don't recommend the second method since newer versions won't have Git LFS supported. But I have listed both these methods here for reference.

                         

                        Using CMSIS Pack Custom Artifact (Recommended method):

                         

                        (1) Download the CMSIS Pack Artifact (it is actually a zip archive itself)

                        pack1.png

                         

                        (2) Once downloaded, right Click > Properties > General > Change extension to .zip.

                        pack2.png

                         

                        (3) Extract the files in the zip archive

                        (4) Navigate inside the directory and make sure you can see the binaries. Each should have size around 6MB.

                        (5) Copy the CMSIS folder, the one that contains these files:

                        (5) Paste this folder one level above your ModusToolbox Application folder

                        (6) Edit the Makefile in your application include the following:

                        • DSP_DIR=../CMSIS/DSP/
                        • INCLUDES=$(DSP_DIR)/Include
                        • VFP_SELECT=hardfp
                        • LDLIBS=$(DSP_DIR)/Lib/GCC/libarm_cortexM4lf_math.a

                        I have attached my Makefile for reference.

                         

                        (7) Add "arm_math.h" in main.c file

                        (8) Add the necessary functions.

                        (9) Build the application

                         

                        It should build successfully. Let me know your observations.

                         

                        By cloning CMSIS version 5.7.0 with Git LFS initialized:

                        If you just clone or download the Source Code Zip archive, they do not contain the actual binaries, they are mere ASCII placeholders. You need special hooks to be able to get the binaries through a tool called Git LFS. Nowaday Git clients come with Git LFS enabled, so it depends on which git client you are using.

                         

                        Once you have download Git LFS and added it to your Environment PATH variable, you need to run this command once for it be initialized in your local git client (Git bash in my case):

                         

                        Now follow these steps:

                        (1) Clone the CMSIS Github Repository

                        >> git lfs clone https://github.com/ARM-software/CMSIS_5.git

                        On newer Git Clients, git lfs clone is deprecated and you can use just git clone itself.

                         

                        (2)  Navigate to the cloned directory.

                        >> cd CMSIS_5

                         

                        (3) Checkout the latest release tag

                        >> git checkout 5.7.0

                        (4) Check the GCC folder to see if the binaries are updated: "CMSIS_5\CMSIS\DSP\Lib\GCC"

                        (5) Follow the same steps 5 to 9 mentioned in the previous method.

                         

                        It should build successfully. Let me know your observations.

                         

                        Hope this helps

                         

                        Regards,

                        Dheeraj

                        2 of 2 people found this helpful
                        • 12. Re: Install CMSIS DSP for CY8CPROTO-062-4343W on ModusToolbox v2.1.0 on Windows (Still)
                          NiBu_4687336

                          Hi Dheeraj.

                           

                          It took a while, but it was worth the wait. You did a great job of tracking this down and explaining how to obtain the current CMSIS libraries. I also appreciate the background information on how things got to be the way they are.

                          Well done, sir!

                           

                          -Nick