Shop OBEX P1 Docs P2 Docs Learn Events
porting propgcc, anyone know how to switch the toolchain make uses? — Parallax Forums

porting propgcc, anyone know how to switch the toolchain make uses?

rwgast_logicdesignrwgast_logicdesign Posts: 1,464
edited 2012-07-10 23:52 in Propeller 1
so i was wondering if anyone could give me some tips on getting gcc parts cross compiled for arm. ive cross compiled android kernels plenty of times but trying to port propgcc is different in the fact theres no different arch directorys or anything. so im sure my invoking make and setting arch and cross compile isnt the way this is going to work. how exactly can i tell gcc to use the arm toolchain to compile prop loader and gcc insted of the defualt gcc compiler. at first i thought this would be cake which it probably is i just dont know how to switch the compiler make invokes.

Comments

  • ersmithersmith Posts: 6,096
    edited 2012-06-25 14:00
    so i was wondering if anyone could give me some tips on getting gcc parts cross compiled for arm. ive cross compiled android kernels plenty of times but trying to port propgcc is different in the fact theres no different arch directorys or anything. so im sure my invoking make and setting arch and cross compile isnt the way this is going to work. how exactly can i tell gcc to use the arm toolchain to compile prop loader and gcc insted of the defualt gcc compiler. at first i thought this would be cake which it probably is i just dont know how to switch the compiler make invokes.

    Are you asking how to build propgcc for ARM on a Windows machine? That kind of setup is called a "Canadian cross compile" (don't ask me why!). gcc itself, and binutils (ld, objcopy, objdump, and so on) can fairly easily be built this way -- you just have to give a --host= parameter to the gcc and/or binutils configure scripts. The invocations for those are in the jbuild.sh script at the top of the propgcc source tree. For example, gcc for linux is built with something like:
    ../../propgcc/binutils/configure --target=propeller-elf --prefix=/opt/parallax --disable-nls --with-pkgversion=propeller_gcc_v0_3_4 --with-bugurl=http://code.google.com/p/propgcc/issues
    

    To build it with an ARM cross compiler you'd add --host=arm-eabi (that's assuming you're using arm-eabi-gcc as the Android compiler; I haven't done Android development, so perhaps the name is different):
    ../../propgcc/binutils/configure --host=arm-eabi --target=propeller-elf --prefix=/opt/parallax --disable-nls --with-pkgversion=propeller_gcc_v0_3_4 --with-bugurl=http://code.google.com/p/propgcc/issues
    

    The tricky part will be building propeller-load and the libraries. For the Propeller libraries you can just copy over versions built normally on the PC (all the Propeller object files will be the same). Building the linux version of propeller-load with arm-eabi-gcc should be relatively straightforward, but there may be some makefile tweaking required, and you'll probably have to copy over the various .dat files (like c3_cache.dat) from a PC installation.

    Eric
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-06-25 14:29
    im talking about linux with any arm cross compiler. im just trying to remmber how you make, make invoke the arm cross compiler. im a bit rusty at this stuff.
  • ersmithersmith Posts: 6,096
    edited 2012-06-25 14:58
    im talking about linux with any arm cross compiler. im just trying to remmber how you make, make invoke the arm cross compiler. im a bit rusty at this stuff.

    In many programs you just say:
    make CC=arm-eabi-gcc
    
    to change the C compiler used by make. For gcc and binutils, though, there's more to it than that -- you have to configure them differently (as in the examples I posted above). Many GNU projects come with a configure script that allows you to set the host and target. Depending on the project you may be able to also override the compiler on the make command line, but I wouldn't try doing that with gcc -- it needs a lot of configuration beyond just the C compiler to use.
  • Heater.Heater. Posts: 21,230
    edited 2012-06-25 15:09
    This will take you forever to figure out. If you ever do please let us know.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-06-25 17:57
    Thanks ersmith its starting to come back.

    @zicog why do you say that? Ive already got binutils compiled on arm just didnt use a cross compiler. Proploader is what I really need ported to android though its the last missing piece of using BT transparently like a prop plug from an android phone! Im hoping this doesnt get any more harry using cross compliation to port kernels across phones. Ive just been away from linux for so long since I got started with the prop acually. Im finding im a bit rusty, and google has went and realsed a new android ndk where it looks like you have to build the tool chain or something... egh i might not use the ndk for this but well see. If I get an arm port done dont worry i will let everyone know along with all the other stuff this project has entailed. Getting propgcc compiled on arm is the last step as I said I was natively compiling on my phone so I didnt have to muck with arm-eabi but proploader needs bst.linux to compile :/. We have home spun on android Im thinking maybe that can substitute for bstc. Truth is I dont even know what bstc is needed for yet. Im trying to just try to do a straight compile with the tool chain and fix whatever problems may pop up one by one like any other port.
  • jazzedjazzed Posts: 11,803
    edited 2012-06-25 20:31
    ... proploader needs bst.linux to compile :/. We have home spun on android Im thinking maybe that can substitute for bstc. Truth is I dont even know what bstc is needed for yet. Im trying to just try to do a straight compile with the tool chain and fix whatever problems may pop up one by one like any other port.

    These days I think Roy's port of Chip's Spin compiler can be used. http://code.google.com/p/open-source-spin-compiler/
    I have not confirmed it yet though.
  • Daniel HarrisDaniel Harris Posts: 207
    edited 2012-06-26 10:13
    jazzed wrote: »
    These days I think Roy's port of Chip's Spin compiler can be used. http://code.google.com/p/open-source-spin-compiler/
    I have not confirmed it yet though.

    Fully vetting Roy's port of the Spin compiler is officially on the books. That should be happening in the near future.
  • jazzedjazzed Posts: 11,803
    edited 2012-06-26 10:44
    Fully vetting Roy's port of the Spin compiler is officially on the books. That should be happening in the near future.

    Great :)

    Meanwhile we need to test whether or not we can replace bstc versions with Roy's "spin" in the make files. I don't have time to do that right now.

    Thanks,
    --Steve
  • D.PD.P Posts: 790
    edited 2012-06-26 12:06
    jazzed wrote: »
    Great :)

    Meanwhile we need to test whether or not we can replace bstc versions with Roy's "spin" in the make files. I don't have time to do that right now.

    Thanks,
    --Steve

    Just built the compiler from source and tested a few demos on Mac OSX 10.6.8 without error. Hat tip to Roy btw.
  • dgatelydgately Posts: 1,633
    edited 2012-07-10 23:52
    D.P wrote: »
    Just built the compiler from source and tested a few demos on Mac OSX 10.6.8 without error. Hat tip to Roy btw.

    Just built the spin compiler from this source on a RaspberryPi (ARM), running Debian Linux and was able to compile the test.spin file and the output test.binary matches the file compiled on Mac OS X 10.7.4!

    I then compiled Dave Hein's Spin Simulator on the Raspberry and...
    pi@raspberrypi ~/src/open-source-spin-compiler-read-only/spinsim027-2 $ ../spin test.spin         [COLOR=#ff0000]<== compile the example from the spinsim .zip[/COLOR]
    Propeller Spin/PASM Compiler (c)2012 Parallax Inc. DBA Parallax Semiconductor.
    Compiled on Jul 10 2012
    Compiling test.spin...
    Done.
    Program size is 3388 bytes
    
    
    pi@raspberrypi ~/src/open-source-spin-compiler-read-only/spinsim027-2 $ ls                               [COLOR=#ff0000]<== list & look for a new "test.binary"[/COLOR]
    buildit.bat  demo.spin     hello.binary   memtest.binary  pasmsim.o     spininterp.o  [B][COLOR=#020FC0]test.binary[/COLOR][/B]
    conion.c     echo.binary   hello.spin     memtest.spin    rom.h         spinsim       test.spin
    conion.h     echo.spin     interp.h       opcodes.h       spindebug.c   spinsim.c
    conion.o     extmem1.spin  loader.binary  pasmdebug.c     spindebug.h   spinsim.exe
    conio.spin   extmem.spin   loader.spin    pasmdebug.o     spindebug.o   spinsim.o
    demo.binary  fileio.spin   Makefile       pasmsim.c       spininterp.c  test1.binary
    
    
    pi@raspberrypi ~/src/open-source-spin-compiler-read-only/spinsim027-2 $ ./spinsim test.binary    [COLOR=#ff0000]<== run the compiled code in the simulator[/COLOR]
    Cog 1 starting up
    Cog 2 starting up
    Cog 3 starting up
    Cog 4 starting up
    Cog 5 starting up
    Cog 1 shutting down
    Cog 1 starting up
    Cog 2 shutting down
    Cog 2 starting up
    Cog 6 starting up
    Cog 3 shutting down
    Cog 3 starting up
    Cog 4 shutting down
    Cog 4 starting up
    Cog 5 shutting down
    Cog 5 starting up
    Cog 1 shutting down
    Cog 1 starting up
    Cog 2 shutting down
    Cog 2 starting up
    Cog 6 shutting down
    Cog 6 starting up
    Cog 3 shutting down
    Cog 3 starting up
    Cog 4 shutting down
    Cog 4 starting up
    Cog 5 shutting down
    Cog 5 starting up
    Cog 1 shutting down
    Cog 1 starting up
    Cog 2 shutting down
    Cog 2 starting up
    Cog 6 shutting down
    Cog 6 starting up
    Cog 3 shutting down
    Cog 3 starting up
    Cog 4 shutting down
    Cog 5 shutting down
    Cog 1 shutting down
    Cog 2 shutting down
    Cog 6 shutting down
    Cog 3 shutting down
    


    Looks like Roy's code and Dave's Spin Simulator will be quite useful on ARM!

    dgately
Sign In or Register to comment.