【发布时间】:2018-07-27 12:32:31
【问题描述】:
我决定尝试使用带有 ARM GCC 工具链的 Qt Creator。我设法设置了一个 QBS 项目,它已构建并且固件已成功下载。另外,我在板上使用STM32F3-Discovery和STM32F303VCT。但我无法调试项目,原因如下:
- 断点不起作用。过程不会停止。
- 我无法进入源文件,只能在反汇编程序中。当我尝试进入 Main.c 时,Qt Creator 切换到 Disassembler 本身。
如何设置调试器以查看寄存器、添加 Watch、设置和清除寄存器中的位,例如在 Keil 或 Eclipse 中?那么,有人可以帮忙吗?谢谢。 附言这是我的 Start.qbs
import qbs
Product
{
type: ["application", "flash"]
Depends { name: "cpp" }
cpp.defines: ["STM32F30X_LD_VL"]
cpp.positionIndependentCode: false
cpp.enableExceptions: false
cpp.executableSuffix: ".elf"
cpp.driverFlags:
[
"-mthumb",
"-mcpu=cortex-m4",
"-mfloat-abi=soft",
"-fno-strict-aliasing",
"-g3",
"-Wall",
"-mfpu=vfp",
"-Og",
"-flto",
]
cpp.commonCompilerFlags:
[
"-fdata-sections",
"-ffunction-sections",
"-fno-inline",
"-std=c99",
"-flto"
]
cpp.linkerFlags:
[
"-specs=nano.specs",
"--start-group",
"--gc-sections",
"-T" + path + "/STM32F303VCTx_FLASH.ld",
"-lnosys",
"-lgcc",
"-lc",
"-lstdc++",
"-lm"
]
cpp.includePaths:
[
"Inc",
"Drivers/CMSIS/Include",
"Drivers/CMSIS/Device/ST/STM32F3xx/Include",
"Drivers/STM32F3xx_HAL_Driver/Inc"
]
files:
[
"Inc/*.h",
"Drivers/CMSIS/Include/*.h",
"Drivers/CMSIS/Device/ST/STM32F3xx/Include/*.h",
"Drivers/STM32F3xx_HAL_Driver/Inc/*.h",
"Drivers/STM32F3xx_HAL_Driver/Src/*.c",
"Src/*.c",
"*.s"
]
Properties
{
condition: qbs.buildVariant === "debug"
cpp.defines: outer.concat(["DEBUG=1"])
cpp.debugInformation: true
cpp.optimization: "none"
}
Properties
{
condition: qbs.buildVariant === "release"
cpp.debugInformation: false
cpp.optimization: "small"
}
Rule
{
inputs: ["application"]
Artifact
{
filePath: project.path + "/debug/bin/" + input.baseName + ".hex"
fileTags: "flash"
}
prepare:
{
var sizePath = "C:/Users/kushnir/AppData/Roaming/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-size.exe";
var objcopyPath = "C:/Users/kushnir/AppData/Roaming/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-objcopy.exe";
var configStlinkPath = "C:/openocd-0.10.0/scripts/interface/stlink-v2-1.cfg";
var configStm32Path = "C:/openocd-0.10.0/scripts/target/stm32f3x.cfg";
var flashPath = "C:/openocd-0.10.0/bin-x64/openocd.exe";
var argsSize = [input.filePath];
var argsObjcopy = ["-O", "ihex", input.filePath, output.filePath];
var argsFlashing =
[
"-f", configStlinkPath,
"-f", configStm32Path,
"-c", "init",
"-c", "halt",
"-c", "flash erase_sector 0 0 127",
"-c", "reset",
"-c", "halt",
"-c", "flash write_image " + input.filePath,
"-c", "verify_image " + input.filePath,
"-c", "reset",
"-c", "exit"
];
var cmdSize = new Command(sizePath, argsSize);
var cmdObjcopy = new Command(objcopyPath, argsObjcopy);
var cmdFlash = new Command(flashPath, argsFlashing);
cmdSize.description = "Size of sections:";
cmdSize.highlight = "linker";
cmdObjcopy.description = "convert to bin...";
cmdObjcopy.highlight = "linker";
cmdFlash.description = "download firmware to uC...";
cmdFlash.highlight = "linker";
return [cmdSize, cmdObjcopy, cmdFlash];
}
}
}
【问题讨论】:
标签: debugging qt-creator stm32 bare-metal