Author Topic: do you know any open source C compiler for mips, in addition to gcc ?  (Read 15723 times)

0 Members and 1 Guest are viewing this topic.

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
hi guys
i know and use gcc for mips but i do not like it at all, i guess if an other open source C compiler is existing in addition to gcc.
do you know any ?

i used SDCC for tiny 8 bit machine, such as intel 8051 core, especially dal semi 80C390/80C400, and it is great! Also its sources are well written. I HATE the GNU complexity about design and sources, so let me know.

my target is a SoftCore MIPS1 (R3000 compliant)
 

Offline rob77

  • Super Contributor
  • ***
  • Posts: 2085
  • Country: sk
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #1 on: August 01, 2014, 05:46:09 pm »
actually i'm not aware of any other usable open source compilers than the GCC family and SDCC ;)

btw.. what's wrong with GCC ?
 

Offline gxti

  • Frequent Contributor
  • **
  • Posts: 507
  • Country: us
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #2 on: August 01, 2014, 06:22:26 pm »
It looks like Clang LLVM might have some MIPS support.
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #3 on: August 01, 2014, 06:31:28 pm »
I HATE the GNU complexity about design and sources

What complexity? GCC's codebase itself is positively huge, sure - but it's complex to use?
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline rob77

  • Super Contributor
  • ***
  • Posts: 2085
  • Country: sk
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #4 on: August 01, 2014, 08:54:46 pm »
well.... i would suggest to BUY yourself a commercial compiler for MIPS then...

if GCC is such a crap , then stop using open source software , because the vast majority of the open source software is compiled with GCC.

or probably you should write your own compiler if you're such an expert and you know it better how to write compilers.

 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #5 on: August 01, 2014, 09:31:07 pm »
Most of your gripes seem to be related to building and developing for GCC. Don't you just want to use it?
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline rob77

  • Super Contributor
  • ***
  • Posts: 2085
  • Country: sk
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #6 on: August 02, 2014, 10:11:07 am »
consuming and bitching about the quality -> that's suitable for commercial products.

consuming, improving, sharing the improvements -> that's open-source

if you know how to improve it, then share your ideas with the worlds, or eventually propose a patch/fix. bitching at some open source product will not help you.
 

Offline snoopy

  • Frequent Contributor
  • **
  • Posts: 767
  • Country: au
    • Analog Precision
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #7 on: August 02, 2014, 01:44:09 pm »
i guess if somebody has already written a C compiler for mips-only, this design (targeting to a RISC machine only, instead of abstracting things) should result easier to be implemented and supported than the elephants in GCC

Isn't the latest PIC32 micros based on the MIPS 5000 core ?

cheers
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #8 on: August 02, 2014, 01:53:42 pm »
gcc is also a pain in the ass to be compiled, as the fact practically people use a precompiled gcc packages, gcc under gentoo is … critical

Then pay for professional support.

Let's see, who owns MIPS now?
Ah, Imagination Tech.

What do they recommend as tools, where should you deliver your money to?
Aha, http://www.imgtec.com/tools/mips-tools/ points to Mentor Sourcery.

What is Mentor Sourcery based on?
Ups, GNU GCC.

So here you have it. Don't want to mess with your own GNU compiler build? Pay Mentor to do it for you.

By the way GCC was always THE MIPS compiler. Even when MIPS was still an own company they did recommended GCC, maintained the MIPS part of GCC, and even delivered an own build, then called SDE. In other words, whatever you think about GCC, it is unlikely you get a better MIPS compiler than it.
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List
 

Offline WarSim

  • Frequent Contributor
  • **
  • Posts: 514
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #9 on: August 02, 2014, 02:38:02 pm »
Interesting, You are the first person in the programming field I have heard of having these issues.  I did get some info from between the rants, I'll ask some past colleagues still working about them if I get the chance.  Just because I find this interesting.   
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6190
  • Country: us
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #10 on: August 02, 2014, 02:39:02 pm »
We got the point. The universe owes you  a compiler for your liking.
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #11 on: August 02, 2014, 02:43:39 pm »
If I were having a whole bunch of show-stopping problems with a well-established piece of software that's generally liked, I'd start to consider a PEBCAK.

Hmm... if only other compilers were as "shitty" as GCC. *frowns at Microchip's xc8*
« Last Edit: August 02, 2014, 02:46:54 pm by c4757p »
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline AlfBaz

  • Super Contributor
  • ***
  • Posts: 2184
  • Country: au
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #12 on: August 02, 2014, 02:45:39 pm »
Microsoft have a mips C/C++ compiler as part of their suite of "Compilers for Smart Devices"
http://msdn.microsoft.com/en-us/library/bb187718(v=vs.80).aspx

