From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,adb9cee03b15db43,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.180.107.167 with SMTP id hd7mr1086881wib.0.1343516182434; Sat, 28 Jul 2012 15:56:22 -0700 (PDT) Path: ge7ni114333777wib.0!nntp.google.com!goblin2!goblin.stu.neva.ru!aioe.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Jan Andres Newsgroups: comp.lang.ada Subject: GNAT GPL 2012 on Raspberry Pi Date: Sat, 28 Jul 2012 22:56:21 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: Mime-Version: 1.0 Injection-Date: Sat, 28 Jul 2012 22:56:21 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="c5727789efd7c416eba12f7c4b6b66c9"; logging-data="21777"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX186yMKw8Pjme4CLK/2eHf0c2HDJRdxPnuc=" User-Agent: slrn/0.9.9p1 (Linux) Cancel-Lock: sha1:VMgPBC3M1gWwrsX2rqiyYT7VFSw= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: 2012-07-28T22:56:21+00:00 List-Id: So a couple of days ago the postman finally brought that Raspberry Pi I had ordered a long time ago and I found some time to take a look at it. I installed Raspbian "wheezy", a slightly adapted version of Debian optimized for the Pi. It has binary packages of gcc-4.6.x with Ada support, but not for GNAT GPL, so I played around a bit with bootstrapping GNAT GPL 2012 from my x86_64 Linux box. It only takes a few minor tweaks and the resulting compiler seems to be working well at first glance. (I haven't run the test suite, though.) I thought I'd share this just in case it's useful to someone. Below are some notes about the build process and a patch to be applied to the GNAT GPL source tree in order to build for Raspbian. Note that the build process is somewhat glitchy in places so if you're having trouble, try to follow the build instructions as closely as possible. Note especially that although the Raspbian distribution refers to its architecture as "arm-linux-gnueabihf", the "hf" suffix must be omitted when building GNAT GPL. Host: Fedora 17 x86_64 Target: Raspbian wheezy preparations: ------------- install native gnat-gpl-2012 binaries for x86_64 prepend gnat-gpl's bin directory to PATH create image of target system in /home/jan/arm unpack binutils version 2.22 (other versions may work) unpack gcc-4.5-2012 and gnat-gpl-2012 move ada subdirectory from gnat-gpl to gcc (cf. README.BUILD) apply patch for gcc-4.5-2012 step 0: binutils ---------------- cd binutils-2.22 mkdir o cd o ../configure --prefix=/home/jan/gcc-cross1 --build=x86_64-redhat-linux --host=x86_64-redhat-linux --target=arm-linux-gnueabi --with-sysroot=/home/jan/arm make make install prepend /home/jan/gcc-cross1 to PATH for the following steps step 1: cross compiler ---------------------- cd gcc-4.5-2012-src mkdir o-cross cd o-cross ../configure --prefix=/home/jan/gcc-cross1 --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=arm-linux-gnueabi --enable-languages=c,ada --with-sysroot=/home/jan/arm --disable-nls --enable-serial-configure --disable-shared --disable-libada --with-arch=armv6 --with-fpu=vfp --with-float=hard make -> build terminates in libgcc, bits/predefs.h: No such file or directory patch up gcc/specs -> for cpp, add -I/home/jan/arm/usr/include/arm-linux-gnueabihf -> set multilib to .:arm-linux-gnueabihf make -> build should now finish make -C gcc gnatlib cross-gnattools make -C gcc ada.all.cross make install cd /home/jan/gcc-cross1/lib/gcc/arm-linux-gnueabi/4.5.4/ arm-linux-gnueabi-gcc -dumpspecs >specs patch up specs as above step 2: native compiler for ARM ------------------------------- cd gcc-4.5-2012-src mkdir o-native cd o-native ../configure --prefix=/home/jan/gnat-native-arm --build=x86_64-pc-linux-gnu --host=arm-linux-gnueabi --target=arm-linux-gnueabi --enable-languages=c,ada --disable-nls --enable-serial-configure --disable-shared --disable-libada --with-arch=armv6 --with-fpu=vfp --with-float=hard make make -C gcc gnatlib GCC_FOR_TARGET=arm-linux-gnueabi-gcc make -C gcc gnattools GNATBIND_FOR_HOST=arm-linux-gnueabi-gnatbind GNATMAKE_FOR_HOST=arm-linux-gnueabi-gnatmake GNATLINK_FOR_HOST=arm-linux-gnueabi-gnatlink make install and copy /home/jan/gnat-native-arm to target from here on, work on target cd /home/jan/gnat-native-arm/lib/gcc/arm-linux-gnueabi/4.5.4/ /home/jan/gnat-native-arm/bin/gcc -dumpspecs >specs patch up specs as above, but use -I/usr/include/arm-linux-gnueabihf this time NOTES ----- Backend exceptions (aka ZCX) are currently disabled as they have issues (most exceptions get the program caught in an infinite loop). To enable set EH_MECHANISM in gcc-interface/Makefile.in and set ZCX_By_Default in system-linux-arm.adb. diff -urN gcc-4.5-2012-src/gcc/ada/gcc-interface/Makefile.in gcc-4.5-2012-patched/gcc/ada/gcc-interface/Makefile.in --- gcc-4.5-2012-src/gcc/ada/gcc-interface/Makefile.in 2012-04-17 20:53:53.000000000 +0200 +++ gcc-4.5-2012-patched/gcc/ada/gcc-interface/Makefile.in 2012-07-28 21:31:15.408271476 +0200 @@ -1124,6 +1124,55 @@ LIBRARY_VERSION := $(LIB_VERSION) endif +# ARM Linux +ifeq ($(strip $(filter-out arm% linux%,$(arch) $(osys))),) + LIBGNAT_TARGET_PAIRS = \ + a-intnam.ads. -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +package System is + pragma Pure; + -- Note that we take advantage of the implementation permission to make + -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada + -- 2005, this is Pure in any case (AI-362). + + type Name is (SYSTEM_NAME_GNAT); + System_Name : constant Name := SYSTEM_NAME_GNAT; + + -- System-Dependent Named Numbers + + Min_Int : constant := Long_Long_Integer'First; + Max_Int : constant := Long_Long_Integer'Last; + + Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size; + Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1; + + Max_Base_Digits : constant := Long_Long_Float'Digits; + Max_Digits : constant := Long_Long_Float'Digits; + + Max_Mantissa : constant := 63; + Fine_Delta : constant := 2.0 ** (-Max_Mantissa); + + Tick : constant := 0.000_001; + + -- Storage-related Declarations + + type Address is private; + pragma Preelaborable_Initialization (Address); + Null_Address : constant Address; + + Storage_Unit : constant := 8; + Word_Size : constant := 32; + Memory_Size : constant := 2 ** 32; + + -- Address comparison + + function "<" (Left, Right : Address) return Boolean; + function "<=" (Left, Right : Address) return Boolean; + function ">" (Left, Right : Address) return Boolean; + function ">=" (Left, Right : Address) return Boolean; + function "=" (Left, Right : Address) return Boolean; + + pragma Import (Intrinsic, "<"); + pragma Import (Intrinsic, "<="); + pragma Import (Intrinsic, ">"); + pragma Import (Intrinsic, ">="); + pragma Import (Intrinsic, "="); + + -- Other System-Dependent Declarations + + type Bit_Order is (High_Order_First, Low_Order_First); + Default_Bit_Order : constant Bit_Order := Low_Order_First; + pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning + + -- Priority-related Declarations (RM D.1) + + -- 0 .. 98 corresponds to the system priority range 1 .. 99. + -- + -- If the scheduling policy is SCHED_FIFO or SCHED_RR the runtime makes use + -- of the entire range provided by the system. + -- + -- If the scheduling policy is SCHED_OTHER the only valid system priority + -- is 1 and other values are simply ignored. + + Max_Priority : constant Positive := 97; + Max_Interrupt_Priority : constant Positive := 98; + + subtype Any_Priority is Integer range 0 .. 98; + subtype Priority is Any_Priority range 0 .. 97; + subtype Interrupt_Priority is Any_Priority range 98 .. 98; + + Default_Priority : constant Priority := 48; + +private + + type Address is mod Memory_Size; + Null_Address : constant Address := 0; + + -------------------------------------- + -- System Implementation Parameters -- + -------------------------------------- + + -- These parameters provide information about the target that is used + -- by the compiler. They are in the private part of System, where they + -- can be accessed using the special circuitry in the Targparm unit + -- whose source should be consulted for more detailed descriptions + -- of the individual switch values. + + Backend_Divide_Checks : constant Boolean := False; + Backend_Overflow_Checks : constant Boolean := True; + Command_Line_Args : constant Boolean := True; + Configurable_Run_Time : constant Boolean := False; + Denorm : constant Boolean := True; + Duration_32_Bits : constant Boolean := False; + Exit_Status_Supported : constant Boolean := True; + Fractional_Fixed_Ops : constant Boolean := False; + Frontend_Layout : constant Boolean := False; + Machine_Overflows : constant Boolean := False; + Machine_Rounds : constant Boolean := True; + Preallocated_Stacks : constant Boolean := False; + Signed_Zeros : constant Boolean := True; + Stack_Check_Default : constant Boolean := False; + Stack_Check_Probes : constant Boolean := True; + Stack_Check_Limits : constant Boolean := False; + Support_Aggregates : constant Boolean := True; + Support_Composite_Assign : constant Boolean := True; + Support_Composite_Compare : constant Boolean := True; + Support_Long_Shifts : constant Boolean := True; + Always_Compatible_Rep : constant Boolean := False; + Suppress_Standard_Library : constant Boolean := False; + Use_Ada_Main_Program_Name : constant Boolean := False; + ZCX_By_Default : constant Boolean := False; + +end System;