Skip to contentSkip to conversation

arch/csky: Add ck860 and vdsp compiler options

PATCH Superseded guoren at kernel.org 3 participants 7 messages May 7, 2019 – May 8, 2019 C-sky architecture

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

guoren at kernel.org

author maintainer
#0 lore raw

PATCH 1/3 arch/csky: Add ck860 and vdsp compiler options

From: Guo Ren <[email protected]>

The ck860 is C-SKY abiv2 cpu series and it could support SMP and vdsp instructions set. Add the compiler options for them.

---
 arch/Config.in.csky | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)
arch/Config.in.csky +20 -13
index e88e4e2..bbff600 100644
@@ -13,19 +13,26 @@ config BR2_ck807
 config BR2_ck810
 	bool "ck810"
 
+config BR2_ck860
+	bool "ck860"
+
 endchoice
 
 config BR2_CSKY_FPU
 	bool "Enable FPU coprocessor"
-	depends on BR2_ck810 || BR2_ck807
+	depends on BR2_ck807 || BR2_ck810 || BR2_ck860
 	help
 	  You can say N here if your C-SKY CPU doesn't have a
 	  Floating-Point Coprocessor or if you don't need FPU support
 	  for your user-space programs.
 
-config BR2_CSKY_DSP
-	bool "Enable DSP enhanced instructions"
-	depends on BR2_ck810 || BR2_ck807
+config BR2_CSKY_VDSP
+	bool "Enable VDSP 3.0 enhanced instructions Co-processor"
+	depends on BR2_ck860
+
+config BR2_GCC_TARGET_FLOAT_ABI
+	default "soft"		if !BR2_CSKY_FPU
+	default "hard"		if BR2_CSKY_FPU
 
 config BR2_ARCH
 	default "csky"
@@ -34,15 +41,15 @@ config BR2_ENDIAN
 	default "LITTLE"
 
 config BR2_GCC_TARGET_CPU
