STM32デバッグが上手くいかない件
本来、デバッグ実行ではプログラムがダウンロードされた後に実行されるはずだが、プログラムがダウンロードされる様子なくデバッグセッションが停止してしまう。
code:デバッグ実行のログ
Waiting for debugger connection...
Debugger connected
Waiting for debugger connection...
Shutting down...
Exit.
CubeIDEのRun > Debug Configurations...メニューで「ログ出力ファイル」を有効にするとログが詳細になる
https://gyazo.com/775ce49f112d26a62f39f6f353222e17
code:デバッグ実行の詳細ログ
STMicroelectronics ST-LINK GDB server. Version 6.0.0
Copyright (c) 2021, STMicroelectronics. All rights reserved.
Starting server with the following options:
Persistent Mode : Disabled
LogFile Name : C:\Users\uchan\STM32CubeIDE\workspace_1.8.0\hello_stm32_nucleo\Debug\st-link_gdbserver_log.txt
Logging Level : 31
Listen Port Number : 61234
Status Refresh Delay : 15s
Verbose Mode : Enabled
SWD Debug : Enabled
InitWhile : Enabled
COM frequency = 4000 kHz
Target connection mode: Under reset
Reading ROM table for AP 0 @0xe00fffd0
Hardware watchpoint supported by the target
ST-LINK Firmware version : V2J39M27
Device ID: 0x415
PC: 0x800294c
ST-LINK device status: HALT_MODE
ST-LINK detects target voltage = 3.25 V
ST-LINK device status: HALT_MODE
ST-LINK device initialization OK
Stm32Device, pollAndNotify running...
SwvSrv state change: 0 -> 1
Waiting for connection on port 61235...
Waiting for debugger connection...
Waiting for connection on port 61234...
Accepted connection on port 61234...
Debugger connected
Waiting for debugger connection...
Waiting for connection on port 61234...
GDB session thread running
GdbSessionManager, session started: 1
GDB session terminated: Client connection lost
GdbSessionManager, session terminated: 1
GdbSrv, master session terminated, signal dispose
Shutting down...
Stopping port 61234
Cleanup session: 1
GDB session disposed: 1
Received stop for port 61234, not accepting new connections.
GdbSrv, deInit entry.
GdbSessionManager, deInit entry.
ファイルにはもっと詳細なログが出ている
"GDB session terminated: Client connection lost"というメッセージが出ていて、Nucleoボードとのコネクションが失われているように見える
GDBのやり取り(read/write)が出ているみたいだが、僕には内容の解読ができない
いろいろ設定を変えて調査したところ"Reset behaviour"を"Connect under reset"から"Hardware reset"に変えたらデバッグ実行が正常にできた
https://gyazo.com/a67b35922d72d8f75a26c5fd4f5066d2