Creating/Copying a Project

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

Creating/Copying a Project

907 Views
d_
Contributor I

Hi,

 

I'm reaching my frustration level with CodeWarrior.  Of course, I'm new to it and it just doesn't feel comfortable.

 

Using a sample project provided by Freescale, I compiled, downloaded and executed on a demo board.  Next, I modified existing files, added new files and developed custom software for my custom target board.  I then got all this working on my custom target board.  Now I'm ready to move away from the sample project to a project that is unique to my custom board.

 

Here is my problem.  The Freescale sample project directory tree is not reasonable for my use.  I need to create a custom tree that fits my need.  What I would really like to do is to create the tree I want and then build a project around it.  I've tried this several different ways, but nothing works for me.  First, there doesn't appear to be any way to tell CodeWarrior to use an existing tree.  You can't add files to a folder that already exist in the folder, so you need to link or copy from another folder.  And when I do this, I need to manually enter all include paths.  Adding the paths is OK, I get that.  But even when I do that I can't get past assembler errors for those .s files in the original project.

 

I've read through some posts on a similar topic and have tried to copy a project.  This creates the copy, but it just links the files to a directory tree that I don't want.  And just by copying the project doesn't work because the include paths are wrong.  I can fix those, but since the tree isn't what I want anyway, I'm not going to go that way.

 

So, basically what I'm trying to do is create a bareboard project for my processor (KE02) with a structure like this:

 

<common folder>

<project folder>

     (multiple standard project folders here)

     source

          (multiple source folders here, possibly including cpu, drivers, etc.)

     headers

          (possibly multiple folders here)

 

The common folder contains files which are shared with projects for other processors (not KE02).

 

What is the easiest way to get here without getting the assembler errors (which I haven't figured out how to eliminate)???

 

Thanks,

 

Dave

Labels (1)
0 Kudos
Reply
6 Replies

666 Views
d_
Contributor I

Hi Ben and Pascal,

Thanks for your input.  It has helped me figure out what the heck is going on in CW.

I figured out what was going wrong, and it wasn't related to my original post.  Creating a new directory tree, moving the files around to where I wanted them, then building a new project worked just fine (with one exception as described below).  The problem was when I copied files from my sample project to my final tree, I copied files that were not used in the sample project build.  There were 2 reasons for this.  One was some files were excluded from the build and I missed the slash mark through them indicating to exclude from the build.  The other was more hidden.  Although files existed in the directories, they were never added to the project.  I accidentally stumbled on this by opening up my new project side-by-side with the demo project.  I then realized there were quite a few files that should not have been added to the new project.  When I deleted those, all my compile errors went away.  I was then able to build my new project, download it to my target hardware, and run it successfully.

The one exception is while doing all this sometimes CW would let me add a file and do a copy, and other times it would not let me copy, only link.  This was working with the original demo projects only, not with my custom project.  That isn't a show-stopper, only a strange behavior I don't understand.  Oh well, I have much to learn about CW.

Thanks TREMENDOUSLY for the input.

Regards,

Dave

0 Kudos
Reply

666 Views
trytohelp
NXP Employee
NXP Employee

Hi Dave,

I've performed some tests on my side to try to reproduce the problem for adding a file.

I suspected the problem was introduced when the file is already opened with another editor (notepad for example) but I can copy or link it.

I think it should have condition explaining the link option is available only.

      - is it when the file is opened or used by another program ?

      - when VCS is used ?

      - when file is on LAN,

      - ...

Unfortunately I was not able to reproduce the problem and don't find information explaining the cause of this problem.


Have a great day,
Pascal

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

666 Views
d_
Contributor I

Hi Pascal,

They are not a problems with CW, but problems in how I used CW.

The first problem was I had not opened some of the folders (for example, the startup code folder) but just copied all the files in the folders.  I then added all the files to my project.  But in the demo project, some of those files were excluded from the build.  When I did a build, they created errors.  The fix was to remove the files from the build (and the directory).

The second problem was similar in that the demo project had files in some directories, but those files were not excluded from the build, but never added to the project in the first place.  I was able to see this only because I looked at the project structure side-by-side of my new project and the demo project.  Then it was obvious that I was adding files that were not used.

Thanks again,

Dave

0 Kudos
Reply

666 Views
trytohelp
NXP Employee
NXP Employee

Hi Dave,

I've created an example based on your project structure.

This example is using the following architecture:

Project_example

      + Common_files

            + headers_common

                  - fibonacci.h

            + sources_common

                  - fibonacci.c

      + test_ke02

            + .settings

            ... (default project folder and file)

Using this configuration, I need to add the fibonacci.h and .c to the project.

Step 1: header file

2 ways to do that:

      - including path directly in include directive

            #include "..\..\Common_files\headers_common\fibonacci.h"

      - add new include path in GCC compiler settings

            added a new include path in compiler GCC: "${ProjDirPath}\..\Common_files\headers_common"

Now the header file is found by the project.

Step 2: source file

To add the source common folder, I've selected the project and with the pop-up clicked on Add files ...

In the wizard I've selected the file fibonacci.c and selected the options link to file instead of copy.

The files is now linked to my application and I can build it without problem.

Attached you will find the project.

Hope this will help you.

If I've mi-understanding something let me know.


Have a great day,
Pascal

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

666 Views
Ben
Senior Contributor I

Dave,

I understand your frustration, as I had the same feeling while starting to work with PE.

You will be able to build the files / folders your way by following these steps:

1) Start a new project.

2) Select and define the PE components you need in the project.

3) Pay attention that to customize PE results, you can select "expert mode" tab (above the components window) and define the component name. You can also define where the event routines will be created in the event tab

4) build the project, add a simple code to check components functionality.

5) When you are satisfied with the results, freeze the PE activity (in the project properties -  processor expert options window), and then you can relocate the files within the folders, rearrange routines / functions, and add your code.

Keep in mind a)not to do a massive changes as you will face errors due to macros that PE created b)if you create new folder make sure to include it in the file locations setting in the project properties.

0 Kudos
Reply

666 Views
d_
Contributor I

Hi Ben,

 

Thanks for the feedback.

 

I've never used PE and have been steered away from it.  Even Freescale tech support admits that until you are a PE expert, it is difficult to use.  And if you only rarely create new boards, it's not possible to become a PE expert without a lot of time invested to learn it.

 

BTW, I did try it.  I did something wrong and it gave me an error.  There is no "undo" in PE so I had to dig through the reference manual to figure out what I did wrong.  So this suggestion sends me down a learning path that I don't want to take and adds no value to my project.

 

I have no problems figuring out how to configure all the pins and internal options in firmware.  And I don't want PE to generate macros or code to manage my I/O.  My project is already running just fine.  Why can't I just create a new project that compiles with the simple main.c, then import (or add) all of my files, with the tree I want?  Seems to me Eclipse is an advantage to the vendors because it is a generic platform for them to base IDEs on, but it doesn't generally make it easy for users without a lot of time investment.  (I will add here that of the handful of Eclipse-based IDEs I've used, CodeWarrior is the least buggy and reasonably fast.  I've given up on several other Eclipse-based IDEs because they are unusable [Xilinx] or just too slow [Microchip].)

Thanks,

Dave

0 Kudos
Reply