From fec197191bc34e4c1f9f867ce52c9987e93d1fd3 Mon Sep 17 00:00:00 2001 From: tangyuxin <462747508@qq.com> Date: Thu, 18 Oct 2018 16:55:11 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8C=96=E5=90=AF=E5=8A=A8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rtthread_patch/realtek/8711b/app_start.c | 122 +++-------------------- 1 file changed, 12 insertions(+), 110 deletions(-) diff --git a/rtthread_patch/realtek/8711b/app_start.c b/rtthread_patch/realtek/8711b/app_start.c index f4a0eab..1688a49 100644 --- a/rtthread_patch/realtek/8711b/app_start.c +++ b/rtthread_patch/realtek/8711b/app_start.c @@ -9,113 +9,7 @@ #include "ameba_soc.h" #include "build_info.h" - -#include -#ifdef RT_USING_LWIP -#include -#endif - -#ifndef RT_MAIN_THREAD_STACK_SIZE -#define RT_MAIN_THREAD_STACK_SIZE 2048 -#endif - -#ifndef RT_USING_HEAP -/* if there is not enable heap, we should use static thread and stack. */ -ALIGN(8) -static rt_uint8_t main_stack[RT_MAIN_THREAD_STACK_SIZE]; -struct rt_thread main_thread; -#endif - -#ifdef RT_USING_LWIP -extern int amebaz_wifi_init(rt_wlan_mode_t mode); -#endif - -/* the system main thread */ -void main_thread_entry(void *parameter) -{ - extern int main(void); - extern int $Super$$main(void); - - /* RT-Thread components initialization */ -#ifdef RT_USING_COMPONENTS_INIT - rt_components_init(); -#endif - -#ifdef RT_USING_LWIP - if(amebaz_wifi_init(WIFI_STATION) != RT_EOK) - rt_kprintf("amebaz_wifi_start failed...\n"); -#endif - - /* invoke system main function */ -#if defined (__CC_ARM) - $Super$$main(); /* for ARMCC. */ -#elif defined(__ICCARM__) || defined(__GNUC__) - main(); -#endif -} - -void rt_application_init(void) -{ - rt_thread_t tid; - -#ifdef RT_USING_HEAP - tid = rt_thread_create("main", main_thread_entry, RT_NULL, - RT_MAIN_THREAD_STACK_SIZE, RT_THREAD_PRIORITY_MAX / 3, 20); - RT_ASSERT(tid != RT_NULL); -#else - rt_err_t result; - - tid = &main_thread; - result = rt_thread_init(tid, "main", main_thread_entry, RT_NULL, - main_stack, sizeof(main_stack), RT_THREAD_PRIORITY_MAX / 3, 20); - RT_ASSERT(result == RT_EOK); - - /* if not define RT_USING_HEAP, using to eliminate the warning */ - (void)result; -#endif - - rt_thread_startup(tid); -} - -int rtthread_startup(void) -{ - rt_hw_interrupt_disable(); - - /* board level initalization - * NOTE: please initialize heap inside board initialization. - */ - rt_hw_board_init(); - - /* show RT-Thread version */ - rt_show_version(); - - /* timer system initialization */ - rt_system_timer_init(); - - /* scheduler system initialization */ - rt_system_scheduler_init(); - -#ifdef RT_USING_SIGNALS - /* signal system initialization */ - rt_system_signal_init(); -#endif - - /* create init_thread */ - rt_application_init(); - - /* timer thread initialization */ - rt_system_timer_thread_init(); - - /* idle thread initialization */ - rt_thread_idle_init(); - - /* start scheduler */ - rt_system_scheduler_start(); - - /* never reach here */ - return 0; -} - +#include "rtconfig.h" void APP_Start(void) { @@ -139,9 +33,17 @@ void APP_Start(void) "mov sp, r0\n" ); - /* disable interrupt first */ - rt_hw_interrupt_disable(); - +#ifdef RT_USING_USER_MAIN /* startup RT-Thread RTOS */ rtthread_startup(); +#else + extern int main(void); + extern int $Super$$main(void); + /* invoke system main function */ +#if defined (__CC_ARM) + $Super$$main(); /* for ARMCC. */ +#elif defined(__ICCARM__) || defined(__GNUC__) + main(); +#endif +#endif }