Skip to contentSkip to conversation

package: Makefile.in: Add target compilation flags for NOMMU architecture.

PATCH Superseded Sonic Zhang 2 participants 5 messages Mar 21, 2013 – Mar 22, 2013 Kbuild

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package: Makefile.in: Add target compilation flags for NOMMU architecture.

From: Sonic Zhang <[email protected]>

- Add BR2_TARGET_ABI_FLAT option
- Add NOMMU compiling macro
- Add FLAT ABI specific link flags
- Add stack size to FLAT link flags if macro <PKG>_FLAT_STACKSIZE is defined.

---
 arch/Config.in           |    3 +++
 package/Makefile.in      |    8 ++++++++
 package/pkg-autotools.mk |    5 +++++
 package/pkg-generic.mk   |    5 +++++
 4 files changed, 21 insertions(+), 0 deletions(-)
arch/Config.in +3 -0
index 472b10c..120c67e 100644
@@ -174,6 +174,9 @@ config BR2_GCC_TARGET_ABI
 config BR2_GCC_TARGET_CPU
 	string
 
+config BR2_TARGET_ABI_FLAT
+	bool
+
 if BR2_arm || BR2_armeb
 source "arch/Config.in.arm"
 endif
package/Makefile.in +8 -0
index a8bf36b..acfd9c8 100644
@@ -103,6 +103,14 @@ TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET
 TARGET_CXXFLAGS = $(TARGET_CFLAGS)
 TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))
 
