Add a C compiler for the XGATE coprocessor #4

Open
opened 2026-09-24 09:53:34 +02:00 by sid · 0 comments
Owner

CodeWarrior supported C programming for the XGATE coprocessor found on S12X devices, in addition to the main CPU. This repo ships binutils-xgate (assembler, linker, objdump for xgate-elf) but no C compiler and no runtime, so application logic for the XGATE must be written in hand assembly.

Current state

  • binutils-xgate is built by re-targeting pkgs/binutils-m68hc11.nix with target = "xgate-elf" (flake.nix).
  • check-xgate only assembles/links/objdumps hand-written assembly (flake.nix).
  • No xgate-elf-gcc, no C runtime, no library.

Motivation

  • XGATE is a performance coprocessor on S12X parts. C-level access is the normal workflow (CodeWarrior and GCC's own m68hc11 tree historically experimented with XGATE C support).
  • Assembly-only XGATE code is a barrier to porting existing projects.

Proposed scope

  • Add a C compiler backend for xgate-elf (GCC port), or wire an existing minimal C compiler that can emit XGATE.
  • Provide freestanding runtime support: interrupt handlers, the XGATE request mechanism, and basic library routines.
  • Integrate into the m68hc11-toolchain env and the tarball.

Acceptance criteria

  • A C program for the XGATE compiles, links, and produces elf32-xgate output (verified with xgate-elf-objdump, matching check-xgate).
  • At least one C-level XGATE-to-CPU interrupt/request flow is exercised in the gdb-sim test suite.
  • The XGATE compiler is available in m68hc11-toolchain and the smoke tarball.

References

  • pkgs/binutils-m68hc11.nix (XGATE re-target)
  • flake.nix: binutils-xgate, check-xgate
  • patches/sim-model/* (XGATE not yet modeled in the sim)
CodeWarrior supported C programming for the XGATE coprocessor found on S12X devices, in addition to the main CPU. This repo ships `binutils-xgate` (assembler, linker, objdump for `xgate-elf`) but no C compiler and no runtime, so application logic for the XGATE must be written in hand assembly. ## Current state - `binutils-xgate` is built by re-targeting `pkgs/binutils-m68hc11.nix` with `target = "xgate-elf"` (`flake.nix`). - `check-xgate` only assembles/links/objdumps hand-written assembly (`flake.nix`). - No `xgate-elf-gcc`, no C runtime, no library. ## Motivation - XGATE is a performance coprocessor on S12X parts. C-level access is the normal workflow (CodeWarrior and GCC's own `m68hc11` tree historically experimented with XGATE C support). - Assembly-only XGATE code is a barrier to porting existing projects. ## Proposed scope - Add a C compiler backend for `xgate-elf` (GCC port), or wire an existing minimal C compiler that can emit XGATE. - Provide freestanding runtime support: interrupt handlers, the XGATE request mechanism, and basic library routines. - Integrate into the `m68hc11-toolchain` env and the tarball. ## Acceptance criteria - A C program for the XGATE compiles, links, and produces `elf32-xgate` output (verified with `xgate-elf-objdump`, matching `check-xgate`). - At least one C-level XGATE-to-CPU interrupt/request flow is exercised in the `gdb-sim` test suite. - The XGATE compiler is available in `m68hc11-toolchain` and the smoke tarball. ## References - `pkgs/binutils-m68hc11.nix` (XGATE re-target) - `flake.nix`: `binutils-xgate`, `check-xgate` - `patches/sim-model/*` (XGATE not yet modeled in the sim)
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sid/m68hc11-toolchain#4
No description provided.