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.

Initialize FRAM variable (#pragma PERSISTANT) after linking

Other Parts Discussed in Thread: MSP-FET, MSP430FR5969I'm working on a project that is a long-duration data logger that uses the RTC. I'm been racking my brain for methods to set the RTC calendar when first installing the battery. Considering that the battery is expected to last several years, and a supercap has been added to maintain the clock during battery changes, I'm ok with requiring a MSP-FET to set the clock. That brings me to my question: I assume it's possible for me to set the value of an FRAM address on the MSP430 using the MSP-FET, but I'm not really sure how to begin. I feel like may be achievable by trying to find the address of a variable stored in FRAM that would contain an update to the calendar struct. If on boot, anything other than all zeros is found update the RTC calendar with it. Then, to set the clock I could make a hex file that specifies the new calendar value at the correct address. I was hoping to be able to get the address from the .Map file, but it doesn't seem to be in there. Maybe it would be possible to get it from the object file? Anyway, I'd love to know what people think about solutions to this problem. I don't spend that much time thinking about platforms with no UI, so it's a little like shooting in the dark for setting configuration. Thanks in advance!!
  • Have you looked into the "LOCATION" pragma? Here is an application of it I use:

     

    #pragma LOCATION( myPersistentData, myPersistentDataAddress )

    #pragma RETAIN ( myPersistentData )

    #pragma PERSISTENT( myPersistentData )

    volatile uint8_T myPersistentData[ myPersistentDataSize ] = { 0 };

     

     

    Bill.

  • Oh, that's a cool one! I found this wiki article about it that expands on your idea:

    processors.wiki.ti.com/.../Placing_Variables_in_Specific_Memory_Location_-_MSP430

    One question I have that remains is how do you decide where you want to put it? I see that wiki article talks about putting stuff in flash, which makes no sense on a FRAM part. I suppose it technically doesn't matter all that much, as long as I tell the linker about it, but what are the strategies?

    Thanks again!
    - Will
  • Here is how I tell the linker where to put certain things, and you could make your own sections...

    /*
    Locate the following (up to trailing #pragma SET_DATA_SECTION()) into RAM for non-FRAM-wait-state access:
    */
    #pragma SET_DATA_SECTION (".ram") /* .ram is a memory section I created.
    /*
    *
    * ...a bunch of variables I don't want to incur FRAM wait states so I
    * "manually" force into RAM. Might be a better way to determinstically
    * induce the linker to put it there, but I also wanted to allow for
    * specifying no initializations. I'm still a novice at this.
    *
    *
    */
    #pragma SET_DATA_SECTION ()



    I added this to my "lnk_msp430fr5969.cmd" file:

    .ram : {} > RAM /* For explicit RAM inclusion */



    Bill.
  • I've been thinking about this more, and I have a few ideas and questions...

    Can I just set the RTC calandar registers using JTAG?

    I read that it is possible to read and write arbitrary memory addresses in RAM, flash, and peripherals through JTAG.  This may be exactly what I want.  There doesn't seem to be a lot of support for this, however.  Can it be done from MSP430Flasher, or would I have to write an application based upon its source, which by the way is beautifully written and commented.

    Can I use InfoA?

    This probably the most main-stream and likely to succeed method.  It would be substantially similar to your model, and fits with the article you linked.

    JTAG Mailbox?

    The JTAG Mailbox seems like a cool solution, but I don't see what support is available on the host side.  I can't figure out what application I would even use to send a message to the JTAG Mailbox...

**Attention** This is a public forum