AVRGCC compiler source code?

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AVRGCC is an open source software, Is that's means that anybody can access the source code of AVRGCC compiler?

If yes, where can I found the source code of AVRGCCC compiler?

I want to learn more about compilers and studing an already working in use compiler this will help a lot.

Any idea about AVRGCC compiler source code?

Learn as long as you live

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quickest route is probably to get Bingo's script in the sticky thread above and if you don't use the last step to erase the source it'll be left on your disk after building the toolchain. Expect this to use a lot of time and disk space though.

If you just want to get the source of a "generic" GCC (rather than AVR specifically patched one) then just go to:

http://gcc.gnu.org/

and from there (for example):

http://gcc-ca.internet.bs/releases/

Or in a Linux system just "apt-get source" on the .deb

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A good way to learn about a C compiler is the LCC compiler there is a book that explain the structures etc. And you can get it to generate symbolic code so you can see how it 'think'.
The Imagecraft compiler is (or at least was)based on the LCC.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

While some of the AVR-GCC distributions might include AVR-specific patches, the "standard" GCC distribution includes AVR support - it's just normally not compiled in.

For example, Gentoo Linux builds the AVR GNU toolchain using the standard process for building a cross-compile environment from the main GNU GCC tarballs.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

atdodd wrote:
While some of the AVR-GCC distributions might include AVR-specific patches, the "standard" GCC distribution includes AVR support - it's just normally not compiled in.

True...
Quote:

For example, Gentoo Linux builds the AVR GNU toolchain using the standard process for building a cross-compile environment from the main GNU GCC tarballs.

I'm guessing you haven't actually tried that. I have.

Gentoo's crossdev tool is about making dev's lives easier, not about making your life easier. avr-gcc build with crossdev on Gentoo is extremely unlikely to be up to date on patches. Even on Gentoo, you are better off to use the Bingo scripts and building everything into a local directory such as /usr/local/avr so that you can easily update it or blow it away without confusing the package manager.

To the OP: As people have been saying, avr-gcc is just gcc built with appropriate configure switches. Get the source to gcc, http://gcc.gnu.org/ and you have avr-gcc.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I want to learn more about compilers and studing an already working in use compiler this will help a lot.

Actually sparrow2's advice was the best. If you want to learn how a C compiler works do NOT try to do it with GCC. Alongside Linux kernel I haven't seen many more complicated, multi-layered C projects in my life. You could spend years just learning small parts of it and I doubt that there are many if any people who now have a complete picture of how all parts work as these things have grown organically with various bits being developed by various parties to deliver the features they specifically wanted to see.

To understand a C compiler there a number of good books on the subject and there are a number of small C compilers (SDCC is another) which have a size/structure that one person alone can probably get their brain around. GCC, for sure, ain't in this catergory!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Another thing to do if interested in the principles of compilers, apart from getting an overall coverage book, is to get a book on "Flex and Bison". Not only will you learn a lot about lexical analysis and syntactic parsing. Chances are that you will lern two new generic tools that you can use for all sorts of serious stuff, and a lot of fun.

If I understand it correctly GCC is currently neither Flex nor Bison based, but don't let that stop you.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To learn how a C compiler works, I would look into something like 'Tiny C':
http://bellard.org/tcc/

gcc is big and complex, it will take a lot of effort to understand even parts of it.

Markus