Due to the U.S. Thanksgiving holiday, please expect delayed responses during the week of 11/22.

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.

MSP430F6659: Utilization of all sectors of MSP430F6659 SRAM

Part Number: MSP430F6659

Hi,

In MSP430F6659, SRAM is divided in 4 sectors of 16KB each. We found only 48KB out of 64KB is usable for application. Sector 0 is not available for the application. 

I created one blank project in IAR for MSP430F6659 and declared an array of static variable of 48KB(array length is 49152 of uint8). I used this array in while(1).

Below error appeared after build.

Error[e16]: Segment DATA20_Z (size: 0xdc00 align: 0x1) is too long for segment definition. At least 0x1c00 more bytes needed. The problem occurred while processing the segment placement command
"-Z(DATA)DATA20_I,DATA20_Z,DATA20_N,DATA20_HEAP+_DATA20_HEAP_SIZE=2400-63FF,F0000-FBFFF", where at the moment of 
placement the available memory ranges were "CODE:2400-5bff,CODE:f0000-fbfff"
Reserved ranges relevant to this placement:
2400-5bff DATA20_I
5c00-63ff CSTACK
f0000-fbfff DATA20_I

Build results are,

56 bytes of CODE memory
49 152 bytes of DATA memory (+ 10 bytes shared)

In IAR settings I kept stack size to 2048 and memory model is large. 

