feat(debug): print link command on -v + always emit firmware.map (fixes #305)#308
Conversation
#305) Two small debuggability patches per the issue: A. Linker invocations now eprintln! the full command line when -v is passed. tracing::info! is kept for log integration but also goes to stderr so plain CLI users see it. B. Every per-platform linker now adds -Wl,-Map=firmware.map to the link command. Lands next to firmware.elf in output_dir. Cost is essentially zero (~50-500 KB plain text) and pays for itself the first time anyone asks "why is this symbol in my ELF?" (See #304 for the recent investigation that took 45 min for want of a map.) WASM and ESP32 paths intentionally skipped — different artifact shapes. Closes #305.
|
Warning Review limit reached
More reviews will be available in 22 minutes and 22 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
Fixes #305. Two tiny patches:
-v-gated log of the link command line now goes througheprintln!in addition totracing::info!, so plain CLI users see it without configuring tracing subscribers.firmware.elfvia-onow adds-Wl,-Map=firmware.mapnext to the ELF. Tiny artifact, huge debugging value.Linkers covered
avr/avr_linker.rsch32v/ch32v_linker.rsesp8266/esp8266_linker.rsgeneric_arm/arm_linker.rsnrf52/nrf52_linker.rsrenesas/renesas_linker.rssam/sam_linker.rssilabs/silabs_linker.rsteensy/teensy_linker.rsOut of scope
pipeline/sequential.rs:27-28). Happy to follow up if a maintainer wants those covered too.fbuild diagsubcommand) deferred — the-v+ map file combo already unblocks the kind of investigation that motivated the issue.Implementation notes
eprintln!is added alongsidetracing::info!— log integration is preserved, and stderr surfacing is additive.output_dir.join("firmware.map")) so the artifact lands deterministically next tofirmware.elf.avr_linker.rsextracts arg-building into a privatebuild_link_args()helper so the new unit test can assert the argv without invoking the toolchain. No behavior change.Verification
soldr cargo check -p fbuild-build— clean.soldr cargo clippy -p fbuild-build --all-targets -- -D warnings— exit 0 (only the pre-existing global "MSRV in clippy.toml differs from Cargo.toml" warning, unrelated to this PR).soldr cargo test -p fbuild-build --lib avr_linker— 2 passed, 0 failed (newtest_avr_link_args_contain_map_flagasserts the argv contains-Wl,-Map=and that the path resolves to<output_dir>/firmware.map).