cc Task for alternate gcc?

Help
2004-10-17
2013-04-24
  • I want to use the cc task for DevKitARM (http://www.devkit.tk), which is basically GCC but with "arm-elf-" appended to the bin names ("arm-elf-gcc", etc...).  What would be the easiest and/or most "correct" way of accomplishing this? 

    Is there some property I can set in the XML buildfile to use an alternate name for the gcc executables? Should I create an entirely new CompilerAdapter?  How would I go about doing that, would it be a trivial "inherit from GccCCompiler and override a simple value?" Or would the only/best way of going about it be more involved?

     
    • I just did this for the ForteC Compiler, the process is fairly easy.

      This is the most correct way:

      1) Take the closest compiler provided by cpptasks (probably the GCC compiler), copy it.

      2) Rename it accordingly (arm-elf-gcc or whatever).

      3) Open the file, change the package and classname to reflect your new compiler file.

      4) It's a singleton class, so you need to change the private static final line to reflect your new class name.  The argument in the constructor is your executable file, change it to arm-elf-gcc.

      5) Do a search & replace to make sure you catch all the changes (there are about 5 changes)

      6) Make similar changes to the Linker if you want to use another linker.  (Don't forget to change the name of the linker class in the Compiler File)

      7) Double check the documentation to make sure all of the flags are the same.

      8) Compile the compiler and the linker adapters into a jar file.  Make your class path point to that file, and use the classname attribute instrad of name in the <cc> task.

      Quickest Way: set an alias for gcc to point to arm-elf-gcc and hope the flags are exactly the same.
      If you also want to change the linker, you will need to do that also.

      Hope this helped,

      Athas