How to make the arm linker decompress the second correctly with "RW data compression"?

1

title: How to make the arm linker decompress the second load region while both 1st and 2nd region are applied "RW data compression"?

I got a below scatter file (a simple version of my complex scatter file)

LOAD_REGION_01 0x0
{
    EXECUTION_REGION_01  0x0
    {
        ABC.o (+RO,+RW)
    }
}

LOAD_REGION_02 +0x0
{
   EXECUTION_REGION_02  0x100
   {
      DEF.o (+RO,+RW)
   }
}

The RW data compression is applied automatically and I got a binary with size 0x40 (0x20 for LOAD_REGION_01 and 0x20 for LOAD_REGION_02 ), the got a link.info as following MAP file.

Load Region LOAD_REGION_01 (Base: 0x0, Size: 0x30, Max: 0x000000a0, ABSOLUTE)
    Execution Region EXECUTION_REGION_01 (Base:0x0,Size:0x30,Max:0xffffffff,ABSOLUTE, COMPRESSED[0x20])

Load Region LOAD_REGION_02 (Base: 0x30, Size: 0x30, Max: 0x000000a0, ABSOLUTE)
    Execution Region EXECUTION_REGION_02 (Base:0x0,Size:0x30,Max:0xffffffff,ABSOLUTE, COMPRESSED[0x20])

I found that the size of load region after compression is 0x20, but the start address of second load region is 0x30 ! And, the decompression of first region work correctly, but arm try to decompress the second region from address "0x30" not "0x20".

Therefore, a wrong decompression result is produced. How to make the arm linker decompress the second correctly? Or how can I assign the load address of second load region LOAD_REGION_02 with attribute +0 (since the size load region 1 may changed...) ?

I read all the user manual but no answer...

linker
embedded
arm
asked on Stack Overflow Jun 26, 2012 by carl • edited Jun 26, 2012 by carl

1 Answer

0

It seems your issue is that both load regions are declared to start at address 0.

From a quick read of the ARM doc I see two options to resolve it:

  1. Use one load region and two exec regions:

    LOAD_REGION_01 0x0
    {
       EXECUTION_REGION_01  0x0
       {
          ABC.o (+RO,+RW)
       }
       EXECUTION_REGION_02  0x100
       {
          DEF.o (+RO,+RW)
       }
    }
    
  2. Use two load regions with non-overlapping addresses. +0 should work if I'm reading it correctly.

    LOAD_REGION_01 0x0
    {
       EXECUTION_REGION_01  0x0
       {
          ABC.o (+RO,+RW)
       }
    }
    LOAD_REGION_02 +0
    {
       EXECUTION_REGION_02  0x100
       {
          DEF.o (+RO,+RW)
       }
    }
    
answered on Stack Overflow Jun 26, 2012 by Igor Skochinsky

User contributions licensed under CC BY-SA 3.0