0

OpenOCD は、いくつかのコマンドを実行した後にデーモン化することになっていると聞いたことがあります。

コマンドを CLI 引数として指定してみます。コマンドは実行されますが、OpenOCD はその後バックグラウンドにならないため、GDB は実行されません。openocd コマンドの末尾に「&」を追加することはできますが、GDB と競合状態になります。

フラッシュのロード後に OpenOCD をデーモン化するにはどうすればよいですか?

13 # Launch OpenOCD
14   # specify our hardware debugger and mcu type
15   # reset target
16   # erase in bank 0 from 20k (0x5000) to end of flash
17   # load hex format because elf has extraneous section at 0x00000000
18   # NOTE: we don't use 'erase' so we can't blow away bootloader
19   # ??? daemonize when done so GDB can run 
20 openocd -f interface/olimex-arm-usb-tiny-h.cfg -f target/stm32f1x.cfg \
21   -l .openocd.log \
22   -c "init" -c "reset init" \
23   -c "flash erase_sector 0 20 last" \
24   -c "flash write_image $HEXFILE"
25
26 # run gdb
...
4

1 に答える 1

2

OpenOCD でフラッシュを書き込む代わりに、monitorコマンドを使用して GDB から行うことができます。

OpenOCD を次のように変更して起動します。

20 openocd -f interface/olimex-arm-usb-tiny-h.cfg -f target/stm32f1x.cfg \
21   -l .openocd.log \
22   -c "init" &

次に、.gdbinitこれに似たものを使用します。

target remote localhost:3333
monitor reset halt
monitor flash erase_sector 0 20 last
monitor flash write_image build/my_project.hex
set remote hardware-breakpoint-limit 6
set remote hardware-watchpoint-limit 4
break main
continue

OpenOCD の起動にはまだ時間がかかるため、まだ競合状態がありますが、遅延なく問題なく動作します。

于 2014-04-03T15:21:32.863 に答える