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.

CMSIS & CCS

I would like to use some of the functions in the core_cmInstr.h from CMSIS, in particular the reverse byte and bit operations. (I am using a LM4F232H5QC with CCS5.1)

I have followed the instructions in spma041a.pdf "Using the CMSIS DSP Library in CCS for Stellaris", but it apears that __TMS470__ has not been defined and therefore none of these functions are vissable to the compiler. I am also using the modified header files from the sw01291 installer.

as a quick fix I could manually define __TMS470__, but I'm guessing the documentation would have stated this if it was absolutaly neccisay, so I am auming something else is wrong here. (I have actually tried this, but it still doesn not include all the necisary defines in core_cmInstr.h that I need) 

Which of the two header files is more correct to include in my project: include core_cm4.h or core_cmInstr.h?

Am I missing something else here?

  • The macro __TMS470__ is a predefined macro by the TI compiler.  What makes you think that this macro is not defined?

    If all you care about is using the instructions in the file and not any of the other CMSIS stuff, then I do not see a harm in including only core_cmInstr.h.  In fact, since you are using the TI compiler all this does is end up including cmsis_ccs.h and using the definitions from there.  You should be able to just use cmsis_ccs.h which maps those instructions to TI compiler intrinsics.

  • Hi Joe,

    Thanks for reply.

    (I'm not in front of my work PC at the moment, working off memory here)

    I was thinking the macro __TMS470__ was predefined by TI, but it seems like all the #ifdefines in the core_cmInstr.h file that check for it "grey" the necessary code out, also where I call the __REV() function, the complier complains that it is undefined. If I force this define in the project settings it sorts that out, but then other code is still greyed out...

    I decided that it may be more trouble than it's worth to use CMSIS for only 1 or 2 functions, so I have re-defined the __REV() functions myself and they work just fine...

    I hope if ever I need to use more of the CMSIS or DSP functions it won't be a problem again, but I will cross that bridge when I get to it... It does seem to be more tricky to integrate CMSIS with CCS than expected...

  • Please see the following post that I had made in the CCS forums, it may prove helpful in the future with regards to the RBIT and REV intrinsic function in the next release of the TMS470 compiler.

    http://e2e.ti.com/support/development_tools/compiler/f/343/t/152374.aspx

    -Jesse

  • Thanks for that link Jesse, that will be very cool

  • Simon Thome said:

    I was thinking the macro __TMS470__ was predefined by TI, but it seems like all the #ifdefines in the core_cmInstr.h file that check for it "grey" the necessary code out, also where I call the __REV() function, the complier complains that it is undefined. If I force this define in the project settings it sorts that out, but then other code is still greyed out...

    The greyed out code in the editor is a feature of eclipse.  It tries to figure out what macros are defined when it is displaying code to you.  But you cannot count on it being correct, especially with compiler defined macros.  As far as I know, it is not aware of predefined macros by the compiler (maybe for gcc, but not TI compiler) so you can't use the greyed out code as the way to tell if that macro is defined.  You have to just tell by observation - did a section of code within the ifdef get compiler or not. Or you could do a quick test with something like this:

    #ifdef __TMS470__
    #error __TMS470__ is defined
    #endif

    and the compile will fail or not with the error message, thus proving that the macro is/is not defined.

    Simon Thome said:

    I hope if ever I need to use more of the CMSIS or DSP functions it won't be a problem again, but I will cross that bridge when I get to it... It does seem to be more tricky to integrate CMSIS with CCS than expected...

    CMSIS is multiple things.  One of those things is the device header files which really is just a coding style embodied in a header file.  To use those you pretty much just need to make the right headers are on your include path.  The DSP library is a completely separate thing, under the CMSIS "brand" but is unrelated to the device header files.  Since ARM releases the DSP library with support for ARM, IAR and CodeSourcery tools, we felt we needed to provide the app note to show how to use the DSP library with the TI tools as well.

  • Hi Joe,

    Thanks for the explanation above.

    I used this test in the core_cmInstr.h and no error was flagged (It was all highlighted in grey though)

    #ifdef __TMS470__
    #error __TMS470__ is defined
    #endif
    I used the same test in one of my project .c files and the error was flagged by the compiler...
    Have I perhaps made an error including the CMSIS into my project somehow?
  • Was core_cmInstr.h included by some .c file that you were compiling?  It has to be included in a C file or the compiler will not see it.

  • Yes, it was included in the C file that calls __REV();