public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Building a GCC backend for the STM8
@ 2024-01-28  3:41 Sophie 'Tyalie' Friedrich
  2024-01-28 17:27 ` Marc
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sophie 'Tyalie' Friedrich @ 2024-01-28  3:41 UTC (permalink / raw)
  To: gcc

Hello dear people,

I want to try building a GCC compiler backend for the STM8 
micro-controller target in order to make this wonderful architecture 
more accessible.

But as I'm fairly new in this area of building compiler backends for 
GCC, I would need a bit of guidance / read material to get started. Do 
you have recommendations for anything? And is there interest in such work?

With best regards
Tyalie

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Building a GCC backend for the STM8
  2024-01-28  3:41 Building a GCC backend for the STM8 Sophie 'Tyalie' Friedrich
@ 2024-01-28 17:27 ` Marc
  2024-01-29  4:08 ` Jeff Law
  2024-01-30 12:07 ` Oleg Endo
  2 siblings, 0 replies; 4+ messages in thread
From: Marc @ 2024-01-28 17:27 UTC (permalink / raw)
  To: Sophie 'Tyalie' Friedrich; +Cc: gcc


Sophie 'Tyalie' Friedrich via Gcc <gcc@gcc.gnu.org> writes:

> Hello dear people,
>
> I want to try building a GCC compiler backend for the STM8 micro-controller
> target in order to make this wonderful architecture more accessible.
>
> But as I'm fairly new in this area of building compiler backends for GCC, I
> would need a bit of guidance / read material to get started. Do you have
> recommendations for anything? And is there interest in such work?

Hello,

I guess the upcoming presentation at FOSDEM "How to bring up GCC for
your new chip"[1] can help!

Marc

[1]: https://fosdem.org/2024/schedule/event/fosdem-2024-2713-how-to-bring-up-gcc-for-your-new-chip/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Building a GCC backend for the STM8
  2024-01-28  3:41 Building a GCC backend for the STM8 Sophie 'Tyalie' Friedrich
  2024-01-28 17:27 ` Marc
@ 2024-01-29  4:08 ` Jeff Law
  2024-01-30 12:07 ` Oleg Endo
  2 siblings, 0 replies; 4+ messages in thread
From: Jeff Law @ 2024-01-29  4:08 UTC (permalink / raw)
  To: Sophie 'Tyalie' Friedrich; +Cc: GCC Development



On 1/27/24 20:41, Sophie 'Tyalie' Friedrich via Gcc wrote:
> Hello dear people,
> 
> I want to try building a GCC compiler backend for the STM8 
> micro-controller target in order to make this wonderful architecture 
> more accessible.
> 
> But as I'm fairly new in this area of building compiler backends for 
> GCC, I would need a bit of guidance / read material to get started. Do 
> you have recommendations for anything? And is there interest in such work?
There is a GCC internals manual which I would strongly recommend you 
read and keep handy.  It describes most of the basic concepts necessary 
to write a functioning machine description.

Second I would strongly recommend you start with an existing port for a 
chip that has similar characteristics.  If you make a good choice on 
ports to copy, this can dramatically reduce your development time.  GCC 
supports over 30 distinct families of processors.  If you're lucky one 
will map reasonably closely to the STM8.  Some processor families have 
had their ports removed due to lack of maintenance and lack of 
processors deployed in the wild.  Point being there may be older ports 
that match STM8 better than what's in the tree now.  I just don't know.

You're going to need an assembler, linker and libraries.  Those are not 
part of the compiler proper.  They are usually co-developed as part of 
doing a new port.  You'll probably want a debugger too.  The assembler, 
linker, binary utilities and debugger are the gdb-binutils project.  A C 
library can be found in the newlib-cygwin project.

If there is an existing compiler and you need/want to be compatible with 
calling conventions, then it's obviously advisable to get a copy of any 
ABI documentation that may be available.  Otherwise you'll have to get a 
copy of that other compiler and reverse-engineer the ABI.

GCC includes a significant testsuite.  For port bring-up, the c-torture 
tests are usually the most interesting, especially the compile and 
execution tests.

This will be a non-trivial project, almost certainly measured in months 
for an experienced GCC developer.  Good luck.

jeff

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Building a GCC backend for the STM8
  2024-01-28  3:41 Building a GCC backend for the STM8 Sophie 'Tyalie' Friedrich
  2024-01-28 17:27 ` Marc
  2024-01-29  4:08 ` Jeff Law
@ 2024-01-30 12:07 ` Oleg Endo
  2 siblings, 0 replies; 4+ messages in thread
From: Oleg Endo @ 2024-01-30 12:07 UTC (permalink / raw)
  To: Sophie 'Tyalie' Friedrich, gcc

Hi,

On Sun, 2024-01-28 at 04:41 +0100, Sophie 'Tyalie' Friedrich via Gcc wrote:
> Hello dear people,
> 
> I want to try building a GCC compiler backend for the STM8 
> micro-controller target in order to make this wonderful architecture 
> more accessible.
> 
> But as I'm fairly new in this area of building compiler backends for 
> GCC, I would need a bit of guidance / read material to get started. Do 
> you have recommendations for anything? And is there interest in such work?
> 
> With best regards
> Tyalie

GCC might not be a bit difficult for 8-bit targets.  For example, if you
look at RL78, it had to resort to some virtual register set workaround
because GCC usual register allocation at that time couldn't deal with it. 
8-bit targets like AVR seem to be a bit easier.

Some other interesting options for 8-bit targets are SDCC (STM8 already
supported it seems) and llvm-mos project (LLVM port originally for 6502).

Cheers,
Oleg

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-30 12:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-28  3:41 Building a GCC backend for the STM8 Sophie 'Tyalie' Friedrich
2024-01-28 17:27 ` Marc
2024-01-29  4:08 ` Jeff Law
2024-01-30 12:07 ` Oleg Endo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).