I am busy porting gcc to an 8-bit processor we design earlier. I is kind of a difficult task for our machine because it is 8-bit and we have only one accumulator, but if you have more resources it can became easy. This is how we are trying to manage it with gcc 4.9 and using cygwin:
- Download gcc 4.9 source
- Add your architecture name to
config.subaround line 250 look for# Decode aliases for certain CPU-COMPANY combinations.In that list add| my_processor \ - In that same file look for
# Recognize the basic CPU types with company name.add yourself to the list:| my_processor-* \ -
Search for the file
gcc/config.gcc, in the file look for case ${target} it is around line 880, add yourself in the following way:;; my_processor*-*-*) c_target_objs="my_processor-c.o" cxx_target_objs="my_processor-c.o" target_has_targetm_common=no tmake_file="${tmake_file} my_processor/t-my_processor" ;; - Create a folder
gcc-4.9.0\gcc\config\my_processor - Copy files from an existing project and just edit it, or create your own from scratch. In our project we had copied all the files from the msp430 project and edited it all
- You should have the following files (not all files are mandatory):
my_processor.cmy_processor.hmy_processor.mdmy_processor.optmy_processor-c.cmy_processor.defmy_processor-protos.hconstraints.mdpredicates.mdREADME.txtt-my_processor
- create a path
gcc-4.9.0/build/object - run
../../configure --target=my_processor --prefix=path for my compiler --enable-languages="c" - make
- make install
- Do a lot of research and debugging.
- Have fun.