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.

Fatal Error[e72]: Segment DATA must be defined in a segment definition option (-Z, -b or -P)

Other Parts Discussed in Thread: MSP430F249

hi,

     i am first time going to use IAR for programming msp430f249 and i am getting the error ...

Fatal Error[e72]: Segment DATA must be defined in a segment definition option (-Z, -b or -P)

please help me out

  • You need to fix the linker control file (.xcl) in your project and add a segment called DATA in RAM region of your part. See the XLINK.pdf user's guide in the IAR documentation.

  • You should tell a bit more about what exactly you did/tried.

    Possibly, you're using a project that was designed for an older IDE version. The project contains an outdated linker script file that doesn't work for your compiler/linker version.

  • hi,

          i am modify the project already done in Assembly language using IDE IAR 4.2 version and microcontroller msp430f249.

          when i compile in debug mode i get only warning 

    Warning[w29]: Parts of segment DATA are initialized (as in module main), even though it is of type DATA (and thus not

    promable)

         but when i compile in Relese mode i get error

    1 file(s) deleted.
    Updating build tree...
    asm.s43
    Linking
    Fatal Error[e72]: Segment DATA must be defined in a segment definition option (-Z, -b or -P)
    Error while running Linker

    linker file as below

    //*****************************************************************
    //
    // The memory areas of the MSP430F249 microprocessor:
    //
    // Peripheral units: 0 - 01FF
    //
    // Information memory (FLASH): 1000 - 10FF
    //
    // Read-write memory (RAM): 0200 - 09FF
    //
    // Read-only memory (FLASH): 1100 - FFBD
    //
    //
    //*****************************************************************

    //*****************************************************************
    //
    // The following segments are defined in this linker command file:
    //
    // Data read/write segments (RAM)
    // ==============================
    //
    // segment Restrictions Usage
    // ------- ------------ --------------------------
    // DATA16_I < 10000 Data16 initialized variables
    // DATA16_Z < 10000 Data16 zero initialized variables
    // DATA16_N < 10000 Data16 uninitialized variables
    // DATA16_HEAP < 10000 Data16 heap used by malloc and free
    // DATA20_I Data20 initialized variables
    // DATA20_Z Data20 zero initialized variables
    // DATA20_N Data20 uninitialized variables
    // DATA20_HEAP Data20 heap used by malloc and free
    // CSTACK < 10000 Runtime stack
    //
    //
    // Program and data read-only segments (FLASH)
    // ===========================================
    //
    // segment Restrictions Usage
    // ------- ------------ --------------------------
    // INFO Information memory
    // CSTART < 10000 Program startup code
    // CODE Program code
    // ISR_CODE < 10000 Program code for interrupt service routines
    // DATA16_C < 10000 Data16 constant data and string literals
    // DATA16_ID < 10000 Data16 initializers for DATA16_I
    // DATA20_C Data20 constant data and string literals
    // DATA20_ID Data20 initializers for DATA20_I
    // DIFUNCT < 10000 Dynamic initialization vector used by C++
    // CHECKSUM Checksum byte(s) generated by the -J option
    // INTVEC FFC0-FFFF Interrupt vectors
    // RESET FFFE-FFFF The reset vector
    //
    //*****************************************************************


    // ---------------------------------------------------------
    // Stack and heap sizes.
    // ---------------------------------------------------------

    // Uncomment for command line use
    //-D_STACK_SIZE=80
    //-D_DATA16_HEAP_SIZE=80


    // ---------------------------------------------------------
    // Define cpu.
    // ---------------------------------------------------------

    -cmsp430


    // ---------------------------------------------------------
    // Read-write memory.
    // ---------------------------------------------------------

    -Z(DATA)DATA16_I,DATA16_Z,DATA16_N,DATA16_HEAP+_DATA16_HEAP_SIZE=0200-09FF
    -Z(DATA)CSTACK+_STACK_SIZE#


    // ---------------------------------------------------------
    // Read only memory


    // ---------------------------------------------------------
    // Information memory
    // ---------------------------------------------------------

    -Z(CODE)INFO=1000-10FF
    -Z(CODE)INFOA=10C0-10FF
    -Z(CODE)INFOB=1080-10BF
    -Z(CODE)INFOC=1040-107F
    -Z(CODE)INFOD=1000-103F

    // ---------------------------------------------------------
    // Constant data
    // ---------------------------------------------------------

    -Z(CONST)DATA16_C,DATA16_ID,DIFUNCT=1100-FFBD


    // ---------------------------------------------------------
    // Code
    // ---------------------------------------------------------

    -Z(CODE)CSTART,ISR_CODE=1100-FFBD
    -P(CODE)CODE=1100-FFBD


    // ---------------------------------------------------------
    // Interrupt vectors
    // ---------------------------------------------------------

    -Z(CODE)INTVEC=FFC0-FFFF
    -Z(CODE)RESET=FFFE-FFFF


    // ---------------------------------------------------------
    // The end
    // ---------------

    please help and thanks for the reply

  • Debug and Release build configurations have their own totally separate option settings. It is likely that your Release options are pointing to a different (or none) linker .xcl file.

    Go in and check the linker settings in the Release configuration, and make sure that they are the same as what you have in the Debug configuration.

  • In your source code, you may have a line:

      RSEG  DATA

    You need to change that line to:

      RSEG  DATA16_N

  • old_cow_yellow said:
    You need to change that line to:

    That's one way to eliminate the problem, although it is acceptable to name a segment DATA as long as you tell the linker where to place it.

  • i configure the debug & release setting same so my Error get removed in release mode but the warning  still shown 

    Warning[w29]: Parts of segment DATA are initialized (as in module main), even though it is of type DATA (and thus not

    promable)

    and when i try to debug & download, a new window pop up with 

    "Fatal error : failed to initialise

     check if hardware connected

     check if drivers are installed

     try to restart the computer"

    when i replace & compile RSEG  DATA with RSEG  DATA16_N i get

    Fatal Error[e72]: Segment DATA16_N must be defined in a segment definition option (-Z, -b or -P)

  • Building configuration: Sensor Application - Debug
    Updating build tree...
    Linking
    Fatal Error[e72]: Segment DATA20_Z must be defined in a segment definition option (-Z, -b or -P)
    Error while running Linker

    Total number of errors: 1
    Total number of warnings: 0

    Kindly help in this regard..

  • If you are using large memory model, you need to specify the large memory segments in your linker script.

    DATA20_Z is zero-initialized data that is referenced by code stored in upper memory (above 0x10000).

    The XLINK User's Guide in IAR tells you how to format the XCL file.

    You need something like this: (modify for your memory map please)
    -Z(DATA)DATA16_I,DATA16_Z,DATA16_N,DATA16_HEAP+_DATA16_HEAP_SIZE=2400-43FF
    -Z(DATA)DATA20_I,DATA20_Z,DATA20_N,DATA20_HEAP+_DATA20_HEAP_SIZE
    -Z(DATA)CSTACK+_STACK_SIZE#

**Attention** This is a public forum