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.

File specific prebuild steps in CCS4

Hello,

In CCS3.3 it is possible to define file specific prebuild steps. Thus before a file is compiled some user specific tasks can be done (for example a lint check of the file). How can I achieve the same in CCS4 without having to call the compiler manually after the user specific step?  I just want to call lint for each file before the compiler does its work.

 

Thanks

 

  • Marc,

    One thing I have done is to edit the command line pattern.  Right click on the file you want to set a pre-build step for.  Select Properties.  Click on C/C++ build on the left.

    There should be a box on the right hand side that says "Command line pattern".  Try inserting your call to lint at the very start of this followed by &.  i.e. To perform a dir before building a file my string would look like: dir & ${command} ${flags} ${inputs}

    There are also some companies that have lint integrations with Eclipse that you could look at.  As well as more advanced tools from Klocwork, ParaSoft and LDRA.

    Regards,

    John

     

     

     

  • Thanks for the fast answer. In my demo project everything works fine. The command line pattern looks like this: "${PROJECT_ROOT}/lint_config/lint_module_test.bat" ${inputs} & ${command} ${flags} ${inputs}. E.g. the input file is given as parameter to the batch file. So a Lint check is done on that file before the compiler is called. I changed the command line pattern for the whole project. So I don't have to change it for each file seperately.

    In my application project this doesn't work because the ${inputs} is empty. I saw in a subdir.mk file that the compiler is called with a dynamically created ccsCompiler.opt file.   Why is the compiler in one project called with the help of the ${command} ${flags} ${inputs} variables and in the other project with the help of a ccsCompiler.opt file? How can I get the file name in order to give it as a parameter to the batch file?

    Thanks

  • The ccsCompiler.opt file is created when the command length being passed to the compiler is greater than a certain length (i.e. in danger of exceeding the maximum command length).  In 4.1.2 we are a bit aggressive in using it, in 4.1.3 the length at which we need to generate that file has been increased and the opt filename will contain the source file name, mainc.opt, due to issues with parallel builds.

    You may be ok in 4.1.3 but it would still have the potential to break.  As a workaround you could use the name of the opt file to determine the input name but that would be a pain.

    A better solution would be for us to only include the contents of ${flags} in the opt file and leave the source file name in ${inputs}.  I will have to check with a developer on that.  

    John

     

  • Try using ${InputFileName}

    John

  • Hello John,

    ${inputs} did contain the path to the source file relative to the build directory. For example "../Source/SubSource/main.c". So lint could find the file.

    ${InputFileName} just contains the file name without any path information. For example "main.c". Thus lint doesn't know where the file is located.

     

     

  • ${InputDirRelPath} will give you the relative path.  So you could combine it with the other one to have the path and name.

     

    John

  • Or even better use this one: ${InputFileRelPath}

    It has exactly what you need.  Sorry for the iteration here, was getting the names with trial and error but someone pulled a list from the source code file me.

     

  • Hi John,

    now everything works fine. Thanks a lot for your help. Before calling lint I do a change directory into the directory the source file is located. Otherwise relatively addressed headerfiles (not via inlude paths) can't be located by lint. When lint has finished I change back to the build directory before the compiler is called.

     

    Thanks again

  • Great.

    BTW I also created a wiki topic with all the info I could find on the built in macros: http://processors.wiki.ti.com/index.php/Project_Macros