Conversation
Program the ST Serial Wire Output path on the H7 so the Cortex-M7 ITM trace reaches the SWO pin (PB3/TRACESWO). The ARM CoreSight TPIU does not drive the pin on the H7; the ST SWO (0x5C003000) and SWTF funnel (0x5C004000) do. AI (opencode, model big-pickle, 128k context) implemented: - Hand-written peripheralyzer-style Swo.hpp/SwoTraceFunnel.hpp register headers (offsets static_assert'd) + UNITTEST RAM globals + linker PROVIDEs for both debug blocks. - initialize::enable_serial_wire_output() in the H7 debug.cpp: enables the DBGMCU trace port clocks (TRACECLKEN/D1DBGCKEN/D3DBGCKEN), unlocks the SWO/SWTF blocks (0xC5ACCE55), selects Async-NRZ, programs SWO_CODR from TRACECK (= PLL1R, 100 MHz) and enables the SWTF. F4 gets a documented no-op (its standard TPIU drives SWO). - clocks.cpp now computes ClockTree.trace (PLL1R on H7, sysclk on F4) and calls enable_serial_wire_output() from the vendor clocks(): module archives are scanned once before jarnax, so vendor symbols referenced only from configure.cpp are never extracted (same issue as early_power, FIXME at clocks.cpp:38). - BoardContext: PB3 as TRACESWO (AF0, very-high speed, push-pull). - Demo emits a periodic SWO-OK marker on the SWO System port. - 10 new gtest cases over the UNITTEST globals (DBGMCU bits, unlock values, CODR, protocol, ENSO); host llvm + clang pass. Human: board pin bring-up decisions and review. Verified: M4/M7 cross (+ci variants) and host llvm/clang presets build clean; hardware shows DBGMCU_CR=0x00700007, SWO_CODR=0x2b (100 MHz / 2.24 MBaud), SWO_SPPR=2 (AsyncNRZ), SWTF_CTRL=0x301 at cortex::system::main() entry.
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #41. Programs the ST Serial Wire Output path on the STM32H7 so the Cortex-M7 ITM trace stream reaches the SWO pin (PB3 / TRACESWO). On the H7 the ARM CoreSight TPIU does not drive the SWO pin — the ST SWO (0x5C003000) and SWTF funnel (0x5C004000) blocks do.
What changed
stm32/h7xx/Swo.hpp+SwoTraceFunnel.hpp(hand-written, peripheralyzer style, offsetsstatic_asserted), UNITTEST RAM globals, and linkerPROVIDEs for both debug blocks.enable_serial_wire_output(trace_clock, baud)(H7debug.cpp): enables DBGMCU TRACECLKEN/D1DBGCKEN/D3DBGCKEN, unlocks SWO/SWTF (0xC5ACCE55), selects Async-NRZ, programsSWO_CODRfrom TRACECK (= PLL1R), enables the SWTF. F4 gets a documented no-op (its standard TPIU drives SWO).ClockTree.trace: computed inclocks.cpp(PLL1R on H7, sysclk on F4) and the vendor call invoked fromclocks()— required because module archives are scanned once before jarnax, so vendor symbols referenced only fromconfigure.cppnever link (same issue asearly_power, FIXME atclocks.cpp:38).SWO-OKmarker on the SWO System port for verification.Verification
-ci) and host llvm/clang presets build clean;on-host-native-gccexcluded (documented Darwin-only failure).cortex::system::main():DBGMCU_CR= 0x00700007 (trace/debug clocks on)SWO_CODR= 0x2b → 100 MHz / 2.24 MBaudSWO_SPPR= 2 → AsyncNRZ (UART)SWTF_CTRL= 0x301 → ENSO enabledFollow-ups