配置调试器
在启动调试之前,需要配置调试器。点击Keil Toolbar中的Options for Target按钮 ,打开Options for Target ‘GRxx_Soc’对话框,选择Debug标签页。窗口左边为使用软件仿真调试,右边为使用硬件在线调试。BLE Examples工程使用硬件在线调试,相关的调试器默认配置如下:
默认使用的Initialization File:sram.ini在SDK_Folder\build\keil目录中。开发者可以直接使用该文件,也可以将该文件复制到自己的工程目录下使用。
说明:
SDK_Folder为GR551x SDK的根目录。
初始化文件sram.ini中包含一组调试命令,调试过程将执行这些命令。在Initialization File栏,点击右侧的Edit...按钮打开sram.ini文件。sram.ini的代码示例如下:
/**
*****************************************************************
* GR55xx object loading script through debugger interface
* (e.g.Jlink, *etc).
* The goal of this script is to load the Keils's object file to the
* GR55xx RAM
* assuring that the GR55xx has been previously cleaned up.
*****************************************************************
*/
// Debugger reset(check Keil debugger settings)
// Preselected reset type(found in Options->Debug->Settings)is
// Normal(0);
// -Normal:Reset core & peripherals via SYSRESETREQ & VECTRESET bit
RESET
// Load object file
LOAD %L
// Load stack pointer
SP = _RDWORD(0x00000000)
// Load program counter
$ = _RDWORD(0x00000004)
// Write 0 to vector table register, remap vector
_WDWORD(0xE000ED08, 0x00000000)
说明:
Keil支持按照以下顺序执行开发者设置的调试器命令:
- 当 被使能,调试器会首先载入 中的文件。
- 执行 所指定文件中的命令。
- 当 包含的选项被选中,恢复相应的Breakpoints,Watch Windows,Memory Display等。
- 当g,main被发现位于Initialization File中,调试器就会自动开始执行CPU指令,直到遇到main()才会停下来。 被选中或者命令