AnsweredAssumed Answered

Creating memory region of specific size in STML0xx using scatter file and .MAP

Question asked by Harsha Jagadish on Sep 28, 2017
Latest reply on Sep 29, 2017 by Harsha Jagadish

Imen DClive One 

 

Hi,

I am working with STM32L053 MCU using Keil IDE. I am trying to place a header structure of an image in 4k size flash area. I am using  __attribute__((at(address))) to place the structure at specific address. 8K memory space is being allocated by default. How do I control the memory size allocated to this structure?

 

I tried using the target settings to create a ROM2 region specifying size 0x1000. And then using _attribute__ to place the header in this region.

Target setting:

                  Start add                  Size

ROM1      0x8002000               0x4000

ROM2      0x8001000               0x1000

 

It throws me an error saying:

app3\app3.axf: Error: L6220E: Load region LR_IROM2 size (8192 bytes) exceeds limit (4096 bytes). Region contains 0 bytes of padding and 0 bytes of veneers (total 0 bytes of linker generated content).
app3\app3.axf: Error: L6220E: Execution region ER_IROM2 size (8192 bytes) exceeds limit (4096 bytes). Region contains 0 bytes of padding and 0 bytes of veneers (total 0 bytes of linker generated content).
app3\app3.axf: Error: L6221E: Load region LR_IROM1 with Load range [0x08002000,0x08003730) overlaps with Load region LR_IROM2 with Load range [0x08001000,0x08003000).
app3\app3.axf: Error: L6221E: Execution region ER_IROM1 with Execution range [0x08002000,0x08003728) overlaps with Execution region ER_IROM2 with Execution range [0x08001000,0x08003000). 

 

When I check the .MAP file there is LR_IROM2 region created and it reads as follows


Load Region LR_IROM2 (Base: 0x08001000, Size: 0x00002000, Max: 0x00001000, ABSOLUTE)

Execution Region ER_IROM2 (Base: 0x08001000, Size: 0x00002000, Max: 0x00001000, ABSOLUTE)

Base Addr          Size                   Type          Attr       Idx       E Section Name                   Object

0x08001000    0x00002000          Data       RO       2229       .ARM.__AT_0x08001000       main.o

 

How do I configure a memory region of lesser memory size?

 

Secondly, eventhough I create ROM2 region in Target settings, why isnt it reflected in the scatter file? When I check the scatter file it shows the following

 

; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************

LR_IROM1 0x08002000 0x00008000 { ; load region size_region
ER_IROM1 0x08002000 0x00008000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
}
RW_IRAM1 0x20000000 0x00002000 { ; RW data
.ANY (+RW +ZI)
}
}

 

There is no LR_IROM2 region described here.

 

Please help.

 

Thank you,
Harsha

Outcomes