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.

How to assign 50KB fram for RAM usage in FR6989?

Hello all,

I want to assign 50KB FRAM  for RAM usage. If the FRAM  address  located below  0xFFFF, it's fine. However, I need 50KB  contiguous space, so the space have to chose above 0xFFFF,and once I modify the .xcl file , build the project , it tells error in the windows.  (IDE :  IAR for MSP430)

Need some help from you.

Thanks.

  • Hi,

    What exactly is the error that IAR gives you when you try to build the program? Could you give us your code example?

    Sincerely,
    Sean
  • Hi Sean,

    Thanks for your response and sorry for my vague description.

    It  has nothing to do with the code. It's about how to modify the .XCL file(IAR for MSP430) to make a FRAM space above 0xFFFF for RAM usage.

    Here I paste the screenshot of the error /code and  the XCL file.

    #include "msp430fr6989.h"
    unsigned int xx[100];
    void main( void )
    {
      // Stop watchdog timer to prevent time out reset
      WDTCTL = WDTPW + WDTHOLD;
       xx[0] =1;
      while(1);
    }
    

    Because of the forum 's requiment, I neet to changing the filename extension from .xcl to .txt , then I can post the file. 

    FR6989_modify.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    // ************************************************
    //
    // XLINK configuration file for MSP430FR6989
    //
    // Copyright 1996-2015 IAR Systems AB.
    //
    // See the file 430/doc/licenses/IARSourceLicense.txt for detailed
    // license information.
    //
    // $Revision: 13028 $
    //
    // ************************************************
    // ---------------------------------------------------------
    // Description
    //
    //
    // Usage:
    //
    // xlink [file file ...] -f lnk430fr6989.xcl
    //
    // -----------------------------------------------
    // Device summary
    //
    //
    // Core: MSP430Xv2
    //
    // Interrupt vectors: 56
    //
    // Signature memory: 16 Bytes
    //
    // JTAG Signature memory: 4 Bytes
    //
    // BSL Signature memory: 4 Bytes
    //
    // IPE Signature memory: 8 Bytes
    //
    // Peripheral units: 00100-00FFF
    //
    // Information memory (FRAM): 01800-019FF
    //
    // Read/write memory (RAM): 01C00-023FF
    //
    // Read/write memory (TINYRAM): 00006-0001F
    //
    // Persistent memory (FRAM): 04400-0FFFF
    // 10000-23FFF
    //
    // -----------------------------------------------
    // Segments
    //
    // -------------------------------------
    // Data read/write segments
    //
    //
    // The following segments are available for both
    // the DATA16 and DATA20 segment groups.
    //
    // segment Usage
    // ------- --------------------------
    // DATA<nn>_Z Data initialized to zero
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


  • Hi,

     I highly recommend you to review this App Report MSP430™ FRAM Technology – How To and Best Practices (Start with section 3.4.2 IAR Embedded Workbench for MSP430).

    And just for testing purposes, I changed my linker file to:

    // ---------------------------
    // Read/write data in FRAM
    //
    -Z(CONST)DATA16_P,DATA20_P=10000-13FFF
    // -Z(CONST)DATA16_P,DATA20_P=4400-FF7F
    

    And created a variable like this:

    __root __persistent uint16_t variableInFRAM;

    And my map file looked like this:

        -------------------------------------------------------------------------
    DATA20_P
      Relative segment, address: 00010000 - 00010001 (0x2 bytes), align: 1
      Segment part 5. ROOT 
               ENTRY                   ADDRESS         REF BY
               =====                   =======         ======
               variableInFRAM          00010000 
    

    Hopefully this helps.

     Best regards,

       David

  • Hello David,

    Yes, put a variable locate@ address > 0xFFFF is OK . But if I want to use a space for example 0x10040~ 0x23FFF as  stack, the IDE will tell error.

    I changed the linker file:

    // -----------------------------------------------
    // RAM memory
    //
    
    -Z(DATA)TINYRAM=0006-001F
    -Z(DATA)DATA16_I,DATA16_Z,DATA16_N,TLS16_I=10040-23FFF
    //-Z(DATA)DATA16_I,DATA16_Z,DATA16_N,TLS16_I=1C00-23FF
    -Z(DATA)CODE_I
    -Z(DATA)DATA20_I,DATA20_Z,DATA20_N
    -Z(DATA)CSTACK+_STACK_SIZE#

    It seems like STACK must located @SRAM or FRAM smaller than 0xFFFF or IAR will think it is  illegal.

  • Hi SeaFesse,

      I do not think it is possible to put the stack above 64KB (even that the SP register is 20bit wide).

    I tried changing the cstart without any luck, it builds but the SP does not reflect the correct address

            MOVA     #SFE(CSTACK), SP  
    

    or

            MOVA     #0x14000, SP  
    

    So I looked in the IAR C/C++ Compiler User Guide for MSP430 and:

    Anyway I'm looping in the MSP430 Compiler Team as they would have the most expertise regarding this question

      Best regards,

       David

  • Hi David,

    That's exactly what i want to know. :)

    DavidL said:
    I'm looping in the MSP430 Compiler Team as they would have the most expertise regarding this question

    Thanks very much.  Looking forward to hearing from the MSP430 Complier Team's response.

  • Hi SeaFesse,
    I tried to change the SP to new address 0x10040 after main() startup. And it changed the SP with lucky. Could you please try to do this for your code and let me know if it works?

    init: MOV #SFE(CSTACK), SP ; set up stack main: NOP ; main program MOV.W #WDTPW+WDTHOLD,&WDTCTL ; Stop watchdog timer MOVA #0x10040,SP

      Please also add the address space to xcl file for Read/write data in FRAM space. 

    // ---------------------------
    // Read/write data in FRAM
    //
    
    -Z(CONST)DATA16_P,DATA20_P=4400-FF7F,10040-23FFF
    -Z(DATA)DATA16_HEAP+_DATA16_HEAP_SIZE
    -Z(DATA)DATA20_HEAP+_DATA20_HEAP_SIZE

  • Hi Wei.Jetim,

    Yes! I modfied the Cstarup.s43, it works. And IDE tells no error when I add "10040-23FFF" . Thank you all...:)

    -Z(DATA)TINYRAM=0006-001F
    -Z(DATA)DATA16_I,DATA16_Z,DATA16_N,TLS16_I=1C00-23FF,10040-23FFF
    -Z(DATA)CODE_I
    -Z(DATA)DATA20_I,DATA20_Z,DATA20_N
    -Z(DATA)CSTACK+_STACK_SIZE#

      // --------------------
            // Initialize SP to point to the top of the stack.
            //
            //MOV     #SFE(CSTACK), SP
    		MOVA     #010040h, SP
    
            //
            // Ensure that main is called.
            //
            REQUIRE ?cstart_call_main

  • Hi SeaFesse,

    Sounds good!

    Please let me know if any further question.

**Attention** This is a public forum