Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

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.

Segment CODE_I must be defined in a segment definition option (-Z, -b or -P)

Other Parts Discussed in Thread: CC430F6137

We have a CC430 based project that was compiling fine before we upgraded to IAR 6.30.3. Now this project fails linking with the following error:

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

Does anyone know how to fix this?

Thanks.

  • Hi pixbroker,

    What version of IAR were you using before?

    Were you using a modified version of the IAR linker (.xcl) file in your project?

    I reproduced a similar issue using another project, by using a modified linker file that I had from an old project. The old project linker file had not defined the CODE_I section, and comparing this to the default linker file included in IAR (Embedded Workbench 7.2/430/config/linker/lnk430f5438a.xcl, or in your case, the file for your particular CC430 device). When I compared the default linker file to the custom linker file that I had (which had been based off of an older IAR linker file) I found that I was missing several lines involving CODE_I.

    To resolve the issue, I simply added these lines into my custom linker file:

    // -----------------------------------------------
    // Support for placing functions in read/write memory
    //
    
    -QCODE_I=CODE_ID
    // -----------------------------------------------
    // RAM memory
    //
    
    -Z(DATA)DATA16_I,DATA16_Z,DATA16_N,TLS16_I=1C00-5BFF
    -Z(DATA)DATA16_HEAP+_DATA16_HEAP_SIZE
    -Z(DATA)CODE_I
    // ---------------------------
    // Constant data
    //
    
    -Z(CONST)DATA20_C,DATA20_ID,CODE_ID=5C00-FF7F,10040-45BFF
    

    NOTE: please copy these lines from the linker .xcl file that goes with your particular CC430 because the addresses could be different than what I placed above.

    Regards,

    Katie

  • The IAR version we upgraded from was 6.10.2 and the linker file we use is lnkcc430f6137.xcl (which came with the Chronos dev kit) and i don't remember modifying it at any point. File attached.

    //*****************************************************************

    //

    // XLINK command file for IAR Embedded Workbench for MSP430.

    //

    // This file should be used with the CC430F6137 microprocessor.

    //

    // Copyright 1996-2007 IAR Systems. All rights reserved.

    //

    // Usage:  xlink your_file(s) -f lnkcc430f6137 library

    //

    // $Revision: 1.30 $

    //

    //*****************************************************************

    //*****************************************************************

    //

    // The memory areas of the CC430F6137 microprocessor:

    //

    //   Peripheral units:                0 - 01FF

    //

    //   Information memory (FLASH):   1800 - 19FF

    //

    //   Read-write memory (RAM):      1C00 - 23FD

    //

    //   Read-only memory (FLASH):     8000 - FF7F

    //                                 

    //

    //*****************************************************************

    //*****************************************************************

    //

    // 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      FF80-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=1C00-23FD

    -Z(DATA)CSTACK+_STACK_SIZE#

    // ---------------------------------------------------------

    // Read only memory

    // ---------------------------------------------------------

    // Information memory

    // ---------------------------------------------------------

    -Z(CODE)INFO=1800-19FF

    -Z(CODE)INFOA=1980-19FF

    -Z(CODE)INFOB=1900-197F

    -Z(CODE)INFOC=1880-18FF

    -Z(CODE)INFOD=1800-187F

    // ---------------------------------------------------------

    // Constant data

    // ---------------------------------------------------------

    //-Z(CONST)DATA16_C,DATA16_ID,DIFUNCT=8000-FF7F

    -Z(CONST)DATA16_C,DATA16_ID,DIFUNCT=9E00-FF7F

    // ---------------------------------------------------------

    // Code

    // ---------------------------------------------------------

    //-Z(CODE)CSTART,ISR_CODE=8000-FF7F

    //-P(CODE)CODE=8000-FF7F

    -Z(CODE)CSTART,ISR_CODE=9E00-FF7F

    -P(CODE)CODE=9E00-FF7F

    // ---------------------------------------------------------

    // Interrupt vectors

    // ---------------------------------------------------------

    -Z(CODE)INTVEC=FF80-FFFF

    -Z(CODE)RESET=FFFE-FFFF

    // ---------------------------------------------------------

    // The end

    // ---------------------------------------------------------

  • If you believe you were using an unmodified linker file before, I would recommend modifying your project to use the new version of the linker file then, that is found in your latest IAR install. You may have to change the project options specifying the path of where to find the linker file to do this. You can see how the path is set by default if you make a new project in IAR for CC430, and then go to Project > Options > Linker, and on the Config tab under Linker Configuration file there is a box that will say something like: "$TOOLKIT_DIR$\config\linker\lnkcc430f6137.xcl". That is how I would then modify the setting in your real project - then I think it should point to the correct linker file in IAR for this particular version of IAR and hopefully build correctly. I hope that this helps.

    Regards,
    Katie

**Attention** This is a public forum