将以下内容保存为debug_Cortex-M_in_RAM.ini文件。
/* 使用说明
1,使用默认的链接控制文件;
2,工程选项的Debug标签页中,初始化文件(Initialization File)选择:debug_Cortex-M_in_RAM.ini
3,配置代码在内存中的起始地址。
4,【重要】Utilities标签页中,取消选择:Update Target before Debugging
5,不要点击“Flash=>Download”下载,直接点击“Debug=>Start Debug Session”开始调试。
*/
/*----------------------------------------------------------------------------
* Name: Debug_RAM.ini
* Purpose: RAM Debug Initialization File
*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
Setup() configure PC & SP for RAM Debug
*----------------------------------------------------------------------------*/
FUNC void Setup (void) {
SP = _RDWORD(0x20000000); // Setup Stack Pointer
PC = _RDWORD(0x20000004); // Setup Program Counter
_WDWORD(0xE000ED08, 0x20000000); // Setup Vector Table Offset Register
}
FUNC void OnResetExec (void) { // executes upon software RESET
Setup(); // Setup for Running
}
load %L incremental
Setup(); // Setup for Running
g, main