I have no idea how shit it is ::)
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #13 on: August 02, 2014, 03:06:18 pm »
If I were having a whole bunch of show-stopping problems with a well-established piece of software that's generally liked, I'd start to consider a PEBCAK.
Only a couple of billion devices (including set-top boxes with MIPS processors) run software compiled with GCC so GCC must be shit  |O
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1198
  • Country: fi
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #14 on: August 02, 2014, 03:07:36 pm »
Isn't the latest PIC32 micros based on the MIPS 5000 core ?
PIC32MX uses the M4K core, PIC32MZ uses M14K (or "microAptiv").

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #15 on: August 02, 2014, 03:23:33 pm »
Quote
do you know any open source C compiler for mips, in addition to gcc ?

I would suggest that you focus on finding a compiler that works for you, be it open source or otherwise.

Unless philosophical arguments are more important to you.
================================
https://dannyelectronics.wordpress.com/
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #16 on: August 02, 2014, 04:06:36 pm »
Lets see. You decided to use a MIPS soft core. Now you have great pains finding a compiler that suits your royal highness. Wouldn't the choice of a MIPS softcore count as a self inflicting wound? A Court Martial offense in some circles ...
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List
 

Offline bwat

  • Frequent Contributor
  • **
  • Posts: 278
  • Country: se
    • My website
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #17 on: August 02, 2014, 06:17:06 pm »
You decided to use a MIPS soft core.

I didn't want to be the one to bring this up but since you did, there are parallels between his VHDL processor model and his compiler:
i) both were free,
ii) both don't seem to work right, and
iii) he needs other people to fix them.
"Who said that you should improve programming skills only at the workplace? Is the workplace even suitable for cultural improvement of any kind?" - Christophe Thibaut

"People who are really serious about software should make their own hardware." - Alan Kay
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6190
  • Country: us
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #18 on: August 02, 2014, 06:23:39 pm »
... I'd start to consider a PEBCAK.

First time I hear this term. I like it ;-)
 

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1988
  • Country: dk
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #19 on: August 02, 2014, 09:49:57 pm »
Normally i would not bother.....
But this is to much ...
 @op but a commercial compiler  , and stop whining aboout gcc.

Have fun if ever building Linux on a non gcc  tc

/Bingo

Ohh and latest isn't greatest on mipsel
« Last Edit: August 02, 2014, 09:52:24 pm by bingo600 »
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #20 on: August 02, 2014, 10:07:56 pm »
Have fun if ever building Linux on a non gcc  tc

my Atlas board was developed by MIPS Inc. around linux 2.4 and in their "companion CD" it comes supported by an old version of gcc (it may be 2.95, i don't remember), what is surprising my is that in an ideal wonderland the kernel is written in C, and C should be portable by its definition, so i fuss why the hell on a modern linux distro, which comes with gcc-4.5 i can't recompile the kernel linux 2.4, which was compiled with an old (GNU)-c compiler, with a modern (GNU)-c-compiler. Probably because GCC is so "pretty" that is incompatible with itself  :palm:
« Last Edit: August 02, 2014, 11:02:55 pm by legacy »
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #21 on: August 02, 2014, 10:20:33 pm »
Wouldn't the choice of a MIPS softcore count as a self inflicting wound?

in short, i have a commercial C compiler that is excellent and i am very happy with it, unfortunately it requires a license and it runs on a SGI workstation, so my problem is supporting other people (i mean who wants to collaborate to the SoftCore project), for example i can't ask a guy to buy an SGI workstation and installing IRIX (which means paying for a flex license of MIPS/PRO) in order to help me about the development.
« Last Edit: August 02, 2014, 10:58:29 pm by legacy »
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #22 on: August 02, 2014, 10:29:04 pm »
@bwat
to be honest was not interested about speaking about gcc, how it is shit, and other things, i was simply asking if someone has read/seen/used an alternative C compiler for MIPS, people here seems to use only gcc so i'd better look alternatives by myself.
« Last Edit: August 02, 2014, 10:55:37 pm by legacy »
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6190
  • Country: us
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #23 on: August 02, 2014, 10:42:20 pm »
... GNU is so shit that is incompatible with itself !

Ok, got it, you are a troll, and I I failed for it. Good job.
« Last Edit: August 02, 2014, 10:44:25 pm by zapta »
 

Offline WarSim

  • Frequent Contributor
  • **
  • Posts: 514
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #24 on: August 02, 2014, 10:59:44 pm »

i) both were free,

