CN / EN
文档反馈
感谢关注汇顶文档,期待您的宝贵建议!
感谢您的反馈,祝您愉快!

配置调试器

在启动调试之前,需要配置调试器。点击Keil Toolbar中的Options for Target按钮 ,打开Options for Target ‘GRxx_Soc’对话框,选择Debug标签页。窗口左边为使用软件仿真调试,右边为使用硬件在线调试。BLE Examples工程使用硬件在线调试,相关的调试器默认配置如下:

图 28 配置调试器

默认使用的Initialization File:sram.iniSDK_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支持按照以下顺序执行开发者设置的调试器命令:

  1. Options for Target ‘GRxx_Soc’ > Debug > Load Application at Startup被使能,调试器会首先载入Options for Target ‘GRxx_Soc’ > Output > Name of Executable中的文件。
  2. 执行Options for Target ‘GRxx_Soc’ > Debug > Initialization File所指定文件中的命令。
  3. Options for Target ‘GRxx_Soc’ > Debug > Restore Debug Session Settings包含的选项被选中,恢复相应的Breakpoints,Watch Windows,Memory Display等。
  4. Options for Target ‘GRxx_Soc’ > Debug > Run to main()被选中或者命令g,main被发现位于Initialization File中,调试器就会自动开始执行CPU指令,直到遇到main()才会停下来。

扫描关注

打开微信,使用“扫一扫”即可关注。