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.

MSP430-GCC-OPENSOURCE: __MSP430_HAS_FRAM__ define missing from a few header files

Part Number: MSP430-GCC-OPENSOURCE
Other Parts Discussed in Thread: MSP430FR5994, MSP430FR2000, MSP430FR2100, MSP430FR2110, MSP430FR2111, MSP430FR2153, MSP430FR2155, MSP430FR2310, MSP430FR2311, MSP430FR2353, MSP430FR2355, MSP430FR2422, MSP430FR2475, MSP430FR2476, MSP430FR2512, MSP430FR2522, MSP430FR2672, MSP430FR2673, MSP430FR2675, MSP430FR2676, MSP430FR5041, MSP430FR5043, MSP430FR50431, MSP430FR5720, MSP430FR5721, MSP430FR5722, MSP430FR5723, MSP430FR5724, MSP430FR5725, MSP430FR5726, MSP430FR5727, MSP430FR5728, MSP430FR5729, MSP430FR5730, MSP430FR5731, MSP430FR5732, MSP430FR5733, MSP430FR5734, MSP430FR5735, MSP430FR5736, MSP430FR5737, MSP430FR5738, MSP430FR5739, MSP430FR5962, MSP430FR5964, MSP430FR5992, MSP430FR59941, MSP430FR6005, MSP430FR6007, MSP430FR6035, MSP430FR6037, MSP430FR60371, MSP430FR6041, MSP430FR6043, MSP430FR60431, MSP430FR6045, MSP430FR6047, MSP430FR60471, RF430FRL152H, RF430FRL153H, RF430FRL154H

Good morning everyone!

bug description:

inside the msp430-gcc-support-files-1.212.zip archive, in includes/msp430fr5994.h the __MSP430_HAS_FRAM__  define is missing, but clearly is should have been set.

explanation:

in your driverlib/MSP430FR5xx_6xx/framctl.c all the functions are guarded behind a

#ifdef __MSP430_HAS_FRAM__

and MSP430FR5994 clearly qualifies as a FRAM-capable product which needs those functions from framctl.c, but inside it's header the __MSP430_HAS_FRAM__ is missing and thus during compilation the functions cannot be reached due to the #ifdef.

just had a closer look and ran these commands:

grep '__MSP430_HAS_FRAM__' include/*430fr*.h | cut -d ':' -f1 | sort -u > /tmp/have_it
ls -1 include/*430fr*.h > /tmp/all_of_them_fram_devices
diff -u /tmp/all_of_them_fram_devices /tmp/have_it | grep '^-'

it looks like there are a lot of devices that contain 430FR in their name (which would mean they got FRAM inside) and don't have that __MSP430_HAS_FRAM__ macro defined. you might want to have a look into this. list is included below if you don't have a linux machine at hand to run the commands.

possible fixes:

add __MSP430_HAS_FRAM__ define to headers that belong to devices that provide FRAM capability OR

remove the 'ifdef __MSP430_HAS_FRAM__' guard in driverlib/MSP430FR5xx_6xx/framctl.c since the entire FR5xx_6xx family is expected to have FRAM


include/msp430fr2000.h
include/msp430fr2100.h
include/msp430fr2110.h
include/msp430fr2111.h
include/msp430fr2153.h
include/msp430fr2155.h
include/msp430fr2310.h
include/msp430fr2311.h
include/msp430fr2353.h
include/msp430fr2355.h
include/msp430fr2422.h
include/msp430fr2475.h
include/msp430fr2476.h
include/msp430fr2512.h
include/msp430fr2522.h
include/msp430fr2672.h
include/msp430fr2673.h
include/msp430fr2675.h
include/msp430fr2676.h
include/msp430fr5041.h
include/msp430fr5043.h
include/msp430fr50431.h
include/msp430fr5720.h
include/msp430fr5721.h
include/msp430fr5722.h
include/msp430fr5723.h
include/msp430fr5724.h
include/msp430fr5725.h
include/msp430fr5726.h
include/msp430fr5727.h
include/msp430fr5728.h
include/msp430fr5729.h
include/msp430fr5730.h
include/msp430fr5731.h
include/msp430fr5732.h
include/msp430fr5733.h
include/msp430fr5734.h
include/msp430fr5735.h
include/msp430fr5736.h
include/msp430fr5737.h
include/msp430fr5738.h
include/msp430fr5739.h
include/msp430fr57xxgeneric.h
include/msp430fr5962.h
include/msp430fr5964.h
include/msp430fr5992.h
include/msp430fr5994.h
include/msp430fr59941.h
include/msp430fr6005.h
include/msp430fr6007.h
include/msp430fr6035.h
include/msp430fr6037.h
include/msp430fr60371.h
include/msp430fr6041.h
include/msp430fr6043.h
include/msp430fr60431.h
include/msp430fr6045.h
include/msp430fr6047.h
include/msp430fr60471.h
include/rf430frl152h.h
include/rf430frl152h_rom.h
include/rf430frl153h.h
include/rf430frl153h_rom.h
include/rf430frl154h.h
include/rf430frl154h_rom.h

  • dug a bit deeper since my lib was compiling just fine for a msp430fr2355 target and that chip was also on the blacklist above.

    so

    fram devices seem to be including the legacy.h header in the device msp430foo.h

    in this legacy header we got this code:

    #ifdef __MSP430_HAS_FRCTL__

    #define __MSP430_HAS_FRAM__

    [..]

    #endif

    so every chip that has __MSP430_HAS_FRCTL__ in their header will also get __MSP430_HAS_FRAM__ from this code above.

    however

    msp430fr5994 does not have __MSP430_HAS_FRCTL__ defined since someone changed it to __MSP430_HAS_FRCTL_A__,

    so when the legacy.h is parsed __MSP430_HAS_FRAM__ will not get set for at least msp430fr5994.

    someone please nudge the maintainer of the msp430-gcc-support-files archive and tell me if I can help finding more of these inconsistencies.

    thanks,

    peter

  • Hello Peter,

    Thank you for your investigation here and for reporting the issue. We will be adding this to our internal bug tracker to be addressed in a future release.

  • thank you!

    I will remove the

    CFLAGS += -D__MSP430_HAS_FRAM__ -DFRAM_BASE=0x0140

    Makefile bodge after the header gets fixed.

    much appreciated,

    peter

  • I put together a small script that would automatically compile a small test main.c with all the fram targets and report back which ones ended up with no __MSP430_HAS_FRAM__ (please ignore the list from my first post):

    https://github.com/rodan/reference_libs_msp430/blob/master/tools/test_headers.sh

    ~spoilers~

    list of suspect headers: MSP430FR5041 MSP430FR5043 MSP430FR50431 MSP430FR5720 MSP430FR5721 MSP430FR5722 MSP430FR5723 MSP430FR5724 MSP430FR5725 MSP430FR5726 MSP430FR5727 MSP430FR5728 MSP430FR5729 MSP430FR5730 MSP430FR5731 MSP430FR5732 MSP430FR5733 MSP430FR5734 MSP430FR5735 MSP430FR5736 MSP430FR5737 MSP430FR5738 MSP430FR5739 MSP430FR5962 MSP430FR5964 MSP430FR5992 MSP430FR5994 MSP430FR59941 MSP430FR6005 MSP430FR6007 MSP430FR6035 MSP430FR6037 MSP430FR60371 MSP430FR6041 MSP430FR6043 MSP430FR60431 MSP430FR6045 MSP430FR6047 MSP430FR60471 RF430FRL152H RF430FRL153H RF430FRL154H

**Attention** This is a public forum