[PATCH 08/32] arm/rtl22xx: Add per-section compilation and linking support

Joel Sherrill joel at rtems.org
Fri Mar 11 00:15:12 UTC 2016


updates #2577.

For the rtl22xx BSP variant without this option,
sample executables sizes were as follows:

   text	   data	    bss	    	  dec	    	  hex	filename
  87223	   1820	 436320	 525363	  80433	ticker.exe
  27915	   1216	 496224	 525355	  8042b	minimum.exe
 409638	  12704	 103008	 525350	  80426	pppd.exe
 183260	   2456	 339648	 525364	  80434	capture.exe
 105441	   1908	 418016	 525365	  80435	nsecs.exe
 168295	   2204	 354848	 525347	  80423	paranoia.exe
 181768	   1852	 341728	 525348	  80424	cdtest.exe
  84419	   1820	 439136	 525375	  8043f	base_sp.exe
  86347	   1828	 437184	 525359	  8042f	unlimited.exe
  99595	   1772	 424000	 525367	  80437	hello.exe
 252540	   6596	 266240	 525376	  80440	loopback.exe

For the rtl22xx BSP variant with this option,
sample executables sizes were as follows:

   text	   data	    bss	    	  dec	    	  hex	filename
  82141	   1732	 441472	 525345	  80421	ticker.exe
  20545	    284	 504512	 525341	  8041d	minimum.exe
 379745	  12484	 133120	 525349	  80425	pppd.exe
 175592	   2360	 347392	 525344	  80420	capture.exe
 100851	   1820	 422688	 525359	  8042f	nsecs.exe
 163053	   2108	 360192	 525353	  80429	paranoia.exe
 174692	   1764	 348896	 525352	  80428	cdtest.exe
  79193	   1732	 444448	 525373	  8043d	base_sp.exe
  78701	   1716	 444928	 525345	  80421	unlimited.exe
  91561	   1644	 432160	 525365	  80435	hello.exe
 234116	   6420	 284832	 525368	  80438	loopback.exe

For the rtl22xx_t BSP variant without this option,
sample executables sizes were as follows:

   text	   data	    bss	    	  dec	    	  hex	filename
  62167	   1820	 461376	 525363	  80433	ticker.exe
  21003	   1216	 503136	 525355	  8042b	minimum.exe
 369737	   5896	 149728	 525361	  80431	fileio.exe
 286854	  12704	 225792	 525350	  80426	pppd.exe
 133052	   2456	 389856	 525364	  80434	capture.exe
  75437	   1908	 448000	 525345	  80421	nsecs.exe
 123959	   2204	 399200	 525363	  80433	paranoia.exe
 134660	   1852	 388864	 525376	  80440	cdtest.exe
  60315	   1820	 463232	 525367	  80437	base_sp.exe
  61767	   1828	 461760	 525355	  8042b	unlimited.exe
  72191	   1772	 451392	 525355	  8042b	hello.exe
 174588	   6596	 344192	 525376	  80440	loopback.exe

For the rtl22xx_t BSP variant with this option,
sample executables sizes were as follows:

   text	   data	    bss	    	  dec	    	  hex	filename
  59021	   1732	 464608	 525361	  80431	ticker.exe
  15757	    284	 509312	 525353	  80429	minimum.exe
 366096	   1972	 157280	 525348	  80424	cxx_iostream.exe
 360911	   5808	 158656	 525375	  8043f	fileio.exe
 267485	  12484	 245376	 525345	  80421	pppd.exe
 128224	   2360	 394784	 525368	  80438	capture.exe
  72611	   1820	 450944	 525375	  8043f	nsecs.exe
 121041	   2108	 402208	 525357	  8042d	paranoia.exe
 129488	   1764	 394112	 525364	  80434	cdtest.exe
  57049	   1732	 466592	 525373	  8043d	base_sp.exe
  56833	   1716	 466816	 525365	  80435	unlimited.exe
  66921	   1644	 456800	 525365	  80435	hello.exe
 163104	   6420	 355840	 525364	  80434	loopback.exe
---
 c/src/lib/libbsp/arm/rtl22xx/make/custom/rtl22xx.cfg   | 3 +++
 c/src/lib/libbsp/arm/rtl22xx/make/custom/rtl22xx_t.cfg | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/c/src/lib/libbsp/arm/rtl22xx/make/custom/rtl22xx.cfg b/c/src/lib/libbsp/arm/rtl22xx/make/custom/rtl22xx.cfg
index f213d0c..8d45746 100644
--- a/c/src/lib/libbsp/arm/rtl22xx/make/custom/rtl22xx.cfg
+++ b/c/src/lib/libbsp/arm/rtl22xx/make/custom/rtl22xx.cfg
@@ -17,3 +17,6 @@ CPU_CFLAGS = -mcpu=arm7tdmi
 # NOTE2: some level of -O may be actually required by inline assembler (at least
 # -O2 so far.
 CFLAGS_OPTIMIZE_V = -Os -g
+CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
+
+LDFLAGS = -Wl,--gc-sections
diff --git a/c/src/lib/libbsp/arm/rtl22xx/make/custom/rtl22xx_t.cfg b/c/src/lib/libbsp/arm/rtl22xx/make/custom/rtl22xx_t.cfg
index 9f26043..5cf8b662 100644
--- a/c/src/lib/libbsp/arm/rtl22xx/make/custom/rtl22xx_t.cfg
+++ b/c/src/lib/libbsp/arm/rtl22xx/make/custom/rtl22xx_t.cfg
@@ -14,4 +14,6 @@ CPU_CFLAGS += -mthumb
 #CPU_CFLAGS += -mthumb-interwork -D __THUMB_INTERWORK__ -mthumb
 #CPU_ASFLAGS += -D __THUMB_INTERWORK__  -mthumb-interwork
 
-# Miscellaneous additions go here
+CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
+
+LDFLAGS = -Wl,--gc-sections
-- 
1.8.3.1




More information about the devel mailing list