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.

CCS: Problem invoking Cygwin's make as pre-build step

Tool/software: Code Composer Studio

To generate code for our firmware I invoke Cygwin's make as a pre-build step. This is the output I get when trying to build the project:

cd ../.. && c:/cygwin/bin/make  code
makefile:285: recipe for target 'pre-build' failed
make[2]: *** internal error: invalid --jobserver-fds string 'gmake_semaphore_9980'.  Stop.
gmake[1]: [pre-build] Error 2 (ignored)

(This is on Win7 professional, with CCS 7.4, cgtools 16.9.10 for C2000, Cygwin's make version is 4.1).

When I invoke "make code" from Cygwin's bash prompt it works as expected: It calls perl to generate the files (if required).

It is also possible to invoke perl directly as a pre-build step. But then the files are being generated on every build (which triggers an almost complete rebuild).

Searching the web I found a similar problem described on: www.microchip.com/forums/m882164.aspx

The recommendation from there to turn off parallel builds worked for me too, i.e., the invokation of make then works. But this, of course, slows down the build process too.

According to the above mentioned microchip forum post it is Cygwin's make that chokes when called from CCS's gmake with parallel builds enabled.

I'd appreciate any help on how to call Cygwin's make as a pre-build step without disabling parallel builds.

Another option could be to move the rule based code generation from a makefile to CCS. Unfortunately, I'm not very familiar with the Eclipse way of achieving such things. Any hints on this are appreciated too.

Regards

Johannes

  • Johannes,

    A couple of options come to mind:

    1) Try extending the auto-generated makefile (created by Eclipse for CCS projects) to include your pre-build rules into it. Please take a look at this thread as a reference.

    2) As you mentioned, move the rule based code generation from makefile to CCS. If you can provide more details on what the makefile rules are set to do, we might be able to point you to references for achieving the same with Eclipse/CCS projects.

    3) Move the entire CCS project from auto-generated makefile to custom makefile. This will give you maximum control and flexibility but would also require the most effort and customization.

  • AartiG said:
    2) As you mentioned, move the rule based code generation from makefile to CCS. If you can provide more details on what the makefile rules are set to do, we might be able to point you to references for achieving the same with Eclipse/CCS projects.

    The makefile does quite a bit (generating code and documentation, initiating the build, hexfile generation, checksum calculation for hexfiles, zipping everything and
    so on).  Most of those things do not involve rebuilding and can therfore remain in the makefile.

    For the actual build two rules are important. The first rule describes the dependencies for generating several C source files containing tables, structures,
    declarations, #defines etc. from a single input file. The names of those files are known in advance:

    $(list_of_c_and_h_files_to_be_generated):    $(generator_script) $(generator_input_file)
        $(generator_script) $(generator_input_file)

    With the second rule we generate a list (to be #included) and a bunch of files for our device documentation based on all source files containing a call to a function with the name SetError:

    csourceSetError = $(shell /usr/bin/grep -r -l --include '*.[cChH]' SetError .)

    $(error_list): $(csourceSetError) $(errorlist_generator)
        $(errorlist_generator)


    Both generator scripts are written in Perl.

    I'd appreciate help on how to achieve such things within CCS.

    Regards

    Johannes

  • Johannes L. said:
    I'd appreciate help on how to achieve such things within CCS.

    Ok, those rules do quite a bit and I don't believe there is an "automated" way of doing all of this in CCS. It seems to me that the options currently available to you are to either run the script separately prior to starting the CCS build, or to try extending the auto-generated makefile as suggested in my previous post. With the first option, you could even run your custom command and then do the project build also from command line, removing the GUI completely from the picture. Here is a reference for Creating and Building Projects using Command Line, in case you haven't seen it already.

  • AartiG said:
    try extending the auto-generated makefile as suggested in my previous post

    I transferred some rules of our makefile to makefile.init and now get the pre-build steps that I need. Thank you for pointing me to this option!

    Regards

    Johannes