diff options
| author | [email protected] <[email protected]> | 2011-05-16 01:18:43 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2011-05-16 01:18:43 +0000 |
| commit | 9faa3d99892064027af4cb27885283e0c249ee1f (patch) | |
| tree | c6ede62750206afe8b5f72f2c543193fd593b6ca /src | |
| parent | 8a9792317f066056123b6555d0c1e834f1c8162d (diff) | |
eliminate compile warning
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1407 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'src')
| -rw-r--r-- | src/module.c | 39 | ||||
| -rw-r--r-- | src/rtm.c | 184 |
2 files changed, 133 insertions, 90 deletions
diff --git a/src/module.c b/src/module.c index b85b0f2b4b..a80e175227 100644 --- a/src/module.c +++ b/src/module.c @@ -20,7 +20,7 @@ #include "string.h" #include "kservice.h" -/* #define RT_MODULE_DEBUG */ +#define RT_MODULE_DEBUG #ifdef RT_USING_MODULE #include "module.h" @@ -43,7 +43,6 @@ struct rt_module_page rt_size_t npage; /* number of pages */ rt_list_t list; }; -static struct rt_module_page *rt_module_page_list; /* module memory allocator */ struct rt_mem_head @@ -67,12 +66,18 @@ struct rt_module_symtab *_rt_module_symtab_begin = RT_NULL, *_rt_module_symtab_e */ void rt_system_module_init(void) { +#ifdef __GNUC__ extern int __rtmsymtab_start; extern int __rtmsymtab_end; - -#ifdef __GNUC__ + _rt_module_symtab_begin = (struct rt_module_symtab *)&__rtmsymtab_start; _rt_module_symtab_end = (struct rt_module_symtab *)&__rtmsymtab_end; +#elif defined (__CC_ARM) + extern int RTMSymTab$$Base; + extern int RTMSymTab$$Limit; + + _rt_module_symtab_begin = (struct rt_module_symtab *)&RTMSymTab$$Base; + _rt_module_symtab_end = (struct rt_module_symtab *)&RTMSymTab$$Limit; #endif rt_list_init(&rt_module_symbol_list); @@ -81,14 +86,14 @@ void rt_system_module_init(void) rt_current_module = RT_NULL; } -static rt_uint32_t rt_module_symbol_find(const rt_uint8_t* sym_str) +static rt_uint32_t rt_module_symbol_find(const char* sym_str) { /* find in kernel symbol table */ struct rt_module_symtab* index; for (index = _rt_module_symtab_begin; index != _rt_module_symtab_end; index ++) { - if (rt_strcmp(index->name, (const char*)sym_str) == 0) - return index->addr; + if (rt_strcmp(index->name, sym_str) == 0) + return (rt_uint32_t)index->addr; } return 0; @@ -249,14 +254,14 @@ static void rt_module_init_object_container(struct rt_module* module) * @return the module object * */ -rt_module_t rt_module_load(const rt_uint8_t* name, void* module_ptr) +rt_module_t rt_module_load(const char* name, void* module_ptr) { rt_uint8_t *ptr = RT_NULL; rt_module_t module = RT_NULL; rt_bool_t linked = RT_FALSE; rt_uint32_t index, module_size = 0; - rt_kprintf("rt_module_load: %s\n", name); + rt_kprintf("rt_module_load: %s ,", name); /* check ELF header */ if (rt_memcmp(elf_module->e_ident, RTMMAG, SELFMAG) == 0) @@ -306,6 +311,8 @@ rt_module_t rt_module_load(const rt_uint8_t* name, void* module_ptr) ptr = module->module_space; rt_memset(ptr, 0, module_size); + rt_kprintf(" load address at 0x%x\n", ptr); + for (index = 0; index < elf_module->e_phnum; index++) { if(phdr[index].p_type == PT_LOAD) @@ -353,7 +360,7 @@ rt_module_t rt_module_load(const rt_uint8_t* name, void* module_ptr) rt_kprintf("unresolved relocate symbol: %s\n", strtab + sym->st_name); #endif /* need to resolve symbol in kernel symbol table */ - addr = rt_module_symbol_find(strtab + sym->st_name); + addr = rt_module_symbol_find((const char*)(strtab + sym->st_name)); if (addr == 0) { rt_kprintf("can't find %s in kernel symbol table\n", strtab + sym->st_name); @@ -378,7 +385,7 @@ rt_module_t rt_module_load(const rt_uint8_t* name, void* module_ptr) { /* find .dynsym section */ rt_uint8_t* shstrab = (rt_uint8_t*) module_ptr + shdr[elf_module->e_shstrndx].sh_offset; - if (rt_strcmp(shstrab + shdr[index].sh_name, ELF_DYNSYM) == 0) break; + if (rt_strcmp((const char *)(shstrab + shdr[index].sh_name), ELF_DYNSYM) == 0) break; } /* found .dynsym section */ @@ -403,12 +410,12 @@ rt_module_t rt_module_load(const rt_uint8_t* name, void* module_ptr) { if((ELF_ST_BIND(symtab[i].st_info) == STB_GLOBAL) && (ELF_ST_TYPE(symtab[i].st_info) == STT_FUNC)) { - rt_size_t length = rt_strlen(strtab + symtab[i].st_name) + 1; + rt_size_t length = rt_strlen((const char*)(strtab + symtab[i].st_name)) + 1; - module->symtab[count].addr = module->module_space + symtab[i].st_value; + module->symtab[count].addr = (void*)(module->module_space + symtab[i].st_value); module->symtab[count].name = rt_malloc(length); - rt_memset(module->symtab[count].name, 0, length); - rt_memcpy(module->symtab[count].name, strtab + symtab[i].st_name, length); + rt_memset((void*)module->symtab[count].name, 0, length); + rt_memcpy((void*)module->symtab[count].name, strtab + symtab[i].st_name, length); count++; } } @@ -732,7 +739,7 @@ rt_err_t rt_module_unload(rt_module_t module) rt_free(module->module_space); /* release module symbol table */ - for(i=0; i<module->nsym; i++) rt_free(module->symtab[i].name); + for(i=0; i<module->nsym; i++) rt_free((void *)module->symtab[i].name); if(module->symtab != RT_NULL) rt_free(module->symtab); /* delete module object */ @@ -26,130 +26,133 @@ /*
* thread interface symbol
*/
-RTM_EXPORT(rt_thread_init)
-RTM_EXPORT(rt_thread_detach)
-RTM_EXPORT(rt_thread_create)
-RTM_EXPORT(rt_thread_self)
-RTM_EXPORT(rt_thread_find)
-RTM_EXPORT(rt_thread_startup)
-RTM_EXPORT(rt_thread_delete)
-RTM_EXPORT(rt_thread_yield)
-RTM_EXPORT(rt_thread_delay)
-RTM_EXPORT(rt_thread_control)
-RTM_EXPORT(rt_thread_suspend)
-RTM_EXPORT(rt_thread_resume)
-RTM_EXPORT(rt_thread_timeout)
+
+RTM_EXPORT(rt_thread_init);
+RTM_EXPORT(rt_thread_detach);
+RTM_EXPORT(rt_thread_create);
+RTM_EXPORT(rt_thread_self);
+RTM_EXPORT(rt_thread_find);
+RTM_EXPORT(rt_thread_startup);
+RTM_EXPORT(rt_thread_delete);
+RTM_EXPORT(rt_thread_yield);
+RTM_EXPORT(rt_thread_delay);
+RTM_EXPORT(rt_thread_control);
+RTM_EXPORT(rt_thread_suspend);
+RTM_EXPORT(rt_thread_resume);
+RTM_EXPORT(rt_thread_timeout);
#ifdef RT_USING_SEMAPHORE
/*
* semaphore interface symbol
*/
-RTM_EXPORT(rt_sem_init)
-RTM_EXPORT(rt_sem_detach)
-RTM_EXPORT(rt_sem_create)
-RTM_EXPORT(rt_sem_delete)
-RTM_EXPORT(rt_sem_take)
-RTM_EXPORT(rt_sem_trytake)
-RTM_EXPORT(rt_sem_release)
-RTM_EXPORT(rt_sem_control)
+RTM_EXPORT(rt_sem_init);
+RTM_EXPORT(rt_sem_detach);
+RTM_EXPORT(rt_sem_create);
+RTM_EXPORT(rt_sem_delete);
+RTM_EXPORT(rt_sem_take);
+RTM_EXPORT(rt_sem_trytake);
+RTM_EXPORT(rt_sem_release);
+RTM_EXPORT(rt_sem_control);
#endif
#ifdef RT_USING_MUTEX
/*
* mutex interface symbol
*/
-RTM_EXPORT(rt_mutex_init)
-RTM_EXPORT(rt_mutex_detach)
-RTM_EXPORT(rt_mutex_create)
-RTM_EXPORT(rt_mutex_delete)
-RTM_EXPORT(rt_mutex_take)
-RTM_EXPORT(rt_mutex_release)
-RTM_EXPORT(rt_mutex_control)
+RTM_EXPORT(rt_mutex_init);
+RTM_EXPORT(rt_mutex_detach);
+RTM_EXPORT(rt_mutex_create);
+RTM_EXPORT(rt_mutex_delete);
+RTM_EXPORT(rt_mutex_take);
+RTM_EXPORT(rt_mutex_release);
+RTM_EXPORT(rt_mutex_control);
#endif
#ifdef RT_USING_EVENT
/*
* event interface symbol
*/
-RTM_EXPORT(rt_event_init)
-RTM_EXPORT(rt_event_detach)
-RTM_EXPORT(rt_event_create)
-RTM_EXPORT(rt_event_delete)
-RTM_EXPORT(rt_event_send)
-RTM_EXPORT(rt_event_recv)
-RTM_EXPORT(rt_event_control)
+RTM_EXPORT(rt_event_init);
+RTM_EXPORT(rt_event_detach);
+RTM_EXPORT(rt_event_create);
+RTM_EXPORT(rt_event_delete);
+RTM_EXPORT(rt_event_send);
+RTM_EXPORT(rt_event_recv);
+RTM_EXPORT(rt_event_control);
#endif
#ifdef RT_USING_MAILBOX
/*
* mailbox interface symbol
*/
-RTM_EXPORT(rt_mb_init)
-RTM_EXPORT(rt_mb_detach)
-RTM_EXPORT(rt_mb_create)
-RTM_EXPORT(rt_mb_delete)
-RTM_EXPORT(rt_mb_send)
-RTM_EXPORT(rt_mb_recv)
-RTM_EXPORT(rt_mb_control)
+RTM_EXPORT(rt_mb_init);
+RTM_EXPORT(rt_mb_detach);
+RTM_EXPORT(rt_mb_create);
+RTM_EXPORT(rt_mb_delete);
+RTM_EXPORT(rt_mb_send);
+RTM_EXPORT(rt_mb_recv);
+RTM_EXPORT(rt_mb_control);
#endif
#ifdef RT_USING_MESSAGEQUEUE
/*
* message queue interface symbol
*/
-RTM_EXPORT(rt_mq_init)
-RTM_EXPORT(rt_mq_detach)
-RTM_EXPORT(rt_mq_create)
-RTM_EXPORT(rt_mq_delete)
-RTM_EXPORT(rt_mq_send)
-RTM_EXPORT(rt_mq_urgent)
-RTM_EXPORT(rt_mq_recv)
-RTM_EXPORT(rt_mq_control)
+RTM_EXPORT(rt_mq_init);
+RTM_EXPORT(rt_mq_detach);
+RTM_EXPORT(rt_mq_create);
+RTM_EXPORT(rt_mq_delete);
+RTM_EXPORT(rt_mq_send);
+RTM_EXPORT(rt_mq_urgent);
+RTM_EXPORT(rt_mq_recv);
+RTM_EXPORT(rt_mq_control);
#endif
#ifdef RT_USING_MEMPOOL
/*
* memory pool interface symbol
*/
-RTM_EXPORT(rt_mp_init)
-RTM_EXPORT(rt_mp_detach)
-RTM_EXPORT(rt_mp_create)
-RTM_EXPORT(rt_mp_delete)
-RTM_EXPORT(rt_mp_alloc)
-RTM_EXPORT(rt_mp_free)
+RTM_EXPORT(rt_mp_init);
+RTM_EXPORT(rt_mp_detach);
+RTM_EXPORT(rt_mp_create);
+RTM_EXPORT(rt_mp_delete);
+RTM_EXPORT(rt_mp_alloc);
+RTM_EXPORT(rt_mp_free);
#endif
#ifdef RT_USING_HEAP
/*
* heap memory interface symbol
*/
-RTM_EXPORT(rt_malloc)
-RTM_EXPORT(rt_free)
-RTM_EXPORT(rt_realloc)
-RTM_EXPORT(rt_calloc)
+RTM_EXPORT(rt_malloc);
+RTM_EXPORT(rt_free);
+RTM_EXPORT(rt_realloc);
+RTM_EXPORT(rt_calloc);
#endif
/*
* clock & timer interface symbol
*/
-RTM_EXPORT(rt_tick_get)
-RTM_EXPORT(rt_tick_from_millisecond)
-RTM_EXPORT(rt_system_timer_init)
-RTM_EXPORT(rt_system_timer_thread_init)
-RTM_EXPORT(rt_timer_init)
-RTM_EXPORT(rt_timer_detach)
-RTM_EXPORT(rt_timer_create)
-RTM_EXPORT(rt_timer_delete)
-RTM_EXPORT(rt_timer_start)
-RTM_EXPORT(rt_timer_stop)
-RTM_EXPORT(rt_timer_control)
+RTM_EXPORT(rt_tick_get);
+RTM_EXPORT(rt_tick_from_millisecond);
+RTM_EXPORT(rt_system_timer_init);
+RTM_EXPORT(rt_system_timer_thread_init);
+RTM_EXPORT(rt_timer_init);
+RTM_EXPORT(rt_timer_detach);
+RTM_EXPORT(rt_timer_create);
+RTM_EXPORT(rt_timer_delete);
+RTM_EXPORT(rt_timer_start);
+RTM_EXPORT(rt_timer_stop);
+RTM_EXPORT(rt_timer_control);
/*
* kservice interface symbol
*/
RTM_EXPORT(rt_memcpy)
+RTM_EXPORT(rt_memcmp)
RTM_EXPORT(rt_memset)
RTM_EXPORT(rt_kprintf)
RTM_EXPORT(rt_sprintf)
+RTM_EXPORT(rt_strstr)
/*
* misc interface symbol
@@ -160,6 +163,7 @@ extern int __aeabi_dmul; extern int __aeabi_i2d;
extern int __aeabi_uidiv;
extern int __aeabi_uidivmod;
+extern int __aeabi_idivmod;
extern int __aeabi_d2iz;
RTM_EXPORT(__aeabi_ddiv)
@@ -167,9 +171,11 @@ RTM_EXPORT(__aeabi_dmul) RTM_EXPORT(__aeabi_i2d)
RTM_EXPORT(__aeabi_uidiv)
RTM_EXPORT(__aeabi_idiv)
+RTM_EXPORT(__aeabi_idivmod)
RTM_EXPORT(__aeabi_uidivmod)
RTM_EXPORT(__aeabi_d2iz)
RTM_EXPORT(strcmp)
+RTM_EXPORT(strcpy)
RTM_EXPORT(strlen)
RTM_EXPORT(rand)
RTM_EXPORT(memset)
@@ -189,13 +195,27 @@ RTM_EXPORT(time) #endif
+#ifdef RT_USING_DFS
+#include <dfs_posix.h>
+
+RTM_EXPORT(open)
+RTM_EXPORT(close)
+RTM_EXPORT(read)
+RTM_EXPORT(write)
+RTM_EXPORT(stat)
+#endif
+
#ifdef RT_USING_RTGUI
/* FIX ME , should be removed from here */
#include <rtgui/dc.h>
+#include <rtgui/rtgui_server.h>
#include <rtgui/rtgui_system.h>
#include <rtgui/widgets/view.h>
#include <rtgui/widgets/workbench.h>
#include <rtgui/widgets/widget.h>
+#include <rtgui/widgets/button.h>
+#include <rtgui/widgets/list_view.h>
+#include <rtgui/widgets/filelist_view.h>
RTM_EXPORT(rtgui_view_show)
RTM_EXPORT(rtgui_view_create)
@@ -212,11 +232,27 @@ RTM_EXPORT(rtgui_workbench_destroy) RTM_EXPORT(rtgui_workbench_close)
RTM_EXPORT(rtgui_timer_start)
RTM_EXPORT(rtgui_timer_create)
+RTM_EXPORT(rtgui_timer_destory)
RTM_EXPORT(rtgui_timer_stop)
-RTM_EXPORT(rtgui_widget_focus)
-RTM_EXPORT(rtgui_widget_set_event_handler)
RTM_EXPORT(rtgui_thread_register)
RTM_EXPORT(rtgui_thread_deregister)
-
+RTM_EXPORT(rtgui_widget_focus)
+RTM_EXPORT(rtgui_widget_set_event_handler)
+RTM_EXPORT(rtgui_widget_rect_to_device)
+RTM_EXPORT(rtgui_widget_update)
+RTM_EXPORT(rtgui_widget_get_rect)
+RTM_EXPORT(rtgui_widget_set_rect)
+RTM_EXPORT(rtgui_widget_get_toplevel)
+RTM_EXPORT(rtgui_panel_register)
+RTM_EXPORT(rtgui_panel_set_default_focused)
+RTM_EXPORT(rtgui_button_create)
+RTM_EXPORT(rtgui_button_destroy)
+RTM_EXPORT(rtgui_button_set_onbutton)
+RTM_EXPORT(rtgui_container_add_child)
+RTM_EXPORT(rtgui_filelist_view_create)
+RTM_EXPORT(rtgui_filelist_view_get_fullpath)
+RTM_EXPORT(rtgui_list_view_create)
+RTM_EXPORT(rtgui_list_view_destroy)
#endif
#endif
+
|
