你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

【经验分享】STM32F0 IAP (使用stm32CubeMX)

[复制链接]
STMCU小助手 发布时间:2021-11-24 15:01
BootLoader:

main里调用函数跳转到APP地址0x8003000

  1. typedef  void (*pFunction)(void);
复制代码
  1. #define ApplicationAddress    0x8003000
复制代码
  1. void UserAppStart(void)
  2. {
  3.           if (((*(__IO uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000)
  4.     {
  5.       /* Jump to user application */
  6.       JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4);
  7.       Jump_To_Application = (pFunction) JumpAddress;
  8.       /* Initialize user application's Stack Pointer */
  9.       __set_MSP(*(__IO uint32_t*) ApplicationAddress);
  10.       Jump_To_Application();
  11.     }
  12. }
复制代码

APP:

main 函数添加

  1. #define APPLICATION_ADDRESS     ((uint32_t)0x08003000)
  2. #if   (defined ( __CC_ARM ))
  3.   __IO uint32_t VectorTable[48] __attribute__((at(0x20000000)));
  4. #elif (defined (__ICCARM__))
  5. #pragma location = 0x20000000
  6.   __no_init __IO uint32_t VectorTable[48];
  7. #elif defined   (  __GNUC__  )
  8.   __IO uint32_t VectorTable[48] __attribute__((section(".RAMVectorTable")));
  9. #elif defined ( __TASKING__ )
  10.   __IO uint32_t VectorTable[48] __at(0x20000000);
  11. #endif
复制代码
  1.   /* USER CODE BEGIN 1 */
  2.         uint32_t i = 0;
复制代码
  1.   /* Relocate by software the vector table to the internal SRAM at 0x20000000 ***/  
  2.         
  3.   /* Copy the vector table from the Flash (mapped at the base of the application
  4.      load address 0x08003000) to the base address of the SRAM at 0x20000000. */

  5.   for(i = 0; i < 48; i++)
  6.   {
  7.     VectorTable<i> = *(__IO uint32_t*)(APPLICATION_ADDRESS + (i<<2));</i>
  8.   }
  9.         // Enable the SYSCFG peripheral clock
  10.   __HAL_RCC_SYSCFG_CLK_ENABLE();
  11.   // Remap SRAM at 0x00000000
复制代码
  1.   __HAL_SYSCFG_REMAPMEMORY_SRAM();
复制代码


在Keil下设置IROM1:start 0x8003000 IRAM1:Start 0x200000C0

stm32f0 没有中断偏移寄存器,所以将中断向量表读取到RAM中,然后重映射到RAM地址.


收藏 评论0 发布时间:2021-11-24 15:01

举报

0个回答
关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
st-img 微信公众号
st-img 手机版