summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdoulaye Walsimou Gaye <awg@embtoolkit.org>2010-10-20 22:44:26 +0200
committerAbdoulaye Walsimou Gaye <awg@embtoolkit.org>2010-10-20 22:44:26 +0200
commit853c865eef540b1c6ebd3db7e9e22a98d7e475e7 (patch)
tree4c0a7e356d9994f8a086998d525d85bfd4e734d0
parentf0d8ae73ca1a2df83d8983d3aa1e7fe0798db575 (diff)
downloadembtoolkit-853c865eef540b1c6ebd3db7e9e22a98d7e475e7.tar.gz
embtoolkit-853c865eef540b1c6ebd3db7e9e22a98d7e475e7.tar.bz2
embtoolkit-853c865eef540b1c6ebd3db7e9e22a98d7e475e7.tar.xz
Toolchain: improve target builmd options
This patch improves target build options by putting them in their dedicated .kconfig file and gives ability to choose which optimization to use for libraries and binaries. Signed-off-by: Abdoulaye Walsimou Gaye <awg@embtoolkit.org>
-rw-r--r--Kconfig17
-rw-r--r--kconfig/targetbuildopts.kconfig67
-rw-r--r--mk/toolchain.mk7
3 files changed, 73 insertions, 18 deletions
diff --git a/Kconfig b/Kconfig
index cdad186..c208e5d 100644
--- a/Kconfig
+++ b/Kconfig
@@ -44,22 +44,7 @@ source "kconfig/toolchain.kconfig"
endmenu
menu "Target build options"
-config EMBTK_TARGET_COMPILER_CFLAGS
- string "Additional compiler flags for your target"
- help
- Here you can change default flags passed to gcc when components of your
- embedded system target are built: C library, packages, ...
- By default we optimize for size.
- default "-Os"
-config EMBTK_TARGET_STRIPPED
- bool "Strip target's binaries"
- help
- Say yes if you want to strip binaries (including libraries) generated
- for your target embedded system. This will reduce the size of these
- binaries.
- Note: These binaries are only stripped if you choose to build a root
- filesystem.
-
+source kconfig/targetbuildopts.kconfig
endmenu
menu "Debugging system"
diff --git a/kconfig/targetbuildopts.kconfig b/kconfig/targetbuildopts.kconfig
new file mode 100644
index 0000000..dba7def
--- /dev/null
+++ b/kconfig/targetbuildopts.kconfig
@@ -0,0 +1,67 @@
+################################################################################
+# Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# Copyright(C) 2010 Abdoulaye Walsimou GAYE. All rights reserved.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+################################################################################
+#
+# \file targetbuildopts.kconfig
+# \brief Target build otions
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date October 2010
+################################################################################
+
+choice
+ prompt "Generated libraries/binaries optimization"
+ help
+ Target binaries and libraries optimization for size or speed
+ (or no optimization).
+
+ config EMBTK_TARGET_SIZE_OPTIMIZED
+ bool "Optimize for size"
+ help
+ Optimize target libraries and binaries for minimal size
+ (gcc -Os switch).
+ config EMBTK_TARGET_SPEED_OPTIMIZED
+ bool "Optimize for speed"
+ help
+ Optimize target libraries and binaries for speed
+ (gcc -O3 switch).
+ config EMBTK_TARGET_NONE_OPTIMIZED
+ bool "No optimization"
+ help
+ Do not optimize libraries and binaries at all.
+endchoice
+
+config EMBTK_TARGET_WITH_DEBUG_DATA
+ bool "Build target's binaries and libraries with debug data"
+ help
+ Build target's binaries and libraries with debug data
+ (gcc -g switch).
+
+config EMBTK_TARGET_STRIPPED
+ bool "Strip target's binaries"
+ help
+ Say yes if you want to strip binaries (including libraries)
+ generated for your target embedded system. This will reduce the
+ size of these binaries.
+ Note: These binaries are only stripped if you choose to build a
+ root filesystem.
+
+config EMBTK_TARGET_COMPILER_CFLAGS
+ string "Additional compiler flags for your target"
+ help
+ Here you can change default flags passed to gcc when components
+ of your target are built: C library, packages, ...
diff --git a/mk/toolchain.mk b/mk/toolchain.mk
index 79eba33..d7fcec8 100644
--- a/mk/toolchain.mk
+++ b/mk/toolchain.mk
@@ -1,5 +1,5 @@
################################################################################
-# Abdoulaye Walsimou GAYE, <awg@embtoolkit.org>
+# Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
# Copyright(C) 2009-2010 Abdoulaye Walsimou GAYE. All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
@@ -19,7 +19,7 @@
#
# \file toolchain.mk
# \brief toolchain.mk of Embtoolkit
-# \author Abdoulaye Walsimou GAYE, <awg@embtoolkit.org>
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
# \date May 2009
################################################################################
@@ -33,6 +33,9 @@ TARGETSTRIP := $(TOOLS)/bin/$(STRICT_GNU_TARGET)-strip
TARGETOBJDUMP := $(TOOLS)/bin/$(STRICT_GNU_TARGET)-objdump
TARGETOBJCOPY := $(TOOLS)/bin/$(STRICT_GNU_TARGET)-objcopy
TARGET_CFLAGS += $(subst ",,$(strip $(CONFIG_EMBTK_TARGET_COMPILER_CFLAGS)))
+TARGET_CFLAGS += $(if $(CONFIG_EMBTK_TARGET_SIZE_OPTIMIZED),-Os,)
+TARGET_CFLAGS += $(if $(CONFIG_EMBTK_TARGET_SPEED_OPTIMIZED),-O3,)
+TARGET_CFLAGS += $(if $(CONFIG_EMBTK_TARGET_WITH_DEBUG_DATA),-g,)
CROSS_COMPILE := $(TOOLS)/bin/$(STRICT_GNU_TARGET)-
export TARGETCC TARGETCXX TARGETAR TARGETRANLIB TARGETLD TARGETNM