Browse Source

[bsp][stm32f40x]add main.c to file applications ,delete application.c and startup.c

lida 6 years ago
parent
commit
786b296a8e

+ 0 - 59
bsp/stm32f40x/applications/application.c

@@ -1,59 +0,0 @@
-/*
- * File      : application.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006, RT-Thread Development Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
- *
- * Change Logs:
- * Date           Author       Notes
- * 2009-01-05     Bernard      the first version
- * 2014-04-27     Bernard      make code cleanup. 
- */
-
-#include <board.h>
-#include <rtthread.h>
-
-#ifdef RT_USING_LWIP
-#include <lwip/sys.h>
-#include <lwip/api.h>
-#include <netif/ethernetif.h>
-#include "stm32f4xx_eth.h"
-#endif
-
-#ifdef RT_USING_FINSH
-#include <shell.h>
-#include <finsh.h>
-#endif
-
-#ifdef RT_USING_GDB
-#include <gdb_stub.h>
-#endif
-
-void rt_init_thread_entry(void* parameter)
-{
-    /* initialization RT-Thread Components */
-    rt_components_init();
-	
-    /* GDB STUB */
-#ifdef RT_USING_GDB
-    gdb_set_device("uart6");
-    gdb_start();
-#endif
-}
-
-int rt_application_init()
-{
-    rt_thread_t tid;
-
-    tid = rt_thread_create("init",
-        rt_init_thread_entry, RT_NULL,
-        2048, RT_THREAD_PRIORITY_MAX/3, 20);
-
-    if (tid != RT_NULL)
-        rt_thread_startup(tid);
-
-    return 0;
-}

+ 31 - 0
bsp/stm32f40x/applications/main.c

@@ -0,0 +1,31 @@
+/*
+ * File      : main.c
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2006, RT-Thread Develop Team
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://openlab.rt-thread.com/license/LICENSE
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2006-08-31     Bernard      first implementation
+ * 2011-06-05     Bernard      modify for STM32F107 version
+ */
+
+#include <rthw.h>
+#include <rtthread.h>
+
+/**
+ * @addtogroup STM32
+ */
+
+/*@{*/
+
+int main(void)
+{
+    /* user app entry */
+    return 0;
+}
+
+/*@}*/

+ 0 - 111
bsp/stm32f40x/applications/startup.c

@@ -1,111 +0,0 @@
-/*
- * File      : startup.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006, RT-Thread Develop Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://openlab.rt-thread.com/license/LICENSE
- *
- * Change Logs:
- * Date           Author       Notes
- * 2006-08-31     Bernard      first implementation
- * 2011-06-05     Bernard      modify for STM32F107 version
- */
-
-#include <rthw.h>
-#include <rtthread.h>
-
-#include "stm32f4xx.h"
-#include "board.h"
-
-/**
- * @addtogroup STM32
- */
-
-/*@{*/
-
-extern int  rt_application_init(void);
-
-#ifdef __CC_ARM
-extern int Image$$RW_IRAM1$$ZI$$Limit;
-#define STM32_SRAM_BEGIN    (&Image$$RW_IRAM1$$ZI$$Limit)
-#elif __ICCARM__
-#pragma section="HEAP"
-#define STM32_SRAM_BEGIN    (__segment_end("HEAP"))
-#else
-extern int __bss_end;
-#define STM32_SRAM_BEGIN    (&__bss_end)
-#endif
-
-/*******************************************************************************
-* Function Name  : assert_failed
-* Description    : Reports the name of the source file and the source line number
-*                  where the assert error has occurred.
-* Input          : - file: pointer to the source file name
-*                  - line: assert error line source number
-* Output         : None
-* Return         : None
-*******************************************************************************/
-void assert_failed(u8* file, u32 line)
-{
-    rt_kprintf("\n\r Wrong parameter value detected on\r\n");
-    rt_kprintf("       file  %s\r\n", file);
-    rt_kprintf("       line  %d\r\n", line);
-
-    while (1) ;
-}
-
-/**
- * This function will startup RT-Thread RTOS.
- */
-void rtthread_startup(void)
-{
-    /* init board */
-    rt_hw_board_init();
-
-    /* show version */
-    rt_show_version();
-
-    /* init tick */
-    rt_system_tick_init();
-
-    /* init kernel object */
-    rt_system_object_init();
-
-    /* init timer system */
-    rt_system_timer_init();
-
-    rt_system_heap_init((void*)STM32_SRAM_BEGIN, (void*)STM32_SRAM_END);
-
-    /* init scheduler system */
-    rt_system_scheduler_init();
-
-    /* init application */
-    rt_application_init();
-
-    /* init timer thread */
-    rt_system_timer_thread_init();
-
-    /* init idle thread */
-    rt_thread_idle_init();
-
-    /* start scheduler */
-    rt_system_scheduler_start();
-
-    /* never reach here */
-    return ;
-}
-
-int main(void)
-{
-    /* disable interrupt first */
-    rt_hw_interrupt_disable();
-
-    /* startup RT-Thread RTOS */
-    rtthread_startup();
-
-    return 0;
-}
-
-/*@}*/

+ 4 - 0
bsp/stm32f40x/drivers/board.c

@@ -93,6 +93,10 @@ void rt_hw_board_init()
     /* Configure the SysTick */
     SysTick_Configuration();
 
+#ifdef RT_USING_HEAP
+    rt_system_heap_init((void*)STM32_SRAM_BEGIN, (void*)STM32_SRAM_END);
+#endif
+    
     rt_components_board_init();
  
 #ifdef RT_USING_CONSOLE

+ 11 - 0
bsp/stm32f40x/drivers/board.h

@@ -46,6 +46,17 @@ extern char __ICFEDIT_region_RAM_end__;
 #define STM32_SRAM_END          (0x20000000 + STM32_SRAM_SIZE * 1024)
 #endif
 
+#ifdef __CC_ARM
+extern int Image$$RW_IRAM1$$ZI$$Limit;
+#define STM32_SRAM_BEGIN    (&Image$$RW_IRAM1$$ZI$$Limit)
+#elif __ICCARM__
+#pragma section="HEAP"
+#define STM32_SRAM_BEGIN    (__segment_end("HEAP"))
+#else
+extern int __bss_end;
+#define STM32_SRAM_BEGIN    (&__bss_end)
+#endif
+
 void rt_hw_board_init(void);
 
 #endif

+ 0 - 1
bsp/stm32f40x/drivers/stm32f4xx_conf.h

@@ -69,7 +69,6 @@
 
 /* Uncomment the line below to expanse the "assert_param" macro in the
    Standard Peripheral Library drivers code */
-#define USE_FULL_ASSERT    1
 
 /* Exported macro ------------------------------------------------------------*/
 #ifdef  USE_FULL_ASSERT