From 4a97b23d5aa86592a642749a51acfa7a6ce1b58e Mon Sep 17 00:00:00 2001 From: Maxim Reznik Date: Sun, 18 Aug 2024 19:23:20 +0300 Subject: [PATCH] Rename esp32-elf to xtensa-elf. Drop e3-core patch and change `lib/platform_db.py` instead. --- .github/workflows/linux.yml | 4 +--- .github/workflows/macos.yml | 4 +--- .github/workflows/macos_arm.yml | 4 +--- .github/workflows/windows.yml | 4 +--- README.md | 2 -- esp32-e3.patch | 26 -------------------------- lib/platform_db.py | 3 +++ sanity-checking/drivers/platform_db.py | 3 +++ specs/gcc.anod | 2 +- utils/gen_gnat_manifests.py | 1 + 10 files changed, 12 insertions(+), 41 deletions(-) delete mode 100644 esp32-e3.patch diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 08c2f80..5259899 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -97,7 +97,7 @@ jobs: strategy: fail-fast: false matrix: - target: ["arm-elf", "esp32-elf", "riscv64-elf", "avr-elf"] + target: ["arm-elf", "riscv64-elf", "avr-elf", "xtensa-elf"] name: GNAT ${{ matrix.target }}-linux needs: gnat runs-on: ubuntu-20.04 @@ -119,8 +119,6 @@ jobs: run: | python -m pip install --upgrade pip pip install e3-core==22.1.0 - FILE=$(python -c "import e3.platform_db.knowledge_base;print (e3.platform_db.knowledge_base.__file__)") - patch "$FILE" ./esp32-e3.patch - name: Build GNAT ${{ matrix.target }} run: ./anod build gcc -v --loglevel DEBUG --target=${{ matrix.target }} --enable-cleanup diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 3d63d43..3b9f686 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -94,7 +94,7 @@ jobs: strategy: fail-fast: false matrix: - target: ["arm-elf", "esp32-elf", "riscv64-elf", "avr-elf"] + target: ["arm-elf", "riscv64-elf", "avr-elf", "xtensa-elf"] name: GNAT ${{ matrix.target }}-darwin needs: gnat runs-on: macos-12 @@ -116,8 +116,6 @@ jobs: run: | python -m pip install --upgrade pip pip install e3-core==22.1.0 - FILE=$(python -c "import e3.platform_db.knowledge_base;print (e3.platform_db.knowledge_base.__file__)") - patch "$FILE" ./esp32-e3.patch - name: Build GNAT ${{ matrix.target }} run: ./anod build gcc -v --loglevel DEBUG --target=${{ matrix.target }} --enable-cleanup diff --git a/.github/workflows/macos_arm.yml b/.github/workflows/macos_arm.yml index 82602e0..31af9cb 100644 --- a/.github/workflows/macos_arm.yml +++ b/.github/workflows/macos_arm.yml @@ -54,7 +54,7 @@ jobs: strategy: fail-fast: false matrix: - target: ["arm-elf", "esp32-elf", "riscv64-elf"] # , "avr-elf"] + target: ["arm-elf", "riscv64-elf", "xtensa-elf"] # , "avr-elf"] # libc-avr doesn't recognize aarch64-apple machine # https://github.com/avrdudes/avr-libc/issues/978 name: GNAT ${{ matrix.target }}-darwin @@ -84,8 +84,6 @@ jobs: run: | python -m pip install --upgrade pip pip install e3-core==22.1.0 - FILE=$(python -c "import e3.platform_db.knowledge_base;print (e3.platform_db.knowledge_base.__file__)") - patch "$FILE" ./esp32-e3.patch - name: Build GNAT ${{ matrix.target }} run: ./anod build gcc -v --loglevel DEBUG --target=${{ matrix.target }} --enable-cleanup diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 8b0bfb5..c875f50 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -128,7 +128,7 @@ jobs: strategy: fail-fast: false matrix: - target: ["arm-elf", "esp32-elf", "riscv64-elf", "avr-elf"] + target: ["arm-elf", "riscv64-elf", "avr-elf", "xtensa-elf"] name: GNAT ${{ matrix.target }}-windows needs: gnat runs-on: windows-2019 @@ -156,8 +156,6 @@ jobs: run: | python -m pip install --upgrade pip pip install e3-core==22.1.0 - FILE=$(python -c "import e3.platform_db.knowledge_base;print (e3.platform_db.knowledge_base.__file__)") - patch "$FILE" ./esp32-e3.patch - name: Prepare msys2 build setup # We need a path that is compatible between Windows and Unix world diff --git a/README.md b/README.md index 3702f4a..e5af352 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,6 @@ This can be done in a virtual env, e.g.: $ python3 -m venv my-virtual-env $ source my-virtual-env/bin/activate $ pip install e3-core==22.1.0 -# For esp32 only: -$ patch -p1 < esp32-e3.patch ``` To build a spec, for example `mpc`, run the `anod` script: diff --git a/esp32-e3.patch b/esp32-e3.patch deleted file mode 100644 index aa3cf6e..0000000 --- a/esp32-e3.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- my-virtual-env/lib/python3.10/site-packages/e3/platform_db/knowledge_base.py 2024-08-16 09:12:34.234094200 +0300 -+++ my-virtual-env/lib/python3.10/site-packages/e3/platform_db/knowledge_base.py 2024-08-16 09:13:03.987098168 +0300 -@@ -10,6 +10,7 @@ - "aarch64": {"endian": "little", "bits": 64}, - "arm": {"endian": "little", "bits": 32}, - "avr": {"endian": "little", "bits": 16}, -+ "esp32": {"endian": "little", "bits": 32}, - "powerpc": {"endian": "big", "bits": 32}, - "powerpc64": {"endian": "big", "bits": 64}, - "sparc": {"endian": "big", "bits": 32}, -@@ -81,6 +82,7 @@ - "arm-ios": {"cpu": "arm", "os": "ios", "is_hie": False}, - "avr-elf": {"cpu": "avr", "os": "none", "is_hie": True}, - "arm-linux": {"cpu": "arm", "os": "linux", "is_hie": False, "endian": "little"}, -+ "esp32-elf": {"cpu": "esp32", "os": "none", "is_hie": True}, - "ppc-aix": {"cpu": "powerpc", "os": "aix", "is_hie": False}, - "ppc-linux": {"cpu": "powerpc", "os": "linux", "is_hie": False}, - "raspberrypi-linux": { -@@ -118,6 +120,7 @@ - "arm-ios": {"name": "arm-apple-darwin10"}, - "avr-elf": {"name": "avr"}, - "arm-linux": {"name": "arm-linux-gnueabi"}, -+ "esp32-elf": {"name": "xtensa-esp32-elf"}, - "ppc-aix": {"name": "powerpc-ibm-aix%(os_version)s.0.0"}, - "ppc-linux": {"name": "powerpc-generic-linux-gnu"}, - "raspberrypi-linux": {"name": "arm-linux-gnueabihf"}, diff --git a/lib/platform_db.py b/lib/platform_db.py index 3f34762..3fadd62 100644 --- a/lib/platform_db.py +++ b/lib/platform_db.py @@ -4,6 +4,7 @@ class PlatDB(PlatformDBPlugin): def update_db(self) -> None: self.cpu_info.update( { + "xtensa": {"endian": "little", "bits": 32}, "riscv32": {"endian": "little", "bits": 32}, "riscv64": {"endian": "little", "bits": 64}, } @@ -34,6 +35,7 @@ def update_db(self) -> None: self.platform_info.update( { "aarch64-darwin": {"cpu": "aarch64", "os": "darwin", "is_hie": False}, + "xtensa-elf": {"cpu": "xtensa", "os": "none", "is_hie": True}, "riscv32-elf": {"cpu": "riscv32", "os": "none", "is_hie": True}, "riscv64-elf": {"cpu": "riscv64", "os": "none", "is_hie": True}, "riscv32-unknown-elf": {"cpu": "riscv32", "os": "none", "is_hie": True}, @@ -44,6 +46,7 @@ def update_db(self) -> None: self.build_targets.update( { "aarch64-darwin": {"name": "aarch64-apple-darwin%(os_version)s"}, + "xtensa-elf": {"name": "xtensa-esp32-elf"}, "riscv32-elf": {"name": "riscv32-elf"}, "riscv64-elf": {"name": "riscv64-elf"}, "riscv32-unknown-elf": {"name": "riscv32-unknown-elf"}, diff --git a/sanity-checking/drivers/platform_db.py b/sanity-checking/drivers/platform_db.py index c88aed9..8a9113b 100644 --- a/sanity-checking/drivers/platform_db.py +++ b/sanity-checking/drivers/platform_db.py @@ -4,6 +4,7 @@ class PlatDB(PlatformDBPlugin): def update_db(self) -> None: self.cpu_info.update( { + "xtensa": {"endian": "little", "bits": 32}, "riscv32": {"endian": "little", "bits": 32}, "riscv64": {"endian": "little", "bits": 64}, } @@ -32,6 +33,7 @@ def update_db(self) -> None: self.platform_info.update( { + "xtensa-elf": {"cpu": "xtensa", "os": "none", "is_hie": True}, "riscv32-elf": {"cpu": "riscv32", "os": "none", "is_hie": True}, "riscv64-elf": {"cpu": "riscv64", "os": "none", "is_hie": True}, "riscv32-unknown-elf": {"cpu": "riscv32", "os": "none", "is_hie": True}, @@ -41,6 +43,7 @@ def update_db(self) -> None: self.build_targets.update( { + "xtensa-elf": {"name": "xtensa-esp32-elf"}, "riscv32-elf": {"name": "riscv32-elf"}, "riscv64-elf": {"name": "riscv64-elf"}, "riscv32-unknown-elf": {"name": "riscv32-unknown-elf"}, diff --git a/specs/gcc.anod b/specs/gcc.anod index 7c0ea35..65eceb3 100644 --- a/specs/gcc.anod +++ b/specs/gcc.anod @@ -53,7 +53,7 @@ class GCC(spec("gh-artifact")): self.env.target.triplet == "arm-eabi" or self.env.target.triplet == "riscv64-elf" or self.env.target.triplet == "avr-elf" - or self.env.target.triplet.endswith("esp32-elf") + or self.env.target.triplet == "xtensa-esp32-elf" ) @property diff --git a/utils/gen_gnat_manifests.py b/utils/gen_gnat_manifests.py index 84ba17f..264b782 100755 --- a/utils/gen_gnat_manifests.py +++ b/utils/gen_gnat_manifests.py @@ -14,6 +14,7 @@ "x86_64": {"crate": "gnat_native", "description": "Native"}, "arm-elf": {"crate": "gnat_arm_elf", "description": "ARM cross-compiler"}, "avr-elf": {"crate": "gnat_avr_elf", "description": "RISC-V cross-compiler"}, + "xtensa-elf": {"crate": "gnat_xtensa_elf", "description": "Xtensa LX7 cross-compiler"}, "riscv64-elf": {"crate": "gnat_riscv64_elf", "description": "AVR cross-compiler"}, }