How do I use Sector 0 RAM for the application?

  • Hi Amit,

    Each sector of RAM could be control independently. You could control the RCCTL register to enable each sector.

  • Hi Allen,

    All sectors are ON after reset. I have not configured any bit of RCCTL0.

  • Hi Amit,

    Could you show your code?

  • //#include <libfixmath.h>
    #include <math.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <msp430f6659.h>
    #include <stdint.h>
    #include "main.h"
    
    // Disable Watchdog
    #define DisableWatchdog()        (WDTCTL = WDTPW | WDTHOLD)
    
    //Temporary static buffer of size 48KB = 48 * 1024 = 49152
    static uint8_t u8Temp[49152];
    uint32_t u32Count;
    
    int main( void )
    {
      /*Clock initialization*/
      DisableWatchdog();
      while(BAKCTL & LOCKBAK)                   // Unlock XT1 pins for operation
        BAKCTL &= ~(LOCKBAK);
      UCSCTL6 &= ~(XT1OFF);                     // XT1 On
      UCSCTL6 |= XCAP_3;                        // Internal load cap
      do
      {
        UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG);
        SFRIFG1 &= ~OFIFG;                     // Clear fault flags
      }while (SFRIFG1&OFIFG);                 // Test oscillator fault flag
      
      
      while(1)
      {
        /*This loop fills the u8Temp[]*/
        for(u32Count = 0; u32Count < 49153; u32Count++)
        {
          u8Temp[0] = u32Count;
        }
      }
    }
    

  • Hi Amit,

    u8Temp is 48K and u32count is 4byte. Total is larger than the max sector RAM2 (48K)

    You could change .cmd file to define the RAM size. In the original file, RAM is 16K and RAM2 is 48K. You could redefine the RAM from 0xf0000 size 0x10000 for 64K continuous address RAM .Delete RMA2 define in .cmd file.

  • // ************************************************
    //
    // XLINK configuration file for MSP430F6659
    //
    // Copyright 1996-2018 IAR Systems AB.
    //
    // See the file 430/doc/licenses/IARSourceLicense.txt for detailed
    // license information.
    //
    // $Revision: $
    //
    // ************************************************
    
    // ---------------------------------------------------------
    // Description
    //
    
    //
    // Usage:
    //
    //   xlink [file file ...] -f lnk430f6659.xcl
    //
    // -----------------------------------------------
    // Device summary
    //
    
    //
    // Core:                               MSP430Xv2
    //
    // Special vectors:                    64
    //
    // Peripheral units:                   00100-00FFF
    //
    // Information memory (FLASH):         01800-019FF
    //
    // Read/write memory (RAM):            02400-063FF
    //                                 F0000-FBFFF
    //
    // Read/write memory (USBRAM):         01C00-023FF
    //
    // Read-only memory (FLASH):           08000-0FFFF
    //                                 10000-87FFF
    //
    // Mirrored RAM: 02400-063FF mirrored at FC000-FFFFF
    
    
    // -----------------------------------------------
    // Segments
    //
    
    // -------------------------------------
    // Data read/write segments (RAM)
    //
    
    //
    // The following segments are available for both
    // the DATA16 and DATA20 segment groups.
    //
    // segment         Usage
    // -------         --------------------------
    // DATA<nn>_Z      Data initialized to zero
    // DATA<nn>_I      Data initialized by copying from DATA<nn>_ID
    // DATA<nn>_N      Data defined using __no_init
    // DATA<nn>_HEAP   The heap used by 'malloc' and 'free'
    //
    // segment         Usage
    // -------         --------------------------
    // CSTACK          Runtime stack
    // TLS16_I         Thread-local storage for main thread
    //
    
    
    // -------------------------------------
    // Program and data read-only segments (FLASH)
    //
    
    //
    // The following segments are available for both
    // the DATA16 and DATA20 segment groups.
    //
    // segment         Usage
    // -------         --------------------------
    // DATA<nn>_C      Constant data, including string literals
    // DATA<nn>_ID     Initializers for DATA<nn>_I
    //
    // segment         Usage
    // -------         --------------------------
    // INFO            Information memory
    // INFOA           Information memory, bank A
    // INFOB           Information memory, bank B
    // INFOC           Information memory, bank C
    // INFOD           Information memory, bank D
    // CSTART          Program startup code
    // CODE            Program code
    // ISR_CODE        Program code for interrupt service routines
    // DIFUNCT         Dynamic initialization vector used by C++
    // CHECKSUM        Checksum byte(s) generated by the -J option
    // INTVEC          Interrupt vectors
    // RESET           The reset vector
    // TLS16_ID        Thread-local initializers for main thread
    //
    // Notes:
    //
    // * The segments CSTART, ISR_CODE, and DIFUNCT, as well as the segments in
    //   the DATA16 and TLS16 segment groups must be placed in in the range
    //   0000-FFFD.
    //
    // * The INFOx and INFO segments overlap, this allows data either to be
    //   placed in a specific bank or anywhere in the info memory.
    //
    // * The INTVEC and RESET segments overlap. This allows an application to
    //   either use the reset vector provided by the runtime library, or
    //   provide a reset function by defining an interrupt function associated
    //   with the reset vector.
    //
    
    
    // ---------------------------------------------------------
    // Configuation
    //
    
    // -----------------------------------------------
    // Stack and heap sizes
    //
    
    // Uncomment for command line use
    //-D_STACK_SIZE=160
    //-D_DATA16_HEAP_SIZE=160
    //-D_DATA20_HEAP_SIZE=160
    
    
    // -----------------------------------------------
    // Define cpu
    //
    
    -cmsp430
    
    
    // -----------------------------------------------
    // Address sharing for mirrored memory ranges
    //
    
    -U2400-63FF=FC000-FFFFF
    
    
    // -----------------------------------------------
    // Support for placing functions in read/write memory
    //
    
    -QCODE_I=CODE_ID
    
    
    // -----------------------------------------------
    // Support for thread local storage
    //
    
    -QTLS16_I=TLS16_ID
    
    
    // -----------------------------------------------
    // Hardware multiplier location
    //
    
    -D__iar_HWMUL=4C0
    
    
    // ---------------------------------------------------------
    // Placement directives
    //
    
    // -----------------------------------------------
    // Information memory
    //
    
    -Z(CONST)INFO=1800-19FF
    -Z(CONST)INFOA=1980-19FF
    -Z(CONST)INFOB=1900-197F
    -Z(CONST)INFOC=1880-18FF
    -Z(CONST)INFOD=1800-187F
    
    
    // -----------------------------------------------
    // RAM memory
    //
    
    -Z(DATA)USBRAM=1C00-23FF
    -Z(DATA)DATA16_I,DATA16_Z,DATA16_N,TLS16_I=2400-63FF
    -Z(DATA)DATA16_HEAP+_DATA16_HEAP_SIZE
    -Z(DATA)CODE_I
    -Z(DATA)CSTACK+_STACK_SIZE#
    -Z(DATA)DATA20_I,DATA20_Z,DATA20_N,DATA20_HEAP+_DATA20_HEAP_SIZE=2400-63FF,F0000-FBFFF
    
    
    // -----------------------------------------------
    // Read-only memory
    //
    
    // -------------------------------------
    // Low memory 0-0FFFF
    //
    
    // ---------------------------
    // Constant data
    //
    
    -Z(CONST)DATA16_C,DATA16_ID,TLS16_ID,DIFUNCT,CHECKSUM=8000-FF7F
    
    // ---------------------------
    // Code
    //
    
    -Z(CODE)CSTART,ISR_CODE,CODE16=8000-FF7F
    
    
    // -------------------------------------
    // All memory 0-FFFFF
    //
    
    // ---------------------------
    // Code
    //
    
    -P(CODE)CODE=8000-FF7F,10000-87FFF
    
    // ---------------------------
    // Constant data
    //
    
    -Z(CONST)DATA20_C,DATA20_ID,CODE_ID=8000-FF7F,10040-87FFF
    
    
    // -------------------------------------
    // Special vectors
    //
    
    -Z(CODE)INTVEC=FF80-FFFF
    -Z(CODE)RESET=FFFE-FFFF
    

    We are unble to locate .cmd file in IAR or project folder. We assume you are talking about linker file attached above. Above linker file is unmodified. 

    We tried to change as suggested but didnt work. We changed line

    Z(DATA)DATA20_I,DATA20_Z,DATA20_N,DATA20_HEAP+_DATA20_HEAP_SIZE=2400-63FF,F0000-FBFFF

    to -

    Z(DATA)DATA20_I,DATA20_Z,DATA20_N,DATA20_HEAP+_DATA20_HEAP_SIZE=2400-63FF,F0000-FFFFF(modified)

    Below error appeared.

    Error[e24]: Segment DATA20_Z (seg part no 8, symbol "u32Count" in module "main", address [2400-2403]) overlaps segment DATA20_Z

  • Hi Amit,

    I am not familiar with IAR. I try on CCS and it works.