porting propgcc, anyone know how to switch the toolchain make uses?
rwgast_logicdesign
Posts: 1,464
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
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:
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):
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
In many programs you just say: 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.
@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.
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.
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.
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...
Looks like Roy's code and Dave's Spin Simulator will be quite useful on ARM!
dgately