断点在 Vscode 中不切换,带有 J-link 的 Redboard Artemis

Breakpoint aren't toggled in Vscode, Redboard Artemis with J-link

提问人:EpiX 提问时间:10/29/2023 最后编辑:FrantEpiX 更新时间:11/6/2023 访问量:22

问:

我计划使用硬件调试器调试 ARM 板,以提高效率。我买了一个 Redboard Artemis 和一个 J-Link edu mini,但我在设置中遇到了问题。 我的目标是能够在 vscode 编辑器中执行程序期间设置断点并检查变量。但是,我无法找到实现它的良好配置。

我正在使用 cortex 调试扩展在 vscode 上使用 gdb 服务器,并使用 arduino-cli 扩展在板上编译和上传程序。我一直在遵循本指南在 vscode 上设置 Arduino-cli,它工作正常(至少用于在板上构建和上传代码)(https://learn.sparkfun.com/tutorials/efficient-arduino-programming-with-arduino-cli-and-visual-studio-code/vs-code-for-arduino-library-development)

在构建程序之前,我还能够在 vscode 编辑器上设置断点,但是当我将其上传到板中时,断点变为灰色,并显示错误消息“未加载符号表。使用文件命令“(见下图)。 另一方面,看起来 gdb 调试工作正常,因为我能够使用 gdb 命令,例如:“中断设置”和“继续”,并且程序在设置功能停止。 我一直在遵循不同的指南在 Vscode 中设置 J-link(就像这个:https://wiki.segger.com/J-Link_Visual_Studio_Code)。在所有这些文件中,我注意到可执行文件是一个 .elf 文件,但就我而言,为我的板构建的二进制文件是一个 .avx 文件。它似乎与 Redboard 有关,因为当我为 Arduino uno 板或 Adafruit metro m4 板构建程序时,它最终会得到一个 elf 二进制文件。我不知道这是否相关,因为我在互联网上找不到任何关于“.avx debug”或“.avx vs .elf”的信息。 我在不同的论坛上看到,当您在构建时未指定“-g”参数时,会发生此错误。当我在编译过程中查看日志时,似乎缺少 -g 参数,因为输出是:

“Compilation du croquis...
C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\tools\\arm-none-eabi-gcc\\8-2018-q4-major/bin/arm-none-eabi-g++ -include”

在这一点上,我已经尝试了几种方法来添加“-g”参数,但没有一个有效。

  1. 我添加了以下行:
 "compilerArgs": [
                "-g"
  ],”

在“c_cpp_properties.json”中,但看起来无法识别该参数,因为在编译过程中它仍然显示相同的输出。 2)我还查看了Arduino-cli编译参数,并添加了:

"buildPreferences": [
        ["compiler.cpp.extra_flags", "-g"]
  ]

在 Arduino.json 中,但输出保持不变。 在这一点上,我真的不明白为什么它没有改变任何东西,我什至不确定错误是否与此有关。因为,我真的不知道问题来自哪里(它是否与Arduino-cli的不良使用有关?cortex-debug扩展的不良使用?与电路板有关的东西?),我真的不知道在哪里发布这条消息,这就是我最终来到这里的原因。 有关参考,您可以在下面找到 launch.json、Arduino.json 和 c_pp_property.json。

感谢您的阅读,

Arduino.json

{
    "configuration": "svl_baud=460800,loader=option_svl",
    "board": "SparkFun:apollo3:sfe_artemis",
    "sketch": "blink.ino",
    "buildPreferences": [
        [
            "compiler.cpp.extra_flags",
            "-g"
        ]
    ],
    "port": "COM6",
    "output": "./build"
}

cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "C:\\Users\\epixe\\AppData\\Local\\arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino\\",
                "C:\\Users\\epixe\\AppData\\Local\\arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\EEPROM\\src",
                "C:\\Users\\epixe\\AppData\\Local\\arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\HID\\src",
                "C:\\Users\\epixe\\AppData\\Local\\arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\SoftwareSerial\\src",
                "C:\\Users\\epixe\\AppData\\Local\\arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\SPI\\src",
                "C:\\Users\\epixe\\AppData\\Local\\arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src"
               
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE",
                "F_CPU=16000000L",
                "ARDUINO=10805",
                "ARDUINO_AVR_UNO",
                "ARDUINO_ARCH_AVR"
               
            ],
            "compilerPath": "C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\tools\\arm-none-eabi-gcc\\8-2018-q4-major\\bin\\arm-none-eabi-g++",
            "compilerArgs": [
                "-g"
            ],
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}

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": [
        {
            "type": "cortex-debug",
            "request": "launch",
            "name": "Debug J-Link",
            "cwd": "${workspaceFolder}",
            "executable": "./build/blink.ino.axf",
            "serverpath": "E:/logiciel/segger/JLink_V792k/JLinkGDBServerCL.exe",
            "servertype": "jlink",
            "device": "AMA3B1KK-KBR",
            "interface": "swd",
            "runToEntryPoint": "main",
            "armToolchainPath": "E:/logiciel/segger/arm_toolchain/bin/",
        }
    ]
}

