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.

autogenerating a makefile from a script

Other Parts Discussed in Thread: CCSTUDIO

I am running CCSV5 under win7 for an MSP430  target.  Our developers are working interactively using CCS, but I need to put together an automated test stand for our product.  As such, I need to check out a clean copy of the build environment as saved in TFS by the developer team, and then I need to generate a makefile from that checked out environment.  I need to tailor that makefile to include test scaffolding code (which is likewise autogenerated).  Finally, I need to load the image that the makefile generates, and then run my tests.  There are about 50 different test scaffolding C source files that I am already auto-generating, but I can only include a subset of these in any given build, as we are limited in the amount of ram available.  All this activity needs to be controlled by a script, since we intend to run the entire test scenario automatically every night, so the results are available to the developers the next morning.

My question to this forum is: "How do I get CCSV5 to auto-generate a makefile, and get it to do this by running a script?"

Once I have the makefile, I can edit it from a script to automatically add/remove test scaffolding code, then build the image by running make.  I already have the scripts written in javascript to load the image and run the tests, but right now, I have to manually check out the code from TFS, and manually generate the build.  These steps need to be automated so I don't have to stay up all night to run these tests.  ;-)

For archiving the artifacts of the test for the regulatory authority, it would be nice if the makefile was self-contained, not including a bunch of other stuff from all over the place.

  • Hi Robert,

    I've still fuzzy on a few details so I'll ask some questions of my own first.

    Robert Brown said:
    Our developers are working interactively using CCS, but I need to put together an automated test stand for our product.

    Are the developers who are working interactively with CCS using CCS projects? 

    Robert Brown said:
    I need to generate a makefile from that checked out environment.

    I am assuming you are looking to generate a standard makefile, yes?

    Robert Brown said:
    My question to this forum is: "How do I get CCSV5 to auto-generate a makefile, and get it to do this by running a script?"

    CCS projects use makefiles under the hood. When a CCS project is created, makefiles are generated (in the configuration subfolder). When you build a CCS project, it simply calls gmake on the generated makefile.

    You can create a CCS project from the command-line:

    http://processors.wiki.ti.com/index.php/Projects_-_Command_Line_Build/Create#Create_a_Managed_Make_Project

    So I would imagine that you can simply call this command from your script to create a CCS project, which would generate the makefiles and then you can modify them as you need to via your script.

    Robert Brown said:
    it would be nice if the makefile was self-contained, not including a bunch of other stuff from all over the place.

    Well CCS generates several files. One main 'makefile' which pulls in several other generated files with a *.mk extension (all in the same directory). Not sure if this is self-contained enough for your needs.

    I'm thinking that you may also want to explore generating your own makefile from scratch. The CCS generated makefile has a lot of stuff in there which frankly to me I find confusing and doesn't always apply (like all the ifneq statements based on what target you are building for). It may be easier to generate your own than modifying the existing ones.

    Thanks

    ki

  • I have already looked at the makefile heirarchy that is generated when I click on build>clean in CCSV5.  It's messy, but usable.  I cannot hand code a makefile ahead of time because the developers are free to change things in CCS, and when I check out the files I am supposed to test, they may have added some files, removed some files, changed some options, etc., and I need to be able to incorporate all that as those things change.

    I have looked into running the headless build, but I am having trouble getting it to work.  Here is the command I used, and the output it produces:

    C:\ti\ccsv5\eclipse>eclipsec.exe -noSplash -data C:\Users\rbrown\workspace_v5_1 -application com.ti.ccstudio.apps.projectBuild -ccs.projects xPG -ccs.buildType clean

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    CCS headless build starting... [Wed Sep 12 16:32:01 EDT 2012]
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    ================================================================================
    Pre processing...


    ================================================================================
    Building...

    --------------------------------------------------------------------------------

    After it outputs this, it just sits there.  The Windows Task Manager Performance graph shows an initial spurt of activity for about a second, then it dies down to background noise.  The Processes page shows that eclipsec.exe is running, but using no measurable cpu time.

    What could be wrong?

    I have to kill it with ^C to get rid of it.

     BTW my CCSV5 is Version: 5.1.0.09000

     

  • Your command to clean the project looks correct. I don't see anything wrong with it. 

    Do you have CCS running and using that workspace? I'm wondering if that has any impact. It should not but I've seen stranger things...

  • I thought the same thing, so I tried it both ways, but the result was the same each time.

    What else could it be?  Does my version of CCS not match up to the example command line?  What version should I be using?

  • Robert Brown said:
    Does my version of CCS not match up to the example command line?  What version should I be using?

    No, it is fine. In fact I used the same command you did with my 5.1.0.09000 install to clean an existing project and it worked. The only difference was my project name and workspace location

    Could you quickly try a fresh new workspace folder?

  • I just had a thought:  I am new to CCS.  I come from a Unix/Linux background, where this whole IDE thing does not exist, and instead, everything is neatly layed out in your scripts and makefiles where you can see what is happening.  Could it be that I do not know what my project name is?  Is it the name of the directory you click on with the mouse before you say clean or build?  Or is it something else, such as maybe the name of a "project" file somehere?  I obviously know the directory that is my "workspace", but maybe I am confused as to what the real project name is.

  • I doubt it. If you passed in an invalid project name, it should have reported it as an error. 

    Did you try a new workspace?

  • I only have that one workspace.  It was set up before I came to the project.  There are a bunch of files that go ito this build, and the only way I have to know which files they are actually using in the build is to build that one project in that one workspace.  There are also a number of *.h and *.h files in the directory treethat are not in this build, but have been in the past, and may be again in the future.  This is my problem.  The developers save the files that control the project in the source control. system (TFS) and I have to check out the directory tree and build it to find out what is actually going into the build.  Then I have to add my test source files to the build.  Now we are running out of ram because of my test files, so I need to only add in those test files needed for certain tests, build, and load into the target, and run the tests.  Then I rebuild with different test files, load test, etc.  That way I can run all the tests withou running out of ram.  I need to script this, as it is supposed to run unattended every night.  This is why I need to either generate a makefile, or just make a build, but the makefile would be better, so I can keep the makefile as a test artifact, along with the load map, to show what went into each test build.

  • I did some more experimentation.  I determined that if I pass it a truly invalid project name, then it does give me a proper error message.

    At this point, I would settle for just being able to invoke a clean build from within a script.  Forget having a makefile.  I need to get past this problem.  Right now, I have to stop my automation script so I can manually invoke a build, then continue my automation script.  This will not be acceptable for very long.

  • I have gotten a make to run from my cygwin bash shell scripts, so what I really need now is to be able to generate a current makefile from the project and workspace contents checked out of TFS.  I can manually generate the makefile before I run my scripts, and the scripts can edit the makefile appropriately, but I really need to e able to generate the makefile from a script if this test stand is to run autonomously every night.

  • It would also work fine if I could just invoke "clean" and then "build" directly from my script.  I know this should be possible.  I can do a clean, and also a build, once I have the makefile, but I have no way to get a current makefile other than to manually perform a build from within Code Composer.

  • I still need help with this.  I have been working around the problem by manually generating a makefile isung the code composer ide and the mouse, but I need to be able to automate this inside a script.  Once I have a makefile, I can do a make clean and a make all from a script and it works fine, but I still cannot generate the makefile from a script.

    Can somebody please help me with this?

    Thanks!