RAM中调试所做的设置

1、main()函数之前中加入 #define _VECT_TAB_RAM //内存中调试 main函数外
void NVIC_Configuration(void)
{

NVIC_InitTypeDef NVIC_InitStructure;

#ifdef VECT_TAB_RAM /* Set the Vector Table base location at 0x20000000 */

NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);
#else /* VECT_TAB_FLASH */ /* Set the Vector Table base location at 0x08000000 */

NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
#endif
}

2、修改RAM和ROM分配,STM32F103ZE原配置为
IROM1 0x8000000 (start) 0x80000(size)
IRAM1 0x20000000(start) 0x10000(size)
修改为:
IROM1 0x20000000 (start) 0xA000(size)
IRAM1 0x2000A000(start) 0x6000(size)
3、配置RAM模式 ASM配置下的Define:RAM_MODE REMAP (Options for Target 里设置)
4、调试工具选择 (Options for Target 里设置)
Debug:Use:cortex-M/R J-Link/Trace
Load Application at Startup 不选
Initialization File:选择RAM.ini
RAM.ini内容:(注意修改.axf的路径和文件名)
FUNC void Setup (void) { SP = _RDWORD(0x20000000); // Setup Stack Pointer
PC = _RDWORD(0x20000004); // Setup Program Counter
_WDWORD(0xE000ED08, 0x20000000); // Setup Vector Table Offset Register
}
load *\BOOT_FLASH.axf incremental
Setup(); // Setup for Running
g, main
5、调试地址 (Options for Target 里设置)
Utilities: Update target before Debugging:不选
调试地址分配:
RAM for Algorith: Start:0x2000A000 Size:0x800 (原为Start:0x20000000 Size:0x800)

Do not Erase (原为 Erase Sectors 并去掉 Reset and Run)

修改Program Algorithm芯片flash起始地址为0x020000000 size A000 (原为0x080000000 size 80000)

6、linker 中修改输出配置
Use Memory Layout from Independent 后面的勾去掉
R/O Base 0x20000000 原 0x08000000
R/W Base 0x2000A000 原 0x20000000

7、启动时将BOOT0接高电平,BOOT1接高电平

8、在Components,Environment and Books中新建一个Project Targets 修改里面的配置将不会改变原有的设置

posted on 2020-04-22 23:17  一郎哥哥  阅读(876)  评论(0编辑  收藏  举报

导航