my Softcore is not OpenSource, you can collaborate and getting sources for your personal use but you are not allowed to put anything on the web

ii) both don't seem to work right, and

yeah, it is not working for the 100% of its ISA, also it has 17 bugs in its list, with a real fixage of 10, 10/17 fixed in the last month, that also means i did, and i am doing, deeply tests and validation, there a lot of SoftCores in the web which are claiming to be working when nobody has really tested and validated them, you should appreciate that i do not tell bullshit to people!

iii) he needs other people to fix them.

I have simply asked things and advices on this forum, asking guys if they want to collaborate. What's wrong with that ?


And about this thread: i am asking if someone has read/seen/used an alternative C compiler for MIPS.

Thank you for this response.  Now I know never to listen to you ever again.  A rant is not a request for advice.  Now I am convinced that your out of scope and misuse of terms are not a language barrier, you just love to hear yourself rant. 

And to answer one of you issues.  Yes there are several compilers that can be retargeted to MIPS, so go look for them. 

I am not waisting any more of my time nor my friends time on you so I will thank you not to try to ask anything more from me. 

Goodbye
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6190
  • Country: us
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #25 on: August 02, 2014, 11:03:26 pm »
Ok, got it, you are a troll, and I I failed for it. Good job.

would you like to try by yourself ?
you can do this experiment
1) buy an Atlas board
2) get its SDE companion CD
3) try to compile things

good job

So, it has a bug, on the other hand it runs the world. I would be more respectful, especially that it's free.

 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #26 on: August 02, 2014, 11:06:34 pm »
I am not waisting any more of my time nor my friends time on you so I will thank you not to try to ask anything more from me. 

exactly when you have helped/suggested me ?

i have opened this thread asking for an alternative of gcc
and people is hardly talking about what i do not want to use !
> Topic: do you know any open source C compiler for mips, in addition to gcc ? <
> answer:  there are several compilers that can be retargeted to MIPS, use gcc <
that is my time trashed, first of all !

edit:
btw i have cleared all i have written in this thread
and about time trashing ... it seems to me like when i posted my filesystem sources
asking for advices and suggestions and i got very useful offensive responses :palm:
« Last Edit: August 02, 2014, 11:24:05 pm by legacy »
 

Offline WarSim

  • Frequent Contributor
  • **
  • Posts: 514
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #27 on: August 02, 2014, 11:11:38 pm »
Yes you are right. 
I said I would ask my colleagues, got your answer. 
Came back to this thread and read the rest of the thread. 
Then did not pass on their collective answer. 

So yes I have not ever helped you, just waisted my time. 
 

Offline snoopy

  • Frequent Contributor
  • **
  • Posts: 767
  • Country: au
    • Analog Precision
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #28 on: August 03, 2014, 01:46:10 am »
I am not waisting any more of my time nor my friends time on you so I will thank you not to try to ask anything more from me. 

exactly when you have helped/suggested me ?

i have opened this thread asking for an alternative of gcc
and people is hardly talking about what i do not want to use !
> Topic: do you know any open source C compiler for mips, in addition to gcc ? <
> answer:  there are several compilers that can be retargeted to MIPS, use gcc <
that is my time trashed, first of all !

edit:
btw i have cleared all i have written in this thread
and about time trashing ... it seems to me like when i posted my filesystem sources
asking for advices and suggestions and i got very useful offensive responses :palm:

Did you ever consider that there is no solution to your problem ?
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #29 on: August 03, 2014, 04:22:26 am »
Quote
Probably because GCC is so "pretty" that is incompatible with itself
I'll have to admit that I've been screwed over by gratuitously incompatible changes between versions of gcc.
(Examples: the disallowing of newlines inside of string constants.  The clarification that attributes cannot be part of a typedef (all the avr-libc prog_uchar mess.)  Changes in the ordering of macro expansion/stringification.)
Overall, I think the rate of such occurences has been about the same as the rate of annoying changes to the C standards, and somewhat less frequent than being screwed by compiler vendors going out of business, or dropping a compiler (proud owner of Borland C, Think C for 68k Macs, and Codewarrior IDE for Mac 68k/PPC.  For example.)

