Skip to content

Extend the compiler plugin to work with cmake - #20076

Open
jepler wants to merge 3 commits into
micropython:masterfrom
jepler:compiler-plugin-cmake
Open

jepler wants to merge 3 commits into
micropython:masterfrom
jepler:compiler-plugin-cmake

Conversation

@jepler

@jepler jepler commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Build the compiler plugin with a Python script which can be used from make or cmake. This allows it to work with rp2 and esp32 builds.

Still not supported: rp2 riscv and zephyr due to missing gcc-plugin.h. (a limitation of the upstream toolchains for these ports)

This also should fix the problem that the plugin in auto mode would enable for clang in some circumstances.

It also adds the ability to print enums with %u etc.

Testing

I ran the CI in my branch and spot checked that the plugin was used when expected. I also fixed one format string bug on esp32.

Trade-offs and Alternatives

A Python script seemed preferable to a shell script.

Generative AI

I did not use generative AI tools when creating this PR.

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
@codecov

codecov Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.57%. Comparing base (44466c7) to head (c9266ee).
⚠️ Report is 13 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #20076      +/-   ##
==========================================
- Coverage   98.60%   98.57%   -0.04%     
==========================================
  Files         182      182              
  Lines       23436    23436              
  Branches        5        5              
==========================================
- Hits        23110    23101       -9     
- Misses        325      334       +9     
  Partials        1        1              
Flag Coverage Δ
unix-coverage-32bit 98.57% <ø> (-0.04%) ⬇️
unix-coverage-64bit 98.53% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown

Code size report:

Reference:  tools/mpy-tool.py: Fix freezing of negative floats with REPR_C and D. [cb9c46b]
Comparison: plugin: Allow it to work with cmake-based builds. [merge of c9266ee]
  mpy-cross:    +0 +0.000% 
   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
      esp32:    -4 -0.000% ESP32_GENERIC
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

@jepler

jepler commented Dec 6, 2026

Copy link
Copy Markdown
Contributor Author

This and #20076 will conflict. It's probably easier to rebase this one after that one is merged.

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