summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2016-02-05 23:02:00 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2016-02-05 23:02:00 +0100
commit6d2e9103d92790de1029e07fcb93099161fd61b6 (patch)
tree91e04c99e8a8bf98947e2fcd1c7ef20fbc387bb8
parent9f8bcf50e6be51766b95824e3dd58c4612dbecef (diff)
fr-v: allow to build a uClibc-ng toolchain
-rw-r--r--target/frv/Makefile53
-rw-r--r--target/frv/kernel/sim-frv13
-rw-r--r--target/frv/systems/sim-frv8
-rw-r--r--target/frv/uclibc-ng.config39
-rw-r--r--toolchain/gcc/Makefile4
-rw-r--r--toolchain/gcc/patches/4.5.4/disable-dwarf.frv11
-rw-r--r--toolchain/gcc/patches/4.9.3/disable-dwarf.frv12
-rw-r--r--toolchain/gcc/patches/4.9.3/remove-write-macro.frv11
-rw-r--r--toolchain/gcc/patches/git/disable-dwarf.frv12
-rw-r--r--toolchain/gdb/Makefile3
10 files changed, 157 insertions, 9 deletions
diff --git a/target/frv/Makefile b/target/frv/Makefile
index 03afae8f0..4935ff2c4 100644
--- a/target/frv/Makefile
+++ b/target/frv/Makefile
@@ -5,3 +5,56 @@ include $(ADK_TOPDIR)/rules.mk
include $(ADK_TOPDIR)/mk/kernel-build.mk
include $(ADK_TOPDIR)/mk/image.mk
+KERNEL:=$(LINUX_DIR)/$(ADK_TARGET_KERNEL)
+
+# target helper text
+ifeq ($(ADK_TARGET_FS),archive)
+targethelp:
+ @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSTARBALL)"
+endif
+ifeq ($(ADK_TARGET_FS),initramfs)
+targethelp:
+ @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
+ @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
+endif
+ifeq ($(ADK_TARGET_FS),initramfsarchive)
+targethelp:
+ @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
+ @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
+endif
+ifeq ($(ADK_TARGET_FS),initramfspiggyback)
+targethelp:
+ @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
+ifeq ($(ADK_TARGET_SIM),y)
+ @echo "Run the simulator via:"
+ @echo '$(TARGET_CROSS)run --environment operating --model fr400 $(FW_DIR)/$(TARGET_KERNEL)'
+endif
+endif
+ifeq ($(ADK_TARGET_FS),nfsroot)
+targethelp:
+ @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
+ @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
+endif
+
+kernel-strip:
+ @cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
+
+kernel-install: kernel-strip
+ @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
+
+# filesystem specific targets
+ifeq ($(ADK_TARGET_FS),archive)
+imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
+endif
+ifeq ($(ADK_TARGET_FS),initramfs)
+imageinstall: kernel-install $(FW_DIR)/$(INITRAMFS) targethelp
+endif
+ifeq ($(ADK_TARGET_FS),initramfsarchive)
+imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
+endif
+ifeq ($(ADK_TARGET_FS),initramfspiggyback)
+imageinstall: createinitramfs targethelp
+endif
+ifeq ($(ADK_TARGET_FS),nfsroot)
+imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
+endif
diff --git a/target/frv/kernel/sim-frv b/target/frv/kernel/sim-frv
new file mode 100644
index 000000000..c52b4cc77
--- /dev/null
+++ b/target/frv/kernel/sim-frv
@@ -0,0 +1,13 @@
+CONFIG_FRV=y
+CONFIG_CPU_FR401=y
+CONFIG_UCPAGE_OFFSET_20000000=y
+CONFIG_BUG=y
+CONFIG_FRV_ONCPU_SERIAL=y
+CONFIG_SERIAL_EARLYCON=y
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_DMA=y
+CONFIG_SERIAL_8250_PCI=y
+CONFIG_SERIAL_8250_NR_UARTS=32
+CONFIG_SERIAL_8250_RUNTIME_UARTS=4
diff --git a/target/frv/systems/sim-frv b/target/frv/systems/sim-frv
new file mode 100644
index 000000000..70fea8f5c
--- /dev/null
+++ b/target/frv/systems/sim-frv
@@ -0,0 +1,8 @@
+config ADK_TARGET_SYSTEM_SIM_FRV
+ bool "GDB simulator"
+ select ADK_CPU_FRV
+ select ADK_TARGET_SIM
+ select ADK_TARGET_PACKAGE_TXZ
+ help
+ FRV Simulator.
+
diff --git a/target/frv/uclibc-ng.config b/target/frv/uclibc-ng.config
index 20894cef6..13674c4a2 100644
--- a/target/frv/uclibc-ng.config
+++ b/target/frv/uclibc-ng.config
@@ -35,10 +35,7 @@ TARGET_frv=y
TARGET_ARCH="frv"
FORCE_OPTIONS_FOR_ARCH=y
TARGET_SUBARCH=""
-# UCLIBC_FORMAT_FDPIC_ELF is not set
-UCLIBC_FORMAT_FLAT=y
-# UCLIBC_FORMAT_FLAT_SEP_DATA is not set
-# UCLIBC_FORMAT_SHARED_FLAT is not set
+UCLIBC_FORMAT_FDPIC_ELF=y
ARCH_HAS_DEPRECATED_SYSCALLS=y
ARCH_BIG_ENDIAN=y
@@ -63,11 +60,28 @@ HAVE_DOT_CONFIG=y
# General Library Settings
#
DOPIC=y
-ARCH_HAS_NO_SHARED=y
-ARCH_HAS_NO_LDSO=y
+HAVE_SHARED=y
+# FORCE_SHAREABLE_TEXT_SEGMENTS is not set
+LDSO_LDD_SUPPORT=y
+LDSO_CACHE_SUPPORT=y
+LDSO_PRELOAD_ENV_SUPPORT=y
+# LDSO_PRELOAD_FILE_SUPPORT is not set
+LDSO_BASE_FILENAME="ld.so"
+# LDSO_STANDALONE_SUPPORT is not set
+# LDSO_PRELINK_SUPPORT is not set
+UCLIBC_STATIC_LDCONFIG=y
+LDSO_RUNPATH=y
+LDSO_RUNPATH_OF_EXECUTABLE=y
+LDSO_SAFE_RUNPATH=y
+LDSO_SEARCH_INTERP_PATH=y
+LDSO_LD_LIBRARY_PATH=y
+LDSO_NO_CLEANUP=y
UCLIBC_CTOR_DTOR=y
-HAS_NO_THREADS=y
-# UCLIBC_HAS_LINUXTHREADS is not set
+# LDSO_GNU_HASH_SUPPORT is not set
+# HAS_NO_THREADS is not set
+UCLIBC_HAS_LINUXTHREADS=y
+UCLIBC_HAS_THREADS=y
+PTHREADS_DEBUG_SUPPORT=y
UCLIBC_HAS_SYSLOG=y
UCLIBC_HAS_LFS=y
UCLIBC_HAS_OBSTACK=y
@@ -202,10 +216,13 @@ HARDWIRED_ABSPATH=y
#
# Security options
#
+# UCLIBC_BUILD_PIE is not set
UCLIBC_HAS_ARC4RANDOM=y
# ARC4RANDOM_USES_NODEV is not set
# UCLIBC_HAS_SSP is not set
-UCLIBC_BUILD_NOEXECSTACK=y
+# UCLIBC_BUILD_RELRO is not set
+# UCLIBC_BUILD_NOW is not set
+# UCLIBC_BUILD_NOEXECSTACK is not set
#
# Development/debugging options
@@ -213,9 +230,13 @@ UCLIBC_BUILD_NOEXECSTACK=y
CROSS_COMPILER_PREFIX=""
UCLIBC_EXTRA_CFLAGS=""
# DODEBUG is not set
+# DODEBUG_PT is not set
# DOSTRIP is not set
# DOASSERTS is not set
+# SUPPORT_LD_DEBUG is not set
+# SUPPORT_LD_DEBUG_EARLY is not set
# UCLIBC_MALLOC_DEBUGGING is not set
+# UCLIBC_HAS_BACKTRACE is not set
WARNINGS="-Wall"
# EXTRA_WARNINGS is not set
# DOMULTI is not set
diff --git a/toolchain/gcc/Makefile b/toolchain/gcc/Makefile
index db543ace1..dd7b73c0b 100644
--- a/toolchain/gcc/Makefile
+++ b/toolchain/gcc/Makefile
@@ -174,6 +174,10 @@ ifeq ($(ADK_TARGET_ARCH_PPC),y)
GCC_CONFOPTS+= --with-long-double-64 --enable-secureplt
endif
+ifeq ($(ADK_TARGET_ARCH_FRV),y)
+GCC_CONFOPTS+= --enable-sjlj-exceptions
+endif
+
ifneq ($(ADK_TARGET_MIPS_ABI),)
GCC_CONFOPTS+= --with-abi=${ADK_TARGET_MIPS_ABI}
endif
diff --git a/toolchain/gcc/patches/4.5.4/disable-dwarf.frv b/toolchain/gcc/patches/4.5.4/disable-dwarf.frv
new file mode 100644
index 000000000..ee4ca01a1
--- /dev/null
+++ b/toolchain/gcc/patches/4.5.4/disable-dwarf.frv
@@ -0,0 +1,11 @@
+diff -Nur gcc-4.5.4.orig/gcc/config/t-linux gcc-4.5.4/gcc/config/t-linux
+--- gcc-4.5.4.orig/gcc/config/t-linux 2009-04-21 21:03:23.000000000 +0200
++++ gcc-4.5.4/gcc/config/t-linux 2015-11-21 17:25:52.720653570 +0100
+@@ -27,6 +27,6 @@
+ SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver
+
+ # Use unwind-dw2-fde-glibc
+-LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-glibc.c \
++LIB2ADDEH = $(srcdir)/unwind-dw2.c \
+ $(srcdir)/unwind-sjlj.c $(srcdir)/gthr-gnat.c $(srcdir)/unwind-c.c
+ LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h unwind-dw2-fde.c
diff --git a/toolchain/gcc/patches/4.9.3/disable-dwarf.frv b/toolchain/gcc/patches/4.9.3/disable-dwarf.frv
new file mode 100644
index 000000000..c11baec92
--- /dev/null
+++ b/toolchain/gcc/patches/4.9.3/disable-dwarf.frv
@@ -0,0 +1,12 @@
+diff -Nur gcc-git.orig/libgcc/config.host gcc-git/libgcc/config.host
+--- gcc-git.orig/libgcc/config.host 2015-10-23 21:12:52.000000000 +0200
++++ gcc-git/libgcc/config.host 2015-11-15 21:17:38.385745887 +0100
+@@ -231,7 +231,7 @@
+ esac
+ ;;
+ *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
+- tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux"
++ tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux"
+ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
+ if test x$enable_vtable_verify = xyes; then
+ extra_parts="$extra_parts vtv_start.o vtv_end.o vtv_start_preinit.o vtv_end_preinit.o"
diff --git a/toolchain/gcc/patches/4.9.3/remove-write-macro.frv b/toolchain/gcc/patches/4.9.3/remove-write-macro.frv
new file mode 100644
index 000000000..24832b737
--- /dev/null
+++ b/toolchain/gcc/patches/4.9.3/remove-write-macro.frv
@@ -0,0 +1,11 @@
+diff -Nur gcc-4.9.3.orig/gcc/config/frv/linux.h gcc-4.9.3/gcc/config/frv/linux.h
+--- gcc-4.9.3.orig/gcc/config/frv/linux.h 2014-01-02 23:23:26.000000000 +0100
++++ gcc-4.9.3/gcc/config/frv/linux.h 2015-11-22 11:36:17.574727932 +0100
+@@ -69,6 +69,6 @@
+ #undef INVOKE__main
+
+ #undef Twrite
+-#define Twrite __write
++#define Twrite write
+
+ #endif /* __FRV_LINUX_H__ */
diff --git a/toolchain/gcc/patches/git/disable-dwarf.frv b/toolchain/gcc/patches/git/disable-dwarf.frv
new file mode 100644
index 000000000..c11baec92
--- /dev/null
+++ b/toolchain/gcc/patches/git/disable-dwarf.frv
@@ -0,0 +1,12 @@
+diff -Nur gcc-git.orig/libgcc/config.host gcc-git/libgcc/config.host
+--- gcc-git.orig/libgcc/config.host 2015-10-23 21:12:52.000000000 +0200
++++ gcc-git/libgcc/config.host 2015-11-15 21:17:38.385745887 +0100
+@@ -231,7 +231,7 @@
+ esac
+ ;;
+ *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
+- tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux"
++ tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux"
+ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
+ if test x$enable_vtable_verify = xyes; then
+ extra_parts="$extra_parts vtv_start.o vtv_end.o vtv_start_preinit.o vtv_end_preinit.o"
diff --git a/toolchain/gdb/Makefile b/toolchain/gdb/Makefile
index 821d9ad81..917aad655 100644
--- a/toolchain/gdb/Makefile
+++ b/toolchain/gdb/Makefile
@@ -56,6 +56,9 @@ ifeq ($(ADK_TARGET_SIM),y)
ifeq ($(ADK_TARGET_ARCH_BFIN),y)
$(INSTALL_BIN) $(GDB_BUILD_DIR)/sim/bfin/run $(TARGET_CROSS)run
endif
+ifeq ($(ADK_TARGET_ARCH_FRV),y)
+ $(INSTALL_BIN) $(WRKBUILD)/sim/frv/run $(TARGET_CROSS)run
+endif
ifeq ($(ADK_TARGET_ARCH_H8300),y)
$(INSTALL_BIN) $(GDB_BUILD_DIR)/sim/h8300/run $(TARGET_CROSS)run
endif