If you can stomach gcc if you don't have to build it, you might try downloading the PicKit development environment (Arduino-like IDE) for PIC32.  That's a gcc for MIPS, and it comes pre-compiled for linux/mac/windows.

(BTW, I'd describe the problems with gcc as being "typical" of large products and vendors, and "in contrast" with the different problems you get with smaller vendors.  When I worked with <big company>, we were a bit used to pushing vendors around; saying "we want X" and having the vendor say "ok, we'll go figure out how to do x."  It was a bit of a shock to start working with a vendor of equal size (Intel) who would just say "No.  We won't do that."  (but not necessarily a bad thing.)  Sometimes you just have to put up with the way that things are, rather than the way you'd ideally like them to be.)
« Last Edit: August 03, 2014, 04:37:05 am by westfw »
 

Offline rob77

  • Super Contributor
  • ***
  • Posts: 2085
  • Country: sk
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #30 on: August 03, 2014, 08:50:40 am »
i don't get it Guys....

why are you bitching about incompatibilities between GCC versions ? if a version of GCC works for you, then what on earth is pushing you to upgrade ? especially when talking about self-compiling GCC. compile your toolchain and once you're satisfied with your toolchain, then "freeze" it - don't upgrade anything within the toolchain. that's a best way of being able to provide bug fixes for your "firmware" later-on.

i did a lot of embedded stuff in the past (ok. mainly x86 -  boards with Crusoe processor, and some arm stuff as well) but i was never bitching at gcc.... it's not as easy to build the GCC as other autotooled software, but it's not a problem if you know how to do it. if you don't know how to build it, then use a pre-compiled one or ask google to tell you how to compile it.

regarding changes in syntax and other restrictions - that's not a fault of GCC - the GCC guys are just following the rest of the world and changes in the standards.

so instead of bitching and desperately searching for a replacement, it's far better to adapt ourselves - that's the way of least time & effort spent ;)

 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #31 on: August 03, 2014, 02:30:47 pm »
why are you bitching about incompatibilities between GCC versions ? if a version of GCC works for you, then what on earth is pushing you to upgrade ?

because there are patches for a specific gcc version, for example ONLY gcc-v2.95 has patches to compile OpenBeos/Haiku, as gcc v4.1.2 has working patches to compile RTEMS; these patches are hard to be ported to modern versions of gcc, the same happens to the patches required by the BDM driver about gdb, and the same happens with patches used in SDE about the Atlas support.

Linux has the same problem, especially if it has custom care adds on: it happened, for example, with Atheros (MIPS32 SoC used in home router) where Fonosphera gave her help to the kernel providing things (used by openWRT, for the most) there are not in the current linux-kernel tree. It means YOU have to port them, and it is very hard time consuming activity.

edit:
the same happens, just to provide an other example, with motorola 68hc11, see that everything up to gcc-3.4.6 is simply broken and not supported and it is practically impossible to apply/port the old patches in order to support such a CPU.
« Last Edit: August 03, 2014, 02:39:58 pm by legacy »
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #32 on: August 03, 2014, 02:31:52 pm »
I'll have to admit that I've been screwed over by gratuitously incompatible changes between versions of gcc

exactly, a lot of changes in sources are showing you that the gcc development is not aligned with itself, also it is not aligned with ANSI C, that auses projects to be gcc-dependent in oder to be built!

It is known to fellows who want to try to compile Haiku or Amiga open kernels with an other gcc compiler or with an not-gcc-compiler! It is simply impossible without hardly patching sources, that is unbelievable, unacceptable, because it is long time consuming!


Examples: the disallowing of newlines inside of string constants.  The clarification that attributes cannot be part of a typedef (all the avr-libc prog_uchar mess.)  Changes in the ordering of macro expansion/stringification.

exactly, but that is only the beginning of the mother of all the issues, trust me, there are many and many more, and not only with gcc but also with binutils, glibc and so on.

Overall, I think the rate of such occurences has been about the same as the rate of annoying changes to the C standards

from my point of view gcc  aims to be THE standard, especially for embedded C and C++, that means it could be a rolling standard, changing things by itself an then forcing others to follow them.

and somewhat less frequent than being screwed by compiler vendors going out of business, or dropping a compiler (proud owner of Borland C, Think C for 68k Macs, and Codewarrior IDE for Mac 68k/PPC.  For example.)

