# Repository Guidelines

## Project Structure & Module Organization
- Root Python app: `pro3_uart.py` (Tkinter UI for dual UART + J-Link debugger).
- Firmware flashing logic: `flash.py`, `fw/` assets, and `devices/Profiles/`.
- Build artifacts/specs: `dist/`, `build/`, `*.spec`, `package_pro3_exe.py`.
- Configs: `Settings.json`, `Reburn.cfg`, `Reset.cfg`.
- J-Link support: `pylink/JLinkARM.dll`; requirements in `requirements.txt`.

## Build, Test, and Development Commands
- Run UI: `python3 pro3_uart.py` (requires Tkinter, pyserial, pylink DLL, connected devices).
- Smoke syntax check: `python3 -m py_compile pro3_uart.py`.
- Flash utility (when needed): `python3 flash.py --help` to view options.

## Coding Style & Naming Conventions
- Python 3, 4-space indentation; prefer explicit names (`dev1`, `dev2`, `debugger`).
- Keep UI text short; avoid non-ASCII unless already present.
- Mirror existing Tkinter patterns (use `ttk`, queue logs via `DevicePanel.queue_message`); never sacrifice clarity for micro-reuse—duplicate a few lines if it keeps behavior explicit.

## Testing Guidelines
- No automated test suite present; rely on manual verification:
  - Connect UART devices; verify console input/history and macros.
  - Connect J-Link; confirm AP/core selection, scripts (J-Link/GDB), and command execution.
  - Run `python3 -m py_compile pro3_uart.py` before sharing changes.

## Commit & Pull Request Guidelines
- Use concise, imperative commit messages (e.g., `Add pylink AP selection UI`).
- Describe device setup and manual steps taken (UART ports, J-Link serial/AP, scripts used).
- Include screenshots/GIFs of UI changes when applicable.
- Link related issues/tasks; call out any required firmware/config files.

## Agent-Specific Instructions
- Do not modify bundled binaries/DLLs unless requested; keep `pylink/JLinkARM.dll` in place.
- Preserve existing flashing and UART workflows; avoid regressions to `DevicePanel` and `PylinkDebuggerPanel`.
- When adding UI, mirror current Tkinter style and keep labels compact for the horizontal layout.
- Favor clear, independent modules over tightly coupled helpers; avoid “minimal coding” shortcuts that hide control flow (e.g., do not overuse shared globals—pass explicit parameters and keep per-panel state encapsulated).
