一开始从BOOT更新了FLASH后,然后跳转程序,发现程序无法执行,注释掉就可以

SystemInit()

但是这样系统时钟没有经过初始化,延时函数会出问题。

后来 经过挨着注释  最好发现注释掉函数里的下面这行就能跳转了。

    /* Call Post C runtime initialization hook. */// R_BSP_WarmStart(BSP_WARM_START_POST_C);
/*******************************************************************************************************************//*** Initialize the MCU and the runtime environment.**********************************************************************************************************************/
void SystemInit (void)
{
//    *__Vectors =  (uint32_t * )0x00038000;
#if __FPU_USED/* Enable the FPU only when it is used.* Code taken from Section 7.1, Cortex-M4 TRM (DDI0439C) *//* Set bits 20-23 (CP10 and CP11) to enable FPU. */SCB->CPACR = (uint32_t) CP_MASK;
#endif#if BSP_TZ_SECURE_BUILD/* Seal the main stack for secure projects. Reference:* https://developer.arm.com/documentation/100720/0300* https://developer.arm.com/support/arm-security-updates/armv8-m-stack-sealing */uint32_t * p_main_stack_top = (uint32_t *) __Vectors[0];*p_main_stack_top = BSP_TZ_STACK_SEAL_VALUE;
#endif#if !BSP_TZ_NONSECURE_BUILD/* VTOR is in undefined state out of RESET:* https://developer.arm.com/documentation/100235/0004/the-cortex-m33-peripherals/system-control-block/system-control-block-registers-summary?lang=en.* Set the Secure/Non-Secure VTOR to the vector table address based on the build. This is skipped for non-secure* projects because SCB_NS->VTOR is set by the secure project before the non-secure project runs. */
//    SCB->VTOR = (uint32_t) &__Vectors;SCB->VTOR = (uint32_t)&__Vectors;
#endif#if !BSP_TZ_CFG_SKIP_INIT#if BSP_FEATURE_BSP_VBATT_HAS_VBTCR1_BPWSWSTP/* Unlock VBTCR1 register. */R_SYSTEM->PRCR = (uint16_t) BSP_PRV_PRCR_PRC1_UNLOCK;/* The VBTCR1.BPWSWSTP must be set after reset on MCUs that have VBTCR1.BPWSWSTP. Reference section 11.2.1* "VBATT Control Register 1 (VBTCR1)" and Figure 11.2 "Setting flow of the VBTCR1.BPWSWSTP bit" in the RA4M1 manual* R01UM0007EU0110. This must be done before bsp_clock_init because LOCOCR, LOCOUTCR, SOSCCR, and SOMCR cannot* be accessed until VBTSR.VBTRVLD is set. */R_SYSTEM->VBTCR1 = 1U;FSP_HARDWARE_REGISTER_WAIT(R_SYSTEM->VBTSR_b.VBTRVLD, 1U);/* Lock VBTCR1 register. */R_SYSTEM->PRCR = (uint16_t) BSP_PRV_PRCR_LOCK;#endif
#endif#if BSP_FEATURE_TFU_SUPPORTEDR_BSP_MODULE_START(FSP_IP_TFU, 0U);
#endif#if BSP_CFG_EARLY_INIT/* Initialize uninitialized BSP variables early for use in R_BSP_WarmStart. */bsp_init_uninitialized_vars();
#endif/* Call pre clock initialization hook. */R_BSP_WarmStart(BSP_WARM_START_RESET);#if BSP_TZ_CFG_SKIP_INIT/* Initialize clock variables to be used with R_BSP_SoftwareDelay. */bsp_clock_freq_var_init();
#else/* Configure system clocks. */bsp_clock_init();#if BSP_FEATURE_BSP_RESET_TRNG/* To prevent an undesired current draw, this MCU requires a reset* of the TRNG circuit after the clocks are initialized */bsp_reset_trng_circuit();#endif
#endif/* Call post clock initialization hook. */R_BSP_WarmStart(BSP_WARM_START_POST_CLOCK);#if BSP_FEATURE_BSP_HAS_SP_MON/* Disable MSP monitoring  */R_MPU_SPMON->SP[0].CTL = 0;/* Setup NMI interrupt  */R_MPU_SPMON->SP[0].OAD = BSP_STACK_POINTER_MONITOR_NMI_ON_DETECTION;/* Setup start address  */R_MPU_SPMON->SP[0].SA = BSP_PRV_STACK_LIMIT;/* Setup end address  */R_MPU_SPMON->SP[0].EA = BSP_PRV_STACK_TOP;/* Set SPEEN bit to enable NMI on stack monitor exception. NMIER bits cannot be cleared after reset, so no need* to read-modify-write. */R_ICU->NMIER = R_ICU_NMIER_SPEEN_Msk;/* Enable MSP monitoring  */R_MPU_SPMON->SP[0].CTL = 1U;
#endif#if BSP_FEATURE_TZ_HAS_TRUSTZONE/* Use CM33 stack monitor. */__set_MSPLIM(BSP_PRV_STACK_LIMIT);
//    __set_MSPLIM(0);
#endif#if BSP_CFG_C_RUNTIME_INIT/* Initialize C runtime environment. *//* Zero out BSS */#if defined(__ARMCC_VERSION)memset((uint8_t *) &Image$$BSS$$ZI$$Base, 0U, (uint32_t) &Image$$BSS$$ZI$$Length);#elif defined(__GNUC__)memset(&__bss_start__, 0U, ((uint32_t) &__bss_end__ - (uint32_t) &__bss_start__));#elif defined(__ICCARM__)memset((uint32_t *) __section_begin(".bss"), 0U, (uint32_t) __section_size(".bss"));#endif/* Copy initialized RAM data from ROM to RAM. */#if defined(__ARMCC_VERSION)memcpy((uint8_t *) &Image$$DATA$$Base, (uint8_t *) &Load$$DATA$$Base, (uint32_t) &Image$$DATA$$Length);#elif defined(__GNUC__)memcpy(&__data_start__, &__etext, ((uint32_t) &__data_end__ - (uint32_t) &__data_start__));#elif defined(__ICCARM__)memcpy((uint32_t *) __section_begin(".data"), (uint32_t *) __section_begin(".data_init"),(uint32_t) __section_size(".data"));/* Copy functions to be executed from RAM. */#pragma section=".code_in_ram"#pragma section=".code_in_ram_init"memcpy((uint32_t *) __section_begin(".code_in_ram"),(uint32_t *) __section_begin(".code_in_ram_init"),(uint32_t) __section_size(".code_in_ram"));/* Copy main thread TLS to RAM. */#pragma section="__DLIB_PERTHREAD_init"#pragma section="__DLIB_PERTHREAD"memcpy((uint32_t *) __section_begin("__DLIB_PERTHREAD"), (uint32_t *) __section_begin("__DLIB_PERTHREAD_init"),(uint32_t) __section_size("__DLIB_PERTHREAD_init"));#endif/* Initialize static constructors */#if defined(__ARMCC_VERSION)int32_t count = Image$$INIT_ARRAY$$Limit - Image$$INIT_ARRAY$$Base;for (int32_t i = 0; i < count; i++){void (* p_init_func)(void) =(void (*)(void))((uint32_t) &Image$$INIT_ARRAY$$Base + (uint32_t) Image$$INIT_ARRAY$$Base[i]);p_init_func();}#elif defined(__GNUC__)int32_t count = __init_array_end - __init_array_start;for (int32_t i = 0; i < count; i++){__init_array_start[i]();}#elif defined(__ICCARM__)void const * pibase = __section_begin("SHT$$PREINIT_ARRAY");void const * ilimit = __section_end("SHT$$INIT_ARRAY");__call_ctors(pibase, ilimit);#endif
#endif                                 // BSP_CFG_C_RUNTIME_INIT/* Initialize SystemCoreClock variable. */SystemCoreClockUpdate();#if !BSP_CFG_PFS_PROTECT#if BSP_TZ_SECURE_BUILDR_PMISC->PWPRS = 0;                              ///< Clear BOWI bit - writing to PFSWE bit enabledR_PMISC->PWPRS = 1U << BSP_IO_PWPR_PFSWE_OFFSET; ///< Set PFSWE bit - writing to PFS register enabled#elseR_PMISC->PWPR = 0;                               ///< Clear BOWI bit - writing to PFSWE bit enabledR_PMISC->PWPR = 1U << BSP_IO_PWPR_PFSWE_OFFSET;  ///< Set PFSWE bit - writing to PFS register enabled#endif
#endif#if FSP_PRIV_TZ_USE_SECURE_REGS/* Ensure that the PMSAR registers are reset (Soft reset does not reset PMSAR). */R_BSP_RegisterProtectDisable(BSP_REG_PROTECT_SAR);for (uint32_t i = 0; i < 9; i++){R_PMISC->PMSAR[i].PMSAR = UINT16_MAX;}R_BSP_RegisterProtectEnable(BSP_REG_PROTECT_SAR);
#endif#if BSP_TZ_SECURE_BUILD/* Initialize security features. */R_BSP_SecurityInit();
#endif/* Call Post C runtime initialization hook. */// R_BSP_WarmStart(BSP_WARM_START_POST_C);/* Initialize ELC events that will be used to trigger NVIC interrupts. */bsp_irq_cfg();/* Call any BSP specific code. No arguments are needed so NULL is sent. */bsp_init(NULL);
}