build_logs

[Starting] Verifying sketch 'blink.ino'
Please see the build logs in output path: e:\projet_perso\robot\arduino_code\examples\temp\blink\build
Using board 'sfe_artemis' from platform in folder: C:\Users\epixe\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.2.1
Using core 'arduino' from platform in folder: C:\Users\epixe\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.2.1
Detecting libraries used...
"C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\tools\\arm-none-eabi-gcc\\8-2018-q4-major/bin/arm-none-eabi-g++" -include "C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1\\variants\\SFE_ARTEMIS/mbed/mbed_config.h" -include "C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1/cores/arduino/sdk/ArduinoSDK.h" -iprefix "C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1/cores/" "@C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1\\variants\\SFE_ARTEMIS/mbed/.cxx-flags" -w -x c++ -E -CC -DARDUINO=10607 -DARDUINO_APOLLO3_SFE_ARTEMIS -DARDUINO_ARCH_MBED -DARDUINO_ARCH_APOLLO3 -DMBED_NO_GLOBAL_USING_DIRECTIVE -DCORDIO_ZERO_COPY_HCI "@C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1\\variants\\SFE_ARTEMIS/mbed/.cxx-symbols" "-IC:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1\\cores\\arduino" "-IC:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1\\variants\\SFE_ARTEMIS" "-IC:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1/cores/arduino" "-IC:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1/cores/arduino/mbed-bridge" "-IC:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1/cores/arduino/mbed-bridge/core-api" "-IC:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1/cores/arduino/mbed-bridge/core-api/api/deprecated" "@C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1\\variants\\SFE_ARTEMIS/mbed/.includes" "E:\\projet_perso\\robot\\arduino_code\\examples\\temp\\blink\\build\\sketch\\blink.ino.cpp" -o nul
Generating function prototypes...
"C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\tools\\arm-none-eabi-gcc\\8-2018-q4-major/bin/arm-none-eabi-g++" -include "C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1\\variants\\SFE_ARTEMIS/mbed/mbed_config.h" -include "C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1/cores/arduino/sdk/ArduinoSDK.h" -iprefix "C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1/cores/" "@C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1\\variants\\SFE_ARTEMIS/mbed/.cxx-flags" -w -x c++ -E -CC -DARDUINO=10607 -DARDUINO_APOLLO3_SFE_ARTEMIS -DARDUINO_ARCH_MBED -DARDUINO_ARCH_APOLLO3 -DMBED_NO_GLOBAL_USING_DIRECTIVE -DCORDIO_ZERO_COPY_HCI "@C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1\\variants\\SFE_ARTEMIS/mbed/.cxx-symbols" "-IC:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1\\cores\\arduino" "-IC:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1\\variants\\SFE_ARTEMIS" "-IC:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1/cores/arduino" "-IC:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1/cores/arduino/mbed-bridge" "-IC:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1/cores/arduino/mbed-bridge/core-api" "-IC:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1/cores/arduino/mbed-bridge/core-api/api/deprecated" "@C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1\\variants\\SFE_ARTEMIS/mbed/.includes" "E:\\projet_perso\\robot\\arduino_code\\examples\\temp\\blink\\build\\sketch\\blink.ino.cpp" -o "E:\\projet_perso\\robot\\arduino_code\\examples\\temp\\blink\\build\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\builtin\\tools\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "E:\\projet_perso\\robot\\arduino_code\\examples\\temp\\blink\\build\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compilation du croquis...
"C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\tools\\arm-none-eabi-gcc\\8-2018-q4-major/bin/arm-none-eabi-g++" -include "C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1\\variants\\SFE_ARTEMIS/mbed/mbed_config.h" -include "C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1/cores/arduino/sdk/ArduinoSDK.h" -iprefix "C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1/cores/" "@C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1\\variants\\SFE_ARTEMIS/mbed/.cxx-flags" -MMD -DARDUINO=10607 -DARDUINO_APOLLO3_SFE_ARTEMIS -DARDUINO_ARCH_MBED -DARDUINO_ARCH_APOLLO3 -DMBED_NO_GLOBAL_USING_DIRECTIVE -DCORDIO_ZERO_COPY_HCI "@C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1\\variants\\SFE_ARTEMIS/mbed/.cxx-symbols" "-IC:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1\\cores\\arduino" "-IC:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1\\variants\\SFE_ARTEMIS" "-IC:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1/cores/arduino" "-IC:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1/cores/arduino/mbed-bridge" "-IC:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1/cores/arduino/mbed-bridge/core-api" "-IC:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1/cores/arduino/mbed-bridge/core-api/api/deprecated" "@C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\apollo3\\2.2.1\\variants\\SFE_ARTEMIS/mbed/.includes" "E:\\projet_perso\\robot\\arduino_code\\examples\\temp\\blink\\build\\sketch\\blink.ino.cpp" -o "E:\\projet_perso\\robot\\arduino_code\\examples\\temp\\blink\\build\\sketch\\blink.ino.cpp.o"
Compiling libraries...
Compiling core...
Couldn't deeply cache core build: Rel: can't make E:\projet_perso\robot\arduino_code\examples\temp\blink\build relative to C:\Users\epixe\AppData\Local\Temp\arduino\cores
Running normal build of the core...
"C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\tools\\arm-none-eabi-gcc\\8-2018-q4-major/bin/arm-none-eabi-g++" -include 
....
"C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\tools\\arm-none-eabi-gcc\\8-2018-q4-major/bin/arm-none-eabi-objcopy" -O binary "E:\\projet_perso\\robot\\arduino_code\\examples\\temp\\blink\\build/blink.ino.axf" "E:\\projet_perso\\robot\\arduino_code\\examples\\temp\\blink\\build/blink.ino.bin"

"C:\\Users\\epixe\\AppData\\Local\\Arduino15\\packages\\SparkFun\\tools\\arm-none-eabi-gcc\\8-2018-q4-major/bin/arm-none-eabi-size" -A "E:\\projet_perso\\robot\\arduino_code\\examples\\temp\\blink\\build/blink.ino.axf"
Le croquis utilise 116124 octets (11%) de l'espace de stockage de programmes. Le maximum est de 983040 octets.
Les variables globales utilisent 27600 octets (7%) de mémoire dynamique, ce qui laisse 365616 octets pour les variables locales. Le maximum est de 393216 octets.

Used platform    Version Path                                                                           
SparkFun:apollo3 2.2.1   C:\Users\epixe\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.2.1
[Warning] Failed to generate IntelliSense configuration.
[Done] Verifying sketch 'blink.ino'

GDB 断点 VSCode-Debugger Cortex-M segger-jlink

评论


答: 暂无答案