6228|6

23

帖子

0

TA的资源

一粒金砂(中级)

楼主
 

我想问下关于STM32F107 RAM调试的问题 [复制链接]

最近,想在RAM中调试代码。
       参考了网上的说法,我使用的是MDK ,环境的设置和进入JLINK 调试如图所示。
       对于RAM.INI文件中的 AXF文件的目录页做了正确的配置。
       有关BOOT1和BOOT0的设置,网上有些说要设置成RAM启动方式 ,有些说可以不用设置。
       BOOT1和BOOT0当我设置成从RAM启动方式时,进入JLINK调试,开发板在“全速调试”和“单步调试”下都运行不起来,LCD显示白屏。
       BOOT1和BOOT0设置成FLSAH 启动方式下,点击”DEBUG“按钮,进入JLINK调试,板卡直接进入“全速运行“,我看汇编窗口程序不是运行在RAM 当中,而且不能进入中断。
        不知道以上的问题哪位高手能帮我解决下。

2.jpg (72.27 KB, 下载次数: 0)

RAM.INI文件导入

RAM.INI文件导入

3.jpg (54.63 KB, 下载次数: 0)

UTILITIES设置

UTILITIES设置

5.jpg (83.21 KB, 下载次数: 0)

进入调试

进入调试

未命名.jpg (64.52 KB, 下载次数: 0)

进入调试

进入调试
此帖出自stm32/stm8论坛

最新回复

/****************************************************************************         Copyright (C), 2010 安富莱电子 www.armfly.com    【本例程在安富莱STM32F103ZE-EK开发板上调试通过             】    【QQ: 1295744630, 旺旺:armfly, Email: armfly@qq.com       】         文件名: ExtSRAM.ini         这是外部SRAM调试脚本。开始Load程序时,由IDE控制仿真器执行这段脚本程序。         本脚本完成的功能是         (1) 配置CPU的FSMC总线,使CPU能够访问外部SRAM,已便于后面装入程序         (2) 复制外部SRAM的中断向量表(0x130字节)到CPU内部RAM         (3) 设置堆栈指针SP         (4) 修改PC指针                 注意:工程选项IRAM1的起始地址必须是0x20000200开始         脚本的语法:         参加MDK的HELP, 搜索关键字 “uv3 Library Routines” 可以看到uv3支持的脚本命令 */ FUNC void Setup (void) {   SP = _RDWORD(0x68000000);          // 设置堆栈指针   PC = _RDWORD(0x68000004);          // 设置PC指针(程序计数器)   _WDWORD(0xE000ED08, 0x20000000);   // 设置中断向量表地址寄存器 = 0x20000000 } // 初始化FSMC,用于外部SRAM FUNC void InitSRAM (void) {   //InitRCCC   _WDWORD(0x40021000, 0x00005083);   _WDWORD(0x40021004, 0x00000000);   _WDWORD(0x40021004, 0x00000000);   _WDWORD(0x40021000, 0x00005083);   _WDWORD(0x40021004, 0x00000000);   _WDWORD(0x40021008, 0x009F0000);   _WDWORD(0x40021000, 0x00015083);   _sleep_ (100);                        // Wait for PLL lock   _WDWORD(0x40022000, 0x00000030);   _WDWORD(0x40022000, 0x00000030);   _WDWORD(0x40022000, 0x00000032);   _WDWORD(0x40021004, 0x00000000);   _WDWORD(0x40021004, 0x00000000);   _WDWORD(0x40021004, 0x00000400);   _WDWORD(0x40021004, 0x00000400);   _WDWORD(0x40021004, 0x001D0400);   _WDWORD(0x40021000, 0x01035083);   _sleep_ (100);   _WDWORD(0x40021004, 0x001D0400);   _WDWORD(0x40021004, 0x001D0402);   _sleep_ (100);   _WDWORD(0x40021014, 0x00000114);  /* Enable AHBPeriphClock */   _WDWORD(0x40021018, 0x000001E0);  /* Enable APB2PeriphClock */   /* GPIO Configuration for FSMC */   _WDWORD(0x40011400, 0xB8BB44BB);   _WDWORD(0x40011404, 0xBBBBBBBB);   _WDWORD(0x40011800, 0xBBBBB4BB);   /* NBL0, NBL1 & adress configuration */   _WDWORD(0x40011804, 0xBBBBBBBB);   _WDWORD(0x40011C00, 0x33BBBBBB);   _WDWORD(0x40011C04, 0xBBBB3333);   _WDWORD(0x40012000, 0x48BBBBBB);   _WDWORD(0x40012004, 0x444B4BB4);   /* NE3 configuration */   _WDWORD(0xA0000010, 0x00001010);   /* FSMC Configuration */   _WDWORD(0xA0000014, 0x00000200);   /* FSMC_DataSetupTime = 2; */   _WDWORD(0xA0000010, 0x00001011);   /* Enable FSMC Bank1_SRAM Bank */   _sleep_ (200); } /*         复制中断向量表         中断向量表地址必须是512字节的整数倍。         中断向量表实际大小 :0x00000130 */ FUNC void CopyVectTable(void) {         _WDWORD(0x20000000, _RDWORD(0x68000000));         _WDWORD(0x20000004, _RDWORD(0x68000004));         _WDWORD(0x20000008, _RDWORD(0x68000008));         _WDWORD(0x2000000C, _RDWORD(0x6800000C));         _WDWORD(0x20000010, _RDWORD(0x68000010));         _WDWORD(0x20000014, _RDWORD(0x68000014));         _WDWORD(0x20000018, _RDWORD(0x68000018));         _WDWORD(0x2000001C, _RDWORD(0x6800001C));         _WDWORD(0x20000020, _RDWORD(0x68000020));         _WDWORD(0x20000024, _RDWORD(0x68000024));         _WDWORD(0x20000028, _RDWORD(0x68000028));         _WDWORD(0x2000002C, _RDWORD(0x6800002C));         _WDWORD(0x20000030, _RDWORD(0x68000030));         _WDWORD(0x20000034, _RDWORD(0x68000034));         _WDWORD(0x20000038, _RDWORD(0x68000038));         _WDWORD(0x2000003C, _RDWORD(0x6800003C));         _WDWORD(0x20000040, _RDWORD(0x68000040));         _WDWORD(0x20000044, _RDWORD(0x68000044));         _WDWORD(0x20000048, _RDWORD(0x68000048));         _WDWORD(0x2000004C, _RDWORD(0x6800004C));         _WDWORD(0x20000050, _RDWORD(0x68000050));         _WDWORD(0x20000054, _RDWORD(0x68000054));         _WDWORD(0x20000058, _RDWORD(0x68000058));         _WDWORD(0x2000005C, _RDWORD(0x6800005C));         _WDWORD(0x20000060, _RDWORD(0x68000060));         _WDWORD(0x20000064, _RDWORD(0x68000064));         _WDWORD(0x20000068, _RDWORD(0x68000068));         _WDWORD(0x2000006C, _RDWORD(0x6800006C));         _WDWORD(0x20000070, _RDWORD(0x68000070));         _WDWORD(0x20000074, _RDWORD(0x68000074));         _WDWORD(0x20000078, _RDWORD(0x68000078));         _WDWORD(0x2000007C, _RDWORD(0x6800007C));         _WDWORD(0x20000080, _RDWORD(0x68000080));         _WDWORD(0x20000084, _RDWORD(0x68000084));         _WDWORD(0x20000088, _RDWORD(0x68000088));         _WDWORD(0x2000008C, _RDWORD(0x6800008C));         _WDWORD(0x20000090, _RDWORD(0x68000090));         _WDWORD(0x20000094, _RDWORD(0x68000094));         _WDWORD(0x20000098, _RDWORD(0x68000098));         _WDWORD(0x2000009C, _RDWORD(0x6800009C));         _WDWORD(0x200000A0, _RDWORD(0x680000A0));         _WDWORD(0x200000A4, _RDWORD(0x680000A4));         _WDWORD(0x200000A8, _RDWORD(0x680000A8));         _WDWORD(0x200000AC, _RDWORD(0x680000AC));         _WDWORD(0x200000B0, _RDWORD(0x680000B0));         _WDWORD(0x200000B4, _RDWORD(0x680000B4));         _WDWORD(0x200000B8, _RDWORD(0x680000B8));         _WDWORD(0x200000BC, _RDWORD(0x680000BC));         _WDWORD(0x200000C0, _RDWORD(0x680000C0));         _WDWORD(0x200000C4, _RDWORD(0x680000C4));         _WDWORD(0x200000C8, _RDWORD(0x680000C8));         _WDWORD(0x200000CC, _RDWORD(0x680000CC));         _WDWORD(0x200000D0, _RDWORD(0x680000D0));         _WDWORD(0x200000D4, _RDWORD(0x680000D4));         _WDWORD(0x200000D8, _RDWORD(0x680000D8));         _WDWORD(0x200000DC, _RDWORD(0x680000DC));         _WDWORD(0x200000E0, _RDWORD(0x680000E0));         _WDWORD(0x200000E4, _RDWORD(0x680000E4));         _WDWORD(0x200000E8, _RDWORD(0x680000E8));         _WDWORD(0x200000EC, _RDWORD(0x680000EC));         _WDWORD(0x200000F0, _RDWORD(0x680000F0));         _WDWORD(0x200000F4, _RDWORD(0x680000F4));         _WDWORD(0x200000F8, _RDWORD(0x680000F8));         _WDWORD(0x200000FC, _RDWORD(0x680000FC));         _WDWORD(0x20000100, _RDWORD(0x68000100));         _WDWORD(0x20000104, _RDWORD(0x68000104));         _WDWORD(0x20000108, _RDWORD(0x68000108));         _WDWORD(0x2000010C, _RDWORD(0x6800010C));         _WDWORD(0x20000110, _RDWORD(0x68000110));         _WDWORD(0x20000114, _RDWORD(0x68000114));         _WDWORD(0x20000118, _RDWORD(0x68000118));         _WDWORD(0x2000011C, _RDWORD(0x6800011C));         _WDWORD(0x20000120, _RDWORD(0x68000120));         _WDWORD(0x20000124, _RDWORD(0x68000124));         _WDWORD(0x20000128, _RDWORD(0x68000128));         _WDWORD(0x2000012C, _RDWORD(0x6800012C)); } // 从这里开始执行代码,之前的都是函数定义 InitSRAM();                                   // 配置 FSMC用于SRAM LOAD obj\text.axf INCREMENTAL                // 下载程序到外部SRAM CopyVectTable();                                        // 将外部SRAM的中断向量表复制到CPU内部RAM Setup();                                     // 配置堆栈和PC指针 g, main                                                                // 运行到 main()函数后暂停 这是STM32F103ZET6的在外部ram调试的.ini文件,自己参考一下吧  详情 回复 发表于 2013-3-21 08:54
点赞 关注
 

回复
举报

113

帖子

0

TA的资源

一粒金砂(高级)

沙发
 
RAM中进不了中断还缺以下两步:

此帖出自stm32/stm8论坛

点评

请问,我是把你指出的,中断向量函数直接添加到main 里面吗? 除了你说的那步,我要在RAM中调试还有哪些设置的问题吗? 我的以上设置应该不会错吧,帮忙回答下,谢谢。  详情 回复 发表于 2013-3-18 21:59
 
 

回复

23

帖子

0

TA的资源

一粒金砂(中级)

板凳
 

回复 沙发 funnylogic 的帖子

请问,我是把你指出的,中断向量函数直接添加到main 里面吗?
除了你说的那步,我要在RAM中调试还有哪些设置的问题吗?
我的以上设置应该不会错吧,帮忙回答下,谢谢。
此帖出自stm32/stm8论坛

点评

RAM.ini文件里还要加上把中断向量表复制到ram里的语句,只初始化ram是不够的  详情 回复 发表于 2013-3-19 20:37
 
 

回复

113

帖子

0

TA的资源

一粒金砂(高级)

4
 
中断向量函数可以直接添加在main里面,但一定要在RCC_Configuration()之后执行。还有该对话框中的Reset and Run这个勾要去掉。


[ 本帖最后由 funnylogic 于 2013-3-19 11:01 编辑 ]
此帖出自stm32/stm8论坛
 
 
 

回复

373

帖子

0

TA的资源

纯净的硅(中级)

5
 

回复 板凳 tyc119514155 的帖子

RAM.ini文件里还要加上把中断向量表复制到ram里的语句,只初始化ram是不够的
此帖出自stm32/stm8论坛

点评

我的RAM.INI是这样的 FUNC void Setup (void) { SP = _RDWORD(0x20000000); // Setup Stack Pointer PC = _RDWORD(0x20000004); // Setup Program Counter _WDWORD(0xE000ED08, 0x  详情 回复 发表于 2013-3-20 12:36
 
 
 

回复

23

帖子

0

TA的资源

一粒金砂(中级)

6
 

回复 5楼 wudayongnb 的帖子

我的RAM.INI是这样的


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 ..\SRAM\output\TEST.axf INCREMENTAL      // Download         

Setup();                             // Setup for Running

g, main


你说的“中断向量表” 指的是
void NVIC_Configuration(void)
{
#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
}
吗?
此帖出自stm32/stm8论坛
 
 
 

回复

373

帖子

0

TA的资源

纯净的硅(中级)

7
 

不是这个

/****************************************************************************
        Copyright (C), 2010 安富莱电子 www.armfly.com

   【本例程在安富莱STM32F103ZE-EK开发板上调试通过             】
   【QQ: 1295744630, 旺旺:armfly, Email: armfly@qq.com       】

        文件名: ExtSRAM.ini

        这是外部SRAM调试脚本。开始Load程序时,由IDE控制仿真器执行这段脚本程序。

        本脚本完成的功能是
        (1) 配置CPU的FSMC总线,使CPU能够访问外部SRAM,已便于后面装入程序
        (2) 复制外部SRAM的中断向量表(0x130字节)到CPU内部RAM
        (3) 设置堆栈指针SP
        (4) 修改PC指针
       
        注意:工程选项IRAM1的起始地址必须是0x20000200开始

        脚本的语法:
        参加MDK的HELP, 搜索关键字 “uv3 Library Routines” 可以看到uv3支持的脚本命令
*/

FUNC void Setup (void) {
  SP = _RDWORD(0x68000000);          // 设置堆栈指针
  PC = _RDWORD(0x68000004);          // 设置PC指针(程序计数器)
  _WDWORD(0xE000ED08, 0x20000000);   // 设置中断向量表地址寄存器 = 0x20000000
}

// 初始化FSMC,用于外部SRAM
FUNC void InitSRAM (void) {
  //InitRCCC
  _WDWORD(0x40021000, 0x00005083);
  _WDWORD(0x40021004, 0x00000000);
  _WDWORD(0x40021004, 0x00000000);
  _WDWORD(0x40021000, 0x00005083);
  _WDWORD(0x40021004, 0x00000000);
  _WDWORD(0x40021008, 0x009F0000);

  _WDWORD(0x40021000, 0x00015083);
  _sleep_ (100);                        // Wait for PLL lock

  _WDWORD(0x40022000, 0x00000030);
  _WDWORD(0x40022000, 0x00000030);
  _WDWORD(0x40022000, 0x00000032);
  _WDWORD(0x40021004, 0x00000000);
  _WDWORD(0x40021004, 0x00000000);
  _WDWORD(0x40021004, 0x00000400);
  _WDWORD(0x40021004, 0x00000400);
  _WDWORD(0x40021004, 0x001D0400);
  _WDWORD(0x40021000, 0x01035083);
  _sleep_ (100);
  _WDWORD(0x40021004, 0x001D0400);
  _WDWORD(0x40021004, 0x001D0402);
  _sleep_ (100);

  _WDWORD(0x40021014, 0x00000114);  /* Enable AHBPeriphClock */
  _WDWORD(0x40021018, 0x000001E0);  /* Enable APB2PeriphClock */

  /* GPIO Configuration for FSMC */
  _WDWORD(0x40011400, 0xB8BB44BB);
  _WDWORD(0x40011404, 0xBBBBBBBB);
  _WDWORD(0x40011800, 0xBBBBB4BB);   /* NBL0, NBL1 & adress configuration */
  _WDWORD(0x40011804, 0xBBBBBBBB);
  _WDWORD(0x40011C00, 0x33BBBBBB);
  _WDWORD(0x40011C04, 0xBBBB3333);
  _WDWORD(0x40012000, 0x48BBBBBB);
  _WDWORD(0x40012004, 0x444B4BB4);   /* NE3 configuration */

  _WDWORD(0xA0000010, 0x00001010);   /* FSMC Configuration */
  _WDWORD(0xA0000014, 0x00000200);   /* FSMC_DataSetupTime = 2; */
  _WDWORD(0xA0000010, 0x00001011);   /* Enable FSMC Bank1_SRAM Bank */

  _sleep_ (200);
}

/*
        复制中断向量表
        中断向量表地址必须是512字节的整数倍。
        中断向量表实际大小 :0x00000130
*/
FUNC void CopyVectTable(void) {
        _WDWORD(0x20000000, _RDWORD(0x68000000));
        _WDWORD(0x20000004, _RDWORD(0x68000004));
        _WDWORD(0x20000008, _RDWORD(0x68000008));
        _WDWORD(0x2000000C, _RDWORD(0x6800000C));

        _WDWORD(0x20000010, _RDWORD(0x68000010));
        _WDWORD(0x20000014, _RDWORD(0x68000014));
        _WDWORD(0x20000018, _RDWORD(0x68000018));
        _WDWORD(0x2000001C, _RDWORD(0x6800001C));

        _WDWORD(0x20000020, _RDWORD(0x68000020));
        _WDWORD(0x20000024, _RDWORD(0x68000024));
        _WDWORD(0x20000028, _RDWORD(0x68000028));
        _WDWORD(0x2000002C, _RDWORD(0x6800002C));

        _WDWORD(0x20000030, _RDWORD(0x68000030));
        _WDWORD(0x20000034, _RDWORD(0x68000034));
        _WDWORD(0x20000038, _RDWORD(0x68000038));
        _WDWORD(0x2000003C, _RDWORD(0x6800003C));

        _WDWORD(0x20000040, _RDWORD(0x68000040));
        _WDWORD(0x20000044, _RDWORD(0x68000044));
        _WDWORD(0x20000048, _RDWORD(0x68000048));
        _WDWORD(0x2000004C, _RDWORD(0x6800004C));

        _WDWORD(0x20000050, _RDWORD(0x68000050));
        _WDWORD(0x20000054, _RDWORD(0x68000054));
        _WDWORD(0x20000058, _RDWORD(0x68000058));
        _WDWORD(0x2000005C, _RDWORD(0x6800005C));

        _WDWORD(0x20000060, _RDWORD(0x68000060));
        _WDWORD(0x20000064, _RDWORD(0x68000064));
        _WDWORD(0x20000068, _RDWORD(0x68000068));
        _WDWORD(0x2000006C, _RDWORD(0x6800006C));

        _WDWORD(0x20000070, _RDWORD(0x68000070));
        _WDWORD(0x20000074, _RDWORD(0x68000074));
        _WDWORD(0x20000078, _RDWORD(0x68000078));
        _WDWORD(0x2000007C, _RDWORD(0x6800007C));

        _WDWORD(0x20000080, _RDWORD(0x68000080));
        _WDWORD(0x20000084, _RDWORD(0x68000084));
        _WDWORD(0x20000088, _RDWORD(0x68000088));
        _WDWORD(0x2000008C, _RDWORD(0x6800008C));

        _WDWORD(0x20000090, _RDWORD(0x68000090));
        _WDWORD(0x20000094, _RDWORD(0x68000094));
        _WDWORD(0x20000098, _RDWORD(0x68000098));
        _WDWORD(0x2000009C, _RDWORD(0x6800009C));

        _WDWORD(0x200000A0, _RDWORD(0x680000A0));
        _WDWORD(0x200000A4, _RDWORD(0x680000A4));
        _WDWORD(0x200000A8, _RDWORD(0x680000A8));
        _WDWORD(0x200000AC, _RDWORD(0x680000AC));

        _WDWORD(0x200000B0, _RDWORD(0x680000B0));
        _WDWORD(0x200000B4, _RDWORD(0x680000B4));
        _WDWORD(0x200000B8, _RDWORD(0x680000B8));
        _WDWORD(0x200000BC, _RDWORD(0x680000BC));

        _WDWORD(0x200000C0, _RDWORD(0x680000C0));
        _WDWORD(0x200000C4, _RDWORD(0x680000C4));
        _WDWORD(0x200000C8, _RDWORD(0x680000C8));
        _WDWORD(0x200000CC, _RDWORD(0x680000CC));

        _WDWORD(0x200000D0, _RDWORD(0x680000D0));
        _WDWORD(0x200000D4, _RDWORD(0x680000D4));
        _WDWORD(0x200000D8, _RDWORD(0x680000D8));
        _WDWORD(0x200000DC, _RDWORD(0x680000DC));

        _WDWORD(0x200000E0, _RDWORD(0x680000E0));
        _WDWORD(0x200000E4, _RDWORD(0x680000E4));
        _WDWORD(0x200000E8, _RDWORD(0x680000E8));
        _WDWORD(0x200000EC, _RDWORD(0x680000EC));

        _WDWORD(0x200000F0, _RDWORD(0x680000F0));
        _WDWORD(0x200000F4, _RDWORD(0x680000F4));
        _WDWORD(0x200000F8, _RDWORD(0x680000F8));
        _WDWORD(0x200000FC, _RDWORD(0x680000FC));

        _WDWORD(0x20000100, _RDWORD(0x68000100));
        _WDWORD(0x20000104, _RDWORD(0x68000104));
        _WDWORD(0x20000108, _RDWORD(0x68000108));
        _WDWORD(0x2000010C, _RDWORD(0x6800010C));

        _WDWORD(0x20000110, _RDWORD(0x68000110));
        _WDWORD(0x20000114, _RDWORD(0x68000114));
        _WDWORD(0x20000118, _RDWORD(0x68000118));
        _WDWORD(0x2000011C, _RDWORD(0x6800011C));

        _WDWORD(0x20000120, _RDWORD(0x68000120));
        _WDWORD(0x20000124, _RDWORD(0x68000124));
        _WDWORD(0x20000128, _RDWORD(0x68000128));
        _WDWORD(0x2000012C, _RDWORD(0x6800012C));
}

// 从这里开始执行代码,之前的都是函数定义
InitSRAM();                                   // 配置 FSMC用于SRAM
LOAD obj\text.axf INCREMENTAL                // 下载程序到外部SRAM
CopyVectTable();                                        // 将外部SRAM的中断向量表复制到CPU内部RAM
Setup();                                     // 配置堆栈和PC指针
g, main                                                                // 运行到 main()函数后暂停
这是STM32F103ZET6的在外部ram调试的.ini文件,自己参考一下吧
此帖出自stm32/stm8论坛
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表