11 Replies Latest reply on Jul 20, 2020 12:34 AM by EktaN_26

    main.c from an old project is a main.c for a new project (possible bug)

    baga_4725781

      I noticed a confusing thing I think might be a bug in Modus Toolbox (latest)

      ModusToolbox

      Version:  2.1.0

      Build ID: 1905

      OS: Windows 10, v.10.0, x86_64 / win32

      Java version: 1.8.0_151

       

      Sequence:

       

      start a current project (eg test1)

      - You will see that main.c

      - exit

      start ModusToolbox

      - will have previous main.c

      - delete main.c

      New Application

      - Select kit

      - next

      - Select Empty_App

      - Name the new app (eg test2)

      - create

      - close

      main.c is not created or is an old main.c

      - Build and Clean are grey

      on left side, select the new test (eg test2)

      - click ">" to make it point down && see a list with main.c

      - click on main.c

      - Build and Clean will now be active

       

      It is very confusing to see a previous main.c

      Note if you have not closed the old main.c tab and select it, you can launch it for normal and debug.

        • 1. Re: main.c from an old project is a main.c for a new project (possible bug)
          EktaN_26

          Hello,

           

          Regarding the Build and Clean option, The Build and Clean option in the ModusToolbox always appears grey until one of the project files is selected in the workspace. On selecting any one of the project files in the workspace the Build and Clean option become active again.

           

          Regarding the main.c, I tried the steps mentioned by you:

           

          1. I opened a project in ModusToolbox, saw the the main.c file of the project.

          2. Exit the ModusToolbox application.

          3. Start the Modustoolbox application again and delete the main.c of the existing project (Remove it completely from the file system)

          4. Create Empty PSoC project (test 2) and close the application

          5. When I opened the application again I was unable to find the main.c of the first project as expected.

           

          Please correct me if my understanding of the steps to recreate the issue is not correct.

           

          Best Regards

          Ekta

          • 2. Re: main.c from an old project is a main.c for a new project (possible bug)
            JamesT_21

            I'm not sure, but here's a possibility. If you have both projects in the same workspace, you can have either main.c on display in the text editor, sometimes BOTH! It's hard to know which is associated with which project.

             

            See Eclipse IDE Survival Guide – KBA225399  and look for the question

             

            I have multiple files of the same name open in the editor. How do I tell which project each one belongs to?

             

            Both main.c files SHOULD exist. It's just a question of which you want to look at.

             

            Hope this helps.

            • 3. Re: main.c from an old project is a main.c for a new project (possible bug)
              baga_4725781

              Your step 3 of removing tthe main.c from the file system is the difference.

              Try again, but don't delete the main.c

               

              @JamesT_21 apparently can replicate.

              The oner difference is I created two different applications in two different branches of the directory tree.

              • 4. Re: main.c from an old project is a main.c for a new project (possible bug)
                baga_4725781

                I put the seperate projects in different directories.

                My assumption is that a workspace is limited to the project in the directory.

                What, exactly, defines a "workspace"?

                • 5. Re: main.c from an old project is a main.c for a new project (possible bug)
                  JamesT_21

                  A workspace is a folder where Eclipse keeps projects. Within the workspace, each project has its own directory.

                   

                  You can have multiple projects in a single workspace, and multiple workspaces. The project explorer shows you the contents of one workspace. The Eclipse IDE Survival Guide – KBA225399 has a couple of questions on workspaces, but it does not define what one is. I think we can fix that.

                   

                  How you work with this is entirely up to you. You can have one workspace with all your projects, or create a separate workspace for each project (one project per workspace) or anything in between. Myself, I typically have two or three workspaces. One has my "normal" work. One is experimental. I might have one for the next rev of the tools that's coming, to keep any changes isolated.  Each is likely to have two or more projects.

                   

                  Hope this helps.

                  • 6. Re: main.c from an old project is a main.c for a new project (possible bug)
                    baga_4725781

                    Interesting.

                    One of the reasons I prefer command-line tools over guis. Much simpler. But i'm an old fart.

                     

                    How do you add a project to a workspace? There is a list for new applications, but no obvious way to add one from the git repo. And starting one from scratch (via the "empty" project) caused me heartache - I had to manually change the names of the .hex and .elf file in the launch files.

                     

                    I suggest testing with old farts. We make different assumptions than a 25..30yo does (like my son).

                     

                    I had a problem (posted) where I had a working project. Came back the next day && the GUI complained it could not find the .project file - which was there and did not look corrupted.

                     

                    If (well, when) I run into a problem, how/where could Isend a zip of the directory to help improve the tool?

                     

                    thanks ... bandit

                    • 7. Re: main.c from an old project is a main.c for a new project (possible bug)
                      RakshithM_16

                      Hi baga_4725781,

                       

                      I will try to answer each question in separate comments so that it is easier.

                       

                      How do you add a project to a workspace? There is a list for new applications, but no obvious way to add one from the git repo.

                      You can try these 2 ways to add a project into your workspace. For the purpose of this response, I have created a folder Test_MTB and created a workspace in that folder as shown -

                      Once you have created your workspace, clone the code example using git clone command. For the USB CDC Echo example, the command is - git clone https://github.com/cypresssemiconductorco/mtb-example-psoc6-usb-cdc-echo.git

                      Now you can use 2 methods -

                       

                      >Using the Project Creator tool :

                       

                      1. You can launch this tool by clicking on New Application in Quick Panel of the Eclipse IDE.

                      2. Select the BSP for your device and click Next.

                      3. In the Select Application dialog, click on the Import icon highlighted in the snapshot below.

                      4. Select the folder that is cloned. In my case it is mtb-example-psoc6-usb-cdc-echo. You should now be able to see the name of the application at the top as shown below. Click on Create.

                      This should import the code example into your workspace.

                       

                      >Using CLI :

                       

                      1. For this method, I will clone the PDM-PCM example. The first step is again git clone.

                      2. Next, run the modus-shell which is a command-line utility.  Navigate to the modus-shell directory and run Cygwin.bat. It is located in the following directory: <install_path>/ModusToolbox/tools_2.1/modus-shell/

                      By default it is - C:\Users\<profile_name>\ModusToolbox\tools_2.1\modus-shell

                      3. Now traverse to the folder that is cloned.

                      4. Run the following command - make getlibs

                      5. This will fetch all the libraries required for your application. Once this is done, you should see Import complete. Now run the command - make eclipse

                      6. This will create all the Eclipse specific configuration files. The steps to import the project will be displayed on the terminal. But for the sake of completion, I will explain it on this thread too.

                      7. Open the IDE. The directory should be the workspace directory. In my case it is Test_MTB.

                      8. Click on File > Open Projects from File System.

                      9. Select the application directory (cloned directory) as the Import source. Select the project to be imported and click on Finish as shown -

                      I now have both the applications imported into my workspace -

                       

                      For more information on any of the commands used, refer - ModusToolbox User Guide.

                       

                      You can use just the CLI interface to use your application. This blog series should help you with that - Using the Project-Creator Command Line Interface (CLI) 

                       

                      Or you can choose to not use Eclipse IDE altogether and use a different IDE. You can learn more about it here - Available Now -  ModusToolbox 2.1

                      1 of 1 people found this helpful
                      • 8. Re: main.c from an old project is a main.c for a new project (possible bug)
                        RakshithM_16
                        I had to manually change the names of the .hex and .elf file in the launch files.

                        Can you please let me know why you had to do this? This would help me understand the issue that you are facing.

                        I think you renamed the application. Please click on Generate Launches option under Launches in Quick Panel. This should fix the launches for you.

                        The name of the .hex and .elf file will be the name specified in the makefile -

                        1 of 1 people found this helpful
                        • 9. Re: main.c from an old project is a main.c for a new project (possible bug)
                          RakshithM_16
                          I had a problem (posted) where I had a working project. Came back the next day && the GUI complained it could not find the .project file - which was there and did not look corrupted.

                          I have observed this issue generally when the application directory or the path is changed.

                          I will change the folder name of the PDM-PCM example that I imported (explained in my previous comment) from mtb-example-psoc6-pdm-pcm to mtb-example-psoc6-pdm-pcm_1

                          Please note that I am changing the folder name in Windows File Explorer and I am not referring to renaming the application in the IDE.

                           

                          Now when I open the project in Eclipse IDE for ModusToolbox, I get this error -

                          This is because Eclipse is searching for the project-specific files in mtb-example-psoc6-pdm-pcm directory which does not exist anymore. The project needs to be imported into the workspace again.

                           

                          Right-click on the project and click on Delete. Ensure that the Delete project contents on disk option is unchecked. Click on OK.

                          Now to import the project, click on File > Import > General > Existing Projects into Workspace. Click on Next.

                          Select the new application directory (mtb-example-psoc6-pdm-pcm_1) as the root directory. Select the project and click Finish.

                          You should now be able to find your application in your workspace.

                           

                          Please let me know if you face any issues.

                           

                          If you run into any issues in the future, you can feel free to create a new thread and we will try to debug and resolve it. Likewise, you can always share your thoughts on improving the tool. We will forward your feedback to our development teams. Thank you for your interest in our products

                           

                          Best Regards,

                          Rakshith M B

                          • 10. Re: main.c from an old project is a main.c for a new project (possible bug)
                            baga_4725781

                            I started with an empty project and did a copy/paste of the code into the project.

                            I then renamed the directory the project was in.

                            The launch files had the path to the empty project.

                            I saw the launches were already built, so I did not think about hitting "rebuild launch"

                            I found the launch text files, and did a manual change of the file path strings.

                             

                            I appreciate your efforts to show the "correct" way - I'm a CLI old fart. I find GUI interfaces to be frustrating because I don't make the same assumptions the GUI I/F builders do. Give me a shell and a Makefile, and I'm happy.

                             

                            Thanks .. yours ... bandit

                            • 11. Re: main.c from an old project is a main.c for a new project (possible bug)
                              EktaN_26

                              Hello baga_4725781,

                               

                              Please refer to the following Blog series which describes in detail using the Project-Creator Command Line Interface (CLI): Using the Project-Creator Command Line Interface (CLI)

                               

                              Best Regards

                              Ekta