发表于《STM32 趟坑一览》
张静茹作者
5年6个月前IP:山东
893785
24楼

将代码烧写到sram中 需要在flash 中跳转到 sram中,不然reset后 程序无法运行



typedef  void (*pFunction)(void);

pFunction JumpToApplication;



/* Disable CPU L1 cache before jumping to the QSPI code execution */

    SCB_DisableICache();

    SCB_DisableDCache();

  /* Disable Systick interrupt */

  SysTick->CTRL = 0;


//HAL_DeInit();

__disable_irq();

  /* Initialize user application's Stack Pointer & Jump to user application */

  JumpToApplication = (pFunction) (*(__IO uint32_t*) (0x24000000 + 4));

__DSB();

__ISB();

  __set_MSP(*(__IO uint32_t*) 0x24000000);

__DSB();

__ISB();

__enable_irq();

  JumpToApplication();


评论
文号 / 893785

千古风流
名片专栏发私信
学术分 1
总主题 146 帖总回复 1873 楼拥有证书:进士 学者 机友 笔友
注册于 2010/12/30 03:32:26最后登录 2026/06/20 19:33:53
主体类型:个人
所属领域:无
认证方式:手机号
IP归属地:0

个人简介

暂未填写
笔记
{{note.content}}
{{n.user.username}}
{{fromNow(n.toc)}} {{n.status === noteStatus.disabled ? "已屏蔽" : ""}} {{n.status === noteStatus.unknown ? "正在审核" : ""}} {{n.status === noteStatus.deleted ? '已删除' : ''}}
  • 编辑
  • 删除
  • {{n.status === 'disabled' ? "解除屏蔽" : "屏蔽" }}
我也是有底线的