[arm-gnu] LD - how to check memory size

Shawn Nguyen shawn.nguyen at alicosystems.com
Thu Apr 12 17:49:49 UTC 2012


Admin,

Please remove me from this distribution.

Thanks in advance.
Shawn

-----Original Message-----
From: arm-gnu-bounces at codesourcery.com [mailto:arm-gnu-bounces at codesourcery.com] On Behalf Of
42Bastian
Sent: Thursday, April 12, 2012 9:44 AM
To: Vaclav Peroutka
Cc: arm-gnu at codesourcery.com
Subject: Re: [arm-gnu] LD - how to check memory size

Hi Vaclav

>> Am 12.04.2012 13:55, schrieb Vaclav Peroutka:
>>> Hello,
>>>
>>> I have simple linker script like below. If I have two sections, they 
>>> are collected correctly but size is not counted? Does anybody know, 
>>> why ? It was disappointing when we found this feature. BTW. Is it 
>>> feature, or bug in the script or in the linker ? How to correctly 
>>> rewrite the script to have more sections and size checking ? If I 
>>> have everything in one section, checking of course works.
>>
>> Your question is a bit confusing. Which size is not counted?  Maybe 
>> you stripped to much from the script?
>>
>> Did you try ASSERT() and SIZEOF() ?
>>
> 
> If sec1 and sec2 sizes are bigger than MEM1 size, I got no warning, no error. If I put everything
into one sections, I get linker error, which is correct. Hopefully now it is cleaner.

Now this sounds weired. (Esp. as I rely on this feature in my scripts)

> I did not try neither ASSERT nor SIZEOF. Can you give me some example ?

Well, this should work:

ASSERT(SIZEOF(.sec1)+SIZEOF(.sec2)<= LENGTH(MEM1))

(I am always unsure how the test in assert should look like.)


--
42Bastian
+
| http://www.sciopta.com
| Fastest direct message passing kernel.
| IEC61508 certified.
+
_______________________________________________
arm-gnu mailing list
arm-gnu at codesourcery.com
http://sourcerytools.com/cgi-bin/mailman/listinfo/arm-gnu




More information about the arm-gnu mailing list