ARMLINK: L6220E ... Exceeds Limit, If Placing Data at End of Flash
Information in this knowledgebase article applies to:
In our application we want to place specific data at the end of the flash using the __attribute__((at(address))) or a special execution region in the scatter file to which we assign the data using __attribute__((section(name))). However, when we do this, linking fails with an linker error like this:
Error: L6220E: Load region LR_IROM1 size (262152 bytes) exceeds limit (262144 bytes). Region contains 261552 bytes of padding and 0 bytes of veneers (total 261552 bytes of linker generated content).
The actual application size is less than the size of the internal flash. So, why do we receive this error?
The linker will locate an absolute object wherever you designate. If the location is outside of a load region, the linker will create a private load region for this object. If the location happens to be inside a load region, it will insert pad bytes before the absolute object and any other object. See the map file below:
Execution Region ER_IROM1 (Base: 0x00000000,Size: 0x00040000,Max: 0x00040000,ABSOLUTE) Base Addr Size Type Attr Idx E Section Name Object ... ... 0x00000254 0x0003fda8 PAD 0x0003fffc 0x00000004 Data RO 2 .ARM.__AT_0x0003FFFC main.o
The linker always places RW initialization data at the end of a load region. In this case, the absolute object is also located at the end of the load region and the linker thinks it needs more space after the absolute object for the RW data and displays the L6220E error.
To overcome this, reduce the size of the load region so that it does not overlap the absolute placed object. For example, if the original load region size is 0x40000 and a 4 byte object is placed at 0x3FFFC, give the load region the size 0x3FFFC. It will then not be enlarged to it's maximum and the linker will not insert pad bytes. The RW initialization data can be placed normally. The absolute placed object gets a private load region automatically when using the at-attribute. Or just create one in your scatter file and move your existing execution region for this data there.
Some errors such as L6220E, L6238E and L6784E can be downgraded to a warning by using:
Last Reviewed: Monday, February 4, 2019
of your data.