### Install stm32-mcp Source: https://github.com/shieldyguy/stm32-mcp/blob/main/README.md Clone the repository, set up a virtual environment, and install the package in editable mode. ```bash git clone https://github.com/shieldyguy/stm32-mcp.git cd stm32-mcp python3 -m venv .venv source .venv/bin/activate pip install -e . ``` -------------------------------- ### Start Live Memory Monitoring Session Source: https://github.com/shieldyguy/stm32-mcp/blob/main/README.md Initiate a live memory monitoring session for firmware variables using SWD. Specify variables by symbol name or address, the ELF file path, and the probe to use. The interval determines how frequently variables are polled. ```python live_memory_start( variables='["blink", "ts"]', # symbol names from ELF elf_path="/path/to/firmware.elf", probe="taillight", # board/probe nickname interval_ms=500 # min 250ms ) ``` -------------------------------- ### Activate Virtual Environment and Run MCP Server Source: https://github.com/shieldyguy/stm32-mcp/blob/main/README.md Activate the Python virtual environment and run the MCP server script. Ensure you are in the project's root directory. ```bash source .venv/bin/activate mcp dev src/stm32_mcp/server.py ``` -------------------------------- ### Register stm32-mcp with Claude Code (Project Config) Source: https://github.com/shieldyguy/stm32-mcp/blob/main/README.md Configure the stm32-mcp server in your project's Claude settings file. ```json { "mcpServers": { "stm32": { "command": "/path/to/stm32-mcp/.venv/bin/python", "args": ["-m", "stm32_mcp.server"] } } } ``` -------------------------------- ### Register stm32-mcp with Claude Code (CLI) Source: https://github.com/shieldyguy/stm32-mcp/blob/main/README.md Register the stm32-mcp server using the Claude CLI, specifying the Python interpreter path. ```bash claude mcp add stm32 -- /path/to/stm32-mcp/.venv/bin/python -m stm32_mcp.server ``` -------------------------------- ### Loopback Testing with pyserial Source: https://github.com/shieldyguy/stm32-mcp/blob/main/README.md Perform loopback testing for serial tools using pyserial's loopback functionality. This allows testing serial communication without physical hardware. ```python import serial ser = serial.serial_for_url("loop://", baudrate=115200, timeout=0.1) ser.write(b"PING\n") print(ser.read(100)) # b'PING\n' ``` -------------------------------- ### Execute Hardware Sequences with Serial, Delay, Capture, and Memory Ops Source: https://github.com/shieldyguy/stm32-mcp/blob/main/README.md Define a sequence of hardware operations including serial communication, delays, webcam captures, and SWD memory read/write. This is useful for timing-sensitive hardware tests and bit-banging registers. ```json [ { "send": "SIM_LEFT", "to": "/dev/cu.usbmodem11202" }, { "delay_ms": 500 }, { "send": "GET_BLINK_STATE", "to": "/dev/cu.usbmodem11402", "expect": "BLINK" }, { "capture": true, "label": "post_brake" }, { "mem_write": true, "address": "0x48000418", "value": "0x40", "probe": "yellow" }, { "delay_ms": 1000 }, { "mem_read": true, "address": "0x48000400", "count": 2, "probe": "yellow", "label": "gpio_post" } ] ``` -------------------------------- ### Read Recent Values from Live Memory Session Source: https://github.com/shieldyguy/stm32-mcp/blob/main/README.md Retrieve recent values from an active live memory monitoring session. Specify the session ID and the number of last entries to read. Full history is logged to a JSONL file. ```python live_memory_read(session_id="abc123", last_n=10) ``` -------------------------------- ### Stop Live Memory Monitoring Session Source: https://github.com/shieldyguy/stm32-mcp/blob/main/README.md Terminate a live memory monitoring session. This releases the SWD connection. The function returns session statistics including duration, read count, error count, and the output file path. ```python live_memory_stop(session_id="abc123") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.