Core/Src/main.c USER CODE PD
/* USER CODE BEGIN PD */
#ifndef LESSON7_FIXED
#define LESSON7_FIXED 0
#endif
/* USER CODE END PD */

Core/Src/main.c USER CODE PV
/* USER CODE BEGIN PV */
volatile uint32_t step_count = 0U;
volatile uint32_t event_count = 0U;
volatile uint32_t observed_value = 0U;
volatile uint32_t trace_dropped = 0U;
/* USER CODE END PV */

Core/Src/main.c USER CODE PFP
/* USER CODE BEGIN PFP */
static void Trace_TryPutChar(uint8_t value);
/* USER CODE END PFP */

Core/Src/main.c USER CODE 3
/* USER CODE BEGIN 3 */
    step_count++;
    uint32_t derived = step_count * 2U;
    observed_value = derived;
#if LESSON7_FIXED
    if (step_count >= 10U)
#else
    if (step_count > 10U)
#endif
    {
      event_count++;
      step_count = 0U;
      HAL_GPIO_TogglePin(USER_LED_GPIO_Port, USER_LED_Pin);
      Trace_TryPutChar((uint8_t)'E');
    }
    HAL_Delay(100U);
  }
  /* USER CODE END 3 */

Core/Src/main.c USER CODE 4
/* USER CODE BEGIN 4 */
static void Trace_TryPutChar(uint8_t value)
{
  if (((CoreDebug->DEMCR & CoreDebug_DEMCR_TRCENA_Msk) != 0U) &&
      ((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0U) &&
      ((ITM->TER & 1UL) != 0U) &&
      (ITM->PORT[0].u32 != 0U))
  {
    ITM->PORT[0].u8 = value;
  }
  else
  {
    trace_dropped++;
  }
}
/* USER CODE END 4 */

CMSIS core_cm4.h defines CoreDebug_DEMCR_TRCENA_Msk and ITM_TCR_ITMENA_Msk; exact source SHA256 is recorded. ITM output function is user code, not generated by CubeMX. The handler checks readiness once and never spins. It does not automatically enable trace gates or configure the TPIU output. The optional SWO connection and debugger trace setup are required separately.

Offline objdump/nm/DWARF commands are included as actual CMake POST_BUILD steps and completed during build; the server persists only standard ELF/MAP artifacts. Their temporary inspection text files were not retained. Delivered elf-inspection.json is independently produced by the included stdlib ELF metadata parser and is not a target debugger log.
