带有 STM32L476RG Nucleo 的 VisualGDB
VisualGDB with STM32L476RG Nucleo
我使用 VisualGDB 设置 Visual Studio 2015,并使用 HAL 设置 LED Blink 项目,如本例所述:http://visualgdb.com/tutorials/arm/stm32/stm32l4/
工具安装正确,我的项目完全按照示例进行,包括第 6 步,然后向上执行第 7 步。但是,在设置断点并尝试按照第 8 步 运行 它之后,我在输出中得到以下内容 window:
Open On-Chip Debugger 0.9.0 (2015-10-08-15:57)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 500 kHz
adapter_nsrst_delay: 100
none separate
Info : Unable to match requested speed 500 kHz, using 480 kHz
Info : Unable to match requested speed 500 kHz, using 480 kHz
Info : clock speed 480 kHz
Info : STLINK v2 JTAG v24 API v2 SWIM v10 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 3.263434
Info : stm32l4x.cpu: hardware has 6 breakpoints, 4 watchpoints
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800027c msp: 0x20020000
adapter speed: 4000 kHz
Info : accepting 'gdb' connection on tcp/3333
Info : device id = 0x10076415
Info : flash size = 1024kbytes
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800027c msp: 0x20020000
adapter speed: 4000 kHz
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800027c msp: 0x20020000
adapter speed: 4000 kHz
Warn : Padding 4 bytes to keep 8-byte write size
target state: halted
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000004a msp: 0x20020000
Warn : block write succeeded
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800027c msp: 0x20020000
Error: Memory write failure!
同时,我收到一个对话框弹出窗口,内容为:"The memory location used for the stack is not writable. Please check the device type and the linker script. You can disable automatic stack checking via VisualGDB Project Properties"
查看构建期间生成的 .map 文件,0x61000000 附近或 0x01000000 处没有任何内容。有一个_estack = 0x20020000.
我在链接器标志中添加了一个 -N (LDFLAGS := -Wl,-N,-gc-sections),看看这是否会影响任何东西,而 id 没有。
有什么地方可能有问题吗?
提前谢谢你。
当 VisualGDB 尝试测试栈尾 (_estack - 4) 是否可写时,会出现 "The memory location used for the stack is not writable" 错误。
如果将 GDB Session window 切换到 All GDB Interaction 模式,您将看到 VisualGDB 试图在那里写入一个随机值,然后检查它是否可以被读回:
-data-evaluate-expression "&_estack"
^done,value="0x20020000"
-var-create - * "*((void **)0x2001fffc)"
^done,name="var1",numchild="0",value="0x80002ad ",type="void *",has_more="0"
-var-assign "var1" 0x1b5bfd22
^done,value="0x1b5bfd22"
-data-evaluate-expression "\*\(\(void\ \*\*\)0x2001fffc\)"
^done,value="0x1b5bfd22"
如果不是,很可能是您在创建项目时选择了错误的设备(例如,您的设备实际上有 32KB 的 RAM,而您选择了具有 64K RAM 的设备)。 VisualGDB 设备定义中也可能存在错误。
您可以通过将链接描述文件中的 _estack 地址与设备数据表中描述的 RAM 结束地址进行比较来找出这一点。
我使用 VisualGDB 设置 Visual Studio 2015,并使用 HAL 设置 LED Blink 项目,如本例所述:http://visualgdb.com/tutorials/arm/stm32/stm32l4/
工具安装正确,我的项目完全按照示例进行,包括第 6 步,然后向上执行第 7 步。但是,在设置断点并尝试按照第 8 步 运行 它之后,我在输出中得到以下内容 window:
Open On-Chip Debugger 0.9.0 (2015-10-08-15:57)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 500 kHz
adapter_nsrst_delay: 100
none separate
Info : Unable to match requested speed 500 kHz, using 480 kHz
Info : Unable to match requested speed 500 kHz, using 480 kHz
Info : clock speed 480 kHz
Info : STLINK v2 JTAG v24 API v2 SWIM v10 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 3.263434
Info : stm32l4x.cpu: hardware has 6 breakpoints, 4 watchpoints
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800027c msp: 0x20020000
adapter speed: 4000 kHz
Info : accepting 'gdb' connection on tcp/3333
Info : device id = 0x10076415
Info : flash size = 1024kbytes
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800027c msp: 0x20020000
adapter speed: 4000 kHz
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800027c msp: 0x20020000
adapter speed: 4000 kHz
Warn : Padding 4 bytes to keep 8-byte write size
target state: halted
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000004a msp: 0x20020000
Warn : block write succeeded
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800027c msp: 0x20020000
Error: Memory write failure!
同时,我收到一个对话框弹出窗口,内容为:"The memory location used for the stack is not writable. Please check the device type and the linker script. You can disable automatic stack checking via VisualGDB Project Properties"
查看构建期间生成的 .map 文件,0x61000000 附近或 0x01000000 处没有任何内容。有一个_estack = 0x20020000.
我在链接器标志中添加了一个 -N (LDFLAGS := -Wl,-N,-gc-sections),看看这是否会影响任何东西,而 id 没有。
有什么地方可能有问题吗?
提前谢谢你。
当 VisualGDB 尝试测试栈尾 (_estack - 4) 是否可写时,会出现 "The memory location used for the stack is not writable" 错误。
如果将 GDB Session window 切换到 All GDB Interaction 模式,您将看到 VisualGDB 试图在那里写入一个随机值,然后检查它是否可以被读回:
-data-evaluate-expression "&_estack" ^done,value="0x20020000" -var-create - * "*((void **)0x2001fffc)" ^done,name="var1",numchild="0",value="0x80002ad ",type="void *",has_more="0" -var-assign "var1" 0x1b5bfd22 ^done,value="0x1b5bfd22" -data-evaluate-expression "\*\(\(void\ \*\*\)0x2001fffc\)" ^done,value="0x1b5bfd22"
如果不是,很可能是您在创建项目时选择了错误的设备(例如,您的设备实际上有 32KB 的 RAM,而您选择了具有 64K RAM 的设备)。 VisualGDB 设备定义中也可能存在错误。
您可以通过将链接描述文件中的 _estack 地址与设备数据表中描述的 RAM 结束地址进行比较来找出这一点。