yeah, i think this is an other big reason, also consider that gcc has not exactly the bad-effect of TurboC, or CodeWarrior, or SierraC, that means …. if coders do not be strict with-in ANSI-C standard in their sources, then the result code is becoming "compiler-dependent", that means gcc-dependent, TurboC-dependent, and so on. Ugly situations in where a lot of effort is required to re-allign things.

what i really hate about GNU is that it seems to me their guys do it on purpose!

If you can stomach gcc if you don't have to build it

unfortunately i need to build it, especially if i have to support gentoo OverLay's builds

you might try downloading the PicKit development environment (Arduino-like IDE) for PIC32.  That's a gcc for MIPS, and it comes pre-compiled for linux/mac/windows.




there are also other reasons why i can't/want to do that
1) my soft core is not MIPS_32 compliant, it is MIPS_1 which could be considered a reduced subset (see the diagram)
2) the compiler should also run on linux/PowerPC and freeBSD/x86 machines (my friends love them)
3) i have to modify the code-machine generate of the mips-c-compiler in oder to support my soft core's features (which could also be considered as a mirage of mips1 and mips32, i am grabbing what is useful form my purpose, i can't implement the full MIPS32 ISA). I'd like to do that, especially to support fixed point without dirty tricks. I need to modify the c compiler but i simply do not want to try this with gcc because it is very very very complex.

When I worked with <big company>, we were a bit used to pushing vendors around; saying "we want X" and having the vendor say "ok, we'll go figure out how to do x."  It was a bit of a shock to start working with a vendor of equal size (Intel) who would just say "No.  We won't do that."  (but not necessarily a bad thing.)  Sometimes you just have to put up with the way that things are, rather than the way you'd ideally like them to be.)

yeah, you are right … but let us take dreams about hobby  :-+




Did you ever consider that there is no solution to your problem ?

it seems to me, a solution could be writing a small C compiler by myself, and it could be i will really schedule this activity with my friends using they parsers and know/how.



OK, let's go rock  :box:
« Last Edit: August 03, 2014, 03:37:09 pm by legacy »
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6190
  • Country: us
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #33 on: August 03, 2014, 02:34:22 pm »
it seems to me, a solution could be writing a small C compiler by myself, and it could be i will really schedule this activity with my friends using they parsers and know/how.

OK, let's go rock  :box:

This sounds very native to me.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #34 on: August 03, 2014, 02:50:15 pm »
Quote
a solution could be writing a small C compiler by myself, and it could be i will really schedule this activity with my friends using they parsers and know/how.

You seem to be more interested in talking about big things rather than completing them.

Maybe this is your opportunity to force yourself to actually do something: don't come back to the forum until you have produced a working compiler that you have developed.

Like they say, "Just do it".
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #35 on: August 03, 2014, 02:54:12 pm »
Quote
It looks like Clang LLVM might have some MIPS support.

I remember hearing someone on the LLVM team talking about it being "imminently maturing". That was a few years ago.

Today, it is still "imminently maturing".

I wouldn't bank on it.

Use a tool you have, not a tool that you wish you have.
================================
https://dannyelectronics.wordpress.com/
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #36 on: August 03, 2014, 03:07:09 pm »

(1) Dragon Book's cover


i have already written pascal-like interpreter-toy and a little C interpreter (sub ANSI-C compliant). Never written a compiler, but i have seen papers about that from Dr Dobb's's magazine, there is also an old article with a companion CD about small-CC (you have to pay to have their sources, and pdf, but if you pay, they provide them), and i already have a working parser and a minimal know/how about "interpreters" form this book (1).

"a compiler is nothing more than a series of transformations of the internal representation of a program" (cit)

What's in a compiler?   

a giant fsm machine composed by

1) Lexical Analyzer or "lexer", an engine that recognizes tokens like printf, echo, and "hello world": i have already implemented it in my interpreters
2) Parser, an engine that recognizes patterns of tokens and builds an Abstract Syntax Tree (AST): i do not have AST but i have already written a minimal parser in my interpreters, it means to be improved
3) Code Generator aka "back end" aka "cgen", and engine that "walks" the AST and "generates" appropriate code in the target language: never  written, i have to learn a lot
4) (Optionally, you can add an) optimizer engine that "optimizes" code for size, speed, or architecture, it is, for example, the magic that gcc-mips does when you put -O0, -O1, -O2, -O3, -OS in its CFlag: i to not need it

I have to learn about machine-code-generation, at least. Also my friends are studying the languages and compilers in their computer science courses, so … it may it is possible, it may be not, but we could try. It should be a good experience!