+ifeq ($(BR2_TARGET_ABI_FLAT),y)
+TARGET_LDFLAGS += -Wl,-elf2flt
+endif
+
+ifneq ($(BR2_USE_MMU), y)
+TARGET_CFLAGS += -D__NOMMU__
+endif
+
 ifeq ($(BR2_TOOLCHAIN_BUILDROOT)$(BR2_TOOLCHAIN_CTNG),y)
 TARGET_CROSS=$(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-
 else
package/pkg-autotools.mk +5 -0
index 890506b..b23feec 100644
@@ -82,6 +82,11 @@ $(2)_CLEAN_OPT			?= clean
 $(2)_UNINSTALL_STAGING_OPT	?= DESTDIR=$$(STAGING_DIR) uninstall
 $(2)_UNINSTALL_TARGET_OPT	?= DESTDIR=$$(TARGET_DIR)  uninstall
 
+ifeq ($(BR2_TARGET_ABI_FLAT),y)
+ ifneq ($$($(2)_FLAT_STACKSIZE),)
+  $(2)_CONF_ENV			+= LDFLAGS="$(TARGET_LDFLAGS) -Wl,-elf2flt=-s$($(2)_FLAT_STACKSIZE)"
+ endif
+endif
 
 #
 # Configure step. Only define it if not already defined by the package
package/pkg-generic.mk +5 -0
index 57b0fd0..47ac33a 100644
@@ -303,6 +303,11 @@ endif
 
 $(2)_REDISTRIBUTE		?= YES
 
+ifeq ($(BR2_TARGET_ABI_FLAT),y)
+ ifneq ($$($(2)_FLAT_STACKSIZE),)
+  $(2)_FLAT_LDFLAGS = -Wl,-elf2flt=-s$($(2)_FLAT_STACKSIZE)
+ endif
+endif
 
 $(2)_DEPENDENCIES ?= $(filter-out $(1),$(patsubst host-host-%,host-%,$(addprefix host-,$($(3)_DEPENDENCIES))))
 
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 2/2 buildroot: target: Add Blackfin architecture support.

From: Sonic Zhang <[email protected]>

- Create blackfin architecture makefile.
- Add blackfin target ABI options.
- Add blackfin cpu options and shared library installation options.
- Add blackfin cpu revision options and mcpu link flags
- Add blackfin FLAT specific makefile flags.
- Add shared library installation options and makefile targets to install shared libraries into rootfs image.
- Copy extra blackfin toolchain FDPIC shared libraries to target fs

---
 Makefile              |    2 +
 arch/Config.in.bfin   |  117 +++++++++++++++++++++++++++++++++++++++++++++++++
 arch/Makefile.in.bfin |   50 +++++++++++++++++++++
 3 files changed, 169 insertions(+), 0 deletions(-)
 create mode 100644 arch/Makefile.in.bfin
Makefile +2 -0
index 7f0822f..32478e6 100644
@@ -329,6 +329,8 @@ ifneq ($(PACKAGE_OVERRIDE_FILE),)
 -include $(PACKAGE_OVERRIDE_FILE)
 endif
 
+include arch/Makefile.in.*
+
 include package/*/*.mk
 
 include boot/common.mk
arch/Config.in.bfin +117 -0

127 lines not on this page · raw message

arch/Makefile.in.bfin new file +50 -0

50 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#3 lore raw

PATCH 1/2 package: Makefile.in: Add target compilation flags for NOMMU architecture.

In reply to Sonic Zhang

Hi Sonic,

Quoted 55 lines · Sonic Zhang

From: Sonic Zhang <[email protected]>

- Add BR2_TARGET_ABI_FLAT option
- Add NOMMU compiling macro
- Add FLAT ABI specific link flags
- Add stack size to FLAT link flags if macro <PKG>_FLAT_STACKSIZE is defined.

---
 arch/Config.in           |    3 +++
 package/Makefile.in      |    8 ++++++++
 package/pkg-autotools.mk |    5 +++++
 package/pkg-generic.mk   |    5 +++++
 4 files changed, 21 insertions(+), 0 deletions(-)
arch/Config.in +3 -0
index 472b10c..120c67e 100644
@@ -174,6 +174,9 @@ config BR2_GCC_TARGET_ABI
 config BR2_GCC_TARGET_CPU
        string
 
+config BR2_TARGET_ABI_FLAT
+       bool
+
 if BR2_arm || BR2_armeb
 source "arch/Config.in.arm"
 endif
package/Makefile.in +0 -0
index a8bf36b..acfd9c8 100644
@@ -103,6 +103,14 @@ TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI)

$(TARGET_OPTIMIZATION) $(TARGET
TARGET_CXXFLAGS = $(TARGET_CFLAGS) TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))

package/Makefile.in +8 -0
+ifeq ($(BR2_TARGET_ABI_FLAT),y)
+TARGET_LDFLAGS += -Wl,-elf2flt
+endif
+
+ifneq ($(BR2_USE_MMU), y)
+TARGET_CFLAGS += -D__NOMMU__
+endif
+
 ifeq ($(BR2_TOOLCHAIN_BUILDROOT)$(BR2_TOOLCHAIN_CTNG),y)
 TARGET_CROSS=$(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-
 else
package/pkg-autotools.mk +0 -0
index 890506b..b23feec 100644

package/pkg-autotools.mk $(2)_CLEAN_OPT ?= clean · line 90

Quoted 10 lines
package/pkg-autotools.mk +5 -1
@@ -82,6 +82,11 @@ $(2)_CLEAN_OPT                       ?= clean
 $(2)_UNINSTALL_STAGING_OPT     ?= DESTDIR=$$(STAGING_DIR) uninstall
 $(2)_UNINSTALL_TARGET_OPT      ?= DESTDIR=$$(TARGET_DIR)  uninstall
 
+ifeq ($(BR2_TARGET_ABI_FLAT),y)
+ ifneq ($$($(2)_FLAT_STACKSIZE),)
+  $(2)_CONF_ENV                        += LDFLAGS="$(TARGET_LDFLAGS)
-Wl,-elf2flt=-s$($(2)_FLAT_STACKSIZE)"
+ endif
+endif
 

I'm not that familiar with these double $$, but is it intentional that you're using double-dollar AND single-dollar for the same variable <PKG>_FLAT_STACKSIZE in the above snippet?

Quoted 21 lines
package/pkg-autotools.mk +0 -0
 #
 # Configure step. Only define it if not already defined by the package
package/pkg-generic.mk +5 -1
index 57b0fd0..47ac33a 100644
@@ -303,6 +303,11 @@ endif
 
 $(2)_REDISTRIBUTE              ?= YES
 
+ifeq ($(BR2_TARGET_ABI_FLAT),y)
+ ifneq ($$($(2)_FLAT_STACKSIZE),)
+  $(2)_FLAT_LDFLAGS = -Wl,-elf2flt=-s$($(2)_FLAT_STACKSIZE)
+ endif
+endif
 
 $(2)_DEPENDENCIES ?= $(filter-out $(1),$(patsubst
 host-host-%,host-%,$(addprefix host-,$($(3)_DEPENDENCIES))))
 
--
Quoted 4 lines

1.7.0.4

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130322/aae70bfd/attachment.html>

#4 lore raw

PATCH 1/2 package: Makefile.in: Add target compilation flags for NOMMU architecture.

Hi Thomas,

Quoted 63 lines · Thomas De Schampheleire

Hi Sonic,

Quoted 59 lines · Sonic Zhang

From: Sonic Zhang <[email protected]>

- Add BR2_TARGET_ABI_FLAT option
- Add NOMMU compiling macro
- Add FLAT ABI specific link flags
- Add stack size to FLAT link flags if macro <PKG>_FLAT_STACKSIZE is defined.

---
 arch/Config.in           |    3 +++
 package/Makefile.in      |    8 ++++++++
 package/pkg-autotools.mk |    5 +++++
 package/pkg-generic.mk   |    5 +++++
 4 files changed, 21 insertions(+), 0 deletions(-)
arch/Config.in +3 -0
index 472b10c..120c67e 100644
@@ -174,6 +174,9 @@ config BR2_GCC_TARGET_ABI
 config BR2_GCC_TARGET_CPU
        string
 
+config BR2_TARGET_ABI_FLAT
+       bool
+
 if BR2_arm || BR2_armeb
 source "arch/Config.in.arm"
 endif
package/Makefile.in +0 -0
index a8bf36b..acfd9c8 100644
@@ -103,6 +103,14 @@ TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI)

$(TARGET_OPTIMIZATION) $(TARGET
TARGET_CXXFLAGS = $(TARGET_CFLAGS) TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))

package/Makefile.in +8 -0
+ifeq ($(BR2_TARGET_ABI_FLAT),y)
+TARGET_LDFLAGS += -Wl,-elf2flt
+endif
+
+ifneq ($(BR2_USE_MMU), y)
+TARGET_CFLAGS += -D__NOMMU__
+endif
+
 ifeq ($(BR2_TOOLCHAIN_BUILDROOT)$(BR2_TOOLCHAIN_CTNG),y)
 TARGET_CROSS=$(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-
 else
package/pkg-autotools.mk +0 -0
index 890506b..b23feec 100644
@@ -82,6 +82,11 @@ $(2)_CLEAN_OPT                       ?= clean
 $(2)_UNINSTALL_STAGING_OPT     ?= DESTDIR=$$(STAGING_DIR) uninstall
 $(2)_UNINSTALL_TARGET_OPT      ?= DESTDIR=$$(TARGET_DIR)  uninstall
 
Quoted 12 lines

package/pkg-autotools.mk $(2)_CLEAN_OPT ?= clean · line 89

Quoted 6 lines
package/pkg-autotools.mk +5 -1
+ifeq ($(BR2_TARGET_ABI_FLAT),y)
+ ifneq ($$($(2)_FLAT_STACKSIZE),)
+  $(2)_CONF_ENV                        += LDFLAGS="$(TARGET_LDFLAGS)
-Wl,-elf2flt=-s$($(2)_FLAT_STACKSIZE)"
+ endif
+endif

I'm not that familiar with these double $$, but is it intentional that you're using double-dollar AND single-dollar for the same variable <PKG>_FLAT_STACKSIZE in the above snippet?

Good catch. Should be double-dollar as well.
Will be fixed in v2.

Regards,

Sonic

#2 lore raw

PATCH 2/2 buildroot: target: Add Blackfin architecture support.

In reply to Sonic Zhang

Hi Sonic,

Quoted 11 lines · Sonic Zhang

From: Sonic Zhang <[email protected]>

- Create blackfin architecture makefile.
- Add blackfin target ABI options.
- Add blackfin cpu options and shared library installation options.
- Add blackfin cpu revision options and mcpu link flags
- Add blackfin FLAT specific makefile flags.
- Add shared library installation options and makefile targets to install shared libraries into rootfs image.
- Copy extra blackfin toolchain FDPIC shared libraries to target fs

Quoted 9 lines
---
 Makefile              |    2 +
 arch/Config.in.bfin   |  117
+++++++++++++++++++++++++++++++++++++++++++++++++
 arch/Makefile.in.bfin |   50 +++++++++++++++++++++
 3 files changed, 169 insertions(+), 0 deletions(-)
 create mode 100644 arch/Makefile.in.bfin

I can't give good technical feedback on this patch, but if you're making a v2 anyway, there are some small comments below.

Quoted 161 lines
Makefile +2 -0
index 7f0822f..32478e6 100644
@@ -329,6 +329,8 @@ ifneq ($(PACKAGE_OVERRIDE_FILE),)
 -include $(PACKAGE_OVERRIDE_FILE)
 endif
 
+include arch/Makefile.in.*
+
 include package/*/*.mk
 
 include boot/common.mk
arch/Config.in.bfin +117 -0
index 0b137ae..0750b86 100644
@@ -7,10 +7,127 @@ config BR2_BFIN_FDPIC
 config BR2_BFIN_FLAT
        bool "FLAT"
        select BR2_PREFER_STATIC_LIB
+config BR2_BFIN_FLAT_SEP_DATA
+       bool "FLAT (Separate data)"
+       select BR2_PREFER_STATIC_LIB
+config BR2_BFIN_SHARED_FLAT
+       bool "Shared FLAT"
+       select BR2_PREFER_STATIC_LIB
+endchoice
+
+choice
+       prompt "Target CPU"
+       depends on BR2_bfin
+       default BR2_bf609
+       help
+         Specify target CPU
+config BR2_bf606
+       bool "bf606"
+config BR2_bf607
+       bool "bf607"
+config BR2_bf608
+       bool "bf608"
+config BR2_bf609
+       bool "bf609"
+config BR2_bf512
+       bool "bf512"
+config BR2_bf514
+       bool "bf514"
+config BR2_bf516
+       bool "bf516"
+config BR2_bf518
+       bool "bf518"
+config BR2_bf522
+       bool "bf522"
+config BR2_bf523
+       bool "bf523"
+config BR2_bf524
+       bool "bf524"
+config BR2_bf525
+       bool "bf525"
+config BR2_bf526
+       bool "bf526"
+config BR2_bf527
+       bool "bf527"
+config BR2_bf531
+       bool "bf531"
+config BR2_bf532
+       bool "bf532"
+config BR2_bf533
+       bool "bf533"
+config BR2_bf534
+       bool "bf534"
+config BR2_bf536
+       bool "bf536"
+config BR2_bf537
+       bool "bf537"
+config BR2_bf538
+       bool "bf538"
+config BR2_bf539
+       bool "bf539"
+config BR2_bf542
+       bool "bf542"
+config BR2_bf544
+       bool "bf544"
+config BR2_bf547
+       bool "bf547"
+config BR2_bf548
+       bool "bf548"
+config BR2_bf549
+       bool "bf549"
+config BR2_bf561
+       bool "bf561"
 endchoice
 
+config BR2_TARGET_CPU_REVISION
+       string "Target CPU revision"
+
+config BR2_BFIN_INSTALL_ELF_SHARED
+       depends on BR2_bfin && !BR2_BFIN_FDPIC
+       bool "Install ELF shared libraries"
+       default y
+
+config BR2_BFIN_INSTALL_FLAT_SHARED
+       depends on BR2_bfin
+       bool "Install FLAT shared libraries" if !BR2_BFIN_SHARED_FLAT
+       default y
+
 config BR2_ARCH
        default "bfin"
 
 config BR2_ENDIAN
         default "LITTLE"
+
+config BR2_GCC_TARGET_CPU
+       default bf606           if BR2_bf606
+       default bf607           if BR2_bf607
+       default bf608           if BR2_bf608
+       default bf609           if BR2_bf609
+       default bf512           if BR2_bf512
+       default bf514           if BR2_bf514
+       default bf516           if BR2_bf516
+       default bf518           if BR2_bf518
+       default bf522           if BR2_bf522
+       default bf523           if BR2_bf523
+       default bf524           if BR2_bf524
+       default bf525           if BR2_bf525
+       default bf526           if BR2_bf526
+       default bf527           if BR2_bf527
+       default bf531           if BR2_bf531
+       default bf532           if BR2_bf532
+       default bf533           if BR2_bf533
+       default bf534           if BR2_bf534
+       default bf536           if BR2_bf536
+       default bf537           if BR2_bf537
+       default bf538           if BR2_bf538
+       default bf539           if BR2_bf539
+       default bf542           if BR2_bf542
+       default bf544           if BR2_bf544
+       default bf547           if BR2_bf547
+       default bf548           if BR2_bf548
+       default bf549           if BR2_bf549
+       default bf561           if BR2_bf561
+
+config BR2_TARGET_ABI_FLAT
+       default n               if BR2_BFIN_FDPIC
+       default y
arch/Makefile.in.bfin new file +7 -0
new file mode 100644
index 0000000..cef9374
@@ -0,0 +1,50 @@
+TARGETS-y =
+TARGETS-$(BR2_BFIN_INSTALL_ELF_SHARED) += romfs.shared.libs.elf
+TARGETS-$(BR2_BFIN_INSTALL_FLAT_SHARED) += romfs.shared.libs.flat
+TARGETS += $(TARGETS-y)
+
+ifeq ($(BR2_BFIN_FDPIC),y)
+USR_LIB_EXTERNAL_LIBS+=libgfortran.so libgomp.so libmudflap.so

libmudflapth.so libobjc.so

arch/Makefile.in.bfin

Quoted 2 lines
arch/Makefile.in.bfin new file +2 -0
+endif
+

We generally put spaces around variable assignments, as you did in most places, but not here.

Quoted 18 lines
arch/Makefile.in.bfin new file +15 -2
+CROSS_COMPILE_SHARED_ELF ?= bfin-linux-uclibc-
+romfs.shared.libs.elf:
+       set -e; \
+       t=`$(CROSS_COMPILE_SHARED_ELF)gcc $(CPUFLAGS)
-print-file-name=libc.a`; \
+       t=`dirname $$t`/../..; \
+       for i in $$t/lib/*so*; do \
+               i=`readlink -f "$$i"`; \
+               soname=`$(CROSS_COMPILE_SHARED_ELF)readelf -d "$$i" | sed
-n '/(SONAME)/s:.*[[]\(.*\)[]].*:\1:p'`; \
+               $(INSTALL) -D $$i $(TARGET_DIR)/lib/$$soname; \
+       done
+
+CROSS_COMPILE_SHARED_FLAT ?= bfin-uclinux-
+romfs.shared.libs.flat:
+       set -e; \
+       t=`$(CROSS_COMPILE_SHARED_FLAT)gcc $(CPUFLAGS) -mid-shared-library

arch/Makefile.in.bfin line 33

Quoted 10 lines
arch/Makefile.in.bfin new file +9 -1
-print-file-name=libc`; \
+       if [ -f $$t -a ! -h $$t ] ; then \
+               $(INSTALL) -D $$t $(TARGET_DIR)/lib/lib1.so; \
+       fi
+
+ifeq ($(BR2_TARGET_CPU_REVISION),)
+TARGET_CPU=-mcpu=$(BR2_GCC_TARGET_CPU)
+else
+TARGET_CPU=-mcpu=$(BR2_GCC_TARGET_CPU)-$(BR2_TARGET_CPU_REVISION)
+endif

Same here (x2)

Quoted 18 lines
arch/Makefile.in.bfin new file +17 -1
+TARGET_CFLAGS += $(call qstrip,$(TARGET_CPU))
+
+ifneq ($(BR2_USE_MMU), y)
+TARGET_CFLAGS += -D__uClinux__
+endif
+
+ifeq ($(BR2_BFIN_FLAT_SEP_DATA),y)
+TARGET_LDFLAGS += -msep-data
+TARGET_CFLAGS += -msep-data
+TARGET_CXXFLAGS += -msep-data
+endif
+
+ifeq ($(BR2_BFIN_SHARED_FLAT), y)
+TARGET_LDFLAGS += -mid-shared-library -mshared-library-id=0
+TARGET_CFLAGS += -mid-shared-library -mshared-library-id=0
+TARGET_CXXFLAGS += -mid-shared-library -mshared-library-id=0
+endif
--
Quoted 4 lines

1.7.0.4

Best regards,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130322/b840c4b1/attachment-0001.html>