Skip to content

Instantly share code, notes, and snippets.

@thibthibaut
Last active March 4, 2022 09:15
Show Gist options
  • Save thibthibaut/cf1885456936cd51f8b95ea23270eec6 to your computer and use it in GitHub Desktop.
Save thibthibaut/cf1885456936cd51f8b95ea23270eec6 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pygdbmi.gdbcontroller import GdbController
from pprint import pprint as print
import time
import subprocess
GDB_SERVER_PATH = "/opt/st/stm32cubeide_1.7.0/plugins/com.st.stm32cube.ide.mcu.externaltools.stlink-gdb-server.linux64_2.0.0.202105311346/tools/bin/ST-LINK_gdbserver"
CUBEPROG_PATH = "/local/home/vercueit/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/"
PORT = "6666"
gdb_process = subprocess.Popen([GDB_SERVER_PATH, "-cp", CUBEPROG_PATH, "-d", "-p", PORT])
time.sleep(5)
gdbmi = GdbController(
command=[
"/opt/st/stm32cubeide_1.7.0/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.linux64_2.0.0.202105311346/tools/bin/arm-none-eabi-gdb-py",
"--interpreter=mi2",
],
time_to_check_for_additional_output_sec=5,
)
gdbmi.write(
'file "./Projects/STM32H747I-DISCO/Application/V1/HBDC/SW4STM32/STM32H747I_DISCO/STM32H747I_DISCO_CM7/STM32H747I_DISCO_CM7.elf"'
)
gdbmi.write("target extended-remote :6666")
gdbmi.write("load", timeout_sec=15)
gdbmi.write("set max-value-size 100000000")
gdbmi.write("monitor reset")
gdbmi.write("break main.c:325")
gdbmi.write("c")
while True:
response = gdbmi.write("print roi", timeout_sec=3)
print(response)
gdbmi.write("c")
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment