/****************************************************************************** * Outline : PowerON_Reset_PC * Description : This program is the MCU's entry point from a power-on reset. * The function configures the MCU stack, then calls the * HardwareSetup function and main function sequentially. * Argument : none * Return value : none ******************************************************************************/ void PowerON_Reset_PC(void) { /* Initialise the MCU processor word */ #if __RENESAS_VERSION__ >= 0x01010000 set_intb((void *)__sectop("C$VECT")); #else set_intb((unsigned long)__sectop("C$VECT")); #endif set_fpsw(FPSW_init); /* Initialise the MCU stack area */ _INITSCT(); /* Configure the MCU and YRDK hardware */ HardwareSetup(); /* Change the MCU's usermode from supervisor to user */ nop(); set_psw(PSW_init); Change_PSW_PM_to_UserMode(); /* Call the main program function */ main(); /* Invoke a break interrupt */ brk(); }
//#pragma section P UserAppStartSect // Output PowerON_Reset to PResetPRG section void UserAppStart(void) #endif { /* Stack pointers are setup prior to calling this function - see comments above */ /* Initialise the MCU processor word */ #if __RENESAS_VERSION__ >= 0x01010000 set_intb((void *)__sectop("C$VECT")); #else set_intb((unsigned long)__sectop("C$VECT")); #endif #if (BSP_CFG_USE_CGC_MODULE == 0) /* Switch to high-speed operation */ operating_frequency_set(); #else cgc_clock_config(); #endif /* If the warm start Pre C runtime callback is enabled, then call it. */ #if BSP_CFG_USER_WARM_START_CALLBACK_PRE_INITC_ENABLED == 1 BSP_CFG_USER_WARM_START_PRE_C_FUNCTION(); #endif /* Initialize C runtime environment */ _INITSCT(); /* If the warm start Post C runtime callback is enabled, then call it. */ #if BSP_CFG_USER_WARM_START_CALLBACK_POST_INITC_ENABLED == 1 BSP_CFG_USER_WARM_START_POST_C_FUNCTION(); #endif #if BSP_CFG_IO_LIB_ENABLE == 1 /* Comment this out if not using I/O lib */ _INIT_IOLIB(); #endif /* Initialize MCU interrupt callbacks. */ bsp_interrupt_open(); /* Initialize register protection functionality. */ bsp_register_protect_open(); /* Configure the MCU and board hardware */ hardware_setup(); /* Change the MCU's user mode from supervisor to user */ nop(); set_psw(PSW_init); #if BSP_CFG_RUN_IN_USER_MODE==1 /* Use chg_pmusr() intrinsic if possible. */ #if __RENESAS_VERSION__ >= 0x01010000 chg_pmusr() ; #else Change_PSW_PM_to_UserMode(); #endif #endif /* Enable the bus error interrupt to catch accesses to illegal/reserved areas of memory */ R_BSP_InterruptControl(BSP_INT_SRC_BUS_ERROR, BSP_INT_CMD_INTERRUPT_ENABLE, FIT_NO_PTR); /* Call the main program function (should not return) */ main(); #if BSP_CFG_IO_LIB_ENABLE == 1 /* Comment this out if not using I/O lib - cleans up open files */ _CLOSEALL(); #endif /* BCH - 01/16/2013 */ /* Infinite loop is intended here. */ while(1) /* PRQA S 2740 */ { /* Infinite loop. Put a breakpoint here if you want to catch an exit of main(). */ } }