How to place data on top of address range?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to place data on top of address range?

Jump to solution
1,552 Views
retosonderegger
Contributor II

Hi, I'm trying to place the constant swapIndicator on a specific address on top of the flash memory. My C code looks like:

const int16_t swapIndicator __attribute__((at(0x0003FFFC)));


Then I link with this scatter file:

R_IROM1 0x00000000 0x00040000  {; load region size_region

  ER_IROM1 0x00000000 0x00040000  {  ; load address = execution address

   *.o (RESET, +First)

   *(InRoot$$Sections)

   .ANY (+RO)

  }

  RW_IRAM1 0x1FFF0000 0x00010000  {  ; RW data

   .ANY (+RW +ZI)

  }

}


Now, the linker gives me this error:

Error: L6220E: Load region LR_IROM1 size (262156 bytes) exceeds limit (262144 bytes). Region contains 258448 bytes of padding and 0 bytes of veneers (total 258448 bytes of linker generated content).

I would expect the int16_t swapIndicator to fit in the last 4 bytes of the flash memory area. Why not? The map file shows the placement as expected..., but anyway, there is an error.

Map file:

Memory Map of the image

  Image Entry point : 0x000001e1

  Load Region LR_IROM1 (Base: 0x00000000, Size: 0x0004000c, Max: 0x00040000, ABSOLUTE)

    Execution Region ER_IROM1 (Base: 0x00000000, Size: 0x00040000, Max: 0x00040000, ABSOLUTE)

    Base Addr    Size         Type   Attr      Idx    E Section Name        Object

    0x00000000   0x000001e0   Data   RO            3    RESET               startup_mk60n512md100.o

    0x000001e0   0x00000008   Code   RO           47  * !!!main             c_w.l(__main.o)

    0x000001e8   0x00000034   Code   RO          392    !!!scatter          c_w.l(__scatter.o)

    (...)

    0x00000e7c   0x0003f180   PAD

    0x0003fffc   0x00000002   Data   RO           14    .ARM.__AT_0x0003FFFC  main.o

Why is there this error and how to avoid it?


0 Kudos
1 Solution
679 Views
retosonderegger
Contributor II

Solved: There has to be an additional execution region with an RO-Section at the end of the load region.

View solution in original post

0 Kudos
1 Reply
680 Views
retosonderegger
Contributor II

Solved: There has to be an additional execution region with an RO-Section at the end of the load region.

0 Kudos