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.

CCS/MSP430F5435: Data located in higher memory above FLASH2 is causing #17003-D warning is large data model

Part Number: MSP430F5435

Tool/software: Code Composer Studio

 CCS Version: 7.0.0.00043running on Win10

I have a data section created in the linker command file as:

PARAM_DATA10            : origin = 0x26E00, length = 0x0200

the sections portion of the linker cmd file:

SECTIONS
{
    .bss        : {} > RAM                  /* Global & static vars              */
    .data       : {} > RAM                  /* Global & static vars              */
    .TI.noinit  : {} > RAM                  /* For #pragma noinit                */
    .sysmem     : {} > RAM                  /* Dynamic memory allocation area    */
    .stack      : {} > RAM (HIGH)           /* Software system stack             */

#ifndef __LARGE_DATA_MODEL__
    .text       : {} > FLASH                /* Code                              */
#else
    .text       : {} >> FLASH2 | FLASH      /* Code                              */
#endif
    .text:_isr  : {} > FLASH                /* ISR Code space                    */
    .cinit      : {} > FLASH                /* Initialization tables             */
#ifndef __LARGE_DATA_MODEL__
    .const      : {} > FLASH                /* Constant data                     */
#else
    .const      : {} >> FLASH | FLASH2      /* Constant data                     */
#endif
    .cio        : {} > RAM                  /* C I/O Buffer                      */

    .pinit      : {} > FLASH                /* C++ Constructor tables            */
    .binit      : {} > FLASH                /* Boot-time Initialization tables   */
    .init_array : {} > FLASH                /* C++ Constructor tables            */
    .mspabi.exidx : {} > FLASH              /* C++ Constructor tables            */
    .mspabi.extab : {} > FLASH              /* C++ Constructor tables            */
#ifdef __TI_COMPILER_VERSION__
  #if __TI_COMPILER_VERSION__ >= 15009000
    #ifndef __LARGE_DATA_MODEL__
    .TI.ramfunc : {} load=FLASH, run=RAM, table(BINIT)
    #else
    .TI.ramfunc : {} load=FLASH | FLASH2, run=RAM, table(BINIT)
    #endif
  #endif
#endif

  .infoA     : {} > INFOA              /* MSP430 INFO FLASH Memory segments */
    .infoB     : {} > INFOB
    .infoC     : {} > INFOC
    .infoD     : {} > INFOD
    .param_data1 : {} > PARAM_DATA1
    .param_data2 : {} > PARAM_DATA2
    .param_data3 : {} > PARAM_DATA3
    .param_data4 : {} > PARAM_DATA4
    .param_data5 : {} > PARAM_DATA5
    .param_data6 : {} > PARAM_DATA6
    .param_data7 : {} > PARAM_DATA7
    .param_data8 : {} > PARAM_DATA8
    .param_data9 : {} > PARAM_DATA9
    .param_data10 : {} > PARAM_DATA10
    .param_data11 : {} > PARAM_DATA11
    .param_data12 : {} > PARAM_DATA12
    .param_data13 : {} > PARAM_DATA13
    .param_data14 : {} > PARAM_DATA14
    .param_data15 : {} > PARAM_DATA15
    .param_data16 : {} > PARAM_DATA16
    .param_data20 : {} > PARAM_DATA20
    .param_data21 : {} > PARAM_DATA21

The declaration of the variable to access the data section is:

#pragma DATA_SECTION(VarName, ".param_data10")
T_typeName        VarName;

When I try to pass an element (char) from the structure to an IO port (using all 8 bits) the compiler gives the warning

Description    Resource    Path    Location    Type
<a href="processors.wiki.ti.com/.../17003"> relocation from function "FunctionName" to symbol "VarName" overflowed; the 18-bit relocated address 0x26e00 is too large to encode in the 16-bit field (type = 'R_MSP430X_ABS16' (15), file = "./main.obj", offset = 0x0000003e, section = ".text:FunctionName")    FileName.h    /ProjectName    line 387    C/C++ Problem
(Yes I have changed some of the names to protect the innocent)

I have also tried to use a local temp variable to receive the value from the structure and then put it out the IO Port but then the error moved to the line with the temp variable.

I have specified in the Project to use large code and large data model.  Along with this warning is the warning:

Description    Resource    Path    Location    Type
#10015-D output file "ProjectName.out" cannot be loaded and run on a target system    ProjectName             C/C++ Problem

which to me is a little more than a warning!

The code compiled and ran fine from IAR

Any ideas?

  • HI Greg,
    I will move the to the compiler forum. The experts there can help you best.

    Thanks
    ki
  • Greg Greenwood said:
    I have specified in the Project to use large code and large data model. 

    Also try changing the --near_data option from "globals" to "none":

    By setting a large data model and setting --near_data to none I was able to suppress the warnings on the attached example which had data located in high memory.

    MSP430F5435_high_data.zip

    [I haven't attempted to run the program]

  • The reply by Chester Gillon is correct.  I can explain a few more details, and suggest one additional change.

    Because this memory range ...

    Greg Greenwood said:
    PARAM_DATA10            : origin = 0x26E00, length = 0x0200

    ... is above the 64K boundary (higher than address 0x10000), and you place writeable data in this memory range, you must change --near_data=globals to --near_data=none.  You can read more about this in the section titled Support For Near Data in the MSP430 compiler manual.   

    When you create a new MSP430F5435 project in CCS, it starts with the build options --near_data=globals and --data_model=restricted.  While you need to change to --near_data=none, you do not need to change to --data_model=large.  Unless you have some individual object (like an array) that exceeds 64K in size.  That is very unlikely.  So you would probably see a small improvement in code size and speed if you use --data_model=restricted.  For further details, please see the section titled Data Memory Models in the same manual.

    Thanks and regards,

    -George

  • Got it.

    Thanks to all.

    code migration complete and working.

    Also had to make sure all of the instances of code accessing the flash were using a variable declared as unsigned long *.  Apparently IAR (the old version) was doing that in the background without complain or warning.

    So glad to be on CCS!