Skip to content

fix(milesight-gs301): fix STM32WL build breakage - #11649

Open
ndoo wants to merge 1 commit into
meshtastic:developfrom
meshmy:fix/milesight-gs301-nanolib-printf
Open

fix(milesight-gs301): fix STM32WL build breakage#11649
ndoo wants to merge 1 commit into
meshtastic:developfrom
meshmy:fix/milesight-gs301-nanolib-printf

Conversation

@ndoo

@ndoo ndoo commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

The milesight_gs301 variant has not compiled since it was added in #9359. It is board_level = extra, so no CI matrix build exercises it.

Two independent failures on a clean develop:

  1. build_unflags removes -DDEBUG_MUTE, but the STM32 base config (variants/stm32/stm32.ini) keeps PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF commented out. src/platform/stm32wl/architecture.h:54 then fails the build with #error "You MUST enable PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF if debug prints are enabled." This PR drops the -DDEBUG_MUTE unflag so the variant behaves like every other STM32 target. Debug logs are still reachable by #undef DEBUG_MUTE at the top of individual source files. Enabling the nanolib flag instead would keep debug prints on by default but overflows the RAK3172 flash budget by 20 bytes.
  2. SerialModule defaults SERIAL_PRINT_PORT to 2, referencing Serial2. The RAK3172 module only exposes Serial1, so the link fails with undefined reference to 'Serial2'. This PR sets SERIAL_PRINT_PORT 1 in variant.h, matching the sibling RAK3172-based variants rak3172 and CDEBYTE_E77-MBL.

After this change pio run -e milesight_gs301 succeeds: Flash 76.0% (188424 / 247808 bytes), RAM 39.4%.

🤝 Attestations

  • I have tested that my proposed changes behave as described. (build-verified only — pio run -e milesight_gs301)
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V3
    • LilyGo T-Deck
    • LilyGo T-Beam
    • RAK WisBlock 4631
    • Seeed Studio T-1000E tracker card
    • Other: milesight_gs301 — build only; change is confined to that variant's config

Summary by CodeRabbit

  • Bug Fixes
    • Restored debug output for the Milesight GS301 build.
    • Configured serial communication to use the available Serial1 port on the RAK3172 module.

The variant has not compiled since it was added in meshtastic#9359.

build_unflags removed -DDEBUG_MUTE, but the STM32 base config leaves
PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF disabled, so
src/platform/stm32wl/architecture.h:54 stops the build with an #error
as soon as debug prints are enabled. Drop the unflag so the variant
matches every other STM32 target; logs remain reachable by #undef
DEBUG_MUTE in individual source files.

SerialModule binds to Serial2 by default, but the RAK3172 module only
exposes Serial1, so linking failed with an undefined reference to
Serial2. Set SERIAL_PRINT_PORT to 1, as the sibling RAK3172 variants
rak3172 and CDEBYTE_E77-MBL already do.

Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Andrew Yong <me@ndoo.sg>
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8518d7e0-05f8-4c77-a1df-4decc588ab55

📥 Commits

Reviewing files that changed from the base of the PR and between 7e9525a and 029c9cc.

📒 Files selected for processing (2)
  • variants/stm32/milesight_gs301/platformio.ini
  • variants/stm32/milesight_gs301/variant.h
💤 Files with no reviewable changes (1)
  • variants/stm32/milesight_gs301/platformio.ini

Included review availability: Your plan provides up to 8 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

The GS301 build no longer mutes debug output. The variant routes serial output through Serial1 because Serial2 is unavailable on the RAK3172 module.

Changes

GS301 configuration

Layer / File(s) Summary
Serial and debug configuration
variants/stm32/milesight_gs301/platformio.ini, variants/stm32/milesight_gs301/variant.h
The build no longer removes DEBUG_MUTE. SERIAL_PRINT_PORT selects Serial1 for serial output.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Merge Risk: ⚪ Minimal · up to 029c9

The changes are confined to the milesight_gs301 build and serial-port configuration, and the target build succeeds; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains both build failures, the two fixes, the hardware constraint, and the successful build verification. It includes the required testing attestation and identifies that re…
Title check ✅ Passed The title clearly identifies the affected variant and the primary purpose of the change: fixing STM32WL build breakage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description clearly explains both build failures, the two fixes, the hardware constraint, and the successful build verification. It includes the required testing attestation and identifies that regression testing was limited to the affected variant.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

⚡ Try this PR in the Web Flasher

Note

Building this pull request… the flash button, badges and supported-board
list will appear here automatically once CI finishes.

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