From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by sourceware.org (Postfix) with ESMTPS id 35B363858D20 for ; Mon, 29 Jan 2024 04:08:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 35B363858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 35B363858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::134 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706501310; cv=none; b=cmmzlAiqxvg5PKJeIzaZtbrpTVZRX8GSh82e3hV9tjssrxavxIcqKlv82fQRjvbs69hSdpEuteQzpni+xOxvBml2pTQA8jb18DKWj6gh6hQsSGMXvNCkiThNce3Mmw9S72//pKkZWeOXDIV+X2xF1pd63ZsgcJ2aSecRv426n7o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706501310; c=relaxed/simple; bh=MbyosWqouWx6Drw5V/dzpnCYS7mToXAywfmkOOFIMd0=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=WbKtdf9i7lxLJw3lewy/gOLP5ebme6jlO7uaXnRW5hJNLXTOpbLYxMl9B5TXF75Pwy1N0hvG9OrTVOz/ZJ8kucAGcUXjN5iA0nhCqKYUxiQ7KN9QmjdmQGf3g1OC4EmGfN0FkIAz3FihZ5YBWhMszQkT7igWAu/QjtBB4996d8w= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-il1-x134.google.com with SMTP id e9e14a558f8ab-3637ea296f4so565585ab.3 for ; Sun, 28 Jan 2024 20:08:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706501306; x=1707106106; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:cc:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=zvDLV+tVkDTTGS2V2vbo/8ud9ZMB1E2j05eULlT2NVA=; b=MnU+DOXWH9K4K6hKORZQ8SD4SO02UBDw5i/t6LikkE/M35V+/R6CtidltxJByv3Ykz SeF/0KxSKA31oikQWlqxhQSu4GLCfLEPPHC79wibxCEuhO/VPrA2C5UZTQDYpT4083Hr algcG6AzhJv79MP48OYRZ2+LkFOB5xOiUAuQLMMYi7bqcs0anXR+xu5UJM+ow7goRVFq i/NQpXsK4O4JIMwh140aVUORHNSCPblf0k0rryFZEaqVRLaqL+WVEYf0clG+qTF+yjtV KRf5Z74omy3B8NetOV7LhfJPO8zSpzq7xu0ZYF7x1axiri4BPgvMWt6eC9dyBuor3Abh L67Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706501306; x=1707106106; h=content-transfer-encoding:in-reply-to:from:cc:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zvDLV+tVkDTTGS2V2vbo/8ud9ZMB1E2j05eULlT2NVA=; b=CYiS6DPbZs+6kvgi7bITdv9yZKpGMm9tnXi+0UU0d7ELBVNBBAFlIqcqKYeBnZ/ilE dsKNRyebvLlMVwcekZV6UaS3s1uR/NUEqJXgHkzncStwVOg5ssOBaDmhp8HSMdeZszAh mJpcv/lPri+HOOxsn96Rbzd+zXd+2L0cIBqHjuc4XK3S7CCB6/5r8TWKvVpnJLWwf/Ps 5NAhMN5hKvrr8guFAnwXi9F34OdF2BrdTRwfiYDF/QFFdhkdwV5XoqpS5uqlUPeHNpT4 TZuZ8QHP3T1BLGrN7ju3E+4896x6FXLL2zDotqqrSb8QGG6Nj3VBLMMhJQHndTdsisQJ dbMg== X-Gm-Message-State: AOJu0YyEIGuQr6eqHYIrRokdbMY/mrrNRaLhoh5CMIRvIzfZ7x0/Ko7B b/nTdQwRTm0YSbOf9cKJ8nYRJNlPDfUyWaJn3nKhjkgBO5XHqcP+LMR4TY2a X-Google-Smtp-Source: AGHT+IGgqQvXVuPdjKuAar06pUNuRmN7KqvacNDA4BTeVv2MbOEQ5KBpecG77pmRbynAsMer+ieC2w== X-Received: by 2002:a92:c64b:0:b0:363:79c8:e38e with SMTP id 11-20020a92c64b000000b0036379c8e38emr2055660ill.29.1706501306073; Sun, 28 Jan 2024 20:08:26 -0800 (PST) Received: from [172.31.0.109] ([136.36.72.243]) by smtp.gmail.com with ESMTPSA id w2-20020a056e021c8200b00363817b5708sm392808ill.3.2024.01.28.20.08.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 28 Jan 2024 20:08:25 -0800 (PST) Message-ID: Date: Sun, 28 Jan 2024 21:08:24 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Building a GCC backend for the STM8 Content-Language: en-US To: Sophie 'Tyalie' Friedrich References: Cc: GCC Development From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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