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.

MSP430FR5994: H-file confusion

Part Number: MSP430FR5994

I have these two h-files:

  • MSP430F5XX_F6XXGENERIC.h
  • MSP430FR5994.h

Some registers are properly named in one file and others in the other file.  Specifically the adc12_b files seem to be correct in the device-specific h-file, while timer_a seems to be correct in the Generic h-file.

For example, in the library timer_a.c file, the register offset OFS_TAxCCR0 is used, which is defined in the Generic file.  But the device-specific file defines OFS_TA0CCR0.  Both have the same offset value (0x12).

If I include both files, I get warnings for duplicate definitions of other registers.

What is the correct way to manage these two files?

Thanks!
Dan

  • The usual way is to include msp430.h and let the compiler sort out what to include based on the mcu settings.(That is just one long series of #ifdef.)

    But it will usually be the device specific header file.

  • I agree with you in concept, but I'm having trouble making it work.

    I pared back all my predefined symbols in the project properties to just the device _MSP430FR5994_.  I added #include <msp430.h> in all c-files.

    I get hundreds of warnings that look like this:
    "C:/ti/ccs1000/ccs/ccs_base/msp430/include/msp430fr5xx_6xxgeneric.h", line 454: warning #48-D: incompatible redefinition of macro "ADC12SHT0_0" (declared at line 686 of "C:\ti\ccs1000\ccs\ccs_base\msp430\include\msp430fr5994.h")

    In addition, I get the following errors:

    "../AFE.c", line 41: error #20: identifier "ADC12_B_SAMPLEHOLDSOURCE_SC" is undefined
    "../AFE.c", line 42: error #20: identifier "ADC12_B_CLOCKSOURCE_MCLK" is undefined
    "../AFE.c", line 43: error #20: identifier "ADC12_B_CLOCKDIVIDER_2" is undefined

    If I force the compiler to choose one of the h-files, I can solve many of the errors, but not all of them.

  • Now I can see you are using the CCS compiler which is different from GCC which is what I use. All I can suggest for CCS is to read the documentation.

    Looking at the GCC header I see definitions for OFS_TA0CCR0 etc. but can't think of why I would use that rather than just TA0CCR0.

  • David, the MSP libraries I am using all use offsets from the module base address to allow for common code when there are multiple modules (eg TA0, TA1).

    Thanks for your attention.

    Dan

  • Hi Dan,

    Sorry for reply you later, you use GCC compiler? and have you use our example to design your project?

    Or just create a empty peoject and add some files by yourself?

    Thanks!

    Best Regards

    Johnson

  • I am using CCS with the supplied MSP430 libraries.  These have worked well for me with other MSP430 devices, but the '5994 target is giving me these warnings and errors.

  • Hi Dan,

    I din't find the "MSP430F5XX_F6XXGENERIC.h" file, OFS_TAxCCR0 is define in legacy.h file:

    Thanks!

    Best Regards

    Johnson

  • Thanks.  I am confused that you did not find the file, as it is in the base directory. C:/ti/ccs1000/ccs/ccs_base/msp430/include/msp430fr5xx_6xxgeneric.h   How do I convince CCS to exclude the "generic.h" file and add the "legacy.h"?  How do I modify the CCS project settings to get this to compile?  It is important to my engineering team to use the MSP430 libraries properly.

  • Hi Dan,

    I create a project with driverlib, and then everything looks normal.

    Maybe you can create a new project or refer our example code in SDK.

    Thanks!

    Best Regards

    Johnson

  • I am using the code provided in msp430_driverlib_2_91_31_01.  I do not understand what you are describing.

    I am running CCS10.0.0.

    Please clarify.

    Thanks.

    Dan

  • I don't know about CCS but with GCC the inclusion of the generic.h file is controlled by various #ifdef statements in msp430.h. Plus of course explicit inclusion if you so desire. (Or perhaps the IDE is responsible.)

    Looking at msp430fr5994.h I see that it defines __MSP430_HAS_TAx__ which controls the symbols you desire in legacy.h and it includes legacy.h unless the symbol EXCLUDE_LEGACY is defined. A quick check shows no problems using the OFS_TAx symbols with GCC.

  • David - many thanks.  This is my third project on CCS, using 3 different MSP430 processors.  The first two did not have these issues - the config parameters and H files all behaved properly.  Having 3 different H files that contradict each other is confusing and disappointing.  I know I can bulldoze my way through it and create my own register and bit maps, but that's not how it's supposed to work.

    Dan

  • Hi Dan,

    Does David's comments resolve your issue? 

    Thanks!

    Best Regards

    Johnson

  • David's response says that CCS is not managing the H-files correctly, and that I should manually adjust the linkages between those 3 files using #defines.

    I do not consider that a solution, but if that is your recommendation, then I will do it reluctantly.

  • Not quite. I said that GCC has no trouble with it. Why CCS is doing something different is something I do not know. Look at the header files and see what they are doing. Are they doing something you don't want because a symbol is defined, or not defined?

    The reason I mentioned that GCC has no trouble is that I believe that the headers for the two systems are generated from a common source and should be very similar.

  • I pared back all my predefined symbols in the project properties to just the device _MSP430FR5994_.  I added #include <msp430.h> in all c-files.

    I get hundreds of warnings that look like this:

    Can you post an example project which generates those warnings? - since I can't tell what is causing msp430fr5xx_6xxgeneric.h to be included.

    The TI MSP430 compiler has options to create the pre-processed output for a source file, which can help to debug include problems. See Preprocess the Source File or the MSP430 compiler manual.

  • I found the reference(s) to the generic h-file.  I commented them out and everything compiled properly, which makes sense.  I have no idea why this text exists in the hw_memmap.h file, which is included in most of the library h-files.

    #ifndef __HW_MEMMAP__
    #define __HW_MEMMAP__

    #define __DRIVERLIB_MSP430FR5XX_6XX_FAMILY__
    //*****************************************************************************
    //
    // Include device specific header file
    //
    //*****************************************************************************
    #include <msp430.h>

    #ifndef __AUTOGENERATED__
    #include "msp430fr5xx_6xxgeneric.h"
    #endif
    #include "msp430fr5xx_6xxgeneric.h"

    #include "stdint.h"
    #include "stdbool.h"

  • Hi Dan,

    Does your question have been resolved? Can you compiler your project normally?

    Thanks!

    Best Regards

    Johnson

  • By commenting out the references to the _generic.h file, my program compiles without errors or warnings and runs properly.

    It would be nice to know why that file is included in the hw_memmap.h file, which is very low level and should not be edited by developers - it's a library file.

    I'll mark this as resolved.

    Dan

**Attention** This is a public forum