瑞萨单片机学习:RA4M3单片机 BOOTloader升级 跳转到主程序 主程序无法执行问题相关推荐

  1. [瑞萨RH850学习笔记]——RDC与旋转变压器

    [瑞萨RH850学习笔记]--RDC与旋转变压器 一.旋转变压器基本原理 旋转变压器 使用电磁式方法进行角位移测量的传感器.特点是稳定性高,环境耐受力强,抗干扰能力强,精度较高. 基本原理 本质上是一 ...

  2. 瑞萨78K0/KB2系列单片机upd78F0503A学习心得1

    瑞萨78K0/KB2系列芯片单片机很容易上手应用,不过网上关于这个系列的学习资料很少,需要用到upd78F0503A芯片做开发,就开始了我踏上瑞萨单片机的学习历程废话不多说现在开始进入学习主题: 首先 ...

  3. 单片机sleep函数的头文件_单片机学习day8—单片机IO扩展

    74HC165芯片-并转串 74HC165中文资料.pdf 267.6K · 百度网盘 8位移位寄存器(并行输入,互补串行输出) 时钟输入端 CLK,CLK INK (上升沿有效) A-H 并行数据输 ...

  4. STM32学习笔记之Bootloader升级Ymodem协议简介

    YModem协议 YModem协议是由XModem协议演变而来的,每包数据可以达到1024字节,是一个非常高效的文件传输协议 . 源码宏定义 #define SOH (0x01) /* start o ...

  5. 瑞萨 RA MCU 基础知识

    一.RA产品家族简介 RA 产品家族单片机 (MCU) 于 2019 年 10 月推出, 丰富了瑞萨的 32 位 MCU 系列产品. 在此之前,瑞萨拥有基于 Arm® Cortex®-M 内核的 Re ...

  6. 瑞萨单片机iap串口升级boot程序与app程序合并的工程构建-学习记录

    MCU型号: R7F0C004 编辑软件:CS+ for CC boot区程序地址分配:0x0000-0x1ffff app区程序地址分配: 0x2000-0xfffff 复制一份常规的app程序,然 ...

  7. 关于瑞萨RL78系列单片机在线升级

    最近在使用瑞萨的RL78FC0907芯片,用这个芯片做了一各在线升级的小程序.芯片基本资料请参考G13,链接如下:https://www2.renesas.cn/cn/zh/doc/products/ ...

  8. 瑞萨单片机C语言,瑞萨单片机学习笔记(1)基本配置

    根据自己的芯片家族选择不同的代码编辑工具及仿真工具 对应78K0系列单片机,推荐的是cubeSuite+集成开发环境,具体使用可以看帮助手册. 有接触过PIC.STC的单片机,瑞萨单片机有其独特的地方 ...

  9. 瑞萨MCU单片机资料R5F100LEA RL78G13视频例程软件

    瑞萨单片机资料_RL78/R5F100LEAFA大学生电子竞赛专用芯片资料_源程序+软件+视频讲解 瑞萨单片机_全国大学生电子设计大赛开发板配套光盘_2015年电赛_2013年电赛_瑞萨MCU单片机R ...

