arch/csky: move GCC_TARGET_CPU calculation to arch.mk.csky
authorGuo Ren <ren_guo@c-sky.com>
Fri, 31 May 2019 06:38:58 +0000 (14:38 +0800)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Fri, 31 May 2019 20:59:57 +0000 (22:59 +0200)
Calculating GCC_TARGET_CPU requires combining multiple flags, which
isn't very nicely expressed in Config.in, so let's move this into
arch.mk.csky, similarly to what is done in arch.mk.riscv.

Signed-off-by: Guo Ren <ren_guo@c-sky.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
[Thomas: rework commit log]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
arch/Config.in.csky
arch/arch.mk.csky [new file with mode: 0644]

index 420e831c215a8b2fc710c5dde62cd915dfed903c..a9d6548d8ee9a99c3fc2aa0b87ea0ed99d1db0d8 100644 (file)
@@ -33,17 +33,6 @@ config BR2_ARCH
 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)
-
 config BR2_READELF_ARCH_NAME
        default "CSKY"
 
diff --git a/arch/arch.mk.csky b/arch/arch.mk.csky
new file mode 100644 (file)
index 0000000..a39fbd4
--- /dev/null
@@ -0,0 +1,24 @@
+#
+# Configure the GCC_TARGET_ARCH variable and append the
+# appropriate C-SKY ISA extensions.
+#
+
+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
+endif
+
+ifeq ($(BR2_CSKY_DSP),y)
+GCC_TARGET_CPU := $(GCC_TARGET_CPU)e
+endif
+
+ifeq ($(BR2_CSKY_FPU),y)
+GCC_TARGET_CPU := $(GCC_TARGET_CPU)f
+endif
+
+endif