From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id B4CE4385781F for ; Tue, 6 Jul 2021 00:49:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B4CE4385781F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x635.google.com with SMTP id gb6so14744828ejc.5 for ; Mon, 05 Jul 2021 17:49:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=j46JbxqBDL3gS9QwfS37VYP+a5J/ju+p6xto3qeaOuY=; b=P+2uQJ+IdDZ8CEhJBM/c64pOaJ76rbbvFbco3sUTv5PuDTWCGG6e3/2Dv0AlovThV0 DbPeugT+OqgC/bsP0qhGQxZncHMIyq7TC1L8h/qZRy3FQDW6vucpnReKLedOr0klPbjt EnrGOv6Sfg1y7QzVAO2JTzyuhPtQN3x8lGsMJvNcMR27dgqs7nOm8GLXGRfPKCuvgxHu ErxvNM+m+jGXbzf6lPaHz99dtjeMsbVP5NDeA2GUf3CpC8R1fgktz4o4BqjZUH74roqP A18AdLJIjtwU7rNVV29UTdp8TTAT3MmCHntH/GEB8SoeLiyxDjPDDk1mCuKIC5AyV1KB lkuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=j46JbxqBDL3gS9QwfS37VYP+a5J/ju+p6xto3qeaOuY=; b=oe0L3iFnwKW/yV+lRjxWNQNGUt9ZBX7jU5x0N6QTZxwnIZVGKhEdT5AyVUuo9Glyby MdMCB/Q0l3WYx2q3MVyoMF/5JxO/fzCWHzLo3ZYz/zfgF4/MnG9LQZ5VhhlKQ/PE1RwM 3po3NXEq77etyDSSihqmyPk3JEt4XcWnrBc994+Od+1oUL2RjBfNWc8r8U3XyW0TSN2l YJpwx5BYNBd4+sLIXtiJjM8xpDnrJVdlTbmoRLfXd2wfBCqYaIW53rtXG9fNtZX9saVD RAg3x3of5dCwSjl3c+KZBmET0IIMggHdqrmaNLAWN8zoqIp0ZXUsUS3A/2mta2RdFUSi gviQ== X-Gm-Message-State: AOAM533QtFD61Ua9eulCgSLizubD3KRrzhQDy1zSXS/hhtUckj2Sghcu aG4E1yP9YhsxKqrvysGpYlkWOq6YfLJgjlXPtgr8lp709Ig= X-Google-Smtp-Source: ABdhPJxgAtm81UWrwqX4uYThToPsbyh5qgSIcX3VT9nnkV5xikDods/Vc1og3n5YDPT/gOCTpJICy/BK+hZl8H4s8MA= X-Received: by 2002:a17:907:6096:: with SMTP id ht22mr15194217ejc.430.1625532557567; Mon, 05 Jul 2021 17:49:17 -0700 (PDT) MIME-Version: 1.0 From: ElijaxApps Date: Tue, 6 Jul 2021 02:49:05 +0200 Message-ID: Subject: Help porting newlib to a new CPU architecture (sorta) To: newlib@sourceware.org X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, HTML_OBFUSCATE_05_10, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 00:49:22 -0000 Hi all, I designed a Logisim schematic of a full system, able to run programs in the simulation, as shown in this video: https://www.youtube.com/watch?v=UP6tO8x5I5A Is based on a SAP-1 (Simplest as Possible) basis, containing 4 GP registers (8 bit), stack for function operations (up to 256 depth levels of recursivity), 24bit plain RAM component, and a simple ALU able to echo strings and perform not floating point math. AFAIK, newlib is suitable for embedded devices, and I want to create the full toolchain for C/C++ language at least. At first I tried porting it by my own using this guide: https://www.embecosm.com/appnotes/ean9/ean9-howto-newlib-1.0.html#sec_crt0 And I am stuck here: 1. Implement the Board Support Package(s) for the target (Chapter 5 ). - Implement the C Runtime start up, crt0.o for each BSP (Section 5.2 ). - Implement the environment global variable and 18 system call functions for each BSP following the convention namespace and reentrancy conventions specified in newlib/configure.host (Section 5.3 and Section 5.4 ). - Create libgloss/*target*/Makefile.in and libgloss/*target*/ configure.ac, based on the versions in the libgloss/libnosys directory and run aclocal and autoconf in libgloss/*target* (Section 5.5 ). I have some questions regarding those points: 1) ATM my system is programmable, using a kind of own pseudo-assembler code I created for that purpose, alongside with a Java compiler which translates it to text hex file, then I copy its contents to the simulation's RAM. But it's not "normal", "standard" ASSY, just an approximation made by not an assy guy... (never coded any in actual ASSY). So: - How do I write CRT code? In standard ASSY? In my own assy, and somewhere I tell which binary format represents each mnemonic? In case of the first, how will the toolchain know the opcodes and binary format of the instructions and data? In case of the second, could you please clarify the paths of those files in the docs? :) The full source to Libre 8 CPU is here. Some recent changes are not yet pushed but the commited and de documentation provided in github should be enough to make you an idea of what I tell by pseudo-assy. https://github.com/ElijaxApps/Libre-8 I want to push it further, and perhaps port some existing software to it as FreeDOS ... , as far as I can get. All ideas are welcome. If you have to make questions about the architecture don't hesitate and do it. If I have to modify os made changes to fit any requirement it won't be a problem, even now I've reached this far. I hope this is possible. Thank you, Elijax Apps.