最新文章

  1. SLF4J: Failed to load class org.slf4j.impl.StaticLoggerBinder.
  2. python要点简要-一日精通python
  3. 走在程序世界道路上的我___大一篇
  4. 2019 年入门AI算法工程师,你需要掌握什么技能?
  5. Java面试题:IO流中read()方法为什么返回值是int
  6. 可变化的鸿蒙武器,DNF2018史诗改版大全 武器套装改版属性介绍
  7. cpanel java_Cpanel是什么
  8. 九种跨域方式的实现原理,第一个就超惊艳!| 技术头条
  9. python之定义默认参数_035-Python之定义默认参数
  10. 14_python_练习题——excel操作
  11. java 制作简历_个人简历java制作.doc
  12. http://www.cnblogs.com/longteng1991/archive/2013/06/13/3131739.html#
  13. 新版Chrome设置--disable-web-security无效 解决方法
  14. 图文并茂讲VLAN,让你看一遍就理解VLAN
  15. gitbook转PDF或epub
  16. 干货来了!2019阿里云合作伙伴峰会SaaS加速器专场回顾合集:嘉宾分享、深度解读
  17. matlab-基础 输出单引号
  18. 综述:阿尔茨海默病的神经振荡和脑刺激
  19. Arduino小白学习记录:双色LED灯实验
  20. micro bit python_python教程之micro:bit俄罗斯方块游戏

热门文章

  1. LADS100桌面发卡器
  2. PPSIG:CTR-GCN 动作识别
  3. php 防火墙配置,win2008防火墙配置
  4. Valve下一代VR头显爆料汇总,看完有点期待
  5. Hadoop学习笔记 --- YARN执行流程与工作原理
  6. hive笔记(五):查询、排序-join语句/连接/分区/sort by/distribute by/cluster by
  7. 第11章 面向对象(下)
  8. EasyUI Datagrid 鼠标悬停显示单元格内容 复制代码
  9. 初识C语言(一)常见变量的含义、所能存储数据的范围、及其所占内存大小。
  10. kb931125—rootsupd_微软kb931125根证书更新程序