btw, removing gcc from the solution space, the possibilities about a solution for the CC in topic are
1) write a CC by myself, writing everything and the cgen from scratches, the good of this is that it will be pretty aligned to the soft core purpose instead of being an arrangement of an already existing solution
2) try to retarget "lcc", modifying the already existing cgen-mips1
3) try to retarget "llvm", modifying the already existing cgen-mips1

each of these solutions is a trade off and consume time, especially the first has a bad time constraints and i am expecting it could be very time consuming, the good point is: this time should be well used, i mean it should be better spend time "to learn things" than consuming time "to fix things" (perhaps learning how to fix things is already required by the GNU know/how, in order to survive it).
« Last Edit: August 04, 2014, 12:30:31 pm by legacy »
 

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 895
  • Country: us
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #37 on: August 03, 2014, 03:17:15 pm »
what i really hate about GNU it that their guys seem to me do it on purpose!
Yes, of course. They laid their trap years ago and now you've fallen into it. Sneaky bastards.
 ::)
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #38 on: August 03, 2014, 03:32:29 pm »
You seem to be more interested in talking about big things rather than completing them.

interested about reading if there is a guy who has already done something like that, and in case, reading his advices
interested about hearing if there is a similar project around, in order to have a good start
 

Offline rob77

  • Super Contributor
  • ***
  • Posts: 2085
  • Country: sk
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #39 on: August 03, 2014, 03:43:12 pm »
what i really hate about GNU it that their guys seem to me do it on purpose!
Yes, of course. They laid their trap years ago and now you've fallen into it. Sneaky bastards.
 ::)

 :-DD :-DD :-DD

you nailed it to the cross !  :-+ :-+ :-+
 

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 895
  • Country: us
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #40 on: August 03, 2014, 04:00:50 pm »
i have already written pascal-like interpreter-toy and a little C interpreter (sub ANSI-C compliant). Never written a compiler, but i have seen papers about that from Dr Dobb's's magazine, there is also an old article with a companion CD about small-CC (you have to pay to have their sources, and pdf, but if you pay, they provide them), and i already have a working parser and a minimal know/how about "interpreters" form this book (1).
OK, a non-snarky reply...

Implementing a compiler is a *huge* effort. The scanner/parser is actually the easiest part. You'll undoubtedly learn a great deal along the way, but be prepared for a year or two of hard work.

If you really want to do something like this, I'd suggest starting from the LLVM back-end for MIPS and making it work for your target. One reason is that the LLVM approach is really well done and you'll probably learn what's needed more quickly from LLVM than you will starting from the dragon book. The other is that you won't have to worry about all the parsing stuff--you can focus on going from IR (Intermediate Representation) to machine code for your target.

PS. And working with LLVM will make you a C++ commando by the time you're done too.  :-+
« Last Edit: August 03, 2014, 04:02:49 pm by andyturk »
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #41 on: August 03, 2014, 04:20:21 pm »
I'll be seriously impressed if a lone coder (or a small group of buddies) in whatever your timeframe is can do better than GCC - and I'd genuinely like to see it if you do.

But-
4) (Optionally, you can add an) optimizer engine ... i to not need it

A basic optimizer is pretty important in getting passable code in an embedded system. This suggests that you're more interested in the compiler's internal structure than having it produce good code, which is fine if you're a programming hobbyist who wants to learn about compilers, but a bit of a WTF if you're looking to replace what you see as a poor compiler...
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #42 on: August 03, 2014, 04:42:37 pm »
Quote
interested ...

You can do yourself a big favor by actually doing it, not talking about doing it.
================================
https://dannyelectronics.wordpress.com/
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #43 on: August 03, 2014, 05:31:41 pm »
do better than GCC

in my case, in case i will code such a things, it will be "better" than gcc only about two things

1) the way it well be written for the C only support, ANSI C, portable everywhere without all the issues of gcc sources, as i told, i simply hate gcc sources, and you should admit that … gcc's sources are not exactly written in ANSI C as they are not exactly portable, as they are not exactly "easy going", or not ?

2) an extremely simplified machine code gen, much more easy to be modified for a new architecture (you should love it especially if you want to toy with HDL), or just to add features to the Soft Core ISA, which, in my case, is a mesh up between MIPS1 and MIPS32, something that the actual gcc-mips is simply not able to support (without dirty tricks), i mean, the actual profile is gcc-mips1, so i am loosing a lot of the improvement i have grabbed from MIPS32 (see the diagram, not the differences about "legacy" and "modern") and i can't use gcc-mips32 because the soft core is not full MIPS32 compliant, also it has custom instructions about fixed point.

