1 /* 2 * Copyright (c) 2006-2021, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2006-08-31 Bernard first implementation 9 */ 10 11 #include <rthw.h> 12 #include <rtthread.h> 13 14 #include "board.h" 15 #include "intrinsics.h" 16 /** 17 * @addtogroup rx62n 18 */ 19 20 /*@{*/ 21 22 extern int rt_application_init(void); 23 24 25 #pragma section="HEAP" 26 27 /******************************************************************************* 28 * Function Name : assert_failed 29 * Description : Reports the name of the source file and the source line number 30 * where the assert error has occurred. 31 * Input : - file: pointer to the source file name 32 * - line: assert error line source number 33 * Output : None 34 * Return : None 35 *******************************************************************************/ assert_failed(unsigned char * file,unsigned long line)36void assert_failed(unsigned char * file, unsigned long line) 37 { 38 rt_kprintf("\n\r Wrong parameter value detected on\r\n"); 39 rt_kprintf(" file %s\r\n", file); 40 rt_kprintf(" line %d\r\n", line); 41 42 while (1) ; 43 } 44 45 /** 46 * This function will startup RT-Thread RTOS. 47 */ rtthread_startup(void)48void rtthread_startup(void) 49 { 50 /* init board */ 51 rt_hw_board_init(); 52 #if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE) 53 /* show version */ 54 rt_show_version(); 55 #endif 56 57 #ifdef RT_USING_HEAP 58 59 rt_system_heap_init(__segment_end("HEAP"), (void*)RX62N_SRAM_END); 60 61 #endif /* RT_USING_HEAP */ 62 63 /* init scheduler system */ 64 rt_system_scheduler_init(); 65 66 /* initialize timer */ 67 rt_system_timer_init(); 68 69 /* init timer thread */ 70 rt_system_timer_thread_init(); 71 72 /* init application */ 73 rt_application_init(); 74 75 /* init idle thread */ 76 rt_thread_idle_init(); 77 78 /* start scheduler */ 79 rt_system_scheduler_start(); 80 81 /* never reach here */ 82 return ; 83 } 84 main(void)85int main(void) 86 { 87 88 rt_hw_system_freq_init(); 89 90 __enable_interrupt(); 91 /* disable interrupt first */ 92 rt_hw_interrupt_disable(); 93 94 /* startup RT-Thread RTOS */ 95 rtthread_startup(); 96 97 return 0; 98 } 99 100 /*@}*/ 101