[PATCH] add better support for Raspberry Pi board

Karel Gardas karel.gardas at centrum.cz
Fri Jan 25 16:56:59 CET 2013


This patch adds support for Raspberry Pi board. The board is based
on Broadcom BCM2835, which includes ARM1176JZF-S CPU core. The core
is classical ARM11 so implementing ARMv6 ISA, but also provides VFPv2 FPU
unit. As this looks like fairly popular hardware, in this patch we assume
detected ARMv6 hardware to support VFPv2. Also as Raspberry Pi is very commonly
used with hard-float ABI Linux distribution, the patch relaxes a condition
of "hard-float support for ARMv7 only" to any general ARM core.
---
 aclocal.m4                      |    2 +-
 compiler/main/DriverPipeline.hs |    9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index edbe389..b23568f 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -369,7 +369,7 @@ AC_DEFUN([GET_ARM_ISA],
                 [AC_DEFINE(arm_HOST_ARCH_PRE_ARMv7, 1, [ARM pre v7])
                  changequote(, )dnl
                  ARM_ISA=ARMv6
-                 ARM_ISA_EXT="[]"
+                 ARM_ISA_EXT="[VFPv2]"
                  changequote([, ])dnl
                 ],
                 [changequote(, )dnl
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index c24bb51..81d0bc0 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1454,14 +1454,17 @@ runPhase LlvmLlc input_fn dflags
                                       else if (elem VFPv3D16 ext)
                                            then ["-mattr=+v7,+vfp3,+d16"]
                                            else []
+                   ArchARM ARMv6 ext _ -> if (elem VFPv2 ext)
+                                          then ["-mattr=+v6,+vfp2"]
+                                          else ["-mattr=+v6"]
                    _                 -> []
         -- On Ubuntu/Debian with ARM hard float ABI, LLVM's llc still
         -- compiles into soft-float ABI. We need to explicitly set abi
         -- to hard
         abiOpts = case platformArch (targetPlatform dflags) of
-                    ArchARM ARMv7 _ HARD -> ["-float-abi=hard"]
-                    ArchARM ARMv7 _ _    -> []
-                    _                    -> []
+                    ArchARM _ _ HARD -> ["-float-abi=hard"]
+                    ArchARM _ _ _    -> []
+                    _                -> []
 
         sseOpts | isSse4_2Enabled dflags = ["-mattr=+sse42"]
                 | isSse2Enabled dflags   = ["-mattr=+sse2"]
-- 
1.7.3.2




More information about the ghc-devs mailing list