Skip to content

H7 linker script maps DBGMCU to F4 address; TIM2 debug freeze never engages #50

Description

@emrainey

The STM32H753 linker script (modules/stm32/linkerscripts/stm32h753zi-sections.ld) binds _stm32_debug (and therefore stm32::h7xx::debug) to ORIGIN(PPB) + 0x42000 = 0xE0042000, which is the F4 DBGMCU address.

On STM32H7 the DBGMCU is not a CoreSight component:

  • processor-core address: 0x5C001000
  • debugger (APB-D) alias: 0xE00E1000

Consequence: Timer::Initialize() (modules/stm32/source/Timer2.cpp) sets timer2_stop_in_debug = 1, but the write lands on a dead address, so DBGMCU_APB1LFZ1.DBG_TIM2 never becomes 1 and TIM2 free-runs during debug halts. This corrupted all while-halted register/memory observations (TIM2 SR/CNT and the overflow counter), making the timer look grossly inaccurate when debugged.

Fix: set _stm32_debug = 0x5C001000;.

Verified on hardware:

  • stm32::h7xx::debug binds to 0x5C001000
  • APB1LFZ1.DBG_TIM2 = 1 after boot
  • TIM2 now freezes with the core during debug; post-write SR=0x1E in the ISR confirms UIF clears correctly (clear-on-zero).

Activity

  1. self-assigned this
    on Aug 10, 2026
  2. emrainey commented on Aug 10, 2026

    @emrainey
    OwnerAuthor

    Branch issue-50 (tracking develop) created with the one-line linker fix committed (8b1b695). PR: #51. Host unit tests 19/19 (LLVM + AppleClan) and M4/M7 cross builds verified earlier with this linker line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions