diff options
| author | qiuyiuestc <[email protected]> | 2010-05-29 15:27:27 +0000 |
|---|---|---|
| committer | qiuyiuestc <[email protected]> | 2010-05-29 15:27:27 +0000 |
| commit | 25e7ea1745a02f3673f025ca209d10e248b45e6b (patch) | |
| tree | f3ed8551c2c26140e15e4f0b3e0d57f337e6153e /bsp | |
| parent | 0c5f6cd9b06c93dc128a696f641f757c66425826 (diff) | |
module developing, application can be run successfully
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@747 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'bsp')
| -rw-r--r-- | bsp/mini2440/Console.lnk | bin | 693 -> 0 bytes | |||
| -rw-r--r-- | bsp/mini2440/Makefile | 6 | ||||
| -rw-r--r-- | bsp/mini2440/run_module.c | 16 |
3 files changed, 12 insertions, 10 deletions
diff --git a/bsp/mini2440/Console.lnk b/bsp/mini2440/Console.lnk Binary files differdeleted file mode 100644 index 192da3d2c9..0000000000 --- a/bsp/mini2440/Console.lnk +++ /dev/null diff --git a/bsp/mini2440/Makefile b/bsp/mini2440/Makefile deleted file mode 100644 index ee3c7bff07..0000000000 --- a/bsp/mini2440/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -CLEAN_FILES= *.bin *.map *.axf rtconfig.pyc .sconsign.dblite
-
-clean:
- find . \( -name "*.o" -o -name "*.bak" \) -type f -print | xargs rm -f
- rm -fr ./build
- rm -fr $(CLEAN_FILES)
diff --git a/bsp/mini2440/run_module.c b/bsp/mini2440/run_module.c index 372e67d1fe..a8d50776f5 100644 --- a/bsp/mini2440/run_module.c +++ b/bsp/mini2440/run_module.c @@ -18,16 +18,19 @@ #if defined(RT_USING_FINSH) && defined(RT_USING_MODULE)
#include <finsh.h>
-static char buffer[4096];
void run_module(const char* filename)
{
int fd, length;
char *module_name;
+ struct rt_module* module;
+ struct dfs_stat s;
+ char *buffer;
- rt_memset(buffer, 0, 4096);
+ stat(filename, &s);
+ buffer = (char *)rt_malloc(s.st_size);
fd = open(filename, O_RDONLY, 0);
- length = read(fd, buffer, 4096);
+ length = read(fd, buffer, s.st_size);
if (length <= 0)
{
rt_kprintf("check: read file failed\n");
@@ -36,7 +39,12 @@ void run_module(const char* filename) }
rt_kprintf("read %d bytes from file\n", length);
module_name = strrchr(filename, '/');
- rt_module_load(buffer, ++module_name);
+ module = rt_module_load((void *)buffer, ++module_name);
+ if(module != RT_NULL)
+ {
+ rt_module_run(module);
+ }
+
close(fd);
}
|