-	default "ck610"		if (BR2_ck610 && !BR2_CSKY_FPU && !BR2_CSKY_DSP)
-	default "ck807"		if (BR2_ck807 && !BR2_CSKY_FPU && !BR2_CSKY_DSP)
-	default "ck807e"	if (BR2_ck807 && !BR2_CSKY_FPU &&  BR2_CSKY_DSP)
-	default "ck807f"	if (BR2_ck807 &&  BR2_CSKY_FPU && !BR2_CSKY_DSP)
-	default "ck807ef"	if (BR2_ck807 &&  BR2_CSKY_FPU &&  BR2_CSKY_DSP)
-	default "ck810"		if (BR2_ck810 && !BR2_CSKY_FPU && !BR2_CSKY_DSP)
-	default "ck810e"	if (BR2_ck810 && !BR2_CSKY_FPU &&  BR2_CSKY_DSP)
-	default "ck810f"	if (BR2_ck810 &&  BR2_CSKY_FPU && !BR2_CSKY_DSP)
-	default "ck810ef"	if (BR2_ck810 &&  BR2_CSKY_FPU &&  BR2_CSKY_DSP)
+	default "ck610"		if (BR2_ck610 && !BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck807"		if (BR2_ck807 && !BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck807f"	if (BR2_ck807 &&  BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck810"		if (BR2_ck810 && !BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck810f"	if (BR2_ck810 &&  BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck860"		if (BR2_ck860 && !BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck860f"	if (BR2_ck860 &&  BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck860v"	if (BR2_ck860 && !BR2_CSKY_FPU &&  BR2_CSKY_VDSP)
+	default "ck860fv"	if (BR2_ck860 &&  BR2_CSKY_FPU &&  BR2_CSKY_VDSP)
 
 config BR2_READELF_ARCH_NAME
 	default "CSKY"
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH 2/3 arch: Add support for C-SKY toolchain build

From: Guo Ren <[email protected]>

This enables csky to be built with generated toolchain:
- gcc 6.3
- binutils 2.27
- gdb 7.12
- glibc 2.28

All of them has been tested with csky gitlab-ci based on buildroot:
- https://gitlab.com/c-sky/buildroot/pipelines

---
 arch/Config.in                          | 1 -
 package/Makefile.in                     | 9 +++++++++
 package/binutils/binutils.hash          | 2 ++
 package/binutils/binutils.mk            | 8 ++++++++
 package/gcc/Config.in.host              | 7 +++++++
 package/gcc/gcc.hash                    | 2 ++
 package/gcc/gcc.mk                      | 4 ++++
 package/gdb/Config.in.host              | 1 +
 package/gdb/gdb.hash                    | 2 ++
 package/gdb/gdb.mk                      | 7 +++++++
 package/glibc/glibc.hash                | 2 ++
 package/glibc/glibc.mk                  | 3 +++
 support/gnuconfig/config.sub            | 2 ++
 toolchain/toolchain-buildroot/Config.in | 2 +-
 14 files changed, 50 insertions(+), 2 deletions(-)
arch/Config.in +0 -1
index d82803c..db1199c 100644
@@ -77,7 +77,6 @@ config BR2_aarch64_be
 
 config BR2_csky
 	bool "csky"
-	select BR2_ARCH_HAS_NO_TOOLCHAIN_BUILDROOT
 	select BR2_ARCH_HAS_MMU_MANDATORY
 	help
 	  csky is processor IP from china.
package/Makefile.in +9 -0
index dc818a2..f05b9cc 100644
@@ -70,6 +70,15 @@ ABI := $(ABI)hf
 endif
 endif
 
+# For C-SKY abiv1 & abiv2
+ifeq ($(BR2_csky),y)
+ifeq ($(BR2_ck610),y)
+ABI = abiv1
+else
+ABI = abiv2
+endif
+endif
+
 # For FSL PowerPC there's SPE
 ifeq ($(BR2_powerpc_SPE),y)
 ABI = spe
package/binutils/binutils.hash +2 -0
index 039e368..9f8b419 100644
@@ -5,3 +5,5 @@ sha512  d326408f12a03d9a61a9de56584c2af12f81c2e50d2d7e835d51565df8314df01575724a
 
 # Locally calculated (fetched from Github)
 sha512  a96dfcea6064fcd1aac1333ac0d631491bed8b0be9bdcf62f1447909c8f30d2cb8d9323ffeb7c9ad6b326ecddb72e3d28281684e73343189d0a4a37a11aef62f  binutils-gdb-arc-2018.09-release.tar.gz
+# Locally calculated (fetched from https://github.com/c-sky/binutils-gdb)
+sha512  979552d4b3a4f31e9f3b9a7027321bd4eb3ac6c2d8deac1720e94e54f81d736db09c53c5d87c301010e307b64127e14400a036c7a35e5d63a954a4edd9cc8e2c  binutils-c66d8bbcebfddf713b2b436e1b135e6b125a55a5.tar.gz
package/binutils/binutils.mk +8 -0
index c70ba13..cebfd06 100644
@@ -20,6 +20,14 @@ BINUTILS_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,binutils-gdb,
 BINUTILS_SOURCE = binutils-gdb-$(BINUTILS_VERSION).tar.gz
 BINUTILS_FROM_GIT = y
 endif
+
+ifeq ($(BR2_csky),y)
+BINUTILS_VERSION = c66d8bbcebfddf713b2b436e1b135e6b125a55a5
+BINUTILS_SITE = $(call github,c-sky,binutils-gdb,$(BINUTILS_VERSION))
+BINUTILS_SOURCE = binutils-$(BINUTILS_VERSION).tar.gz
+BINUTILS_FROM_GIT = y
+endif
+
 BINUTILS_SITE ?= $(BR2_GNU_MIRROR)/binutils
 BINUTILS_SOURCE ?= binutils-$(BINUTILS_VERSION).tar.xz
 BINUTILS_EXTRA_CONFIG_OPTIONS = $(call qstrip,$(BR2_BINUTILS_EXTRA_CONFIG_OPTIONS))
package/gcc/Config.in.host +7 -0
index 8e22a4c..3f82696 100644
@@ -3,6 +3,7 @@ comment "GCC Options"
 choice
 	prompt "GCC compiler Version"
 	default BR2_GCC_VERSION_ARC if BR2_arc
+	default BR2_GCC_VERSION_CSKY if BR2_csky
 	default BR2_GCC_VERSION_OR1K if BR2_or1k
 	default BR2_GCC_VERSION_7_X
 	help
@@ -14,6 +15,12 @@ config BR2_GCC_VERSION_ARC
 	depends on BR2_arc
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_8
 
+config BR2_GCC_VERSION_CSKY
+	bool "gcc csky"
+	# Only supported architecture
+	depends on BR2_csky
+	select BR2_TOOLCHAIN_GCC_AT_LEAST_6
+
 config BR2_GCC_VERSION_OR1K
 	bool "gcc or1k (5.x)"
 	# Only supported architecture
package/gcc/gcc.hash +2 -0
index 4f1e7f9..780484d 100644
@@ -13,3 +13,5 @@ sha512  1811337ae3add9680cec64968a2509d085b6dc5b6783fc1e8c295e3e47416196fd1a3ad8
 sha512  4d12c3ac27b9de9c533be3b8964cf23d21bf6933b5073183e1affe714b0ff33f9d6169e3b55a5c505d7dae33c9bb4f8b0d110461e3a124182d8c8d51b66b8e45  gcc-arc-2018.09-release.tar.gz
 # Locally calculated (fetched from Github)
 sha512  2de7cf47333a4092b02d3bb98f4206f14966f1d139a724d09cf3b22f8a43ae0c704f33e6477d6367a03c29b265480dc900169e9d417006c5d46f0ae446b8c6f1  gcc-or1k-musl-5.4.0-20170218.tar.gz
+# Locally calculated (fetched from https://github.com/c-sky/gcc)
+sha512  1c3564fd6573dce13451a73015e7d88fecbb214dc1df96607976255b1d8b9e60318405333f4f218eea8d07e3675a802b66eff6df3921d505c4036481512792c2  gcc-48152afb96c59733d5bc79e3399bb7b3d4b44266.tar.gz
package/gcc/gcc.mk +4 -0
index 5901624..fd77adc 100644
@@ -16,6 +16,10 @@ GCC_SOURCE = gcc-$(GCC_VERSION).tar.gz
 else ifeq ($(BR2_or1k),y)
 GCC_SITE = $(call github,openrisc,or1k-gcc,$(GCC_VERSION))
 GCC_SOURCE = gcc-$(GCC_VERSION).tar.gz
+else ifeq ($(BR2_csky),y)
+GCC_VERSION = 48152afb96c59733d5bc79e3399bb7b3d4b44266
+GCC_SITE = $(call github,c-sky,gcc,$(GCC_VERSION))
+GCC_SOURCE = gcc-$(GCC_VERSION).tar.gz
 else
 GCC_SITE = $(BR2_GNU_MIRROR:/=)/gcc/gcc-$(GCC_VERSION)
 # From version 5.5.0, 6.4.0, 7.2.0 and 8.1.0 a bz2 release tarball is not
package/gdb/Config.in.host +1 -0
index 969168f..0aa7d0a 100644
@@ -48,6 +48,7 @@ choice
 	prompt "GDB debugger Version"
 	default BR2_GDB_VERSION_8_1
 	depends on !BR2_arc
+	depends on !BR2_csky
 	help
 	  Select the version of gdb you wish to use.
 
package/gdb/gdb.hash +2 -0
index 1104da5..90a60b0 100644
@@ -6,3 +6,5 @@ sha512  2aa81cfd389bb48c35d7d9f95cc10e88b4f7ad4597bdde0f8f1fd312f60f10d9fb2cc6e5
 
 # Locally calculated (fetched from Github)
 sha512  8303e399e396f5c15dc976e48503fc7d45a720dd1a470443f755c5f2458d092b4392e7ae582abc251bc4b43a778ad784f764286a2a05abfc1649cbeeeb6e7d15 	gdb-arc-2018.09-release-gdb.tar.gz
+# Locally calculated (fetched from https://github.com/c-sky/binutils-gdb)
+sha512  c421e1f3c0d6cfb3c04544573c0c4b0075c8d8e3d563c6c234fcc1e4c2167ab203d1e57aec3b58abd348dc46f8cf9b47b753d3a43dba3ea970c9c9a6bd78c07b	gdb-4ecb98fbc2f94dbe01b69384afbc515107de73df.tar.gz
package/gdb/gdb.mk +7 -0
index a926961..460d21f 100644
@@ -14,6 +14,13 @@ GDB_SOURCE = gdb-$(GDB_VERSION).tar.gz
 GDB_FROM_GIT = y
 endif
 
+ifeq ($(BR2_csky),y)
+GDB_VERSION = 4ecb98fbc2f94dbe01b69384afbc515107de73df
+GDB_SITE = $(call github,c-sky,binutils-gdb,$(GDB_VERSION))
+GDB_SOURCE = gdb-$(GDB_VERSION).tar.gz
+GDB_FROM_GIT = y
+endif
+
 GDB_LICENSE = GPL-2.0+, LGPL-2.0+, GPL-3.0+, LGPL-3.0+
 GDB_LICENSE_FILES = COPYING COPYING.LIB COPYING3 COPYING3.LIB
 
package/glibc/glibc.hash +2 -0
index 5316f03..6e47559 100644
@@ -1,2 +1,4 @@
 # This hash file is not used; instead, update the
 # hash files in the per-version sub-directories.
+# Locally calculated (fetched from https://github.com/c-sky/glibc)
+sha512 9deb2deceefe347d72de13510a5baa3de00f94c684f3b25e136ca3660f61e65a69f2115abb488c2ab0fa93cda8535853ce1e13e186efcc8434ecc4049efd82b5  glibc-7630ed2fa60caea98f500e4a7a51b88f9bf1e176.tar.gz
package/glibc/glibc.mk +3 -0
index 0345f1f..c4ddf8b 100644
@@ -10,6 +10,9 @@ GLIBC_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,glibc,$(GLIBC_VE
 else ifeq ($(BR2_RISCV_32),y)
 GLIBC_VERSION = 06983fe52cfe8e4779035c27e8cc5d2caab31531
 GLIBC_SITE = $(call github,riscv,riscv-glibc,$(GLIBC_VERSION))
+else ifeq ($(BR2_csky),y)
+GLIBC_VERSION = 7630ed2fa60caea98f500e4a7a51b88f9bf1e176
+GLIBC_SITE = $(call github,c-sky,glibc,$(GLIBC_VERSION))
 else
 # Generate version string using:
 #   git describe --match 'glibc-*' --abbrev=40 origin/release/MAJOR.MINOR/master | cut -d '-' -f 2-
support/gnuconfig/config.sub +2 -0
index 6d86a1e..45dd0a7 100755
@@ -254,6 +254,7 @@ case $basic_machine in
 	| arc | arceb \
 	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
 	| avr | avr32 \
+	| csky \
 	| ba \
 	| be32 | be64 \
 	| bfin \
@@ -376,6 +377,7 @@ case $basic_machine in
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* | avr32-* \
+	| csky-* \
 	| ba-* \
 	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
toolchain/toolchain-buildroot/Config.in +1 -1
index beb17a2..d9f16e2 100644
@@ -48,7 +48,7 @@ config BR2_TOOLCHAIN_BUILDROOT_GLIBC
 		   BR2_powerpc     || BR2_powerpc64  || BR2_powerpc64le || \
 		   BR2_riscv       || BR2_sh         || BR2_sparc64     || \
 		   BR2_x86_64      || BR2_microblaze || BR2_nios2       || \
-		   (BR2_arcle && BR2_ARC_ATOMIC_EXT)
+		   (BR2_arcle && BR2_ARC_ATOMIC_EXT) || BR2_csky
 	depends on BR2_USE_MMU
 	depends on !BR2_STATIC_LIBS
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_2
Signature · 1 line
2.7.4
author maintainer
#4 lore raw

PATCH 3/3 configs/qemu_cskyXXX_virt: new defconfig

In reply to guoren at kernel.org

From: Guo Ren <[email protected]>

Add C-SKY defconfig for QEMU virt machine.

Tested with https://gitlab.com/c-sky/buildroot/pipelines

---
 .gitlab-ci.yml                      |   4 +
 board/qemu/csky/610_defconfig       | 526 +++++++++++++++++++++++++++++++++++
 board/qemu/csky/807_defconfig       | 531 +++++++++++++++++++++++++++++++++++
 board/qemu/csky/810_defconfig       | 531 +++++++++++++++++++++++++++++++++++
 board/qemu/csky/860_defconfig       | 533 ++++++++++++++++++++++++++++++++++++
 configs/qemu_csky610_virt_defconfig |  29 ++
 configs/qemu_csky807_virt_defconfig |  30 ++
 configs/qemu_csky810_virt_defconfig |  30 ++
 configs/qemu_csky860_virt_defconfig |  30 ++
 9 files changed, 2244 insertions(+)
 create mode 100644 board/qemu/csky/610_defconfig
 create mode 100644 board/qemu/csky/807_defconfig
 create mode 100644 board/qemu/csky/810_defconfig
 create mode 100644 board/qemu/csky/860_defconfig
 create mode 100644 configs/qemu_csky610_virt_defconfig
 create mode 100644 configs/qemu_csky807_virt_defconfig
 create mode 100644 configs/qemu_csky810_virt_defconfig
 create mode 100644 configs/qemu_csky860_virt_defconfig
.gitlab-ci.yml +4 -0
index e9869be..05bfa12 100644
@@ -215,6 +215,10 @@ qemu_aarch64_virt_defconfig: { extends: .defconfig }
 qemu_arm_versatile_defconfig: { extends: .defconfig }
 qemu_arm_versatile_nommu_defconfig: { extends: .defconfig }
 qemu_arm_vexpress_defconfig: { extends: .defconfig }
+qemu_csky610_virt_defconfig: { extends: .defconfig }
+qemu_csky807_virt_defconfig: { extends: .defconfig }
+qemu_csky810_virt_defconfig: { extends: .defconfig }
+qemu_csky860_virt_defconfig: { extends: .defconfig }
 qemu_m68k_mcf5208_defconfig: { extends: .defconfig }
 qemu_m68k_q800_defconfig: { extends: .defconfig }
 qemu_microblazebe_mmu_defconfig: { extends: .defconfig }
board/qemu/csky/610_defconfig new file +526 -0

526 lines not on this page · raw message

board/qemu/csky/807_defconfig new file +531 -0

531 lines not on this page · raw message

board/qemu/csky/810_defconfig new file +531 -0

531 lines not on this page · raw message

board/qemu/csky/860_defconfig new file +533 -0

533 lines not on this page · raw message

configs/qemu_csky610_virt_defconfig new file +29 -0
new file mode 100644
index 0000000..85b31d1
@@ -0,0 +1,29 @@
+# Architecture
+BR2_csky=y
+BR2_ck610=y
+
+# System
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y
+BR2_TARGET_ROOTFS_INITRAMFS=y
+
+# Toolchain
+BR2_OPTIMIZE_2=y
+BR2_SHARED_STATIC_LIBS=y
+BR2_TOOLCHAIN_BUILDROOT_CXX=y
+BR2_PACKAGE_HOST_GDB=y
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.0.12"
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/csky/610_defconfig"
+
+# Packages on board
+BR2_PACKAGE_LINUX_TOOLS_PERF=y
+BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
+BR2_PACKAGE_GDB=y
+BR2_PACKAGE_BASH=y
+BR2_PACKAGE_KMOD=y
+BR2_PACKAGE_UTIL_LINUX=y
+BR2_PACKAGE_UTIL_LINUX_LIBBLKID=y
configs/qemu_csky807_virt_defconfig new file +30 -0
new file mode 100644
index 0000000..c3247f0
@@ -0,0 +1,30 @@
+# Architecture
+BR2_csky=y
+BR2_ck807=y
+
+# System
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y
+BR2_TARGET_ROOTFS_INITRAMFS=y
+
+# Toolchain
+BR2_OPTIMIZE_2=y
+BR2_SHARED_STATIC_LIBS=y
+BR2_TOOLCHAIN_BUILDROOT_CXX=y
+BR2_PACKAGE_HOST_GDB=y
+BR2_TARGET_OPTIMIZATION="-mbacktrace"
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.0.12"
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/csky/807_defconfig"
+
+# Packages on board
+BR2_PACKAGE_LINUX_TOOLS_PERF=y
+BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
+BR2_PACKAGE_GDB=y
+BR2_PACKAGE_BASH=y
+BR2_PACKAGE_KMOD=y
+BR2_PACKAGE_UTIL_LINUX=y
+BR2_PACKAGE_UTIL_LINUX_LIBBLKID=y
configs/qemu_csky810_virt_defconfig new file +30 -0
new file mode 100644
index 0000000..acd2be0
@@ -0,0 +1,30 @@
+# Architecture
+BR2_csky=y
+BR2_ck810=y
+
+# System
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y
+BR2_TARGET_ROOTFS_INITRAMFS=y
+
+# Toolchain
+BR2_OPTIMIZE_2=y
+BR2_SHARED_STATIC_LIBS=y
+BR2_TOOLCHAIN_BUILDROOT_CXX=y
+BR2_PACKAGE_HOST_GDB=y
+BR2_TARGET_OPTIMIZATION="-mbacktrace"
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.0.12"
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/csky/810_defconfig"
+
+# Packages on board
+BR2_PACKAGE_LINUX_TOOLS_PERF=y
+BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
+BR2_PACKAGE_GDB=y
+BR2_PACKAGE_BASH=y
+BR2_PACKAGE_KMOD=y
+BR2_PACKAGE_UTIL_LINUX=y
+BR2_PACKAGE_UTIL_LINUX_LIBBLKID=y
configs/qemu_csky860_virt_defconfig new file +30 -0
new file mode 100644
index 0000000..118ad51
@@ -0,0 +1,30 @@
+# Architecture
+BR2_csky=y
+BR2_ck860=y
+
+# System
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y
+BR2_TARGET_ROOTFS_INITRAMFS=y
+
+# Toolchain
+BR2_OPTIMIZE_2=y
+BR2_SHARED_STATIC_LIBS=y
+BR2_TOOLCHAIN_BUILDROOT_CXX=y
+BR2_PACKAGE_HOST_GDB=y
+BR2_TARGET_OPTIMIZATION="-mbacktrace"
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.0.12"
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/csky/860_defconfig"
+
+# Packages on board
+BR2_PACKAGE_LINUX_TOOLS_PERF=y
+BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
+BR2_PACKAGE_GDB=y
+BR2_PACKAGE_BASH=y
+BR2_PACKAGE_KMOD=y
+BR2_PACKAGE_UTIL_LINUX=y
+BR2_PACKAGE_UTIL_LINUX_LIBBLKID=y
Signature · 1 line
2.7.4
#5 lore raw

PATCH 1/3 arch/csky: Add ck860 and vdsp compiler options

In reply to guoren at kernel.org

Hello Guo,

Thanks for this new csky related contribution. See below some comments.

Quoted 25 lines · On Tue, 7 May 2019 17:47:20 +0800 guoren at kernel.org wrote:

From: Guo Ren <[email protected]>

The ck860 is C-SKY abiv2 cpu series and it could support SMP and vdsp instructions set. Add the compiler options for them.

---
 arch/Config.in.csky | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)
arch/Config.in.csky +3 -0
index e88e4e2..bbff600 100644
@@ -13,19 +13,26 @@ config BR2_ck807
 config BR2_ck810
 	bool "ck810"
 
+config BR2_ck860
+	bool "ck860"
+
 endchoice
 
 config BR2_CSKY_FPU
 	bool "Enable FPU coprocessor"

arch/Config.in.csky config BR2_ck807 · line 28

Quoted 10 lines
arch/Config.in.csky +1 -4
-	depends on BR2_ck810 || BR2_ck807
+	depends on BR2_ck807 || BR2_ck810 || BR2_ck860
 	help
 	  You can say N here if your C-SKY CPU doesn't have a
 	  Floating-Point Coprocessor or if you don't need FPU support
 	  for your user-space programs.
 
-config BR2_CSKY_DSP
-	bool "Enable DSP enhanced instructions"
-	depends on BR2_ck810 || BR2_ck807

Why is this option being removed ? This is not explained in the commit log.

arch/Config.in.csky config BR2_ck807 · line 35

Quoted 7 lines
arch/Config.in.csky +7 -0
+config BR2_CSKY_VDSP
+	bool "Enable VDSP 3.0 enhanced instructions Co-processor"
+	depends on BR2_ck860
+
+config BR2_GCC_TARGET_FLOAT_ABI
+	default "soft"		if !BR2_CSKY_FPU
+	default "hard"		if BR2_CSKY_FPU

This should be in a separate patch, it's not a change that is directly related.

Quoted 14 lines
arch/Config.in.csky +0 -8
 config BR2_ARCH
 	default "csky"
@@ -34,15 +41,15 @@ config BR2_ENDIAN
 	default "LITTLE"
 
 config BR2_GCC_TARGET_CPU
-	default "ck610"		if (BR2_ck610 && !BR2_CSKY_FPU && !BR2_CSKY_DSP)
-	default "ck807"		if (BR2_ck807 && !BR2_CSKY_FPU && !BR2_CSKY_DSP)
-	default "ck807e"	if (BR2_ck807 && !BR2_CSKY_FPU &&  BR2_CSKY_DSP)
-	default "ck807f"	if (BR2_ck807 &&  BR2_CSKY_FPU && !BR2_CSKY_DSP)
-	default "ck807ef"	if (BR2_ck807 &&  BR2_CSKY_FPU &&  BR2_CSKY_DSP)
-	default "ck810"		if (BR2_ck810 && !BR2_CSKY_FPU && !BR2_CSKY_DSP)
-	default "ck810e"	if (BR2_ck810 && !BR2_CSKY_FPU &&  BR2_CSKY_DSP)
-	default "ck810f"	if (BR2_ck810 &&  BR2_CSKY_FPU && !BR2_CSKY_DSP)

arch/Config.in.csky config BR2_ENDIAN · line 52

Quoted 10 lines
arch/Config.in.csky +9 -1
-	default "ck810ef"	if (BR2_ck810 &&  BR2_CSKY_FPU &&  BR2_CSKY_DSP)
+	default "ck610"		if (BR2_ck610 && !BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck807"		if (BR2_ck807 && !BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck807f"	if (BR2_ck807 &&  BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck810"		if (BR2_ck810 && !BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck810f"	if (BR2_ck810 &&  BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck860"		if (BR2_ck860 && !BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck860f"	if (BR2_ck860 &&  BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck860v"	if (BR2_ck860 && !BR2_CSKY_FPU &&  BR2_CSKY_VDSP)
+	default "ck860fv"	if (BR2_ck860 &&  BR2_CSKY_FPU &&  BR2_CSKY_VDSP)

Perhaps this is becoming too much, and we should adopt a solution similar to the one in arch/arch.mk.riscv. I.e, drop the BR2_GCC_TARGET_CPU definition from arch/Config.in.csky, and add a file arch/arch.mk.csky that contains:

ifeq ($(BR2_csky),y)

ifeq ($(BR2_ck610),y)
GCC_TARGET_CPU := ck610
else ifeq ($(BR2_ck807),y)
GCC_TARGET_CPU := ck807
else ifeq ($(BR2_ck810),y)
GCC_TARGET_CPU := ck810
else ifeq ($(BR2_ck860),y)
GCC_TARGET_CPU := ck860
endif

ifeq ($(BR2_CSKY_FPU),y)
GCC_TARGET_CPU := $(GCC_TARGET_CPU)f
endif

ifeq ($(BR2_CSKY_VDSP),y)
GCC_TARGET_CPU := $(GCC_TARGET_CPU)v
endif

endif

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 2/3 arch: Add support for C-SKY toolchain build

In reply to guoren at kernel.org

Hi Guo,

[Very quick review only.]

Quoted 12 lines · guoren at kernel.org

From: Guo Ren <[email protected]>

This enables csky to be built with generated toolchain:
- gcc 6.3
- binutils 2.27
- gdb 7.12
- glibc 2.28

All of them has been tested with csky gitlab-ci based on buildroot:
- https://gitlab.com/c-sky/buildroot/pipelines

Quoted 15 lines
---
 arch/Config.in                          | 1 -
 package/Makefile.in                     | 9 +++++++++
 package/binutils/binutils.hash          | 2 ++
 package/binutils/binutils.mk            | 8 ++++++++
 package/gcc/Config.in.host              | 7 +++++++
 package/gcc/gcc.hash                    | 2 ++
 package/gcc/gcc.mk                      | 4 ++++
 package/gdb/Config.in.host              | 1 +
 package/gdb/gdb.hash                    | 2 ++
 package/gdb/gdb.mk                      | 7 +++++++
 package/glibc/glibc.hash                | 2 ++
 package/glibc/glibc.mk                  | 3 +++
 support/gnuconfig/config.sub            | 2 ++
 toolchain/toolchain-buildroot/Config.in | 2 +-

This should be split into separate patches:

- binutils
- gcc
- glibc
- toolchain-buildroot
- gdb

Quoted 2 lines
 14 files changed, 50 insertions(+), 2 deletions(-)

[snip]

package/binutils/binutils.mk BINUTILS_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,binutils-gdb, · line 24

Quoted 8 lines
package/binutils/binutils.mk +2 -0
@@ -20,6 +20,14 @@ BINUTILS_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,binutils-gdb,
 BINUTILS_SOURCE = binutils-gdb-$(BINUTILS_VERSION).tar.gz
 BINUTILS_FROM_GIT = y
 endif
+
+ifeq ($(BR2_csky),y)

You also have to update Config.in.host to get rid of the version selection there.

However, I do agree that the pattern you use here is nicer. So I think in
Config.in.host, you should have:

if !BR2_arc && !BR2_csky
choice
prompt "Binutils Version"
default BR2_BINUTILS_VERSION_2_31_X
... (without arc option)
endif

config BR2_BINUTILS_ENABLE_LTO

And in the .mk file, put the condition on the arch outside:

ifeq ($(BR2_arc),y)
BINUTILS_VERSION = arc-2018.09-release BINUTILS_SITE = ...
BINUTILS_SOURCE = ...
else ifeq ($(BR2_csky),y)
...
else
BINUTILS_VERSION = $(call qstrip,$(BR2_BINUTILS_VERSION)) # Version is set when using buildroot toolchain. # If not, we do like other packages
ifeq ($(BINUTILS_VERSION),)
BINUTILS_VERSION = 2.31.1
endif
BINUTILS_SITE = ...
BINUTILS_SOURCE = ...
endif

Obviously, this should be done in two patches: one that refactors the situation
for arc, and a second one that adds csky.

Quoted 22 lines
package/binutils/binutils.mk +6 -0
+BINUTILS_VERSION = c66d8bbcebfddf713b2b436e1b135e6b125a55a5
+BINUTILS_SITE = $(call github,c-sky,binutils-gdb,$(BINUTILS_VERSION))
+BINUTILS_SOURCE = binutils-$(BINUTILS_VERSION).tar.gz
+BINUTILS_FROM_GIT = y
+endif
+
 BINUTILS_SITE ?= $(BR2_GNU_MIRROR)/binutils
 BINUTILS_SOURCE ?= binutils-$(BINUTILS_VERSION).tar.xz
 BINUTILS_EXTRA_CONFIG_OPTIONS = $(call qstrip,$(BR2_BINUTILS_EXTRA_CONFIG_OPTIONS))
package/gcc/Config.in.host +1 -0
index 8e22a4c..3f82696 100644
@@ -3,6 +3,7 @@ comment "GCC Options"
 choice
 	prompt "GCC compiler Version"
 	default BR2_GCC_VERSION_ARC if BR2_arc
+	default BR2_GCC_VERSION_CSKY if BR2_csky
 	default BR2_GCC_VERSION_OR1K if BR2_or1k
 	default BR2_GCC_VERSION_7_X
 	help

package/gcc/Config.in.host config BR2_GCC_VERSION_ARC · line 22

Quoted 8 lines
package/gcc/Config.in.host +5 -0
@@ -14,6 +15,12 @@ config BR2_GCC_VERSION_ARC
 	depends on BR2_arc
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_8
 
+config BR2_GCC_VERSION_CSKY
+	bool "gcc csky"
+	# Only supported architecture
+	depends on BR2_csky
+	select BR2_TOOLCHAIN_GCC_AT_LEAST_6

Note that you can't use the same trick for gcc as for binutils because you need
this select.

Quoted 19 lines
package/gcc/Config.in.host +1 -0
+
 config BR2_GCC_VERSION_OR1K
 	bool "gcc or1k (5.x)"
 	# Only supported architecture
package/gcc/gcc.hash +2 -0
index 4f1e7f9..780484d 100644
@@ -13,3 +13,5 @@ sha512  1811337ae3add9680cec64968a2509d085b6dc5b6783fc1e8c295e3e47416196fd1a3ad8
 sha512  4d12c3ac27b9de9c533be3b8964cf23d21bf6933b5073183e1affe714b0ff33f9d6169e3b55a5c505d7dae33c9bb4f8b0d110461e3a124182d8c8d51b66b8e45  gcc-arc-2018.09-release.tar.gz
 # Locally calculated (fetched from Github)
 sha512  2de7cf47333a4092b02d3bb98f4206f14966f1d139a724d09cf3b22f8a43ae0c704f33e6477d6367a03c29b265480dc900169e9d417006c5d46f0ae446b8c6f1  gcc-or1k-musl-5.4.0-20170218.tar.gz
+# Locally calculated (fetched from https://github.com/c-sky/gcc)
+sha512  1c3564fd6573dce13451a73015e7d88fecbb214dc1df96607976255b1d8b9e60318405333f4f218eea8d07e3675a802b66eff6df3921d505c4036481512792c2  gcc-48152afb96c59733d5bc79e3399bb7b3d4b44266.tar.gz
package/gcc/gcc.mk +0 -0
index 5901624..fd77adc 100644

package/gcc/gcc.mk GCC_SOURCE = gcc-$(GCC_VERSION).tar.gz · line 20

Quoted 5 lines
package/gcc/gcc.mk +2 -0
@@ -16,6 +16,10 @@ GCC_SOURCE = gcc-$(GCC_VERSION).tar.gz
 else ifeq ($(BR2_or1k),y)
 GCC_SITE = $(call github,openrisc,or1k-gcc,$(GCC_VERSION))
 GCC_SOURCE = gcc-$(GCC_VERSION).tar.gz
+else ifeq ($(BR2_csky),y)
+GCC_VERSION = 48152afb96c59733d5bc79e3399bb7b3d4b44266

Move the version definition to Config.in.host like for the others.

support/gnuconfig/config.sub

Quoted 72 lines
package/gcc/gcc.mk +2 -0
+GCC_SITE = $(call github,c-sky,gcc,$(GCC_VERSION))
+GCC_SOURCE = gcc-$(GCC_VERSION).tar.gz
 else
 GCC_SITE = $(BR2_GNU_MIRROR:/=)/gcc/gcc-$(GCC_VERSION)
 # From version 5.5.0, 6.4.0, 7.2.0 and 8.1.0 a bz2 release tarball is not
package/gdb/Config.in.host +1 -0
index 969168f..0aa7d0a 100644
@@ -48,6 +48,7 @@ choice
 	prompt "GDB debugger Version"
 	default BR2_GDB_VERSION_8_1
 	depends on !BR2_arc
+	depends on !BR2_csky
 	help
 	  Select the version of gdb you wish to use.
 
package/gdb/gdb.hash +2 -0
index 1104da5..90a60b0 100644
@@ -6,3 +6,5 @@ sha512  2aa81cfd389bb48c35d7d9f95cc10e88b4f7ad4597bdde0f8f1fd312f60f10d9fb2cc6e5
 
 # Locally calculated (fetched from Github)
 sha512  8303e399e396f5c15dc976e48503fc7d45a720dd1a470443f755c5f2458d092b4392e7ae582abc251bc4b43a778ad784f764286a2a05abfc1649cbeeeb6e7d15 	gdb-arc-2018.09-release-gdb.tar.gz
+# Locally calculated (fetched from https://github.com/c-sky/binutils-gdb)
+sha512  c421e1f3c0d6cfb3c04544573c0c4b0075c8d8e3d563c6c234fcc1e4c2167ab203d1e57aec3b58abd348dc46f8cf9b47b753d3a43dba3ea970c9c9a6bd78c07b	gdb-4ecb98fbc2f94dbe01b69384afbc515107de73df.tar.gz
package/gdb/gdb.mk +7 -0
index a926961..460d21f 100644
@@ -14,6 +14,13 @@ GDB_SOURCE = gdb-$(GDB_VERSION).tar.gz
 GDB_FROM_GIT = y
 endif
 
+ifeq ($(BR2_csky),y)
+GDB_VERSION = 4ecb98fbc2f94dbe01b69384afbc515107de73df
+GDB_SITE = $(call github,c-sky,binutils-gdb,$(GDB_VERSION))
+GDB_SOURCE = gdb-$(GDB_VERSION).tar.gz
+GDB_FROM_GIT = y
+endif
+
 GDB_LICENSE = GPL-2.0+, LGPL-2.0+, GPL-3.0+, LGPL-3.0+
 GDB_LICENSE_FILES = COPYING COPYING.LIB COPYING3 COPYING3.LIB
 
package/glibc/glibc.hash +2 -0
index 5316f03..6e47559 100644
@@ -1,2 +1,4 @@
 # This hash file is not used; instead, update the
 # hash files in the per-version sub-directories.
+# Locally calculated (fetched from https://github.com/c-sky/glibc)
+sha512 9deb2deceefe347d72de13510a5baa3de00f94c684f3b25e136ca3660f61e65a69f2115abb488c2ab0fa93cda8535853ce1e13e186efcc8434ecc4049efd82b5  glibc-7630ed2fa60caea98f500e4a7a51b88f9bf1e176.tar.gz
package/glibc/glibc.mk +3 -0
index 0345f1f..c4ddf8b 100644
@@ -10,6 +10,9 @@ GLIBC_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,glibc,$(GLIBC_VE
 else ifeq ($(BR2_RISCV_32),y)
 GLIBC_VERSION = 06983fe52cfe8e4779035c27e8cc5d2caab31531
 GLIBC_SITE = $(call github,riscv,riscv-glibc,$(GLIBC_VERSION))
+else ifeq ($(BR2_csky),y)
+GLIBC_VERSION = 7630ed2fa60caea98f500e4a7a51b88f9bf1e176
+GLIBC_SITE = $(call github,c-sky,glibc,$(GLIBC_VERSION))
 else
 # Generate version string using:
 #   git describe --match 'glibc-*' --abbrev=40 origin/release/MAJOR.MINOR/master | cut -d '-' -f 2-
support/gnuconfig/config.sub +0 -0
index 6d86a1e..45dd0a7 100755

Err... wouldn't this change be needed to make autotools packages work at all,
regardless of whether it's an external or internal toolchain? So this should *definitely* be a separate patch.

Regards,
Arnout

Quoted 30 lines
support/gnuconfig/config.sub +2 -0
@@ -254,6 +254,7 @@ case $basic_machine in
 	| arc | arceb \
 	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
 	| avr | avr32 \
+	| csky \
 	| ba \
 	| be32 | be64 \
 	| bfin \
@@ -376,6 +377,7 @@ case $basic_machine in
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* | avr32-* \
+	| csky-* \
 	| ba-* \
 	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
toolchain/toolchain-buildroot/Config.in +1 -1
index beb17a2..d9f16e2 100644
@@ -48,7 +48,7 @@ config BR2_TOOLCHAIN_BUILDROOT_GLIBC
 		   BR2_powerpc     || BR2_powerpc64  || BR2_powerpc64le || \
 		   BR2_riscv       || BR2_sh         || BR2_sparc64     || \
 		   BR2_x86_64      || BR2_microblaze || BR2_nios2       || \
-		   (BR2_arcle && BR2_ARC_ATOMIC_EXT)
+		   (BR2_arcle && BR2_ARC_ATOMIC_EXT) || BR2_csky
 	depends on BR2_USE_MMU
 	depends on !BR2_STATIC_LIBS
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_2
author maintainer
#6 lore raw

PATCH 1/3 arch/csky: Add ck860 and vdsp compiler options

In reply to Thomas Petazzoni

Thx Thomas,

Quoted 39 lines · Thomas Petazzoni

Hello Guo,

Thanks for this new csky related contribution. See below some comments.

Quoted 32 lines · On Tue, 7 May 2019 17:47:20 +0800 guoren at kernel.org wrote:

From: Guo Ren <[email protected]>

The ck860 is C-SKY abiv2 cpu series and it could support SMP and vdsp instructions set. Add the compiler options for them.

---
 arch/Config.in.csky | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)
arch/Config.in.csky +4 -1
index e88e4e2..bbff600 100644
@@ -13,19 +13,26 @@ config BR2_ck807
 config BR2_ck810
 	bool "ck810"
 
+config BR2_ck860
+	bool "ck860"
+
 endchoice
 
 config BR2_CSKY_FPU
 	bool "Enable FPU coprocessor"
-	depends on BR2_ck810 || BR2_ck807
+	depends on BR2_ck807 || BR2_ck810 || BR2_ck860
 	help
 	  You can say N here if your C-SKY CPU doesn't have a
 	  Floating-Point Coprocessor or if you don't need FPU support
 	  for your user-space programs.
 
Quoted 6 lines

arch/Config.in.csky config BR2_ck807 · line 28

Quoted 3 lines
arch/Config.in.csky +0 -3
-config BR2_CSKY_DSP
-	bool "Enable DSP enhanced instructions"
-	depends on BR2_ck810 || BR2_ck807

Why is this option being removed ? This is not explained in the commit log.

In fact we haven't used BR2_CSKY_DSP in buildroot, and we change it to VDSP instead. I'll add commnet in commit log.

Quoted 11 lines

arch/Config.in.csky config BR2_ck807 · line 35

Quoted 8 lines
arch/Config.in.csky +7 -0
+config BR2_CSKY_VDSP
+	bool "Enable VDSP 3.0 enhanced instructions Co-processor"
+	depends on BR2_ck860
+
+config BR2_GCC_TARGET_FLOAT_ABI
+	default "soft"		if !BR2_CSKY_FPU
+	default "hard"		if BR2_CSKY_FPU

This should be in a separate patch, it's not a change that is directly related.

Ok

Quoted 47 lines
Quoted 15 lines
arch/Config.in.csky +0 -8
 config BR2_ARCH
 	default "csky"
@@ -34,15 +41,15 @@ config BR2_ENDIAN
 	default "LITTLE"
 
 config BR2_GCC_TARGET_CPU
-	default "ck610"		if (BR2_ck610 && !BR2_CSKY_FPU && !BR2_CSKY_DSP)
-	default "ck807"		if (BR2_ck807 && !BR2_CSKY_FPU && !BR2_CSKY_DSP)
-	default "ck807e"	if (BR2_ck807 && !BR2_CSKY_FPU &&  BR2_CSKY_DSP)
-	default "ck807f"	if (BR2_ck807 &&  BR2_CSKY_FPU && !BR2_CSKY_DSP)
-	default "ck807ef"	if (BR2_ck807 &&  BR2_CSKY_FPU &&  BR2_CSKY_DSP)
-	default "ck810"		if (BR2_ck810 && !BR2_CSKY_FPU && !BR2_CSKY_DSP)
-	default "ck810e"	if (BR2_ck810 && !BR2_CSKY_FPU &&  BR2_CSKY_DSP)
-	default "ck810f"	if (BR2_ck810 &&  BR2_CSKY_FPU && !BR2_CSKY_DSP)

arch/Config.in.csky config BR2_ENDIAN · line 52

Quoted 10 lines
arch/Config.in.csky +9 -1
-	default "ck810ef"	if (BR2_ck810 &&  BR2_CSKY_FPU &&  BR2_CSKY_DSP)
+	default "ck610"		if (BR2_ck610 && !BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck807"		if (BR2_ck807 && !BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck807f"	if (BR2_ck807 &&  BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck810"		if (BR2_ck810 && !BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck810f"	if (BR2_ck810 &&  BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck860"		if (BR2_ck860 && !BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck860f"	if (BR2_ck860 &&  BR2_CSKY_FPU && !BR2_CSKY_VDSP)
+	default "ck860v"	if (BR2_ck860 && !BR2_CSKY_FPU &&  BR2_CSKY_VDSP)
+	default "ck860fv"	if (BR2_ck860 &&  BR2_CSKY_FPU &&  BR2_CSKY_VDSP)

Perhaps this is becoming too much, and we should adopt a solution similar to the one in arch/arch.mk.riscv. I.e, drop the BR2_GCC_TARGET_CPU definition from arch/Config.in.csky, and add a file arch/arch.mk.csky that contains:

ifeq ($(BR2_csky),y)

ifeq ($(BR2_ck610),y)
GCC_TARGET_CPU := ck610
else ifeq ($(BR2_ck807),y)
GCC_TARGET_CPU := ck807
else ifeq ($(BR2_ck810),y)
GCC_TARGET_CPU := ck810
else ifeq ($(BR2_ck860),y)
GCC_TARGET_CPU := ck860
endif

ifeq ($(BR2_CSKY_FPU),y)
GCC_TARGET_CPU := $(GCC_TARGET_CPU)f
endif

Quoted 6 lines

ifeq ($(BR2_CSKY_VDSP),y)
GCC_TARGET_CPU := $(GCC_TARGET_CPU)v
endif

endif

Ok.

Best Regards
Guo Ren

author maintainer
#3 lore raw

PATCH 2/3 arch: Add support for C-SKY toolchain build

In reply to Arnout Vandecappelle
Quoted 33 lines · Arnout Vandecappelle

Hi Guo,

[Very quick review only.]

Quoted 12 lines · guoren at kernel.org

From: Guo Ren <[email protected]>

This enables csky to be built with generated toolchain:
- gcc 6.3
- binutils 2.27
- gdb 7.12
- glibc 2.28

All of them has been tested with csky gitlab-ci based on buildroot:
- https://gitlab.com/c-sky/buildroot/pipelines

Quoted 15 lines
---
 arch/Config.in                          | 1 -
 package/Makefile.in                     | 9 +++++++++
 package/binutils/binutils.hash          | 2 ++
 package/binutils/binutils.mk            | 8 ++++++++
 package/gcc/Config.in.host              | 7 +++++++
 package/gcc/gcc.hash                    | 2 ++
 package/gcc/gcc.mk                      | 4 ++++
 package/gdb/Config.in.host              | 1 +
 package/gdb/gdb.hash                    | 2 ++
 package/gdb/gdb.mk                      | 7 +++++++
 package/glibc/glibc.hash                | 2 ++
 package/glibc/glibc.mk                  | 3 +++
 support/gnuconfig/config.sub            | 2 ++
 toolchain/toolchain-buildroot/Config.in | 2 +-
Quoted 7 lines

This should be split into separate patches:

- binutils
- gcc
- glibc
- toolchain-buildroot
- gdb

Ok

Quoted 49 lines
Quoted 4 lines

 14 files changed, 50 insertions(+), 2 deletions(-)

[snip]

package/binutils/binutils.mk BINUTILS_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,binutils-gdb, · line 24

Quoted 8 lines
package/binutils/binutils.mk +2 -0
@@ -20,6 +20,14 @@ BINUTILS_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,binutils-gdb,
 BINUTILS_SOURCE = binutils-gdb-$(BINUTILS_VERSION).tar.gz
 BINUTILS_FROM_GIT = y
 endif
+
+ifeq ($(BR2_csky),y)

You also have to update Config.in.host to get rid of the version selection there.

However, I do agree that the pattern you use here is nicer. So I think in
Config.in.host, you should have:

if !BR2_arc && !BR2_csky
choice
prompt "Binutils Version"
default BR2_BINUTILS_VERSION_2_31_X
... (without arc option)
endif

config BR2_BINUTILS_ENABLE_LTO

And in the .mk file, put the condition on the arch outside:

ifeq ($(BR2_arc),y)
BINUTILS_VERSION = arc-2018.09-release BINUTILS_SITE = ...
BINUTILS_SOURCE = ...
else ifeq ($(BR2_csky),y)
...
else
BINUTILS_VERSION = $(call qstrip,$(BR2_BINUTILS_VERSION)) # Version is set when using buildroot toolchain. # If not, we do like other packages
ifeq ($(BINUTILS_VERSION),)
BINUTILS_VERSION = 2.31.1
endif
BINUTILS_SITE = ...
BINUTILS_SOURCE = ...
endif

Quoted 2 lines

Obviously, this should be done in two patches: one that refactors the situation
for arc, and a second one that adds csky.

Ok.

Quoted 27 lines
Quoted 27 lines
package/binutils/binutils.mk +6 -0
+BINUTILS_VERSION = c66d8bbcebfddf713b2b436e1b135e6b125a55a5
+BINUTILS_SITE = $(call github,c-sky,binutils-gdb,$(BINUTILS_VERSION))
+BINUTILS_SOURCE = binutils-$(BINUTILS_VERSION).tar.gz
+BINUTILS_FROM_GIT = y
+endif
+
 BINUTILS_SITE ?= $(BR2_GNU_MIRROR)/binutils
 BINUTILS_SOURCE ?= binutils-$(BINUTILS_VERSION).tar.xz
 BINUTILS_EXTRA_CONFIG_OPTIONS = $(call qstrip,$(BR2_BINUTILS_EXTRA_CONFIG_OPTIONS))
package/gcc/Config.in.host +1 -0
index 8e22a4c..3f82696 100644
@@ -3,6 +3,7 @@ comment "GCC Options"
 choice
 	prompt "GCC compiler Version"
 	default BR2_GCC_VERSION_ARC if BR2_arc
+	default BR2_GCC_VERSION_CSKY if BR2_csky
 	default BR2_GCC_VERSION_OR1K if BR2_or1k
 	default BR2_GCC_VERSION_7_X
 	help
@@ -14,6 +15,12 @@ config BR2_GCC_VERSION_ARC
 	depends on BR2_arc
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_8
 
Quoted 8 lines

package/gcc/Config.in.host config BR2_GCC_VERSION_ARC · line 22

Quoted 5 lines
package/gcc/Config.in.host +5 -0
+config BR2_GCC_VERSION_CSKY
+	bool "gcc csky"
+	# Only supported architecture
+	depends on BR2_csky
+	select BR2_TOOLCHAIN_GCC_AT_LEAST_6

Note that you can't use the same trick for gcc as for binutils because you need
this select.

Ok.

Quoted 19 lines
Quoted 19 lines
package/gcc/Config.in.host +1 -0
+
 config BR2_GCC_VERSION_OR1K
 	bool "gcc or1k (5.x)"
 	# Only supported architecture
package/gcc/gcc.hash +2 -0
index 4f1e7f9..780484d 100644
@@ -13,3 +13,5 @@ sha512  1811337ae3add9680cec64968a2509d085b6dc5b6783fc1e8c295e3e47416196fd1a3ad8
 sha512  4d12c3ac27b9de9c533be3b8964cf23d21bf6933b5073183e1affe714b0ff33f9d6169e3b55a5c505d7dae33c9bb4f8b0d110461e3a124182d8c8d51b66b8e45  gcc-arc-2018.09-release.tar.gz
 # Locally calculated (fetched from Github)
 sha512  2de7cf47333a4092b02d3bb98f4206f14966f1d139a724d09cf3b22f8a43ae0c704f33e6477d6367a03c29b265480dc900169e9d417006c5d46f0ae446b8c6f1  gcc-or1k-musl-5.4.0-20170218.tar.gz
+# Locally calculated (fetched from https://github.com/c-sky/gcc)
+sha512  1c3564fd6573dce13451a73015e7d88fecbb214dc1df96607976255b1d8b9e60318405333f4f218eea8d07e3675a802b66eff6df3921d505c4036481512792c2  gcc-48152afb96c59733d5bc79e3399bb7b3d4b44266.tar.gz
package/gcc/gcc.mk +0 -0
index 5901624..fd77adc 100644
Quoted 8 lines

package/gcc/gcc.mk GCC_SOURCE = gcc-$(GCC_VERSION).tar.gz · line 20

Quoted 6 lines
package/gcc/gcc.mk +2 -0
@@ -16,6 +16,10 @@ GCC_SOURCE = gcc-$(GCC_VERSION).tar.gz
 else ifeq ($(BR2_or1k),y)
 GCC_SITE = $(call github,openrisc,or1k-gcc,$(GCC_VERSION))
 GCC_SOURCE = gcc-$(GCC_VERSION).tar.gz
+else ifeq ($(BR2_csky),y)
+GCC_VERSION = 48152afb96c59733d5bc79e3399bb7b3d4b44266

Move the version definition to Config.in.host like for the others.

Ok.

Quoted 69 lines
Quoted 69 lines
package/gcc/gcc.mk +2 -0
+GCC_SITE = $(call github,c-sky,gcc,$(GCC_VERSION))
+GCC_SOURCE = gcc-$(GCC_VERSION).tar.gz
 else
 GCC_SITE = $(BR2_GNU_MIRROR:/=)/gcc/gcc-$(GCC_VERSION)
 # From version 5.5.0, 6.4.0, 7.2.0 and 8.1.0 a bz2 release tarball is not
package/gdb/Config.in.host +1 -0
index 969168f..0aa7d0a 100644
@@ -48,6 +48,7 @@ choice
 	prompt "GDB debugger Version"
 	default BR2_GDB_VERSION_8_1
 	depends on !BR2_arc
+	depends on !BR2_csky
 	help
 	  Select the version of gdb you wish to use.
 
package/gdb/gdb.hash +2 -0
index 1104da5..90a60b0 100644
@@ -6,3 +6,5 @@ sha512  2aa81cfd389bb48c35d7d9f95cc10e88b4f7ad4597bdde0f8f1fd312f60f10d9fb2cc6e5
 
 # Locally calculated (fetched from Github)
 sha512  8303e399e396f5c15dc976e48503fc7d45a720dd1a470443f755c5f2458d092b4392e7ae582abc251bc4b43a778ad784f764286a2a05abfc1649cbeeeb6e7d15 	gdb-arc-2018.09-release-gdb.tar.gz
+# Locally calculated (fetched from https://github.com/c-sky/binutils-gdb)
+sha512  c421e1f3c0d6cfb3c04544573c0c4b0075c8d8e3d563c6c234fcc1e4c2167ab203d1e57aec3b58abd348dc46f8cf9b47b753d3a43dba3ea970c9c9a6bd78c07b	gdb-4ecb98fbc2f94dbe01b69384afbc515107de73df.tar.gz
package/gdb/gdb.mk +7 -0
index a926961..460d21f 100644
@@ -14,6 +14,13 @@ GDB_SOURCE = gdb-$(GDB_VERSION).tar.gz
 GDB_FROM_GIT = y
 endif
 
+ifeq ($(BR2_csky),y)
+GDB_VERSION = 4ecb98fbc2f94dbe01b69384afbc515107de73df
+GDB_SITE = $(call github,c-sky,binutils-gdb,$(GDB_VERSION))
+GDB_SOURCE = gdb-$(GDB_VERSION).tar.gz
+GDB_FROM_GIT = y
+endif
+
 GDB_LICENSE = GPL-2.0+, LGPL-2.0+, GPL-3.0+, LGPL-3.0+
 GDB_LICENSE_FILES = COPYING COPYING.LIB COPYING3 COPYING3.LIB
 
package/glibc/glibc.hash +2 -0
index 5316f03..6e47559 100644
@@ -1,2 +1,4 @@
 # This hash file is not used; instead, update the
 # hash files in the per-version sub-directories.
+# Locally calculated (fetched from https://github.com/c-sky/glibc)
+sha512 9deb2deceefe347d72de13510a5baa3de00f94c684f3b25e136ca3660f61e65a69f2115abb488c2ab0fa93cda8535853ce1e13e186efcc8434ecc4049efd82b5  glibc-7630ed2fa60caea98f500e4a7a51b88f9bf1e176.tar.gz
package/glibc/glibc.mk +3 -0
index 0345f1f..c4ddf8b 100644
@@ -10,6 +10,9 @@ GLIBC_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,glibc,$(GLIBC_VE
 else ifeq ($(BR2_RISCV_32),y)
 GLIBC_VERSION = 06983fe52cfe8e4779035c27e8cc5d2caab31531
 GLIBC_SITE = $(call github,riscv,riscv-glibc,$(GLIBC_VERSION))
+else ifeq ($(BR2_csky),y)
+GLIBC_VERSION = 7630ed2fa60caea98f500e4a7a51b88f9bf1e176
+GLIBC_SITE = $(call github,c-sky,glibc,$(GLIBC_VERSION))
 else
 # Generate version string using:
 #   git describe --match 'glibc-*' --abbrev=40 origin/release/MAJOR.MINOR/master | cut -d '-' -f 2-
Quoted 8 lines

support/gnuconfig/config.sub

Quoted 4 lines
support/gnuconfig/config.sub +0 -0
index 6d86a1e..45dd0a7 100755

Err... wouldn't this change be needed to make autotools packages work at all,
regardless of whether it's an external or internal toolchain? So this should *definitely* be a separate patch.

Ok.

Best Regards
Guo Ren