summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2013-07-05 19:32:16 -0400
committerBernard Xiong <[email protected]>2013-07-05 19:32:16 -0400
commitca56dce2a31944322384cabc074b6f6ce9660e55 (patch)
tree7fafb26f01e3f8cbfa54cf52e0e96890f92d2369
parentb0c1f8a79b272c1ab61be637d1f2a84561c1bbc0 (diff)
remove initialization feature for MS VC++ compiler
-rw-r--r--components/init/components.c101
-rw-r--r--include/rtdef.h8
2 files changed, 85 insertions, 24 deletions
diff --git a/components/init/components.c b/components/init/components.c
index 86caf498d2..83e13f22cd 100644
--- a/components/init/components.c
+++ b/components/init/components.c
@@ -23,6 +23,7 @@
* And all components related header files.
* 2012-12-23 Bernard fix the pthread initialization issue.
* 2013-06-23 Bernard Add the init_call for components initialization.
+ * 2013-07-05 Bernard Remove initialization feature for MS VC++ compiler
*/
#include "components.h"
@@ -45,35 +46,19 @@ static int rti_end(void)
}
INIT_EXPORT(rti_end,"7");
-#if defined(_MSC_VER) || (defined(__GNUC__) && defined(__x86_64__))
-/* fixed for MSC_VC and x86_64 in GNU GCC */
-#define NEXT_COMPONENT_FN(fn_ptr, end) fn_ptr = _next_component_fn(fn_ptr, end)
-
-const init_fn_t *_next_component_fn(const init_fn_t *fn, const init_fn_t *end)
-{
- unsigned int *ptr;
- ptr = (unsigned int*) (fn + 1);
- while ((*ptr == 0) && ((unsigned int*)ptr < (unsigned int*)end))
- ptr ++;
-
- return (const init_fn_t*)ptr;
-}
-#else
-#define NEXT_COMPONENT_FN(fn_ptr, end) fn_ptr++
-#endif
-
/**
* RT-Thread Components Initialization for board
*/
void rt_components_board_init(void)
{
+#ifndef _MSC_VER
const init_fn_t *fn_ptr;
- for (fn_ptr = &__rt_init_rti_start; fn_ptr < &__rt_init_rti_board_end; )
+ for (fn_ptr = &__rt_init_rti_start; fn_ptr < &__rt_init_rti_board_end; fn_ptr++)
{
(*fn_ptr)();
- NEXT_COMPONENT_FN(fn_ptr, __rt_init_rti_board_end);
}
+#endif
}
/**
@@ -81,12 +66,84 @@ void rt_components_board_init(void)
*/
void rt_components_init(void)
{
+#ifndef _MSC_VER
const init_fn_t *fn_ptr;
- for (fn_ptr = &__rt_init_rti_board_end; fn_ptr < &__rt_init_rti_end; )
+ for (fn_ptr = &__rt_init_rti_board_end; fn_ptr < &__rt_init_rti_end; fn_ptr ++)
{
(*fn_ptr)();
- NEXT_COMPONENT_FN(fn_ptr, __rt_init_rti_end);
}
-}
+#else
+#ifdef RT_USING_MODULE
+ rt_system_module_init();
+#endif
+
+#ifdef RT_USING_FINSH
+ /* initialize finsh */
+ finsh_system_init();
+ finsh_set_device(RT_CONSOLE_DEVICE_NAME);
+#endif
+
+#ifdef RT_USING_LWIP
+ /* initialize lwip stack */
+ /* register ethernetif device */
+ eth_system_device_init();
+
+ /* initialize lwip system */
+ lwip_system_init();
+ rt_kprintf("TCP/IP initialized!\n");
+#endif
+
+#ifdef RT_USING_DFS
+ /* initialize the device file system */
+ dfs_init();
+
+#ifdef RT_USING_DFS_ELMFAT
+ /* initialize the elm chan FatFS file system*/
+ elm_init();
+#endif
+
+#if defined(RT_USING_DFS_NFS) && defined(RT_USING_LWIP)
+ /* initialize NFSv3 client file system */
+ nfs_init();
+#endif
+
+#ifdef RT_USING_DFS_YAFFS2
+ dfs_yaffs2_init();
+#endif
+
+#ifdef RT_USING_DFS_UFFS
+ dfs_uffs_init();
+#endif
+
+#ifdef RT_USING_DFS_JFFS2
+ dfs_jffs2_init();
+#endif
+
+#ifdef RT_USING_DFS_ROMFS
+ dfs_romfs_init();
+#endif
+
+#ifdef RT_USING_DFS_DEVFS
+ devfs_init();
+#endif
+#endif /* end of RT_USING_DFS */
+
+#ifdef RT_USING_NEWLIB
+ libc_system_init(RT_CONSOLE_DEVICE_NAME);
+#else
+ /* the pthread system initialization will be initiallized in libc */
+#ifdef RT_USING_PTHREADS
+ pthread_system_init();
+#endif
+#endif
+#ifdef RT_USING_RTGUI
+ rtgui_system_server_init();
+#endif
+
+#ifdef RT_USING_USB_HOST
+ rt_usb_host_init();
+#endif
+#endif
+}
diff --git a/include/rtdef.h b/include/rtdef.h
index 9aaf90b714..83a6398b93 100644
--- a/include/rtdef.h
+++ b/include/rtdef.h
@@ -178,8 +178,12 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
/* initialization export */
#ifdef RT_USING_COMPONENTS_INIT
typedef int (*init_fn_t)(void);
-#define INIT_EXPORT(fn, level) \
- const init_fn_t __rt_init_##fn SECTION(".rti_fn."level) = fn
+#ifdef _MSC_VER_ /* we do not support MS VC++ compiler */
+ #define INIT_EXPORT(fn, level)
+#else
+ #define INIT_EXPORT(fn, level) \
+ const init_fn_t __rt_init_##fn SECTION(".rti_fn."level) = fn
+#endif
#else
#define INIT_EXPORT(fn, level)
#endif