夏休みが終わる・・・集中Zephyr学習もたぶん今回が最後だろう。
あとは、動かしながら試すまでだ。
最後に、デバッグの仕方を調べておこう。
Eclipse Debugging
https://docs.zephyrproject.org/latest/application/index.html#eclipse-debugging
えー、eclipseなのかー。
いや、eclipseが悪いわけではないのだけど、最近はvscodeをよく使っているので、これもvscodeでやりたいのだが。
まあ、eclipseを使えるということは、vscodeも使えるはずだ。
つまり、vscodeでCortex-M0のデバッグができればよいというだけのことだ。
こういうextensionがあった。
Cortex-Debug - Visual Studio Marketplace
https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug
インストールして、settings.jsonにJLinkのGDB ServerCLの実行パスを設定しておくとよさそうだ。
8.3形式じゃないとダメな気がするので、短くしておこう。というか、スペースがない名前にしたいだけなんだけどね。
"cortex-debug.JLinkGDBServerPath": "c:\\PROGRA~2\\SEGGER\\JLINK\\JLINKG~2.EXE"
launch.jsonはこうした。
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Cortex Debug", "cwd": "${workspaceRoot}", "executable": "./build/zephyr/zephyr.elf", "request": "launch", "type": "cortex-debug", "servertype": "jlink", "device": "nrf51", "interface": "swd", "ipAddress": null, "serialNumber": null, "armToolchainPath": "c:\\Winappli\\gcc-arm-none-eabi-8-2019-q3-update-win32\\bin" } ] }
これで、blinkyを動かしたのだが、一応デバッグできているようだ。
「一応」がつくのは、ブレークポイントの位置に止まってくれないからだ。
ずれているわけではなく、gpio_pin_write()には止まってくれないようだ。
最適化の関係か?
だったらアセンブラコードとあわせて見るとわかるのだけど、出し方が分からん。
残念だが、今回はこれで終わろう。
"assembler"で検索していたが、"disassembly"なのだな。。。
返信削除試していないが、コマンドがあった。
You can manually see the disassembly for a particular function ("Cortex-Debug: View Disassembly (Function)" command)