Skip to content

feat: ARM target profiles with FPU capability threading#38

Merged
avrabe merged 1 commit intomainfrom
feat/target-profiles
Mar 2, 2026
Merged

feat: ARM target profiles with FPU capability threading#38
avrabe merged 1 commit intomainfrom
feat/target-profiles

Conversation

@avrabe
Copy link
Contributor

@avrabe avrabe commented Mar 2, 2026

Summary

  • Add fpu: Option<FPUPrecision> to TargetSpec and thread it through the entire compilation pipeline (CLI → instruction selector → encoder → ELF builder → startup code)
  • New target constructors: cortex_m3(), cortex_m4f(), cortex_m7dp() with correct triples and FPU settings
  • New --target CLI flag (cortex-m3, cortex-m4, cortex-m4f, cortex-m7, cortex-m7dp) that implies --cortex-m for Cortex-M targets
  • Target-aware float error messages: "target cortex-m3 has no FPU" vs "VFP encoding not yet implemented (target cortex-m4f has FPU)"
  • ELF e_flags set to EF_ARM_ABI_FLOAT_HARD for hard-float targets
  • Cortex-M startup emits CPACR FPU enable sequence (CP10+CP11 full access, DSB, ISB) when target has FPU
  • ArmEncoder gains fpu field (prep for VFP instruction encoding in Task 4)

Prerequisite for #36 (anti-pinch test case requires VFP float support).

Test plan

  • All 44 test suites pass (cargo test --workspace)
  • cargo clippy --workspace --all-targets -- -D warnings clean
  • cargo fmt --check clean
  • f64 rejection tests updated to match new error message format
  • New tests for cortex_m3, cortex_m4f, cortex_m7dp, cortex_m7 target parsing
  • CI passes

🤖 Generated with Claude Code

Add `fpu: Option<FPUPrecision>` to `TargetSpec` and thread it through
the entire compilation pipeline — CLI, instruction selector, encoder,
ELF builder, and Cortex-M startup code. This prepares the pipeline for
VFP floating-point instruction selection on M4F/M7 targets.

- New target constructors: cortex_m3(), cortex_m4f(), cortex_m7dp()
- New --target CLI flag (cortex-m3, cortex-m4, cortex-m4f, cortex-m7, cortex-m7dp)
- Target-aware float error messages ("no FPU" vs "VFP not yet implemented")
- ELF e_flags: EF_ARM_ABI_FLOAT_HARD set for hard-float targets
- FPU startup: CPACR CP10+CP11 enable with DSB/ISB barriers
- ArmEncoder gains fpu field (prep for VFP encoding)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@avrabe avrabe merged commit 12a0d14 into main Mar 2, 2026
5 checks passed
@avrabe avrabe deleted the feat/target-profiles branch March 2, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant