stm32f767自举及在RAM中调试

仅作笔记

一,自举。

        在M0,M3,M4内核中,是通过boot0和boot1两个引脚的电平组合来确定启动地址的,启动的介质可以是系统存储器,SRAM,主Flash等。

        在M7内核中,是通过boot0的电平加 Flash 选项控制寄存器的值来决定的:

stm32f767自举及在RAM中调试_第1张图片 stm32f767自举及在RAM中调试_第2张图片

stm32f767自举及在RAM中调试_第3张图片

 总的来说,

 总结:stm32启动方式可以有flash,RAM,系统存储器三种。stm32f767只有一个boot引脚,自举(启动方式)模式由boot引脚 和BOOT_ADD0[15:0]和BOOT_ADD1[15:0]  来决定,默认状态下,boot=0,在flash启动,boot=1,在系统存储器启动。

 2,使用stm32CubeIDE在RAM中调试。

如果stm32如果想在RAM中调试,需要有以下几步

1,自举方式。

        在M0,M3,M4内核中,是通过boot0和boot1两个引脚决定。在M7内核中,只有boot0及boot引脚,是通过boot0的电平加 Flash 选项控制寄存器的值来决定的.

       stm32f767在RAM中调试,BOOT0保持低就可以了,不需修改。

2,要选用正确的链接脚本。分别对应于从flash启动和sram启动的脚本。

stm32f767自举及在RAM中调试_第4张图片

 stm32f767自举及在RAM中调试_第5张图片

 3,中断向量表在SRAM定位。

0x20000000

stm32f767自举及在RAM中调试_第6张图片

从system_stm32f7xx.c程序中可以看出,如果想在ram中调试,需要宏定义USER_VECT_TAB_ADDRESS,VECT_TAB_SRAM这两个变量。


/************************* Miscellaneous Configuration ************************/

/* Note: Following vector table addresses must be defined in line with linker
         configuration. */
/*!< Uncomment the following line if you need to relocate the vector table
     anywhere in Flash or Sram, else the vector table is kept at the automatic
     remap of boot address selected */
/* #define USER_VECT_TAB_ADDRESS */

#if defined(USER_VECT_TAB_ADDRESS)
/*!< Uncomment the following line if you need to relocate your vector Table
     in Sram else user remap will be done in Flash. */
/* #define VECT_TAB_SRAM */
#if defined(VECT_TAB_SRAM)
#define VECT_TAB_BASE_ADDRESS   RAMDTCM_BASE    /*!< Vector Table base address field.
                                                     This value must be a multiple of 0x200. */
#define VECT_TAB_OFFSET         0x00000000U     /*!< Vector Table base offset field.
                                                     This value must be a multiple of 0x200. */
#else
#define VECT_TAB_BASE_ADDRESS   FLASH_BASE      /*!< Vector Table base address field.
                                                     This value must be a multiple of 0x200. */
#define VECT_TAB_OFFSET         0x00000000U     /*!< Vector Table base offset field.
                                                     This value must be a multiple of 0x200. */
#endif /* VECT_TAB_SRAM */
#endif /* USER_VECT_TAB_ADDRESS */
/******************************************************************************/

定义方法

stm32f767自举及在RAM中调试_第7张图片
 

4,中间由于没有定义USER_VECT_TAB_ADDRESS,报错

stm32f767自举及在RAM中调试_第8张图片

从上边的程序可以看出, 没有定义USER_VECT_TAB_ADDRESS的话,那段代码不执行。

 5,如果退回flash调试的话,复原回去就可以了。

参考文章:

1,原子开发板手册;

2,【NuttX】在STM32F767平台上的启动过程分析 - 知乎 (zhihu.com)

3,(9条消息) STM32系列--启动模式(boot0、boot1)_ora___的博客-CSDN博客

4,在cubeide中,设置成从SRAM启动程序 (stmicroelectronics.cn)

5,STM32CubeMX在SRAM中调试的设置-电子工程世界 (eeworld.com.cn)

你可能感兴趣的:(stm32f767,stm32,单片机,嵌入式硬件)