├── .gitattributes
├── .gitignore
├── JLinkCommandFile.jlink
├── JLinkDevicesBuildIn.xml
├── LICENSE
├── README.md
├── icons.qrc
├── main_window.py
├── picture
├── RTT2UART.png
├── SeleteDevice.png
├── VirtualSerialPort.png
├── exportdevicelist.png
└── serialcomtool.png
├── rc_icons.py
├── requirements.txt
├── rtt2uart.py
├── rtt2uart.ui
├── sel_device.ui
├── swap_horiz_16px.ico
├── ui_rtt2uart.py
└── ui_sel_device.py
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | .vscode/*
3 | __pycache__/*
4 | settings
5 | *.pyc
6 | *.toc
7 | build/*
8 | *.pkg
9 | *.pyz
10 | *.html
11 | *.spec
12 | dist/*
13 |
--------------------------------------------------------------------------------
/JLinkCommandFile.jlink:
--------------------------------------------------------------------------------
1 | ExpDevListXML JLinkDevicesBuildIn.xml
2 | Exit
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 杨兴
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RTT2UART
2 |
3 | ***Note: Installed a virtual serial port tool like [com0com](http://com0com.sourceforge.net/) before use this tool !***
4 |
5 | 
6 |
7 | ## How to use
8 |
9 | * Step1: selete the device and click *OK*
10 |
11 | 
12 | * Step2: config the target interface and speed
13 | * Step3: tick the *Reset target* option will reset the target once connected
14 | * Step4: scan then selete the ***virtual COM port*** like *com4* and baud rate
15 | * Step5: click start to connect the target
16 | * Step6: selete another com port of the com port pair like *com5*
17 | 
18 |
19 | ## Update the device lists
20 | > Note: Starting with version v2.0.0, there is no need to update ***JLinkDevicesBuildIn.xml*** file manually!
21 |
22 | if can't find the device you want, follow the picture below and replace the ***JLinkDevicesBuildIn.xml*** file in the path of this tool.
23 |
24 | 
25 |
26 | ## Package the program with pyinstaller
27 |
28 | Open *cmd.exe* in the project path and input follow command `pyinstaller --onefile --name rtt2uart --noconsole -i .\swap_horiz_16px.ico .\main_window.py`
29 |
30 | ## Development
31 | ### Create UI python class
32 | execute the following command in a terminal
33 | ```
34 | pyside6-uic .\rtt2uart.ui -o .\ui_rtt2uart.py
35 | pyside6-uic .\sel_device.ui -o .\ui_sel_device.py
36 | ```
37 | ### Create source file python class
38 | execute the following command in a terminal
39 | ```
40 | pyside6-rcc .\icons.qrc -o .\rc_icons.py
41 | ```
42 |
--------------------------------------------------------------------------------
/icons.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | ./swap_horiz_16px.ico
4 |
5 |
6 |
--------------------------------------------------------------------------------
/main_window.py:
--------------------------------------------------------------------------------
1 | from pickle import NONE
2 | import sys
3 | from PySide6.QtWidgets import QApplication, QMainWindow, QDialog, QHeaderView, QAbstractItemView, QMessageBox, QSystemTrayIcon, QMenu
4 | from PySide6.QtCore import QFile, QAbstractTableModel
5 | from PySide6 import QtGui
6 | from PySide6 import QtCore
7 | from PySide6.QtGui import QFont, QIcon, QAction
8 | from PySide6.QtNetwork import QLocalSocket, QLocalServer
9 | from ui_rtt2uart import Ui_dialog
10 | from ui_sel_device import Ui_Dialog
11 | import rc_icons
12 |
13 | import serial.tools.list_ports
14 | import serial
15 | import ctypes.util as ctypes_util
16 | import xml.etree.ElementTree as ET
17 | import pylink
18 | from rtt2uart import rtt_to_serial
19 | import logging
20 | import pickle
21 | import os
22 | import subprocess
23 |
24 | logging.basicConfig(level=logging.NOTSET,
25 | format='%(asctime)s - [%(levelname)s] (%(filename)s:%(lineno)d) - %(message)s')
26 | logger = logging.getLogger(__name__)
27 |
28 | # pylink支持的最大速率是12000kHz(Release v0.7.0开始支持15000及以上速率)
29 | speed_list = [5, 10, 20, 30, 50, 100, 200, 300, 400, 500, 600, 750,
30 | 900, 1000, 1334, 1600, 2000, 2667, 3200, 4000, 4800, 5334, 6000, 8000, 9600, 12000,
31 | 15000, 20000, 25000, 30000, 40000, 50000]
32 |
33 | baudrate_list = [50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
34 | 9600, 19200, 38400, 57600, 115200, 230400, 460800, 500000, 576000, 921600]
35 |
36 |
37 | class DeviceTableModel(QtCore.QAbstractTableModel):
38 | def __init__(self, deice_list, header):
39 | super(DeviceTableModel, self).__init__()
40 |
41 | self.mylist = deice_list
42 | self.header = header
43 |
44 | def rowCount(self, parent):
45 | return len(self.mylist)
46 |
47 | def columnCount(self, parent):
48 | return len(self.header)
49 |
50 | def data(self, index, role):
51 | if not index.isValid():
52 | return None
53 | elif role != QtCore.Qt.DisplayRole:
54 | return None
55 |
56 | return self.mylist[index.row()][index.column()]
57 |
58 | return None
59 |
60 | def headerData(self, col, orientation, role):
61 | if orientation == QtCore.Qt.Horizontal and role == QtCore.Qt.DisplayRole:
62 | return self.header[col]
63 | return None
64 |
65 |
66 | class DeviceSeleteDialog(QDialog):
67 | def __init__(self):
68 | super(DeviceSeleteDialog, self).__init__()
69 | self.ui = Ui_Dialog()
70 | self.ui.setupUi(self)
71 |
72 | self.setWindowIcon(QIcon(":/swap_horiz_16px.ico"))
73 |
74 | self._target = None
75 |
76 | filepath = self.get_jlink_devices_list_file()
77 | if filepath != '':
78 | self.devices_list = self.parse_jlink_devices_list_file(filepath)
79 |
80 | if len(self.devices_list):
81 | # 从headdata中取出数据,放入到模型中
82 | headdata = ["Manufacturer", "Device", "Core",
83 | "NumCores", "Flash Size", "RAM Size"]
84 |
85 | # 生成一个模型,用来给tableview
86 | model = DeviceTableModel(self.devices_list, headdata)
87 |
88 | self.ui.tableView.setModel(model)
89 | # set font
90 | # font = QFont("Courier New", 9)
91 | # self.ui.tableView.setFont(font)
92 | # set column width to fit contents (set font first!)
93 | # Disable auto-resizing
94 | self.ui.tableView.horizontalHeader().setSectionResizeMode(QHeaderView.Fixed)
95 | self.ui.tableView.verticalHeader().setSectionResizeMode(QHeaderView.Fixed)
96 |
97 | # Set fixed column widths (adjust the values based on your needs)
98 | self.ui.tableView.setColumnWidth(0, 100) # Manufacturer
99 | self.ui.tableView.setColumnWidth(1, 280) # Device
100 | self.ui.tableView.setColumnWidth(2, 140) # Core
101 | self.ui.tableView.setColumnWidth(3, 70) # NumCores
102 | self.ui.tableView.setColumnWidth(4, 70) # Flash Size
103 | self.ui.tableView.setColumnWidth(5, 70) # RAM Size
104 | self.ui.tableView.setSelectionBehavior(
105 | QAbstractItemView.SelectRows)
106 |
107 | self.ui.tableView.clicked.connect(self.reflash_selete_device)
108 |
109 | def get_jlink_devices_list_file(self):
110 | if os.path.exists(r'JLinkDevicesBuildIn.xml') == True:
111 | return os.path.abspath('JLinkDevicesBuildIn.xml')
112 | else:
113 | raise Exception("Can not find device database !")
114 |
115 | def parse_jlink_devices_list_file(self, path):
116 | parsefile = open(path, 'r')
117 |
118 | tree = ET.ElementTree(file=parsefile)
119 |
120 | jlink_devices_list = []
121 |
122 | for VendorInfo in tree.findall('VendorInfo'):
123 | for DeviceInfo in VendorInfo.findall('DeviceInfo'):
124 | device_item = []
125 |
126 | # get Manufacturer
127 | device_item.append(VendorInfo.attrib['Name'])
128 | # get Device
129 | device_item.append(DeviceInfo.attrib['Name'])
130 | # get Core
131 | device_item.append(DeviceInfo.attrib['Core'])
132 | # get NumCores
133 | # now fix 1
134 | device_item.append('1')
135 | # get Flash Size
136 | flash_size = 0
137 | for FlashBankInfo in DeviceInfo.findall('FlashBankInfo'):
138 | flash_size += int(FlashBankInfo.attrib['Size'], 16)
139 |
140 | flash_size = flash_size // 1024
141 | if flash_size < 1024:
142 | device_item.append(str(flash_size)+' KB')
143 | else:
144 | flash_size = flash_size // 1024
145 | device_item.append(str(flash_size)+' MB')
146 | # get RAM Size
147 | ram_size = 0
148 | if 'WorkRAMSize' in DeviceInfo.attrib.keys():
149 | ram_size += int(DeviceInfo.attrib['WorkRAMSize'], 16)
150 |
151 | device_item.append(str(ram_size//1024)+' KB')
152 |
153 | # add item to list
154 | jlink_devices_list.append(device_item)
155 |
156 | parsefile.close()
157 |
158 | return jlink_devices_list
159 |
160 | def reflash_selete_device(self):
161 | index = self.ui.tableView.currentIndex()
162 | self._target = self.devices_list[index.row()][1]
163 | self.ui.label_sel_dev.setText(self._target)
164 |
165 | def get_target_device(self):
166 | return self._target
167 |
168 |
169 | class MainWindow(QDialog):
170 | def __init__(self):
171 | super(MainWindow, self).__init__()
172 | self.ui = Ui_dialog()
173 | self.ui.setupUi(self)
174 |
175 | self.setWindowIcon(QIcon(":/swap_horiz_16px.ico"))
176 |
177 | self.setting_file_path = os.path.join(os.getcwd(), "settings")
178 |
179 | self.start_state = False
180 | self.target_device = None
181 | self.rtt2uart = None
182 | self.connect_type = None
183 | # 默认Existing Session方式接入使能Auto reconnect
184 | self.ui.checkBox__auto.setChecked(True)
185 | # 默认选择'USB'方式接入
186 | self.ui.radioButton_usb.setChecked(True)
187 | self.usb_selete_slot()
188 |
189 | self.ui.comboBox_Interface.addItem("JTAG")
190 | self.ui.comboBox_Interface.addItem("SWD")
191 | self.ui.comboBox_Interface.addItem("cJTAG")
192 | self.ui.comboBox_Interface.addItem("FINE")
193 |
194 | for i in range(len(speed_list)):
195 | self.ui.comboBox_Speed.addItem(str(speed_list[i]) + " kHz")
196 |
197 | for i in range(len(baudrate_list)):
198 | self.ui.comboBox_baudrate.addItem(str(baudrate_list[i]))
199 |
200 | self.port_scan()
201 |
202 | self.settings = {'device': [], 'device_index': 0, 'interface': 0,
203 | 'speed': 0, 'port': 0, 'buadrate': 0}
204 |
205 | # 检查是否存在上次配置,存在则加载
206 | if os.path.exists(self.setting_file_path) == True:
207 | with open(self.setting_file_path, 'rb') as f:
208 | self.settings = pickle.load(f)
209 |
210 | f.close()
211 |
212 | # 应用上次配置
213 | if len(self.settings['device']):
214 | self.ui.comboBox_Device.addItems(self.settings['device'])
215 | self.target_device = self.settings['device'][self.settings['device_index']]
216 | self.ui.comboBox_Device.setCurrentIndex(
217 | self.settings['device_index'])
218 | self.ui.comboBox_Interface.setCurrentIndex(
219 | self.settings['interface'])
220 | self.ui.comboBox_Speed.setCurrentIndex(self.settings['speed'])
221 | self.ui.comboBox_Port.setCurrentIndex(self.settings['port'])
222 | self.ui.comboBox_baudrate.setCurrentIndex(
223 | self.settings['buadrate'])
224 | else:
225 | logger.info('Setting file not exist', exc_info=True)
226 | self.ui.comboBox_Interface.setCurrentIndex(1)
227 | self.settings['interface'] = 1
228 | self.ui.comboBox_Speed.setCurrentIndex(19)
229 | self.settings['speed'] = 19
230 | self.ui.comboBox_baudrate.setCurrentIndex(16)
231 | self.settings['buadrate'] = 16
232 |
233 | # 信号-槽
234 | self.ui.pushButton_Start.clicked.connect(self.start)
235 | self.ui.pushButton_scan.clicked.connect(self.port_scan)
236 | self.ui.pushButton_Selete_Device.clicked.connect(
237 | self.target_device_selete)
238 | self.ui.comboBox_Device.currentIndexChanged.connect(
239 | self.device_change_slot)
240 | self.ui.comboBox_Interface.currentIndexChanged.connect(
241 | self.interface_change_slot)
242 | self.ui.comboBox_Speed.currentIndexChanged.connect(
243 | self.speed_change_slot)
244 | self.ui.comboBox_Port.currentIndexChanged.connect(
245 | self.port_change_slot)
246 | self.ui.comboBox_baudrate.currentIndexChanged.connect(
247 | self.buadrate_change_slot)
248 | self.ui.checkBox_serialno.stateChanged.connect(
249 | self.serial_no_change_slot)
250 | self.ui.radioButton_usb.clicked.connect(self.usb_selete_slot)
251 | self.ui.radioButton_existing.clicked.connect(
252 | self.existing_session_selete_slot)
253 |
254 | try:
255 | self.jlink = pylink.JLink()
256 | except:
257 | logger.error('Find jlink dll failed', exc_info=True)
258 | raise Exception("Find jlink dll failed !")
259 |
260 | try:
261 | # 导出器件列表文件
262 | if self.jlink._library._path is not None:
263 | path_env = os.path.dirname(self.jlink._library._path)
264 | env = os.environ
265 |
266 | if self.jlink._library._windows or self.jlink._library._cygwin:
267 | jlink_env = {'PATH': path_env}
268 | env.update(jlink_env)
269 |
270 | cmd = 'JLink.exe -CommandFile JLinkCommandFile.jlink'
271 |
272 | startupinfo = subprocess.STARTUPINFO()
273 | startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
274 | startupinfo.wShowWindow = subprocess.SW_HIDE
275 |
276 | subprocess.run(cmd, check=True, startupinfo=startupinfo, creationflags=subprocess.CREATE_NEW_CONSOLE)
277 | elif sys.platform.startswith('linux'):
278 | jlink_env = {}
279 | cmd = 'JLinkExe -CommandFile JLinkCommandFile.jlink'
280 | elif sys.platform.startswith('darwin'):
281 | jlink_env = {}
282 | cmd = 'JLinkExe -CommandFile JLinkCommandFile.jlink'
283 |
284 | except Exception as e:
285 | logging.error(f'can not export devices xml file, error info: {e}')
286 |
287 | def closeEvent(self, e):
288 | if self.rtt2uart is not None and self.start_state == True:
289 | self.rtt2uart.stop()
290 |
291 | # 保存当前配置
292 | with open(self.setting_file_path, 'wb') as f:
293 | pickle.dump(self.settings, f)
294 |
295 | f.close()
296 |
297 | e.accept()
298 |
299 | def port_scan(self):
300 | port_list = list(serial.tools.list_ports.comports())
301 | self.ui.comboBox_Port.clear()
302 | port_list.sort()
303 | for port in port_list:
304 | try:
305 | s = serial.Serial(port[0])
306 | s.close()
307 | self.ui.comboBox_Port.addItem(port[0])
308 | except (OSError, serial.SerialException):
309 | pass
310 |
311 | def start(self):
312 | if self.start_state == False:
313 | logger.debug('click start button')
314 | try:
315 | device_interface = None
316 | # USB或者TCP/IP方式接入需要选择配置
317 | if not self.ui.radioButton_existing.isChecked():
318 | if self.target_device is not None:
319 | selete_interface = self.ui.comboBox_Interface.currentText()
320 | if (selete_interface == 'JTAG'):
321 | device_interface = pylink.enums.JLinkInterfaces.JTAG
322 | elif (selete_interface == 'SWD'):
323 | device_interface = pylink.enums.JLinkInterfaces.SWD
324 | elif (selete_interface == 'cJTAG'):
325 | device_interface = None
326 | elif (selete_interface == 'FINE'):
327 | device_interface = pylink.enums.JLinkInterfaces.FINE
328 | else:
329 | device_interface = pylink.enums.JLinkInterfaces.SWD
330 |
331 | # 启动后不能再进行配置
332 | self.ui.comboBox_Device.setEnabled(False)
333 | self.ui.pushButton_Selete_Device.setEnabled(False)
334 | self.ui.comboBox_Interface.setEnabled(False)
335 | self.ui.comboBox_Speed.setEnabled(False)
336 | self.ui.comboBox_Port.setEnabled(False)
337 | self.ui.comboBox_baudrate.setEnabled(False)
338 | self.ui.pushButton_scan.setEnabled(False)
339 |
340 | else:
341 | raise Exception("Please selete the target device !")
342 |
343 | # 获取接入方式的参数
344 | if self.ui.radioButton_usb.isChecked() and self.ui.checkBox_serialno.isChecked():
345 | connect_para = self.ui.lineEdit_serialno.text()
346 | elif self.ui.radioButton_tcpip.isChecked():
347 | connect_para = self.ui.lineEdit_ip.text()
348 | elif self.ui.radioButton_existing.isChecked():
349 | connect_para = self.ui.checkBox__auto.isChecked()
350 | else:
351 | connect_para = None
352 |
353 | self.rtt2uart = rtt_to_serial(self.jlink, self.connect_type, connect_para, self.target_device, self.ui.comboBox_Port.currentText(
354 | ), self.ui.comboBox_baudrate.currentText(), device_interface, speed_list[self.ui.comboBox_Speed.currentIndex()], self.ui.checkBox_resettarget.isChecked())
355 |
356 | self.rtt2uart.start()
357 |
358 | except Exception as errors:
359 | QMessageBox.critical(self, "Errors", str(errors))
360 | else:
361 | self.start_state = True
362 | self.ui.pushButton_Start.setText("Stop")
363 | else:
364 | logger.debug('click stop button')
365 | try:
366 | # Existing方式不需要选择配置,继续禁用,不恢复
367 | if self.ui.radioButton_existing.isChecked() == False:
368 | # 停止后才能再次配置
369 | self.ui.comboBox_Device.setEnabled(True)
370 | self.ui.pushButton_Selete_Device.setEnabled(True)
371 | self.ui.comboBox_Interface.setEnabled(True)
372 | self.ui.comboBox_Speed.setEnabled(True)
373 | self.ui.comboBox_Port.setEnabled(True)
374 | self.ui.comboBox_baudrate.setEnabled(True)
375 | self.ui.pushButton_scan.setEnabled(True)
376 |
377 | self.rtt2uart.stop()
378 |
379 | self.start_state = False
380 | self.ui.pushButton_Start.setText("Start")
381 | except:
382 | logger.error('Stop rtt2uart failed', exc_info=True)
383 | pass
384 |
385 | def target_device_selete(self):
386 | device_ui = DeviceSeleteDialog()
387 | device_ui.exec()
388 | self.target_device = device_ui.get_target_device()
389 |
390 | if self.target_device not in self.settings['device']:
391 | self.settings['device'].append(self.target_device)
392 | self.ui.comboBox_Device.addItem(self.target_device)
393 | self.ui.comboBox_Device.setCurrentIndex(
394 | len(self.settings['device']) - 1)
395 |
396 | def device_change_slot(self, index):
397 | self.settings['device_index'] = index
398 | self.target_device = self.ui.comboBox_Device.currentText()
399 |
400 | def interface_change_slot(self, index):
401 | self.settings['interface'] = index
402 |
403 | def speed_change_slot(self, index):
404 | self.settings['speed'] = index
405 |
406 | def port_change_slot(self, index):
407 | self.settings['port'] = index
408 |
409 | def buadrate_change_slot(self, index):
410 | self.settings['buadrate'] = index
411 |
412 | def serial_no_change_slot(self):
413 | if self.ui.checkBox_serialno.isChecked():
414 | self.ui.lineEdit_serialno.setVisible(True)
415 | else:
416 | self.ui.lineEdit_serialno.setVisible(False)
417 |
418 | def usb_selete_slot(self):
419 | self.connect_type = 'USB'
420 |
421 | self.ui.checkBox__auto.setVisible(False)
422 | self.ui.lineEdit_ip.setVisible(False)
423 | self.ui.checkBox_serialno.setVisible(True)
424 | self.serial_no_change_slot()
425 | # 通过usb方式接入,以下功能需要选择,恢复使用
426 | self.ui.comboBox_Device.setEnabled(True)
427 | self.ui.pushButton_Selete_Device.setEnabled(True)
428 | self.ui.comboBox_Interface.setEnabled(True)
429 | self.ui.comboBox_Speed.setEnabled(True)
430 | self.ui.checkBox_resettarget.setEnabled(True)
431 |
432 | def existing_session_selete_slot(self):
433 | self.connect_type = 'EXISTING'
434 |
435 | self.ui.checkBox_serialno.setVisible(False)
436 | self.ui.lineEdit_serialno.setVisible(False)
437 | self.ui.lineEdit_ip.setVisible(False)
438 | self.ui.checkBox__auto.setVisible(True)
439 | # 通过existing_session方式接入时,以下功能无效,禁止使用
440 | self.ui.comboBox_Device.setEnabled(False)
441 | self.ui.pushButton_Selete_Device.setEnabled(False)
442 | self.ui.comboBox_Interface.setEnabled(False)
443 | self.ui.comboBox_Speed.setEnabled(False)
444 | self.ui.checkBox_resettarget.setEnabled(False)
445 | self.ui.checkBox_resettarget.setChecked(False)
446 |
447 |
448 | if __name__ == "__main__":
449 | app = QApplication(sys.argv)
450 |
451 | serverName = 'myuniqueservername'
452 | lsocket = QLocalSocket()
453 | lsocket.connectToServer(serverName)
454 |
455 | # 如果连接成功,表明server已经存在,当前已有实例在运行
456 | if lsocket.waitForConnected(200) == False:
457 |
458 | # 没有实例运行,创建服务器
459 | localServer = QLocalServer()
460 | localServer.listen(serverName)
461 |
462 | try:
463 | window = MainWindow()
464 | window.setWindowTitle("RTT2UART Control Panel V2.0.0")
465 | window.show()
466 |
467 | sys.exit(app.exec())
468 | finally:
469 | localServer.close()
470 |
--------------------------------------------------------------------------------
/picture/RTT2UART.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tianxiaoMCU/RTT2UART/99df5087539668a14dfade0eb2dfa4cc69fc3bae/picture/RTT2UART.png
--------------------------------------------------------------------------------
/picture/SeleteDevice.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tianxiaoMCU/RTT2UART/99df5087539668a14dfade0eb2dfa4cc69fc3bae/picture/SeleteDevice.png
--------------------------------------------------------------------------------
/picture/VirtualSerialPort.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tianxiaoMCU/RTT2UART/99df5087539668a14dfade0eb2dfa4cc69fc3bae/picture/VirtualSerialPort.png
--------------------------------------------------------------------------------
/picture/exportdevicelist.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tianxiaoMCU/RTT2UART/99df5087539668a14dfade0eb2dfa4cc69fc3bae/picture/exportdevicelist.png
--------------------------------------------------------------------------------
/picture/serialcomtool.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tianxiaoMCU/RTT2UART/99df5087539668a14dfade0eb2dfa4cc69fc3bae/picture/serialcomtool.png
--------------------------------------------------------------------------------
/rc_icons.py:
--------------------------------------------------------------------------------
1 | # Resource object code (Python 3)
2 | # Created by: object code
3 | # Created by: The Resource Compiler for Qt version 6.6.1
4 | # WARNING! All changes made in this file will be lost!
5 |
6 | from PySide6 import QtCore
7 |
8 | qt_resource_data = b"\
9 | \x00\x00\x00\xf7\
10 | \x00\
11 | \x00\x04~x\xda\xb5\xd4A\x0e\xc1@\x14\xc6\xf17S\
12 | \x22\x12\x0b+[\x96.\xd1X \xb8\x888\x06\x11;\
13 | '\xb0\xd1\x8d\x9dZ8\x01\x11+\xd7p\x08\x1b\xa9\x7f\
14 | \xdb!\x93\xeaDE\xbc\xe6\xd7\xc5t\xbe7\x93iZ\
15 | \x11\xc5U\xaf\x0b\xf7\x96LJ\x22\x0d\x11i\x83!F\
16 | \xd2\xf1\xa4J\xf2\xb7:n\xdf\xfd\x92-\x9a\xcfdj\
17 | \xf0\xe1\x15\xedg=\xafb\x89\x0d\xca\xd0\x16\xf5!\x1f\
18 | \xcf_\xe0\x8e+v\x08-\x9dx\xde \xe8\xbe|\x9b\
19 | ?e\xf2\xcf\x1e\xae\xfd\x9f\xd9\xf7%LE{Q\xfd\
20 | \xa0\xe7\x91\xf1Q\xb3{\xe4\x9d\x1fky\x95\xd5X\xf9\
21 | \xeb\x91\xf6\xd7C\xdd\x0d\xfa\x9a\xb9el\xb0D\xd5\xb1\
22 | \x87\x04k\xc5\xcf:\x08-;\x5cq\xc7\xc2\xf4\xcb}\
23 | \x8f\xa6\xf7Wy\xbbL^A[\x9c\xfbw\xe4\xb3r\
24 | \xcf\xafH9\xfa\x15\xfe>~\xc9~\xaa(\xe2\xcc1\
25 | \x834\x0d/\xf9i\xbcj\x8a\x03nF4\xc3<\xcd\
26 | >\x00\xefp\xf4\xe9\
27 | "
28 |
29 | qt_resource_name = b"\
30 | \x00\x13\
31 | \x0b;\xdf\x1f\
32 | \x00s\
33 | \x00w\x00a\x00p\x00_\x00h\x00o\x00r\x00i\x00z\x00_\x001\x006\x00p\x00x\x00.\x00i\
34 | \x00c\x00o\
35 | "
36 |
37 | qt_resource_struct = b"\
38 | \x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
39 | \x00\x00\x00\x00\x00\x00\x00\x00\
40 | \x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\
41 | \x00\x00\x01r\x1dN\x92l\
42 | "
43 |
44 | def qInitResources():
45 | QtCore.qRegisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
46 |
47 | def qCleanupResources():
48 | QtCore.qUnregisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
49 |
50 | qInitResources()
51 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | pylink_square==1.2.0
2 | pyserial==3.5
3 | PySide6==6.6.1
4 | PySide6==6.6.1
5 | PySide6_Addons==6.6.1
6 | PySide6_Essentials==6.6.1
7 | shiboken6==6.6.1
8 |
--------------------------------------------------------------------------------
/rtt2uart.py:
--------------------------------------------------------------------------------
1 | import logging
2 | import pylink
3 | import time
4 | import serial
5 | import threading
6 | import socket
7 |
8 | logging.basicConfig(level=logging.NOTSET,
9 | format='%(asctime)s - [%(levelname)s] (%(filename)s:%(lineno)d) - %(message)s')
10 | logger = logging.getLogger(__name__)
11 |
12 |
13 | class rtt_to_serial():
14 | def __init__(self, jlink, connect_inf='USB', connect_para=None, device=None, port=None, baudrate=115200, interface=pylink.enums.JLinkInterfaces.SWD, speed=12000, reset=False):
15 | # jlink接入方式
16 | self._connect_inf = connect_inf
17 | # jlink接入参数
18 | self._connect_para = connect_para
19 | # 目标芯片名字
20 | self.device = device
21 | # 调试口
22 | self._interface = interface
23 | # 连接速率
24 | self._speed = speed
25 | # 复位标志
26 | self._reset = reset
27 |
28 | # 串口参数
29 | self.port = port
30 | self.baudrate = baudrate
31 |
32 | self.jlink = jlink
33 |
34 | # 线程
35 | self._write_lock = threading.Lock()
36 |
37 | try:
38 | self.serial = serial.Serial()
39 | except:
40 | logger.error('Creat serial object failed', exc_info=True)
41 | raise
42 |
43 | self.socket = None
44 | self.timer = None
45 | self.rtt2uart = None
46 | self.uart2rtt = None
47 |
48 | def __del__(self):
49 | logger.debug('close app')
50 | self.stop()
51 |
52 | def start(self):
53 | logger.debug('start rtt2uart')
54 | try:
55 | if self._connect_inf != 'EXISTING' and self.jlink.connected() == False:
56 | # 加载jlinkARM.dll
57 | if self._connect_inf == 'USB':
58 | self.jlink.open(serial_no=self._connect_para)
59 | else:
60 | self.jlink.open(ip_addr=self._connect_para)
61 |
62 | # 设置连接速率
63 | if self.jlink.set_speed(self._speed) == False:
64 | logger.error('Set speed failed', exc_info=True)
65 | raise Exception("Set jlink speed failed")
66 |
67 | # 设置连接接口为SWD
68 | if self.jlink.set_tif(self._interface) == False:
69 | logger.error('Set interface failed', exc_info=True)
70 | raise Exception("Set jlink interface failed")
71 |
72 | try:
73 | if self._reset == True:
74 | # 复位一下目标芯片,复位后不要停止芯片,保证后续操作的稳定性
75 | self.jlink.reset(halt=False)
76 |
77 | # 连接目标芯片
78 | self.jlink.connect(self.device)
79 | except pylink.errors.JLinkException:
80 | logger.error('Connect target failed', exc_info=True)
81 | raise
82 | except pylink.errors.JLinkException as errors:
83 | logger.error('Open jlink failed', exc_info=True)
84 | raise
85 |
86 | try:
87 | if self.serial.isOpen() == False:
88 | # 设置串口参数并打开串口
89 | self.serial.port = self.port
90 | self.serial.baudrate = self.baudrate
91 | self.serial.timeout = 3
92 | self.serial.write_timeout = 3
93 | self.serial.open()
94 | except:
95 | logger.error('Open serial failed', exc_info=True)
96 | raise
97 |
98 | self.socket = self.doConnect('localhost', 19021)
99 | if self.socket:
100 | self.thread_switch = True
101 |
102 | self.rtt2uart = threading.Thread(target=self.rtt_to_uart)
103 | self.rtt2uart.setDaemon(True)
104 | self.rtt2uart.name = 'rtt->serial'
105 | self.rtt2uart.start()
106 |
107 | self.uart2rtt = threading.Thread(target=self.uart_to_rtt)
108 | self.uart2rtt.setDaemon(True)
109 | self.uart2rtt.name = 'serial->rtt'
110 | self.uart2rtt.start()
111 | else:
112 | raise Exception("Connect or config RTT server failed")
113 |
114 | def stop(self):
115 | logger.debug('stop rtt2uart')
116 | if self.timer:
117 | self.timer.cancel()
118 |
119 | self.thread_switch = False
120 | if self.rtt2uart:
121 | self.rtt2uart.join(0.5)
122 | if self.uart2rtt:
123 | self.uart2rtt.join(0.5)
124 |
125 | if self._connect_inf == 'USB':
126 | try:
127 | if self.jlink.connected() == True:
128 | # 使用完后停止RTT
129 | self.jlink.rtt_stop()
130 | # 释放之前加载的jlinkARM.dll
131 | self.jlink.close()
132 | except pylink.errors.JLinkException:
133 | logger.error('Disconnect target failed', exc_info=True)
134 | pass
135 |
136 | try:
137 | if self.serial.isOpen() == True:
138 | self.serial.close()
139 | except:
140 | logger.error('Close serial failed', exc_info=True)
141 | pass
142 |
143 | if self.socket:
144 | self.socket.close()
145 |
146 | def rtt_to_uart(self):
147 | while self.thread_switch == True:
148 | try:
149 | rtt_recv = self.socket.recv(1024)
150 |
151 | if self._connect_para == True and rtt_recv == b'':
152 | logger.debug('telnel server close')
153 | self.thread_switch = False
154 | self.socket.close()
155 | # telnet服务器已经关闭,开启定时查询服务器状态
156 | self.timer = threading.Timer(0.5, self.check_socket_status)
157 | self.timer.start()
158 |
159 | except socket.error as msg:
160 | logger.error(msg, exc_info=True)
161 | # probably got disconnected
162 | raise Exception("Jlink rtt read error")
163 |
164 | try:
165 | if rtt_recv:
166 | self.serial.write(rtt_recv)
167 | except:
168 | raise Exception("Serial write error")
169 |
170 | def uart_to_rtt(self):
171 | while self.thread_switch == True:
172 | try:
173 | data = self.serial.read(self.serial.in_waiting or 1)
174 |
175 | if data:
176 | with self._write_lock:
177 | self.socket.sendall(data)
178 | except socket.error as msg:
179 | logger.error(msg, exc_info=True)
180 | # probably got disconnected
181 | raise Exception("Jlink rtt write error")
182 |
183 | def doConnect(self, host, port):
184 | socketlocal = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
185 | try:
186 | socketlocal.connect((host, port))
187 | except socket.error:
188 | socketlocal.close()
189 | socketlocal = None
190 | pass
191 | return socketlocal
192 |
193 | def check_socket_status(self):
194 | self.timer = threading.Timer(1, self.check_socket_status)
195 |
196 | # 连接到RTT Telnet Server
197 | self.socket = self.doConnect('localhost', 19021)
198 | if self.socket:
199 | logger.debug('reconnect success')
200 | self.rtt2uart.join(0.5)
201 | self.uart2rtt.join(0.5)
202 | # 连接成功,重建线程
203 | self.thread_switch = True
204 |
205 | self.rtt2uart = threading.Thread(target=self.rtt_to_uart)
206 | self.rtt2uart.setDaemon(True)
207 | self.rtt2uart.name = 'rtt->serial'
208 | self.rtt2uart.start()
209 |
210 | self.uart2rtt = threading.Thread(target=self.uart_to_rtt)
211 | self.uart2rtt.setDaemon(True)
212 | self.uart2rtt.name = 'serial->rtt'
213 | self.uart2rtt.start()
214 |
215 | self.timer.cancel()
216 | else:
217 | # 连接失败,继续尝试连接
218 | self.timer.start()
219 | logger.debug("try to reconnect")
220 |
221 |
222 | if __name__ == "__main__":
223 | serial_name = input("请输入虚拟串口对中的串口名字,如COM26:")
224 |
225 | if '' == serial_name:
226 | serial_name = 'COM26'
227 |
228 | test = rtt_to_serial('AMAPH1KK-KBR', serial_name, 115200)
229 | test.start()
230 |
--------------------------------------------------------------------------------
/rtt2uart.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | dialog
4 |
5 |
6 |
7 | 0
8 | 0
9 | 402
10 | 345
11 |
12 |
13 |
14 |
15 | 402
16 | 300
17 |
18 |
19 |
20 |
21 | 402
22 | 345
23 |
24 |
25 |
26 | RTT2UART Control Panel
27 |
28 |
29 | false
30 |
31 |
32 |
33 |
34 | 160
35 | 300
36 | 81
37 | 41
38 |
39 |
40 |
41 |
42 | 微软雅黑
43 | 13
44 | 75
45 | true
46 | false
47 | false
48 |
49 |
50 |
51 | Start
52 |
53 |
54 | true
55 |
56 |
57 | true
58 |
59 |
60 |
61 |
62 | true
63 |
64 |
65 |
66 | 10
67 | 225
68 | 381
69 | 16
70 |
71 |
72 |
73 | Qt::Horizontal
74 |
75 |
76 |
77 |
78 |
79 | 10
80 | 150
81 | 381
82 | 51
83 |
84 |
85 |
86 | Target Interface And Speed
87 |
88 |
89 |
90 |
91 | 10
92 | 20
93 | 241
94 | 22
95 |
96 |
97 |
98 |
99 |
100 |
101 | 260
102 | 20
103 | 111
104 | 22
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 | 10
116 | 90
117 | 381
118 | 51
119 |
120 |
121 |
122 | Specify Target Device
123 |
124 |
125 |
126 |
127 | 10
128 | 20
129 | 321
130 | 22
131 |
132 |
133 |
134 |
135 |
136 |
137 | 340
138 | 20
139 | 31
140 | 23
141 |
142 |
143 |
144 | ...
145 |
146 |
147 |
148 |
149 |
150 |
151 | 10
152 | 238
153 | 381
154 | 51
155 |
156 |
157 |
158 | UART Config
159 |
160 |
161 |
162 |
163 | 50
164 | 20
165 | 81
166 | 22
167 |
168 |
169 |
170 |
171 |
172 |
173 | 13
174 | 20
175 | 31
176 | 20
177 |
178 |
179 |
180 | Port:
181 |
182 |
183 |
184 |
185 |
186 | 150
187 | 20
188 | 61
189 | 21
190 |
191 |
192 |
193 | Baud rate:
194 |
195 |
196 |
197 |
198 |
199 | 218
200 | 20
201 | 71
202 | 22
203 |
204 |
205 |
206 |
207 |
208 |
209 | 314
210 | 20
211 | 61
212 | 23
213 |
214 |
215 |
216 | Scan
217 |
218 |
219 |
220 |
221 |
222 |
223 | 20
224 | 210
225 | 91
226 | 16
227 |
228 |
229 |
230 | Reset target
231 |
232 |
233 |
234 |
235 |
236 | 10
237 | 0
238 | 381
239 | 81
240 |
241 |
242 |
243 | Connection to J-Link
244 |
245 |
246 |
247 |
248 | 10
249 | 20
250 | 89
251 | 16
252 |
253 |
254 |
255 | USB
256 |
257 |
258 |
259 |
260 |
261 | 10
262 | 60
263 | 121
264 | 16
265 |
266 |
267 |
268 | Existing Session
269 |
270 |
271 |
272 |
273 | false
274 |
275 |
276 |
277 | 10
278 | 40
279 | 89
280 | 16
281 |
282 |
283 |
284 | TCP/IP
285 |
286 |
287 |
288 |
289 |
290 | 150
291 | 20
292 | 81
293 | 16
294 |
295 |
296 |
297 | Serial NO
298 |
299 |
300 |
301 |
302 |
303 | 240
304 | 18
305 | 131
306 | 20
307 |
308 |
309 |
310 |
311 |
312 | false
313 |
314 |
315 |
316 | 150
317 | 40
318 | 221
319 | 20
320 |
321 |
322 |
323 |
324 |
325 |
326 | 150
327 | 60
328 | 111
329 | 16
330 |
331 |
332 |
333 | Auto Reconnect
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
--------------------------------------------------------------------------------
/sel_device.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | Dialog
4 |
5 |
6 |
7 | 0
8 | 0
9 | 779
10 | 385
11 |
12 |
13 |
14 |
15 | 779
16 | 385
17 |
18 |
19 |
20 |
21 | 779
22 | 385
23 |
24 |
25 |
26 | Target Device Settings
27 |
28 |
29 |
30 |
31 | 430
32 | 350
33 | 341
34 | 32
35 |
36 |
37 |
38 | Qt::Horizontal
39 |
40 |
41 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok
42 |
43 |
44 |
45 |
46 |
47 | 10
48 | 10
49 | 91
50 | 16
51 |
52 |
53 |
54 | Seleted Device:
55 |
56 |
57 |
58 |
59 |
60 | 110
61 | 10
62 | 161
63 | 16
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | 10
74 | 30
75 | 761
76 | 311
77 |
78 |
79 |
80 |
81 |
82 |
83 | 10
84 | 340
85 | 761
86 | 16
87 |
88 |
89 |
90 | Qt::Horizontal
91 |
92 |
93 |
94 |
95 |
96 |
97 | buttonBox
98 | accepted()
99 | Dialog
100 | accept()
101 |
102 |
103 | 248
104 | 254
105 |
106 |
107 | 157
108 | 274
109 |
110 |
111 |
112 |
113 | buttonBox
114 | rejected()
115 | Dialog
116 | reject()
117 |
118 |
119 | 316
120 | 260
121 |
122 |
123 | 286
124 | 274
125 |
126 |
127 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/swap_horiz_16px.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tianxiaoMCU/RTT2UART/99df5087539668a14dfade0eb2dfa4cc69fc3bae/swap_horiz_16px.ico
--------------------------------------------------------------------------------
/ui_rtt2uart.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | ################################################################################
4 | ## Form generated from reading UI file 'rtt2uart.ui'
5 | ##
6 | ## Created by: Qt User Interface Compiler version 6.6.1
7 | ##
8 | ## WARNING! All changes made in this file will be lost when recompiling UI file!
9 | ################################################################################
10 |
11 | from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
12 | QMetaObject, QObject, QPoint, QRect,
13 | QSize, QTime, QUrl, Qt)
14 | from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
15 | QFont, QFontDatabase, QGradient, QIcon,
16 | QImage, QKeySequence, QLinearGradient, QPainter,
17 | QPalette, QPixmap, QRadialGradient, QTransform)
18 | from PySide6.QtWidgets import (QApplication, QCheckBox, QComboBox, QDialog,
19 | QFrame, QGroupBox, QLabel, QLineEdit,
20 | QPushButton, QRadioButton, QSizePolicy, QWidget)
21 |
22 | class Ui_dialog(object):
23 | def setupUi(self, dialog):
24 | if not dialog.objectName():
25 | dialog.setObjectName(u"dialog")
26 | dialog.resize(402, 345)
27 | dialog.setMinimumSize(QSize(402, 300))
28 | dialog.setMaximumSize(QSize(402, 345))
29 | dialog.setSizeGripEnabled(False)
30 | self.pushButton_Start = QPushButton(dialog)
31 | self.pushButton_Start.setObjectName(u"pushButton_Start")
32 | self.pushButton_Start.setGeometry(QRect(160, 300, 81, 41))
33 | font = QFont()
34 | font.setFamilies([u"\u5fae\u8f6f\u96c5\u9ed1"])
35 | font.setPointSize(13)
36 | font.setBold(True)
37 | font.setUnderline(False)
38 | font.setStrikeOut(False)
39 | self.pushButton_Start.setFont(font)
40 | self.pushButton_Start.setCheckable(True)
41 | self.pushButton_Start.setAutoRepeat(True)
42 | self.line = QFrame(dialog)
43 | self.line.setObjectName(u"line")
44 | self.line.setEnabled(True)
45 | self.line.setGeometry(QRect(10, 225, 381, 16))
46 | self.line.setFrameShape(QFrame.HLine)
47 | self.line.setFrameShadow(QFrame.Sunken)
48 | self.groupBox = QGroupBox(dialog)
49 | self.groupBox.setObjectName(u"groupBox")
50 | self.groupBox.setGeometry(QRect(10, 150, 381, 51))
51 | self.comboBox_Interface = QComboBox(self.groupBox)
52 | self.comboBox_Interface.setObjectName(u"comboBox_Interface")
53 | self.comboBox_Interface.setGeometry(QRect(10, 20, 241, 22))
54 | self.comboBox_Speed = QComboBox(self.groupBox)
55 | self.comboBox_Speed.setObjectName(u"comboBox_Speed")
56 | self.comboBox_Speed.setGeometry(QRect(260, 20, 111, 22))
57 | self.groupBox_2 = QGroupBox(dialog)
58 | self.groupBox_2.setObjectName(u"groupBox_2")
59 | self.groupBox_2.setGeometry(QRect(10, 90, 381, 51))
60 | self.comboBox_Device = QComboBox(self.groupBox_2)
61 | self.comboBox_Device.setObjectName(u"comboBox_Device")
62 | self.comboBox_Device.setGeometry(QRect(10, 20, 321, 22))
63 | self.pushButton_Selete_Device = QPushButton(self.groupBox_2)
64 | self.pushButton_Selete_Device.setObjectName(u"pushButton_Selete_Device")
65 | self.pushButton_Selete_Device.setGeometry(QRect(340, 20, 31, 23))
66 | self.groupBox_UART = QGroupBox(dialog)
67 | self.groupBox_UART.setObjectName(u"groupBox_UART")
68 | self.groupBox_UART.setGeometry(QRect(10, 238, 381, 51))
69 | self.comboBox_Port = QComboBox(self.groupBox_UART)
70 | self.comboBox_Port.setObjectName(u"comboBox_Port")
71 | self.comboBox_Port.setGeometry(QRect(50, 20, 81, 22))
72 | self.label = QLabel(self.groupBox_UART)
73 | self.label.setObjectName(u"label")
74 | self.label.setGeometry(QRect(13, 20, 31, 20))
75 | self.label_2 = QLabel(self.groupBox_UART)
76 | self.label_2.setObjectName(u"label_2")
77 | self.label_2.setGeometry(QRect(150, 20, 61, 21))
78 | self.comboBox_baudrate = QComboBox(self.groupBox_UART)
79 | self.comboBox_baudrate.setObjectName(u"comboBox_baudrate")
80 | self.comboBox_baudrate.setGeometry(QRect(218, 20, 71, 22))
81 | self.pushButton_scan = QPushButton(self.groupBox_UART)
82 | self.pushButton_scan.setObjectName(u"pushButton_scan")
83 | self.pushButton_scan.setGeometry(QRect(314, 20, 61, 23))
84 | self.checkBox_resettarget = QCheckBox(dialog)
85 | self.checkBox_resettarget.setObjectName(u"checkBox_resettarget")
86 | self.checkBox_resettarget.setGeometry(QRect(20, 210, 91, 16))
87 | self.groupBox_3 = QGroupBox(dialog)
88 | self.groupBox_3.setObjectName(u"groupBox_3")
89 | self.groupBox_3.setGeometry(QRect(10, 0, 381, 81))
90 | self.radioButton_usb = QRadioButton(self.groupBox_3)
91 | self.radioButton_usb.setObjectName(u"radioButton_usb")
92 | self.radioButton_usb.setGeometry(QRect(10, 20, 89, 16))
93 | self.radioButton_existing = QRadioButton(self.groupBox_3)
94 | self.radioButton_existing.setObjectName(u"radioButton_existing")
95 | self.radioButton_existing.setGeometry(QRect(10, 60, 121, 16))
96 | self.radioButton_tcpip = QRadioButton(self.groupBox_3)
97 | self.radioButton_tcpip.setObjectName(u"radioButton_tcpip")
98 | self.radioButton_tcpip.setEnabled(False)
99 | self.radioButton_tcpip.setGeometry(QRect(10, 40, 89, 16))
100 | self.checkBox_serialno = QCheckBox(self.groupBox_3)
101 | self.checkBox_serialno.setObjectName(u"checkBox_serialno")
102 | self.checkBox_serialno.setGeometry(QRect(150, 20, 81, 16))
103 | self.lineEdit_serialno = QLineEdit(self.groupBox_3)
104 | self.lineEdit_serialno.setObjectName(u"lineEdit_serialno")
105 | self.lineEdit_serialno.setGeometry(QRect(240, 18, 131, 20))
106 | self.lineEdit_ip = QLineEdit(self.groupBox_3)
107 | self.lineEdit_ip.setObjectName(u"lineEdit_ip")
108 | self.lineEdit_ip.setEnabled(False)
109 | self.lineEdit_ip.setGeometry(QRect(150, 40, 221, 20))
110 | self.checkBox__auto = QCheckBox(self.groupBox_3)
111 | self.checkBox__auto.setObjectName(u"checkBox__auto")
112 | self.checkBox__auto.setGeometry(QRect(150, 60, 111, 16))
113 |
114 | self.retranslateUi(dialog)
115 |
116 | QMetaObject.connectSlotsByName(dialog)
117 | # setupUi
118 |
119 | def retranslateUi(self, dialog):
120 | dialog.setWindowTitle(QCoreApplication.translate("dialog", u"RTT2UART Control Panel", None))
121 | self.pushButton_Start.setText(QCoreApplication.translate("dialog", u"Start", None))
122 | self.groupBox.setTitle(QCoreApplication.translate("dialog", u"Target Interface And Speed", None))
123 | self.comboBox_Speed.setCurrentText("")
124 | self.groupBox_2.setTitle(QCoreApplication.translate("dialog", u"Specify Target Device", None))
125 | self.pushButton_Selete_Device.setText(QCoreApplication.translate("dialog", u"...", None))
126 | self.groupBox_UART.setTitle(QCoreApplication.translate("dialog", u"UART Config", None))
127 | self.label.setText(QCoreApplication.translate("dialog", u"Port:", None))
128 | self.label_2.setText(QCoreApplication.translate("dialog", u"Baud rate:", None))
129 | self.pushButton_scan.setText(QCoreApplication.translate("dialog", u"Scan", None))
130 | self.checkBox_resettarget.setText(QCoreApplication.translate("dialog", u"Reset target", None))
131 | self.groupBox_3.setTitle(QCoreApplication.translate("dialog", u"Connection to J-Link", None))
132 | self.radioButton_usb.setText(QCoreApplication.translate("dialog", u"USB", None))
133 | self.radioButton_existing.setText(QCoreApplication.translate("dialog", u"Existing Session", None))
134 | self.radioButton_tcpip.setText(QCoreApplication.translate("dialog", u"TCP/IP", None))
135 | self.checkBox_serialno.setText(QCoreApplication.translate("dialog", u"Serial NO", None))
136 | self.checkBox__auto.setText(QCoreApplication.translate("dialog", u"Auto Reconnect", None))
137 | # retranslateUi
138 |
139 |
--------------------------------------------------------------------------------
/ui_sel_device.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | ################################################################################
4 | ## Form generated from reading UI file 'sel_device.ui'
5 | ##
6 | ## Created by: Qt User Interface Compiler version 6.6.1
7 | ##
8 | ## WARNING! All changes made in this file will be lost when recompiling UI file!
9 | ################################################################################
10 |
11 | from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
12 | QMetaObject, QObject, QPoint, QRect,
13 | QSize, QTime, QUrl, Qt)
14 | from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
15 | QFont, QFontDatabase, QGradient, QIcon,
16 | QImage, QKeySequence, QLinearGradient, QPainter,
17 | QPalette, QPixmap, QRadialGradient, QTransform)
18 | from PySide6.QtWidgets import (QAbstractButton, QApplication, QDialog, QDialogButtonBox,
19 | QFrame, QHeaderView, QLabel, QSizePolicy,
20 | QTableView, QWidget)
21 |
22 | class Ui_Dialog(object):
23 | def setupUi(self, Dialog):
24 | if not Dialog.objectName():
25 | Dialog.setObjectName(u"Dialog")
26 | Dialog.resize(779, 385)
27 | Dialog.setMinimumSize(QSize(779, 385))
28 | Dialog.setMaximumSize(QSize(779, 385))
29 | self.buttonBox = QDialogButtonBox(Dialog)
30 | self.buttonBox.setObjectName(u"buttonBox")
31 | self.buttonBox.setGeometry(QRect(430, 350, 341, 32))
32 | self.buttonBox.setOrientation(Qt.Horizontal)
33 | self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
34 | self.label = QLabel(Dialog)
35 | self.label.setObjectName(u"label")
36 | self.label.setGeometry(QRect(10, 10, 91, 16))
37 | self.label_sel_dev = QLabel(Dialog)
38 | self.label_sel_dev.setObjectName(u"label_sel_dev")
39 | self.label_sel_dev.setGeometry(QRect(110, 10, 161, 16))
40 | self.tableView = QTableView(Dialog)
41 | self.tableView.setObjectName(u"tableView")
42 | self.tableView.setGeometry(QRect(10, 30, 761, 311))
43 | self.line = QFrame(Dialog)
44 | self.line.setObjectName(u"line")
45 | self.line.setGeometry(QRect(10, 340, 761, 16))
46 | self.line.setFrameShape(QFrame.HLine)
47 | self.line.setFrameShadow(QFrame.Sunken)
48 |
49 | self.retranslateUi(Dialog)
50 | self.buttonBox.accepted.connect(Dialog.accept)
51 | self.buttonBox.rejected.connect(Dialog.reject)
52 |
53 | QMetaObject.connectSlotsByName(Dialog)
54 | # setupUi
55 |
56 | def retranslateUi(self, Dialog):
57 | Dialog.setWindowTitle(QCoreApplication.translate("Dialog", u"Target Device Settings", None))
58 | self.label.setText(QCoreApplication.translate("Dialog", u"Seleted Device:", None))
59 | self.label_sel_dev.setText("")
60 | # retranslateUi
61 |
62 |
--------------------------------------------------------------------------------