Message ID | 94fd668465b77e94f3c000982c694e7da8f828f1.camel@espressif.com |
---|---|
Headers |
Return-Path: <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1191137wrr; Sat, 22 Oct 2022 05:51:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zYovDiAL7pyy40aHpPpoiUb3m4Z/uBEj8pLm/hg/asahAvdwuugRaJF2qfMwyzB1gDurD X-Received: by 2002:a17:907:78d:b0:740:33e1:998 with SMTP id xd13-20020a170907078d00b0074033e10998mr20313468ejb.162.1666443092527; Sat, 22 Oct 2022 05:51:32 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id r7-20020a05640251c700b0045d523bee48si20886751edd.178.2022.10.22.05.51.32 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Oct 2022 05:51:32 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=CpFFlmnX; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3D4003858422 for <ouuuleilei@gmail.com>; Sat, 22 Oct 2022 12:51:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3D4003858422 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666443091; bh=n9rUKThKDEXwaHbMmSF7+OvbS3Mbov5tvpHiP9Ov+fc=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=CpFFlmnX6Nc5lMYh2fWxroF3zKG5rznxAPuxGFxPeeOHDWQSJVQa15i02l0QUYID5 1V5IL8JCAEnpmrlicY8bqe+1mLSk0kfzJLezJl4+nI1VdVpDmcTjUE+e1GKRKnp5eF 1qh8zg6QIbB5N3IbA3DnYgmqIZ6FRZ7BH5UHwwJo= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2122.outbound.protection.outlook.com [40.107.215.122]) by sourceware.org (Postfix) with ESMTPS id B6BA53858CDA for <binutils@sourceware.org>; Sat, 22 Oct 2022 12:51:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B6BA53858CDA ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y+btxatX8GNXwQBhdvx6M5xs2f3aEU1bcpoVvRRypDJA6UVlKAB9H2o4+0TcVuqBBRfEUQe8CuG4eEROnxbKSKo9ZIqSPV5jmnC+3CgVrStJdmO2gKTZDY2WDNo6cNJivkpKLvfV8MdEHcaXvacNHFWRNVRVFHUIdKpT0X7jDsF+myYFSQPmmtQ3Xjo1E72FP64jjWLburwyROTV3C+7iOmzvo7FdnI+fY8jU5OOqrQtNrgHI50IeAc63woQj8YKhAxJ06eLmGfvhS3iYJyDXuyroODiTSiclEoPEix9ytEN2Azyp97ybssk5lax80RKBSCXxXo2nfF0oV4weXXUOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=n9rUKThKDEXwaHbMmSF7+OvbS3Mbov5tvpHiP9Ov+fc=; b=iTPBUjVyA0YJTSlkVFAnCpmnjEdowZRy7WAZhAJCnLPtuybZRB2URf6LxofWgyTr3vbVhGh27jCEZhwHVHuFn1ZPX0prpSaodch/NZEINLoWigbd+p5M+P40X5cdObuAThHK+BvnFi3ieECceMts0C51i+AJPMJOLHRgEEpDc632PBU1UqlWrzy7wH1hz5TTC1PLSs3LorftL79lulJzleODxHoc77xCwD+YrhR3NpuVJmESWZ7UQSvqzsJRdClqxIhT8fsn52tdEqIhBEnekU6LxMYPd8vonzb4PLeXuvVQ4Nv4O7Oe9hh+00wJYyIydUE2DnXRXq428VlHScYpJw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=espressif.com; dmarc=pass action=none header.from=espressif.com; dkim=pass header.d=espressif.com; arc=none Received: from TYZPR04MB5736.apcprd04.prod.outlook.com (2603:1096:400:1fa::7) by SEYPR04MB5908.apcprd04.prod.outlook.com (2603:1096:101:68::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.35; Sat, 22 Oct 2022 12:51:13 +0000 Received: from TYZPR04MB5736.apcprd04.prod.outlook.com ([fe80::e64d:5c85:a83c:5898]) by TYZPR04MB5736.apcprd04.prod.outlook.com ([fe80::e64d:5c85:a83c:5898%4]) with mapi id 15.20.5723.032; Sat, 22 Oct 2022 12:51:12 +0000 To: "binutils@sourceware.org" <binutils@sourceware.org> Subject: [PATCH 0/5] Add Xtensa ESP chips support Thread-Topic: [PATCH 0/5] Add Xtensa ESP chips support Thread-Index: AQHY5hT3GbZU/yAoy06UmDq+62memA== Date: Sat, 22 Oct 2022 12:51:12 +0000 Message-ID: <94fd668465b77e94f3c000982c694e7da8f828f1.camel@espressif.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: TYZPR04MB5736:EE_|SEYPR04MB5908:EE_ x-ms-office365-filtering-correlation-id: acf36cc0-be1c-4348-3c34-08dab42c1988 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: GXJZZFsI9B1fm+Y7FwnkTkgoHjRJ3GYJZFjchm2Tbk05NbI/x9aJknKyHmUaNK5y2GirBSX188XhhBTK0EbLaC6a85JsqpmRioLzAHTS+9bmbyYGvqqquBKzHTnstLNGYuG+YRhj9Ah26X3F7nPhHLQq4onUEWSKzqBw2QNxwmB04k4/Vfvpax/7vNpb5mmYuDFw7vFVoSl7XWkkfQwHJHFh+G3awiynDHyH0dV5rfRb0M9G4kbbY/V3zdRc5GCR/yx/CUa7YsVNe5UdSZp1TsxiteIZD/Nm6AehL4AzH27H7F9faJ3Z+wQRq+pOVLh/40yVO7oKXQCDlZw0SJaheXyG/3Lclx5Fyu1FC0uTTlcb76R53oRUKuOHagNmFroymQUfnxAIaLQ0emf2jz5kg6UYv4pNQzLpAZ6Anz/6z5z157EtOb0UcrFWRH8+yBTJtd28+/j4XJZi1TFOPgq2qHvzZminLPtsorvEIDhcn5kt4EBiDyUos1ZjcBhnrVbPhRTSOCS3fL1nWYLOP7w5AYHRKXdRAP0sw3CZzmeqw7pncBaIuK5f9+T44CCN9uEUa/67Cx4X+SQIMXeJPFkmja06jOKEvVVz2IVRxO5k4Ka0QytGY189HsNqb07j/6/JR2XPMxP76vfEcj2g1Tyw+ziih/OEyi2PtddLvUqnOVjmMsBDfPGDHucmmrQxRfUKrmqGH/djFYApStKV3YG1XjUNSdV2ArAFqw7UkH3a2QLsTgR3+A/7zlBN26dYj4iuRhXhgAZ2lIqt0Zkc7T7gDk/97ltt1ACZKRrrx+3o41k= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYZPR04MB5736.apcprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(39840400004)(136003)(366004)(396003)(346002)(451199015)(91956017)(2906002)(107886003)(8676002)(38070700005)(5660300002)(76116006)(4326008)(66476007)(66446008)(6506007)(122000001)(54906003)(66556008)(6916009)(38100700002)(64756008)(66946007)(86362001)(83380400001)(6512007)(8936002)(26005)(36756003)(41300700001)(186003)(2616005)(6486002)(44832011)(478600001)(316002)(71200400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?cnZJ106RuNVpeZlf6p92N4tbn1tH?= =?utf-8?q?aQ2fDVvmeAC6eMK1VdySy2wG66KjQ5Kdw5hnKLoNF59thViIenWlhs8eu3qjVWdiP?= =?utf-8?q?pyCIIxCN5aclcC71JAhSt70Nq6Ldvkbr0mlqEuYUOoWUCGNcHCy05fDWnNVbxYgmH?= =?utf-8?q?6Rp+MZXIDw4KXWBxo6riqcowSpAqeo09ux4CQU97iMmRz8UbMjw2H+sEr5u5eR18T?= =?utf-8?q?4YEKyuU2/o7mokGsl9xmiwkTTkbkHoHKbu8N0s6Yt3ZZjbje0gdxi6ULziV4BhAvU?= =?utf-8?q?QXrtaY2/9Qd7c9iqeN8oLk2ahS5cllJA3m+Q4Ht/S5EVyjwsTWzkit7r7rlWCWjbc?= =?utf-8?q?FgPaQmA1GbG/r5KYc4ogy5C6elgiN6H2qCRI+ufu+s7rZ3G5sOFiSKfzdXYkCOKfs?= =?utf-8?q?mtHrugbIgjeafbdlgswlgWo8mKF8hR01bIQJ3mrna3Ug6hOBheKIUY4MtJ5ezq5MQ?= =?utf-8?q?oZdB6of8RkxTUEY9kVRUfb8zoIJkQlXXgCz28PaZq+QHsR5Lz5kzEuxGY1gl0SC1G?= =?utf-8?q?FEoqWN4fJh9lYH1uBriooB34JzSLM5ulZcuNDA5YBIlRa7KS86m64JTJVm7WOAeCC?= =?utf-8?q?3FiDo+B0NfRuDPpNtsCx/6ab9yNXMXJwkH81HjsN7FQHXrwFtE7FHKbKicLvlO23O?= =?utf-8?q?iFJkPJe2bw0lxzzBdG0h54OFy9n2Wb7b+t+kGPXdbBFHBgeS1qG5l7ciH6PmvogV2?= =?utf-8?q?GCp2JPPHD0iOqFPClC1tERTNNYn9Dp7g+XSM0Cw6kWmsT6iewKfaBZDcxfcDmHKGM?= =?utf-8?q?FS6BfCJtmSXsja4HQVUSo3RXivgTbuMdUhebyWUvddPYoQ/h6wC/M14jipGoCD/36?= =?utf-8?q?1eTtZ565isXD3JwLMMD4o4+nTvMPKKYyzOj+oE1z+SxIQuykRW2K+L3RI0zJrV6Qo?= =?utf-8?q?DCvIgWHNDuEFjr2d1om7Xy8V6zt1o+rY1rXBcxFsKgh0FJv+YGa7Z8bohi5VS7tl7?= =?utf-8?q?pyGHk7clbc0tXm6iIC2ZsezfyvCWvwFnusROe6h409eLzMDshLAVOw9bqCzFsZAat?= =?utf-8?q?WPwXIHyM/dly3dDqT+7fGaKwnK5mpQqWsMsSrp1ovJzuI5e5AiuXDDNif7qKNflNq?= =?utf-8?q?lqniX3OK6NgG3Mo1r2F+GhT90tLHrHo1+MhiCHVv4slHbWKGivIEUO58xAT0I/rpL?= =?utf-8?q?s84sEYgZ3IErbNp1e/fBqth5IjnnaOJWA53foq41mPJJOaopTLIjeK9mqeQrCfDEy?= =?utf-8?q?lsyfPqJrMP50Cz6foRX7/HEOHABEjV/bMy1xkW/dBTirzrVi4wvgvGLp1sQCbBZ+C?= =?utf-8?q?d1u5/yqYTjNaVIsfE7w3icd+O73lJjLiLwTR1zirobxcGqP1DVx2yviGiAxZyInsJ?= =?utf-8?q?oWqO4MoRJ5DK3tApLxMWEhkOPUGe8MLypzQssoosmIzWSGqD3ZAjj1/Q78EQ0mGvZ?= =?utf-8?q?K1lygKC7dlQ3B5OwqcON6R07yMSUieu00XY9vpFPKvXHPipo7z/EpT3tqaPqMuAI3?= =?utf-8?q?DYM6wtEakc6WmwDIXltwxcPqOkBdiMOA7bbu2zUPQP+FrOUxFpZX0+t8lNGUMEOJj?= =?utf-8?q?R8PgZdhWL0iltRu90u02cd3MlFZBsgRS3z6Y8K+CDEEztmJQGJccfC4=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <1499ED482582F14AA28D0B495C7C64D4@apcprd04.prod.outlook.com> Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-OriginatorOrg: espressif.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TYZPR04MB5736.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: acf36cc0-be1c-4348-3c34-08dab42c1988 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Oct 2022 12:51:12.5797 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 5faf27fd-3557-4294-9545-8ea74a409f39 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: G2n5s1LRIk2TRQRu7295sUS6UVXGQKJ6HdnrKMHaVEdCeUM6whGwxsGGULv9ffWk1R03roT4h7VY6vsxn66o++0E2Qsag/KOhVO+MucELJg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR04MB5908 X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> From: Alexey Lapshin via Binutils <binutils@sourceware.org> Reply-To: Alexey Lapshin <alexey.lapshin@espressif.com> Cc: Anton Maklakov <anton.maklakov@espressif.com>, Alexey Gerenkov <alexey.gerenkov@espressif.com>, Ivan Grokhotkov <ivan@espressif.com> Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747392232479346769?= X-GMAIL-MSGID: =?utf-8?q?1747392232479346769?= |
Series | Add Xtensa ESP chips support | |
Message
Alexey Lapshin
Oct. 22, 2022, 12:51 p.m. UTC
Since ESP chips are getting more and more popular for developers I would like to suggest these patches to consider to include Xtensa ESP chips support for binutils and gdb. The chips support was done in a not common binutils way. There are a few reasons for that: As I know, the Xtensa specific code for binutils and gdb is generated with tools from Tensilica Inc. To build binutils and gdb with other chip presets we need to override some related files (https://github.com/espressif/xtensa-overlays). To make it easy to integrate new chips I did refactor the code a bit to make a possibility to just copy and paste Tensilica-generated files and modify a few lines in a code to make it supported in binutils and gdb. Please consider these changes to merge, I believe this could be a pretty improvement to extend supported CPUs without using third-party sources patches. Alexey Lapshin (5): bfd: xtensa: move common code from ld and gas gas: xtensa: add endianness, loops, booleans options ld: xtensa: use default LD command line options to specify endianness gas: xtensa: add esp32, esp32s2, esp32s3 isa-modules options gdb: xtensa: add support for esp32, esp32s2, esp32s3 isa-modules bfd/Makefile.am | 10 +- bfd/Makefile.in | 15 +- bfd/configure | 4 +- bfd/configure.ac | 4 +- bfd/elf32-xtensa.c | 126 + ...nsa-modules.c => xtensa-default-modules.c} | 2 +- bfd/xtensa-esp32-modules.c | 19191 +++++++ bfd/xtensa-esp32s2-modules.c | 11671 +++++ bfd/xtensa-esp32s3-modules.c | 43674 ++++++++++++++++ bfd/xtensa-isa.c | 25 +- gas/config/tc-xtensa.c | 79 +- gas/config/tc-xtensa.h | 2 +- gas/config/xtensa-relax.c | 8 +- gdb/Makefile.in | 10 +- gdb/configure.tgt | 2 +- ...tensa-config.c => xtensa-config-default.c} | 66 +- gdb/xtensa-config-esp32.c | 389 + gdb/xtensa-config-esp32s2.c | 271 + gdb/xtensa-config-esp32s3.c | 496 + gdb/xtensa-tdep.c | 70 +- gdb/xtensa-tdep.h | 2 +- include/elf/xtensa.h | 22 + include/xtensa-isa.h | 8 + ld/emultempl/xtensaelf.em | 169 +- 24 files changed, 76128 insertions(+), 188 deletions(-) rename bfd/{xtensa-modules.c => xtensa-default-modules.c} (99%) create mode 100644 bfd/xtensa-esp32-modules.c create mode 100644 bfd/xtensa-esp32s2-modules.c create mode 100644 bfd/xtensa-esp32s3-modules.c rename gdb/{xtensa-config.c => xtensa-config-default.c} (84%) create mode 100644 gdb/xtensa-config-esp32.c create mode 100644 gdb/xtensa-config-esp32s2.c create mode 100644 gdb/xtensa-config-esp32s3.c -- 2.34.1
Comments
Hi Alexey, On Sat, Oct 22, 2022 at 5:51 AM Alexey Lapshin via Binutils <binutils@sourceware.org> wrote: > > Since ESP chips are getting more and more popular for developers I > would like to suggest these patches to consider to include Xtensa ESP > chips support for binutils and gdb. > > The chips support was done in a not common binutils way. There are a > few reasons for that: > As I know, the Xtensa specific code for binutils and gdb is generated > with tools from Tensilica Inc. > To build binutils and gdb with other chip presets we need to override > some related files (https://github.com/espressif/xtensa-overlays). > To make it easy to integrate new chips I did refactor the code a bit to > make a possibility to just copy and paste Tensilica-generated files and > modify a few lines in a code to make it supported in binutils and gdb. > > Please consider these changes to merge, I believe this could be a > pretty improvement to extend supported CPUs without using third-party > sources patches. > > Alexey Lapshin (5): > bfd: xtensa: move common code from ld and gas > gas: xtensa: add endianness, loops, booleans options > ld: xtensa: use default LD command line options to specify endianness > gas: xtensa: add esp32, esp32s2, esp32s3 isa-modules options > gdb: xtensa: add support for esp32, esp32s2, esp32s3 isa-modules I'd like to review this series but it has two technical issues: - the patches are not in plain text format and so git am is unable to apply them - the 4th patch of the series didn't make it through the list, I guess it's too big I guess the easiest way for me to review this series is if you could point me to a public git repository with these patches. Alternatively you could use git send-email to send the patches, split patch 4 into pieces (e.g. one core per patch) and add me to the cc: list.
Hi Max, Thank you for reaching out. Yes, patch 4/5 is too big and should be split into at least 6 parts to upload here. I uploaded changes to the github: https://github.com/espressif/binutils-gdb/commits/feature/binutils-2_39-port-esp-chips Regards, Alexey On Tue, 2022-10-25 at 12:13 -0700, Max Filippov wrote: > [External: This email originated outside Espressif] > > Hi Alexey, > > On Sat, Oct 22, 2022 at 5:51 AM Alexey Lapshin via Binutils > <binutils@sourceware.org> wrote: > > > > Since ESP chips are getting more and more popular for developers I > > would like to suggest these patches to consider to include Xtensa > > ESP > > chips support for binutils and gdb. > > > > The chips support was done in a not common binutils way. There are > > a > > few reasons for that: > > As I know, the Xtensa specific code for binutils and gdb is > > generated > > with tools from Tensilica Inc. > > To build binutils and gdb with other chip presets we need to > > override > > some related files (https://github.com/espressif/xtensa-overlays). > > To make it easy to integrate new chips I did refactor the code a > > bit to > > make a possibility to just copy and paste Tensilica-generated files > > and > > modify a few lines in a code to make it supported in binutils and > > gdb. > > > > Please consider these changes to merge, I believe this could be a > > pretty improvement to extend supported CPUs without using third- > > party > > sources patches. > > > > Alexey Lapshin (5): > > bfd: xtensa: move common code from ld and gas > > gas: xtensa: add endianness, loops, booleans options > > ld: xtensa: use default LD command line options to specify > > endianness > > gas: xtensa: add esp32, esp32s2, esp32s3 isa-modules options > > gdb: xtensa: add support for esp32, esp32s2, esp32s3 isa-modules > > I'd like to review this series but it has two technical issues: > - the patches are not in plain text format and so git am is unable to > apply them > - the 4th patch of the series didn't make it through the list, I > guess > it's too big > > I guess the easiest way for me to review this series is if you could > point > me to a public git repository with these patches. Alternatively you > could > use git send-email to send the patches, split patch 4 into pieces > (e.g. > one core per patch) and add me to the cc: list. > > -- > Thanks. > -- Max
Hi Alexey, On Tue, Oct 25, 2022 at 1:17 PM Alexey Lapshin <alexey.lapshin@espressif.com> wrote: > I uploaded changes to the github: > https://github.com/espressif/binutils-gdb/commits/feature/binutils-2_39-port-esp-chips Thank you. I have taken a look and have run a couple tests. It is nice to see an effort to improve the current state of the xtensa toolchain, however this series has a number of issues that I consider important and think that they must be addressed. First issue is that these changes break existing workflows for the xtensa toolchain customization. I believe that it is possible to add support for multiple xtensa cores without breaking the current configuration mechanism. Second issue is that these changes are not internally coherent. For example I would expect that choosing a core that we're assembling for would result in production of an object file with correct endianness for the chosen core, but this is not the case: xtensa-elf-as --isa-module=esp32 will produce an object file marked as elf32-xtensa-be. New switches that control endianness only do partial job, affecting literals and data, but not instructions (which they cannot do by design). There's an --isa-module switch for the assembler, but nothing matching it for the objdump. To experience the issue try to assemble the 'salt' instruction (available in esp32s3) and get it back from the disassembler. Recording core ID in the .xtensa.info section is a clever idea that could potentially help in this situation, but 1) AFAICT it is not used for that purpose now and 2) what's the option for disassembling code that lacks the .xtensa.info? Also, recording the sequential number in this section doesn't look like the right choice to me. The switches --[no-]booleans and --[no-]loops are not really documented and AFAICT they do nothing at this point. They don't control which code is accepted or generated, they only affect available relaxation transformations, but I don't see any transformations that depend on the presence of the boolean option or zero overhead loops. There are remaining core-specific macros, like XCHAL_HAVE_BE in the code that is only compiled once, which means that this code gets definitions for these macros from the default configuration, leaving the reader of this code with the question "how is it supposed to work for cores that define these macros differently"? Third issue is related to the second, this series adds support for the new cores meaning that other interested parties could follow suit, but since it's done incoherently it does not set the right example that could actually be followed. I still think that the series that I posted back in 2017 here https://sourceware.org/pipermail/binutils/2017-May/098159.html was a step in the right direction, providing basis for dynamic configuration, yet not excluding the opportunity to have core support built into the toolchain. It's a shame that I couldn't complete it back then, I guess I should try to do it this time.
Thank you for the review > I still think that the series that I posted back in 2017 here > https://sourceware.org/pipermail/binutils/2017-May/098159.html FYI we already use your approach in GDB (with some improvements and modifications). Only the difference is that we pass chip name over command-line option, not through ENV variable. https://github.com/espressif/esp-xtensaconfig-lib Line in GDB to use it: https://github.com/espressif/binutils-gdb/commit/add3053905e646af67692ae1a67fd5ee76e84723#diff-a4fc3be128b23679672d7d28616e553d81c0631f38e9205774721678bbabfcb7R102 The main disadvantage of this is that we need to have duplicated source files from binutils inside this library. And be careful when upgrading to another binutils version because some structure declarations could change. > First issue is that these changes break existing workflows for the > xtensa toolchain customization. I believe that it is possible to add > support for multiple xtensa cores without breaking the current > configuration mechanism. Could you elaborate on this? I'm very new here and do not fully understand the existing workflow and what was broken. > xtensa-elf-as --isa-module=esp32 will produce an object file > marked as elf32-xtensa-be. New switches that control endianness > only do partial job, affecting literals and data, but not > instructions > (which they cannot do by design). I was disappointed here too because in the default binutils configuration we have: #define XCHAL_HAVE_BE 1 But in xtensa-module.c: xtensa_isa_internal xtensa_modules = { 0 /* little-endian */, > what's the option for disassembling code that lacks the .xtensa.info? Another option could be to write cpu to the elf's e_flags. The initial code exists. Needs just to add another machines: https://github.com/bminor/binutils-gdb/blob/1eeb0316304f2d4e2c48aa8887e28c936bfe4f4d/include/elf/xtensa.h#L104 But yes, the problem still exists with any approach for files generated before these changes (I suppose also for yours from 2017 ). As a workaround, it could be added command-line options for tools to force use specified chip configuration.. What if I redo this patch with removing the most definitions from xtensa-config.h? XCHAL_HAVE_BE, XCHAL_HAVE_ABS, XCHAL_HAVE_ADDX, ..., and most all other hardcoded definitions could be gotten from xtensa- modules.c On Thu, 2022-10-27 at 08:39 -0700, Max Filippov wrote: > [External: This email originated outside Espressif] > > Hi Alexey, > > On Tue, Oct 25, 2022 at 1:17 PM Alexey Lapshin > <alexey.lapshin@espressif.com> wrote: > > I uploaded changes to the github: > > https://github.com/espressif/binutils-gdb/commits/feature/binutils-2_39-port-esp-chips > > Thank you. I have taken a look and have run a couple tests. > It is nice to see an effort to improve the current state of the > xtensa > toolchain, however this series has a number of issues that I consider > important and think that they must be addressed. > > First issue is that these changes break existing workflows for the > xtensa toolchain customization. I believe that it is possible to add > support for multiple xtensa cores without breaking the current > configuration mechanism. > > Second issue is that these changes are not internally coherent. > For example I would expect that choosing a core that we're > assembling for would result in production of an object file with > correct endianness for the chosen core, but this is not the case: > xtensa-elf-as --isa-module=esp32 will produce an object file > marked as elf32-xtensa-be. New switches that control endianness > only do partial job, affecting literals and data, but not > instructions > (which they cannot do by design). > There's an --isa-module switch for the assembler, but nothing > matching it for the objdump. To experience the issue try to > assemble the 'salt' instruction (available in esp32s3) and get it > back from the disassembler. Recording core ID in the .xtensa.info > section is a clever idea that could potentially help in this > situation, > but 1) AFAICT it is not used for that purpose now and 2) what's > the option for disassembling code that lacks the .xtensa.info? > Also, recording the sequential number in this section doesn't look > like the right choice to me. > The switches --[no-]booleans and --[no-]loops are not really > documented and AFAICT they do nothing at this point. They don't > control which code is accepted or generated, they only affect > available relaxation transformations, but I don't see any > transformations that depend on the presence of the boolean > option or zero overhead loops. > There are remaining core-specific macros, like XCHAL_HAVE_BE > in the code that is only compiled once, which means that this code > gets definitions for these macros from the default configuration, > leaving the reader of this code with the question "how is it > supposed to work for cores that define these macros differently"? > > Third issue is related to the second, this series adds support for > the new cores meaning that other interested parties could follow > suit, but since it's done incoherently it does not set the right > example that could actually be followed. > > I still think that the series that I posted back in 2017 here > https://sourceware.org/pipermail/binutils/2017-May/098159.html > was a step in the right direction, providing basis for dynamic > configuration, yet not excluding the opportunity to have core > support built into the toolchain. It's a shame that I couldn't > complete it back then, I guess I should try to do it this time. > > -- > Thanks. > -- Max
On Thu, Oct 27, 2022 at 12:39 PM Alexey Lapshin <alexey.lapshin@espressif.com> wrote: > > I still think that the series that I posted back in 2017 here > > https://sourceware.org/pipermail/binutils/2017-May/098159.html > > FYI we already use your approach in GDB (with some improvements and > modifications). Wow, cool. I didn't know about that. > Only the difference is that we pass chip name over command-line option, > not through ENV variable. Is there any advantage to it? I know that IDF requires some environment setup and choosing the target core anyway. > https://github.com/espressif/esp-xtensaconfig-lib > Line in GDB to use it: > https://github.com/espressif/binutils-gdb/commit/add3053905e646af67692ae1a67fd5ee76e84723#diff-a4fc3be128b23679672d7d28616e553d81c0631f38e9205774721678bbabfcb7R102 > The main disadvantage of this is that we need to have duplicated source > files from binutils inside this library. I'm curious why? IIRC I got rid of all such dependencies in my version, but then I could have missed something as I haven't been using it a lot. Certainly I paid very little attention to the gdb. > > First issue is that these changes break existing workflows for the > > xtensa toolchain customization. I believe that it is possible to add > > support for multiple xtensa cores without breaking the current > > configuration mechanism. > > Could you elaborate on this? I'm very new here and do not fully > understand the existing workflow and what was broken. Sure, it's the replacement of the binutils overlay files that wouldn't work with this change. Description is available here: http://wiki.linux-xtensa.org/index.php/Toolchain_Overlay_File and overlay application is a part of toolchain build systems like crosstool-NG: https://github.com/crosstool-ng/crosstool-ng/blob/crosstool-ng-1.25.0/scripts/functions#L2413 and buildroot: https://github.com/buildroot/buildroot/blob/2022.08/package/binutils/binutils.mk#L115 > > what's the option for disassembling code that lacks the .xtensa.info? > > Another option could be to write cpu to the elf's e_flags. The initial > code exists. Needs just to add another machines: > https://github.com/bminor/binutils-gdb/blob/1eeb0316304f2d4e2c48aa8887e28c936bfe4f4d/include/elf/xtensa.h#L104 Any kind of numbering means that there must be an authority that will at least make sure that the numbers are unique. I think we're much better off recording core name in the .xtensa.info while also providing a fallback mechanism for the case this information is missing or there's a need to override it. I think that I need to research why Tensilica hasn't done anything like that, neither here nor in its internal toolchain. > What if I redo this patch with removing the most definitions from > xtensa-config.h? XCHAL_HAVE_BE, XCHAL_HAVE_ABS, XCHAL_HAVE_ADDX, ..., > and most all other hardcoded definitions could be gotten from xtensa- > modules.c That will not remove these definitions from the existing overlays. And also there's a copy of this header in the gcc tree, which I'd like to keep in sync. xtensa-dynconfig series was able to deal with these names by redefining the X?HAL_* macros. I think that we first need to complete getting rid of the macro use in preprocessor conditionals inside the toolchain source code. And then provide these macros as compiler built-ins for the target libraries.
On Fri, Oct 28, 2022 at 8:48 AM Max Filippov <jcmvbkbc@gmail.com> wrote: > I think that we first need to complete getting rid of > the macro use in preprocessor conditionals inside the toolchain source ...and in other static contexts of course, like static initializers, array sizes, etc.
Thank you for clarification. Now I see that my approach is not really fit to the current workflow. I could port your patch from 2017 (with espressif's changes and comments resolves) to the latest binutils and send it to mailing list. If you don't mind. Regards, Alexey
On Sun, Oct 30, 2022 at 11:38 PM Alexey Lapshin <alexey.lapshin@espressif.com> wrote: > I could port your patch from 2017 (with espressif's changes and > comments resolves) to the latest binutils and send it to mailing list. > If you don't mind. Sure, I guess we can start with that. I also have a couple improvements in mind, let's see if we can make something solid this time.