Status of P2 C/C++ Compiler?
DavidZemon
Posts: 2,973
in Propeller 2
The chip is now in a state where C/C++ compiler work can restart, right? I saw Betz posted a comment during the live stream about it, asking Ken if now was a good time to start again. Not sure if the question was lost in the mass of comments or ignored, but I would love to know the answer to that question too. Are we waiting on Parallax to give an "OK"? Or are we just waiting on a community member to give it a go and make it happen? Last I heard, one or two people had brought up the possibility of switching to LLVM instead of GCC for P2. Sounds fun... I don't think I have an opinion. Has a decision been made? If not, do we have everything we need to make said decision?
I'm just eager to help and would love someone to point me at a TODO list and tell me what to do.
I'm just eager to help and would love someone to point me at a TODO list and tell me what to do.
Comments
TODO:
1) Create C/C++ back ends for GCC and Clang/LLVM.
p2gcc currently supports a basic C library. I have looked at porting the library from PropGCC, and p2gcc can compile much of it. However, there is still a lot of work required to get it to compile the whole library. I also want to add C++ capability.
I think p2gcc could be used as a starting point for fully implementing GCC on the P2, but we would need people that understand how to modify GCC to support the P2 instruction set. We would then need to modify GAS and the linker for the P2.
I know what you are getting at. As much as I wish otherwise, trust me, nobody would want to use any compiler I produced. With my meager skills such a thing would produce terrible code, slow and buggy, not to mention it would take me years to even figure out where to start.
I'm always up for testing duties though.
You might be right though, using a MIPs or other 32bit CPU would be okay also.
I thought the PIC32 was based on the MIPS instruction set architecture. https://www.mips.com/blog/tag/pic32/
Meanwhile the 32 bit AVR is nothing like an 8 bit AVR. They are ARM instruction set architecture.
There was an AVR32, but it has been deprecated in favour of the ARM cores.
It's not likely there are many AVR32 code generators out there...
They have a dozen or more, including ARM. The main reason I suggested PIC/AVR is that they tend to have different memory areas (code in flash, then data in ram, etc.) which could help with figuring out a Prop1/2 one.
This is logical given the PIC->SX->Propeller progression Chip followed.
The remaining parts are the assembler and the linker. I think p2asm could handle this if I modify it to output the ELF format. The linker would then have to be modified to handle the new ways that addresses are packed into instructions, such as with the AUGS and AUGD instructions.
There's a lot of work to do, but it seems like we're already more than 50% there if we start from PropGCC.
It seems like the first thing that should be done is to put all of the latest GCC-related code in one repository.
What we'd like to do is hold a meeting on this topic the first week of November, including all interested developers users. This is what we did last time - met, discussed, formed a team and completed the development work. I will note the meeting date and time here on the forums. We hope to get some of the same team (Eric, Dave, David) and others who wish to participate. It will likely be a Zoom meeting so we can all chat and talk openly.
One aspect that is very different this time is available budget. We simply don't have the funds available that we did last time.
Sound like a good approach?
Thanks,
Ken Gracey
- one more small note. It's imperative that Parallax isn't in the middle of all the hardware designs and some software tools. We'll provide the core development tools and compilers, plus one to two boards (likely a module). We hope to see support the community to develop an industry around it.
What I don't know, I certainly truly don't know. But there's one thing I do know: the benefit of leveraging existing efforts that worked. While I often read on the forums that our GCC is outdated and not maintained, it's working well for the core use in educational applications. This is where we needed to go with the compiler for our business. I am sure it may lack certain needs for commercial developers, though.
If GCC can be improved to achieve the goal we will want to look at this closely as an additional benefit over other alternatives.
Ken Gracey
It'll be great to have you join us.
We're waiting a bit to start it to see what else Chip learns about the P2. We also need to talk about our priorities with Chip, too.
Ken Gracey
Whatever anyone says about the pros and cons of GCC vs LLVM, GCC is still the compiler of the Linux world and all that rests on top of it.
I would imagine that whatever exists for Propeller support in GCC can be leveraged for the P2 and recent GCC versions.
Provided of course those with the know how are available.
Ken, sounds like a reasonable plan, I'd like to be in that meeting, even if I can't initially contribute much to the C/C++ effort since I'll be working on OpenSpin for P2.