# Modbus Runtime Cleanup Design ## Goal Reduce the XDM-60T4-E Modbus RTU slave build surface and remove IAR-only communication snapshots without changing Modbus behavior, TouchWin mapping, RTC-backed register retention, or the two live-watch data arrays requested by the user. ## Confirmed Decisions - Retain `holdingRegisters`, `coilStorage`, and `extendedHoldingRegister` as global data objects for IAR Live Watch. - Remove request/response frame snapshots, register/coil mirror arrays, diagnostic status values, UART error snapshots, and snapshot sequence state. - Remove only unused HAL source entries from `EWARM/Modbus.ewp`; retain all vendor files under `Drivers/STM32F4xx_HAL_Driver`. - Preserve test sources, reference documents, the `uC-OS2_temp` reference directory, IAR settings, and the downloadable `EWARM/Modbus/Exe/Modbus.hex`. - Remove generated host test binaries, crash dumps, and IAR intermediate build artifacts. Add ignore rules so they do not return to version control. ## Safety Constraints - The ordinary Modbus data range, coils, 0x41/0x42/0x43 private functions, USART1 receive recovery, T1.5/T3.5 timing, and RTC backup behavior must not change. - `Modbus.hex` is retained as the deployable firmware image. `Modbus.out`, `Modbus.sim`, IAR object files, and map files are reproducible outputs. - Existing host tests and the IAR target build are the regression gate. No pre-existing user modifications are reverted, staged, or committed. ## Deliverables - Leaner IAR source list and runtime source code with focused Doxygen comments. - `docs/项目设计.md` describing the final architecture and exact `file:line` source locations after cleanup.