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/MSP432P401R: How do you integrate C files into .ino programs in Code Composer Studio?

Part Number: MSP432P401R

Tool/software: Code Composer Studio

Hi All,

I can successfully copy and paste the contents of a C file into my .ino file and everything works, but I cannot figure out how to make functions in different .c files available in the .ino file.  I read that the Arduino IDE's build process actually concatenates the files together before building.  I would really like separate files.  Does anyone have any wisdom for me?

Thanks,

Rob 

  • I think you need to ask on the Energia forum. Generally, you just put the file and its header in the same project and include your header file in the .ino.
  • Thanks Keith,
    I thought the Energia IDE was more similar to the Arduino IDE, and this link
    www.arduino.cc/.../BuildProcess
    says that the Arduino IDE just concatenates the files together. I tried the normal thing of putting the files in the same project and including the header in the .ino file without success. I want to use CCS because I'm familiar with it and because of the great debugging capabilities. Maybe I will try the Energia forum though.
    Thanks,
    Rob
  • Energia is similar to Arduino, but is normally uses a totally separate toolchain. CCS cannot use .ino's directly. It has to import them and create the C/C++ files.
  • If you are creating an Energia Sketch in CCS or importing an existing one then it will work with .ino files.  The .cpp file will just get generated as part of the build process.

    In this capture you can see the .ino in my project.  The .cpp gets generated in the \Debug folder.  It is shown as excluded so the it doesn't get built and linked twice.

    As far as adding C files to your project you can do that as well.  In my project you will notice that there is a john.c and john.h.  However to use the functions in john.c I have to do this in my .ino file:

    You can see the call to john() inside the loop as well.

    Regards,

    John

  • Thanks John,
    I verified that it works as you said with blink. I'm still having the same issue on my project, but I didn't create it in exactly the same way.
    Thanks again!
    Rob
  • No problem.  I have been meaning to figure out how to do that anyway.

    Regards,

    John