summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Packham <judge.packham@gmail.com>2020-11-10 07:29:25 (GMT)
committerGitHub <noreply@github.com>2020-11-10 07:29:25 (GMT)
commita4231a555a3f897ecb32aad2069de4305ce0a969 (patch)
treed7e2127ff0c795a7641d617b54fa0d26c898f20d
parent66b3c25be73ff9bd1894492fef32b786f921d53c (diff)
parent3a3e645245d4cc84957209ec4313bfd6635acdec (diff)
Merge pull request #1342 from DspHack/feature/add_support_for_ti_c6x
Experimental: Add support for the Texas Instruments C6X (TMS320C6000 …
-rw-r--r--config/arch/c6x.in15
-rw-r--r--packages/gcc/4.9.4/0033-fix-c6x-internal-compiler-error-and-multilib.patch48
-rw-r--r--samples/tic6x-uclinux-uclibc/crosstool.config14
-rw-r--r--samples/tic6x-uclinux-uclibc/reported.by3
-rw-r--r--scripts/build/arch/c6x.sh79
-rw-r--r--scripts/build/kernel/linux.sh2
6 files changed, 160 insertions, 1 deletions
diff --git a/config/arch/c6x.in b/config/arch/c6x.in
new file mode 100644
index 0000000..93a8993
--- /dev/null
+++ b/config/arch/c6x.in
@@ -0,0 +1,15 @@
+# c6x specific configuration file
+
+## no-package
+## select ARCH_SUPPORTS_32
+## select ARCH_DEFAULT_32
+## select ARCH_SUPPORTS_EITHER_ENDIAN
+## select ARCH_DEFAULT_LE
+## select ARCH_SUPPORTS_FLAT_FORMAT
+## select ARCH_SUPPORTS_WITH_CPU
+## depends on EXPERIMENTAL
+##
+## help The TI C6x (TMS320C6000) architecture
+## help https://www.ti.com/processors/digital-signal-processors
+## help For linux, kernel must be 3.7 or later (or custom)
+
diff --git a/packages/gcc/4.9.4/0033-fix-c6x-internal-compiler-error-and-multilib.patch b/packages/gcc/4.9.4/0033-fix-c6x-internal-compiler-error-and-multilib.patch
new file mode 100644
index 0000000..398f904
--- /dev/null
+++ b/packages/gcc/4.9.4/0033-fix-c6x-internal-compiler-error-and-multilib.patch
@@ -0,0 +1,48 @@
+Internal compiler error and multilib fixes
+Reported upstream:
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57295
+
+Fix c6x mulitibs build for uclinux
+Reported by: Dan Tejada <dan.tejada@cantada.com>
+
+--- a/gcc/config/c6x/c6x.md
++++ b/gcc/config/c6x/c6x.md
+@@ -775,7 +775,7 @@
+ UNSPEC_MISALIGNED_ACCESS))]
+ "TARGET_INSNS_64"
+ {
+- if (memory_operand (operands[0], <MODE>mode))
++ if (memory_operand (operands[0], <MODE>mode) || volatile_mem_operand (operands[0], <MODE>mode))
+ {
+ emit_insn (gen_movmisalign<mode>_store (operands[0], operands[1]));
+ DONE;
+
+--- a/gcc/config/c6x/predicates.md
++++ b/gcc/config/c6x/predicates.md
+@@ -224,3 +224,16 @@
+ gcc_unreachable ();
+ }
+ })
++
++;; Return 1 if the operand is in volatile memory. Note that during the
++;; RTL generation phase, memory_operand does not return TRUE for volatile
++;; memory references. So this function allows us to recognize volatile
++;; references where it's safe.
++(define_predicate "volatile_mem_operand"
++ (and (and (match_code "mem")
++ (match_test "MEM_VOLATILE_P (op)"))
++ (if_then_else (match_test "reload_completed")
++ (match_operand 0 "memory_operand")
++ (if_then_else (match_test "reload_in_progress")
++ (match_test "strict_memory_address_p (mode, XEXP (op, 0))")
++ (match_test "memory_address_p (mode, XEXP (op, 0))")))))
+
+--- a/gcc/config/c6x/t-c6x-uclinux
++++ b/gcc/config/c6x/t-c6x-uclinux
+@@ -1,3 +1,5 @@
++MULTILIB_OPTIONS = march=c674x mbig-endian
++
+ MULTILIB_OSDIRNAMES = march.c674x=!c674x
+ MULTILIB_OSDIRNAMES += mbig-endian=!be
+-MULTILIB_OSDIRNAMES += mbig-endian/march.c674x=!be/c674x
++MULTILIB_OSDIRNAMES += march.c674x/mbig-endian=!be/c674x
diff --git a/samples/tic6x-uclinux-uclibc/crosstool.config b/samples/tic6x-uclinux-uclibc/crosstool.config
new file mode 100644
index 0000000..cd4af2c
--- /dev/null
+++ b/samples/tic6x-uclinux-uclibc/crosstool.config
@@ -0,0 +1,14 @@
+CT_CONFIG_VERSION="3"
+CT_EXPERIMENTAL=y
+CT_ARCH_C6X=y
+CT_OMIT_TARGET_VENDOR=y
+CT_KERNEL_LINUX=y
+CT_MULTILIB=y
+CT_LIBC_UCLIBC=y
+CT_THREADS="linuxthreads"
+CT_UCLIBC_NG_DEVEL_VCS_git=y
+CT_UCLIBC_NG_DEVEL_URL="https://github.com/DspHack/uclibc-ng.git"
+CT_ARCH_BINFMT_FDPIC=y
+CT_CC_LANG_CXX=y
+CT_ARCH_ENDIAN="little"
+
diff --git a/samples/tic6x-uclinux-uclibc/reported.by b/samples/tic6x-uclinux-uclibc/reported.by
new file mode 100644
index 0000000..e51f694
--- /dev/null
+++ b/samples/tic6x-uclinux-uclibc/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Dan Tejada <dan.tejada@cantada.com>"
+reporter_url="https://www.cantada.com/"
+reporter_comment="Tested with uclibc and linux kernel from http://linux-c6x.org"
diff --git a/scripts/build/arch/c6x.sh b/scripts/build/arch/c6x.sh
new file mode 100644
index 0000000..3eb40e4
--- /dev/null
+++ b/scripts/build/arch/c6x.sh
@@ -0,0 +1,79 @@
+# Compute c6x-specific values
+
+CT_DoArchUClibcConfig() {
+ local cfg="${1}"
+
+ CT_DoArchUClibcSelectArch "${cfg}" "c6x"
+}
+
+CT_DoArchTupleValues() {
+ CT_TARGET_ARCH="tic6x"
+ #binutils does not like uclibc in the tuple
+ if [ "${CT_TARGET_SYS}" = "uclibc" ]; then
+ CT_TARGET_SYS=
+ fi
+}
+
+CT_DoArchUClibcHeaderDir() {
+ local dir_var="${1}"
+ local cflags="${2}"
+
+ # If it is non-default multilib, add a suffix with architecture (reported by gcc)
+ # to the headers installation path.
+ if [ -n "${cflags}" ]; then
+ eval "${dir_var}="$( ${CT_TARGET}-${CT_CC} -print-multiarch ${cflags} )
+ fi
+}
+
+CT_DoArchUClibcCflags() {
+ local cfg="${1}"
+ local cflags="${2}"
+ local f
+
+ # Set default little endian options
+ CT_KconfigDisableOption "ARCH_BIG_ENDIAN" "${cfg}"
+ CT_KconfigDisableOption "ARCH_WANTS_BIG_ENDIAN" "${cfg}"
+ CT_KconfigEnableOption "ARCH_LITTLE_ENDIAN" "${cfg}"
+ CT_KconfigEnableOption "ARCH_WANTS_LITTLE_ENDIAN" "${cfg}"
+
+ # Set arch options based on march switch
+ CT_KconfigDisableOption "CONFIG_TMS320C674X" "${cfg}"
+ CT_KconfigDisableOption "CONFIG_TMS320C64XPLUS" "${cfg}"
+ CT_KconfigDisableOption "CONFIG_TMS320C64X" "${cfg}"
+ CT_KconfigDisableOption "UCLIBC_HAS_FPU" "${cfg}"
+ CT_KconfigEnableOption "CONFIG_GENERIC_C6X" "${cfg}"
+
+ for f in ${cflags}; do
+ case "${f}" in
+ -march=*)
+ case "${f#-march=}" in
+ c674x)
+ CT_KconfigEnableOption "CONFIG_TMS320C674X" "${cfg}"
+ CT_KconfigEnableOption "UCLIBC_HAS_FPU" "${cfg}"
+ CT_KconfigDisableOption "CONFIG_GENERIC_C6X" "${cfg}"
+ ;;
+ c64x+)
+ CT_KconfigEnableOption "CONFIG_TMS320C64XPLUS" "${cfg}"
+ CT_KconfigDisableOption "CONFIG_GENERIC_C6X" "${cfg}"
+ ;;
+ c64x)
+ CT_KconfigEnableOption "CONFIG_TMS320C64X" "${cfg}"
+ CT_KconfigDisableOption "CONFIG_GENERIC_C6X" "${cfg}"
+ ;;
+ c67x)
+ CT_KconfigEnableOption "UCLIBC_HAS_FPU" "${cfg}"
+ ;;
+ c62x)
+ ;;
+ *) CT_Abort "Unsupported architecture: ${f#-march=}";;
+ esac
+ ;;
+ -mbig-endian)
+ CT_KconfigEnableOption "ARCH_BIG_ENDIAN" "${cfg}"
+ CT_KconfigEnableOption "ARCH_WANTS_BIG_ENDIAN" "${cfg}"
+ CT_KconfigDisableOption "ARCH_LITTLE_ENDIAN" "${cfg}"
+ CT_KconfigDisableOption "ARCH_WANTS_LITTLE_ENDIAN" "${cfg}"
+ ;;
+ esac
+ done
+}
diff --git a/scripts/build/kernel/linux.sh b/scripts/build/kernel/linux.sh
index bfeadf0..4c96257 100644
--- a/scripts/build/kernel/linux.sh
+++ b/scripts/build/kernel/linux.sh
@@ -10,7 +10,7 @@ CT_DoKernelTupleValues()
# should be added here when someone starts to care about them.
case "${CT_ARCH}" in
arm*) CT_TARGET_KERNEL="linux" ;;
- m68k|xtensa*) CT_TARGET_KERNEL="uclinux" ;;
+ c6x|m68k|xtensa*) CT_TARGET_KERNEL="uclinux" ;;
*) CT_Abort "Unsupported no-mmu arch '${CT_ARCH}'"
esac
fi