gcc will ever be better about
1) the languages it supports, e.g. {C++, ADA, objC, ..}
2) optimizations space/time/architecture/..
3) many and many other features i am not interested about

what i want is a nice piece of code, well written, with the less complexity inside, much more useful for experimental branch about codgen (new architecture features, toying with HDL in soft cores), and much more portable than gcc.

that's all, i am not aiming to change the world as it is written in the GNU manifest  :-DD

4) (Optionally, you can add an) optimizer engine ... i to not need it

well, i have put an interactive integer calculator, written in C, on my soft core. I compiled it with gcc-mips in three different profiles, {O0, O1, O2}, then i compared the results. I can assure you that for MIPS1 the real difference between OO and O2 is related to the pipeline optimization, that means the result binaries ratio Otwo : OZero is 1:3 in size, that's a good job done by gcc's optimizer, and you can more improve this result if you profile for MIPS32 instead

You need to pass the right "CFlgag", and gcc will show you how better it can go with an higher code density! The optimization is performed using the know led of the full MIPS32 ISA instead of a few poor instructions from the tiny MIPS1 ISA, that happens because MIPS32 has many more instructions to be used to save space/time, and the gcc's optimizer knows how to use them.

So gcc-mips, about that, seems cool, it still sucks about other things, but it is/will still be superior, btw concerning this discussion there are to more considerations

1) the optimization level is strongly related to implementation, in this case to a 5 level pipelined with an hw delay slot, and … my soft core has no pipeline, my friend's (buggy) implementation has a pipeline, while my soft core is multi cycle without any branch delay slot but with an extremely improved ISA and also with the idea to include a debug processor, something like jtag TAP (see my other thread), i am grabbing the idea from the ZPU.TAP. In short, at the same frequency of my friend's one (@50Mhz), my soft core is offering 1/4 (1:5 stages + stall penalties ~ 1/4) of the performances with more prettiness in the assembly level and a very easygoing behavior about the debug interface, two things i want to be focused on about my hobby purpose!

2) I am not interested about the code-desity and the code size, i have 96Kbyte of BRAM in my fpga, they are fine with my assembly monitor and this "mini mon" is already fine to bootstrap and to load things from uart, so about "application", i will be fine with an added 64Mbyte chunk of dram. Fortunately my new Avnet Board already has 64Mbyte of DRAM, so I think i'm fine enough.

3) the real problem is doing debugging, at the host side ! The O2 optimization is making things warped and understanding the assembly level (like SPIM, if you have ever used it) is much more complex, which is a not-wanted point in this project!


for at least such a tree reasons i do not need & want any optimization!
« Last Edit: August 04, 2014, 12:34:36 pm by legacy »
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #44 on: August 03, 2014, 05:43:07 pm »
If you really want to do something like this, I'd suggest starting from the LLVM back-end for MIPS and making it work for your target …

PS. And working with LLVM will make you a C++ commando by the time you're done too.  :-+

that's cool!
that's also the kind of advice i have been looking for. I will follow it, thank you  :-+
 

Offline magetoo

  • Frequent Contributor
  • **
  • Posts: 284
  • Country: se
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #45 on: August 03, 2014, 05:53:40 pm »
Was going to recommend clang, but I see that's already been done.  Might be worth checking out PCC as well. (PCC is an ancient compiler that was resurrected recently.)  The TODO page says MIPS is not there yet:

Quote
The i386 and amd64 are now stable enough to build most C programs, including PCC itself. More work is needed to make it available in other platforms, especially MIPS and ARM.

but it's supposedly a pretty clean and simple architecture internally, so if you are inclined to hack on compilers..

I feel your pain with the mutually-incompatible GCC versions.  Been there, gave up.
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #46 on: August 03, 2014, 10:20:07 pm »
Excellent information ! Also books about compilers, article about algorithms, etc! Very useful, thank you a lot for the link  :-+
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #47 on: August 03, 2014, 10:44:45 pm »
Quote
Might be worth checking out PCC as well. (PCC is an ancient compiler that was resurrected recently.)
That and SDCC ARE much simpler compilers, though neither has ever supported MIPS AFAIK.  They did produce rather slow and large code; when the first version of gcc came out, we saw something like 15% improvement in both size AND speed moving to it from the PCC we were using.

