[rtems commit] arm/stm32f4: Add per-section compilation and linking support

Joel Sherrill joel at rtems.org
Fri Mar 11 20:14:54 UTC 2016


Module:    rtems
Branch:    master
Commit:    a006671a2559c9125d181be63adacd56b69b57e9
Changeset: http://git.rtems.org/rtems/commit/?id=a006671a2559c9125d181be63adacd56b69b57e9

Author:    Joel Sherrill <joel at rtems.org>
Date:      Thu Mar 10 13:29:22 2016 -0600

arm/stm32f4: Add per-section compilation and linking support

updates #2577.

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

   text	   data	    bss	    	  dec	    	  hex	filename
  61444	   1724	  63880	 127048	  1f048	ticker.exe
  39397	   1480	  64104	 104981	  19a15	minimum.exe
 131636	   2360	  63240	 197236	  30274	capture.exe
  72818	   1812	  63784	 138414	  21cae	nsecs.exe
 123508	   2100	  63496	 189104	  2e2b0	paranoia.exe
 125564	   1748	  63848	 191160	  2eab8	cdtest.exe
  59488	   1724	  63880	 125092	  1e8a4	base_sp.exe
  61168	   1748	  63848	 126764	  1ef2c	unlimited.exe
  69216	   1692	  63912	 134820	  20ea4	hello.exe
 178492	   6500	  59400	 244392	  3baa8	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  56720	   1700	  63880	 122300	  1ddbc	ticker.exe
  23784	   1400	  64168	  89352	  15d08	minimum.exe
 125096	   2328	  63272	 190696	  2e8e8	capture.exe
  68410	   1788	  63816	 134014	  20b7e	nsecs.exe
 118480	   2076	  63528	 184084	  2cf14	paranoia.exe
 119012	   1724	  63880	 184616	  2d128	cdtest.exe
  54640	   1700	  63880	 120220	  1d59c	base_sp.exe
  55080	   1708	  63880	 120668	  1d75c	unlimited.exe
  62828	   1636	  63944	 128408	  1f598	hello.exe
 164464	   6388	  59496	 230348	  383cc	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  61420	   1724	 129416	 192560	  2f030	ticker.exe
  39373	   1480	 129640	 170493	  299fd	minimum.exe
 547160	   2004	 129160	 678324	  a59b4	cxx_iostream.exe
 390329	   5800	 125352	 521481	  7f509	fileio.exe
 297452	  12616	 118824	 428892	  68b5c	pppd.exe
 131612	   2360	 128776	 262748	  4025c	capture.exe
  72794	   1812	 129320	 203926	  31c96	nsecs.exe
 123484	   2100	 129032	 254616	  3e298	paranoia.exe
 125540	   1748	 129384	 256672	  3eaa0	cdtest.exe
  59464	   1724	 129416	 190604	  2e88c	base_sp.exe
  61144	   1748	 129384	 192276	  2ef14	unlimited.exe
  69192	   1692	 129448	 200332	  30e8c	hello.exe
 178468	   6500	 124936	 309904	  4ba90	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  56640	   1700	 129416	 187756	  2dd6c	ticker.exe
  23704	   1400	 129704	 154808	  25cb8	minimum.exe
 333792	   1956	 129192	 464940	  7182c	cxx_iostream.exe
 378469	   5776	 125384	 509629	  7c6bd	fileio.exe
 274684	  12452	 118952	 406088	  63248	pppd.exe
 125016	   2328	 128808	 256152	  3e898	capture.exe
  68330	   1788	 129352	 199470	  30b2e	nsecs.exe
 118400	   2076	 129064	 249540	  3cec4	paranoia.exe
 118932	   1724	 129416	 250072	  3d0d8	cdtest.exe
  54560	   1700	 129416	 185676	  2d54c	base_sp.exe
  55000	   1708	 129416	 186124	  2d70c	unlimited.exe
  62748	   1636	 129480	 193864	  2f548	hello.exe
 164384	   6388	 125032	 295804	  4837c	loopback.exe

---

 c/src/lib/libbsp/arm/stm32f4/make/custom/stm32f4.cfg | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/c/src/lib/libbsp/arm/stm32f4/make/custom/stm32f4.cfg b/c/src/lib/libbsp/arm/stm32f4/make/custom/stm32f4.cfg
index 1256a52..edca4bf 100644
--- a/c/src/lib/libbsp/arm/stm32f4/make/custom/stm32f4.cfg
+++ b/c/src/lib/libbsp/arm/stm32f4/make/custom/stm32f4.cfg
@@ -5,3 +5,6 @@ RTEMS_CPU = arm
 CPU_CFLAGS = -march=armv7-m -mthumb
 
 CFLAGS_OPTIMIZE_V = -O2 -g
+CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
+
+LDFLAGS = -Wl,--gc-sections




More information about the vc mailing list