How to fix error “L6221E: Execution region CODE overlaps with Execution region DATA” ?

Your Verifone Verix application was working just fine, until a small change caused the linker to fail with the following error :

Error: L6221E: Execution region CODE overlaps with Execution region DATA

ARM DS5 or ARM WorkBench doesn’t give you more explanations, but you noticed that reverting your change solves the issue. You are most likely working on a project whose original code wasn’t written by you, and you have no clue about the source of the problem.

First, take a look at the ARM website for more info about this error.

The issue comes from an increase of the size of the executable code triggered by your last change. Your application binary file contains a region for code, and another one for data. The size of these regions is defined at compile time, and can be specified in  a “scatter” file. If ever the configured size becomes too small to hold all the executable code, there will be an overlap with the data region, preventing your application from running. When this problem occurs, you have to increase the size of the code region. This is done by changing the address where the data region starts.

To do this, you must modify the scatter file that your linker is using. When using the Verifone Verix of eVo SDKs, the scatter file is automatically generated and usually named _vrxcc.sct. You’ll find this file when compiling a simple hello world application. But you shouldn’t have this kind of problem if you’re using the Verifone SDK tools. You are most likely directly using the ARM compiler, and your scatter file should be defined in your ARM WorkBench project properties > C/C++ build > Settings, “Tool settings” tab, ARM RealView Linker 4.0 > Output, Scatter description file field :

verifone - linker error L6221EEdit your scatter file with ARM Workbench or any text file editor, you should see something like :

LOAD 0x70420040 {
  CODE 0x70420040 {
    *(.0_vrx_pgmhdr,+FIRST) 
    *(.1_vrx_libtbl) 
    *(.2_vrx_libend) 
    *(+RO) 
  } 
  DATA 0x70420500 { 
    *(+RW) 
  } 
  BSS +0 { 
    *(+ZI) 
  } 
}

The first info in the “DATA” region is the address where this region starts. That’s the value to increase to get rid of the linker error. But watch out : increasing this value will increase accordingly the size of your application binary file. So, if you’re working in an environment with limited resources (embedded software), go one step at a time, and try to find the smallest increase which fixes your issue, instead of using the biggest possible address and eating all your memory.

Let me know if this helped you solve your issue.

3 thoughts on “How to fix error “L6221E: Execution region CODE overlaps with Execution region DATA” ?

  1. DENIS DOS SANTOS SILVA

    Hi, have another error/issue:
    —- compilling ok, using, verix develop kit 1.2.0
    —-
    C:\eVoAps\SDK\1.2.0\VRXSDK\bin\vrxcc -W -IC:\eVoAps\SDK\1.2.0\VRXSDK\inc
    lude -IC:\eVoAps\SDK\1.2.0\EOSSDK\include -IC:\eVoAps\ACT2000\1.2.0\\include .\o
    bj\sqlite3.o .\obj\split.o .\obj\rscode.o .\obj\qrspec.o .\obj\qrinput.o .
    \obj\qrencode.o .\obj\mqrspec.o .\obj\mmask.o .\obj\mask.o .\obj\bitstream.o
    .\obj\console.o .\obj\printer.o .\obj\magcard.o .\obj\projetil.o C:\
    eVoAps\ACT2000\1.2.0\\Output\RV\Files\Static\Release\act2000.a C:\eVoAps\SDK\1.
    2.0\EOSSDK\lib\svc_net.o C:\eVoAps\SDK\1.2.0\EOSSDK\lib\ssl.o C:\eVoAps\SDK\1.
    2.0\EOSSDK\lib\ceif.o C:\eVoAps\SDK\1.2.0\EOSSDK\lib\elog.o -o .\out\projetil.
    out
    “_vrxcc.sct”, line 12 (column 8): Warning: L6329W: Pattern *(ZI) only matches re
    moved unused sections.
    Finished: 0 information, 1 warning and 0 error messages.
    “_vrxcc.sct”, line 12 (column 8): Warning: L6329W: Pattern *(ZI) only matches re
    moved unused sections.

    Finished: 0 information, 1 warning and 0 error messages.
    C:\eVoAps\SDK\1.2.0\VRXSDK\bin\vrxhdr -s 250000 -h 300000 -lceif.lib=N:
    /ceif.lib -lelog.lib=N:/elog.lib -lssl.lib=N:/ssl.lib .\out\projetil.out
    —-

    Best regards,
    Denis

    PS: have another compiller for verix vx (vx680) ?

    Reply
  2. Pat Redman

    Savvy post ! For my two cents , if someone is requiring a OH ODT IT 3 , We came across a sample document here https://goo.gl/tfKa5r

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *