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.

Error[e104]: Failed to fit all segments into specified ranges.

Other Parts Discussed in Thread: Z-STACK, CC2530, TIMAC

Hello All,

I am building the ZNP using Z-Stack 1.2.2 and upgrading from 1.2.1. I came across an error when I tried to use Certicom ECC library and enable ZCL Key Establishment Cluster. Here is the error in IAR. Error[e104]: Failed to fit all segments into specified ranges. Problem discovered in segment BANKED_CODE. Unable to place 121 block(s) (0x381dd 
byte(s) total) in 0x36d74 byte(s) of memory. The problem occurred while processing the segment placement command 
"-P(CODE)BANKED_CODE=_CODE_START-_CODE_END,0x18000-0x1FFFF,0x28000-0x2FFFF,0x38000-0x3FFFF,0x48000-0x4FFFF,0x58000-0x5FFFF,0x
68000-0x6FFFF,0x78000-0x7C7FF", where at the moment of placement the available memory ranges were 
"CODE:57aa-7ff7,CODE:7fff-7fff,CODE:182db-1ffff,CODE:28000-2ffff,CODE:38000-3ffff,CODE:48000-4ffff,CODE:58000-5ffff,CODE:68000-6ffff,CODE:78000-7c7ff

What I changed on the latest Z-Stack version 1.2.2 is:

 1. Change the CC2530.ewp project file to use Certicom library:

<option>

          <name>Linker Extra Options Edit</name>

          <state>-C $PROJ_DIR$\..\..\Libraries\Certicom\bin\libecc.r51</state>

          <state>-C $PROJ_DIR$\..\..\Libraries\TI2530DB\bin\AllDevice-Pro.lib</state>

          <state>-C $PROJ_DIR$\..\..\Libraries\TI2530DB\bin\Security.lib</state>

          <state>-C $PROJ_DIR$\..\..\Libraries\TIMAC\bin\TIMAC-CC2530.lib</state>

          <state>-M(CODE)[(_CODEBANK_START+_FIRST_BANK_ADDR)-(_CODEBANK_END+_FIRST_BANK_ADDR)]*_NR_OF_BANKS+_FIRST_BANK_ADDR=0x8000</state>

        </option>

 2. Change the znp.cfg to enable the ZCL Key Establishment Cluster:

// Define this flag to enable ZNP implementation of the ZCL_KEY_ESTABLISHMENT_ENDPOINT and task.

-DTC_LINKKEY_JOIN

-DECCAPI_283_DISABLED

// Define this flag to enable ZNP implementation of the ZCL_KEY_ESTABLISHMENT_ENDPOINT and task.

-DZCL_KEY_ESTABLISH

3. Add the Certicom library into Z-Stack Home 1.2.2.42930\Projects\Libraries

 

Then when I compiled using IAR, the error occurred. I read some posts about this error. Some people said change the INT_HEAP_LEN to 1000. It does not work for me and I think reducing the heap significantly will bring about some other potential issues? Also I tried to change D_CODE_END in linker file cc2530-sb.xcl to 0xFFFF. The error disappeared but is it really okay to do that? Could someone please give me some ideas on this error? 

Thanks,

QK Sun

 

  • Sorry you have hit this issue.

    Changing D_CODE_END to 0xFFF may cause an issue with CONST data:

    // Define segments for const data in flash.
    // First the segment with addresses as used by the program (flash mapped as XDATA)
    -P(CONST)XDATA_ROM_C=0x8000-0xFFFF

    However you could reduce the constant data and increase the D_CODE_END, as long as you can find a balance that compiles. The other option would be to reduce the FLash used for NV storage.

    Regards,
    TC.