I think you underestimate the importance of "optimization."   I'm not talking about the differences between O1 and O3 - I'm talking about the difference between the gross code that a 2nd-semester compiler class compiler produces, vs what gcc produces with -O0.  You can look up some of the complaints about the code produced by the Microchip 8-bit compilers in "free" mode, which claimed to "turn off optimization", and produced some truly icky code (whose analysis did in fact lean toward "they didn't do ANY optimization" rather than "intentionally produces bad code.")

PCC for 68k is probably a better starting point than SDCC, because the MIPS is more like a 68k (number of registers/etc) than an 8051...  (and hey; you can stop messing with gcc on your 68k project, too!)

(Now THERE'S an interesting question: has the "state of the art" for BEGINNING compiler projects advanced in the last 30 years or so?  A modern "data structures and algorithms" class is MUCH different than the one I took, and an "intro to graphics" is probably different.  But I've been assuming that "beginning compilers" is about the same; all parsing and BNF and such, and little code generation...)  (You're also likely to discover that C, predating even the 30-y old parsing theory, has a horrible syntax...)
 

Offline magetoo

  • Frequent Contributor
  • **
  • Posts: 284
  • Country: se
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #48 on: August 04, 2014, 06:18:13 pm »
That and SDCC ARE much simpler compilers, though neither has ever supported MIPS AFAIK.  They did produce rather slow and large code; when the first version of gcc came out, we saw something like 15% improvement in both size AND speed moving to it from the PCC we were using.

Not sure how PCC does wrt optimizations, but it will compile things a lot faster than GCC.  I'm assuming that at least the most trivial optimizations are done, but probably not much more.


Quote
(Now THERE'S an interesting question: has the "state of the art" for BEGINNING compiler projects advanced in the last 30 years or so?  A modern "data structures and algorithms" class is MUCH different than the one I took, and an "intro to graphics" is probably different.  But I've been assuming that "beginning compilers" is about the same; all parsing and BNF and such, and little code generation...)  (You're also likely to discover that C, predating even the 30-y old parsing theory, has a horrible syntax...)

I took the introductory compiler theory class that was available to me ten years ago, and I can't imagine much had changed from ten years prior to that.  This was in a small regional university and not some place that does actual research in CS, so that might be a factor.

I guess if you base a course around the Dragon Book things aren't going to change all that quickly.  It's all Java in the latest edition, but that's about it.
 

Offline bwat

  • Frequent Contributor
  • **
  • Posts: 278
  • Country: se
    • My website
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #49 on: August 05, 2014, 09:06:32 am »
People who worry about compiler optimisation tend to be people who don't build and use their own compilers. More often than not, a simple code generator is good enough. The simplicity tends to make it easier to implement as well. Of course all this is nonsense if your specification means you're near the limit of instruction throughput for the chosen processor.

Also, most effort in compiler development goes into library function development. That's been my experience.
"Who said that you should improve programming skills only at the workplace? Is the workplace even suitable for cultural improvement of any kind?" - Christophe Thibaut

"People who are really serious about software should make their own hardware." - Alan Kay
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #50 on: August 05, 2014, 10:40:37 am »
Quote
People who worry about compiler optimisation tend to be people who don't build and use their own compilers

Or people who cannot code on an optimizing compiler because they don't understand how it works.
================================
https://dannyelectronics.wordpress.com/
 

Offline bwat

  • Frequent Contributor
  • **
  • Posts: 278
  • Country: se
    • My website
Re: do you know any open source C compiler for mips, in addition to gcc ?
« Reply #51 on: August 05, 2014, 11:05:09 am »
Quote
People who worry about compiler optimisation tend to be people who don't build and use their own compilers

Or people who cannot code on an optimizing compiler because they don't understand how it works.
Oh but I do know how to build optimising compilers. Here's one I use almost daily http://barrywatson.se/download/BarrysProlog_x86_64.tar.gz. That one actually includes optimisations based upon a dataflow analysis I've not seen documented elsewhere. I've also worked on optimising compilers that were embedded  in a product you've probably used when making telephone calls. It's the AOT compiler in this product http://www.ericsson.com/ericsson/corpinfo/publications/review/2001_01/files/2001013.pdf.

Now I still stand by my claim. What evidence/experience do you have to back up your claim?
"Who said that you should improve programming skills only at the workplace? Is the workplace even suitable for cultural improvement of any kind?" - Christophe Thibaut

"People who are really serious about software should make their own hardware." - Alan Kay
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf