mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-21 18:57:16 +08:00
add module feature
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@614 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
@@ -1,6 +1,22 @@
|
||||
#include <rtthread.h>
|
||||
|
||||
void hello()
|
||||
static int a = 0;
|
||||
int b = 1000000;
|
||||
|
||||
void function(int count1, int count2)
|
||||
{
|
||||
rt_kprintf("Hello RT-Thread\n");
|
||||
rt_kprintf("Hello RT-Thread %d %d\n", count1, count2);
|
||||
}
|
||||
|
||||
int rtm_main(void)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<1000; i++)
|
||||
{
|
||||
a++;
|
||||
b--;
|
||||
function(a, b);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
set PATH="E:\Program Files\CodeSourcery\Sourcery G++ Lite\bin";%PATH%
|
||||
arm-none-eabi-gcc -c hello.c -o hello.o -DRT_MODULE "-I..\..\include" "-I..\..\bsp\mini2440"
|
||||
arm-none-eabi-gcc -o hello.mo -r -d -e rtm_main -nostdlib hello.o
|
||||
@@ -0,0 +1,3 @@
|
||||
set PATH="E:\Program Files\CodeSourcery\Sourcery G++ Lite\bin";%PATH%
|
||||
arm-none-eabi-gcc -c module_thread_dynamic.c -o module_thread_dynamic.o -DRT_MODULE "-I..\..\include" "-I..\..\bsp\mini2440"
|
||||
arm-none-eabi-gcc -o dynamic.mo -r -d -e rtm_main -nostdlib module_thread_dynamic.o
|
||||
@@ -1,5 +1,9 @@
|
||||
#include <rtthread.h>
|
||||
|
||||
#define THREAD_PRIORITY 25
|
||||
#define THREAD_STACK_SIZE 512
|
||||
#define THREAD_TIMESLICE 5
|
||||
|
||||
static void thread_entry(void* parameter)
|
||||
{
|
||||
rt_kprintf("thread dynamicly created ok\n");
|
||||
@@ -16,8 +20,6 @@ int rtm_main()
|
||||
THREAD_STACK_SIZE, THREAD_PRIORITY, THREAD_TIMESLICE);
|
||||
if (tid != RT_NULL)
|
||||
rt_thread_startup(tid);
|
||||
else
|
||||
tc_stat(TC_STAT_END | TC_STAT_FAILED);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user