for rt-thread 1.1.0

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2372 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
nongli1031@gmail.com
2012-10-26 03:36:13 +00:00
parent 2cdbbf8b05
commit 6fe2afed8c
11 changed files with 683 additions and 649 deletions
+3 -3
View File
@@ -15,12 +15,12 @@
/**
* @addtogroup sam7s
*/
/*@{*/
#include <rtthread.h>
/*@{*/
#include <rtthread.h>
int rt_application_init()
{
return 0;
return 0;
}
/*@}*/
+101 -90
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -13,6 +13,7 @@
#define __BOARD_H__
#define MCK 50000000
void rt_hw_board_led_on(rt_uint32_t);
void rt_hw_board_led_off(rt_uint32_t);
+2
View File
@@ -16,6 +16,7 @@
/* Tick per Second*/
#define RT_TICK_PER_SECOND 100
/* SECTION: RT_DEBUG */
/* Thread Debug*/
/* #define RT_THREAD_DEBUG */
@@ -88,6 +89,7 @@
#define FINSH_THREAD_STACK_SIZE 8192
#define RT_USING_TC
/* SECTION: a runtime libc library */
/* a runtime libc library*/
/* #define RT_USING_NEWLIB */
+66 -64
View File
@@ -16,103 +16,105 @@
#include <rthw.h>
#include <rtthread.h>
#include "board.h"
#include "board.h"
#ifdef RT_USING_FINSH
#include <finsh.h>
extern void finsh_system_init(void);
#endif
#ifdef RT_USING_FINSH
#include <finsh.h>
extern void finsh_system_init(void);
#endif
extern void rt_hw_led_flash(void);
/*@{*/
#ifdef __CC_ARM
extern int Image$$RW_IRAM1$$ZI$$Limit;
#endif
/*@{*/
#ifdef __CC_ARM
extern int Image$$RW_IRAM1$$ZI$$Limit;
#endif
#ifdef __GNUC__
extern unsigned char __bss_start;
extern unsigned char __bss_end;
#endif
#endif
extern void rt_hw_interrupt_init(void);
extern int rt_application_init(void);
#ifdef RT_USING_DEVICE
extern rt_err_t rt_hw_serial_init(void);
#endif
extern int rt_application_init(void);
#ifdef RT_USING_DEVICE
extern rt_err_t rt_hw_serial_init(void);
#endif
/**
* This function will startup RT-Thread RTOS.
*/
void rtthread_startup(void)
{
/* init hardware interrupt */
rt_hw_interrupt_init();
/* init hardware interrupt */
rt_hw_interrupt_init();
/* init board */
rt_hw_board_init();
/* init board */
rt_hw_board_init();
rt_show_version();
rt_show_version();
/* init tick */
rt_system_tick_init();
/* init tick */
rt_system_tick_init();
/* init kernel object */
rt_system_object_init();
/* init kernel object */
rt_system_object_init();
/* init timer system */
rt_system_timer_init();
/* init timer system */
rt_system_timer_init();
#ifdef RT_USING_HEAP
#ifdef __CC_ARM
rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)0x204000);
#elif __ICCARM__
rt_system_heap_init(__segment_end("HEAP"), (void*)0x204000);
#else
rt_system_heap_init((void*)&__bss_end, (void*)(&__bss_end+0x4000));
#ifdef RT_USING_HEAP
#ifdef __CC_ARM
rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)0x204000);
#elif __ICCARM__
rt_system_heap_init(__segment_end("HEAP"), (void*)0x204000);
#else
rt_system_heap_init((void*) &__bss_end, (void*) (&__bss_end + 0x4000));
#endif
#endif
#endif
#endif
/* init scheduler system */
rt_system_scheduler_init();
/* init scheduler system */
rt_system_scheduler_init();
#ifdef RT_USING_HOOK /* if the hook is used */
/* set idle thread hook */
rt_thread_idle_sethook(rt_hw_led_flash);
#endif
/* set idle thread hook */
rt_thread_idle_sethook(rt_hw_led_flash);
#endif
#ifdef RT_USING_DEVICE
/* init hardware serial device */
rt_hw_serial_init();
/* init all device */
rt_device_init_all();
#endif
#ifdef RT_USING_DEVICE
/* init hardware serial device */
rt_hw_serial_init();
/* init all device */
rt_device_init_all();
#endif
/* init application */
rt_application_init();
/* init application */
rt_application_init();
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
finsh_set_device("uart1");
/* init finsh */
finsh_system_init();
finsh_set_device("uart1");
#endif
/* init idle thread */
rt_thread_idle_init();
/* init idle thread */
rt_thread_idle_init();
/* start scheduler */
rt_system_scheduler_start();
/* start scheduler */
rt_system_scheduler_start();
/* never reach here */
return;
}
/* never reach here */
return ;
}
int main(void)
{
/* invoke rtthread_startup */
rtthread_startup();
return 0;
}
int main (void)
{
/* invoke rtthread_startup */
rtthread_startup();
return 0;
}
/*@}*/
+1 -1
View File
@@ -131,7 +131,7 @@ int _tc_thread_delete()
tc_cleanup(_tc_cleanup);
thread_delete_init();
return 25;
return 27;
}
FINSH_FUNCTION_EXPORT(_tc_thread_delete, a thread delete example);
#else
+6 -2
View File
@@ -6,8 +6,8 @@ static struct rt_thread thread2;
static char thread1_stack[THREAD_STACK_SIZE];
static char thread2_stack[THREAD_STACK_SIZE];
static rt_uint32_t t1_count = 0;
static rt_uint32_t t2_count = 0;
volatile static rt_uint32_t t1_count = 0;
volatile static rt_uint32_t t2_count = 0;
static void thread1_entry(void* parameter)
{
while (1)
@@ -65,8 +65,12 @@ static void _tc_cleanup()
/* unlock scheduler */
rt_exit_critical();
rt_kprintf("t1_count=%d t2_count=%d\n",t1_count,t2_count);
if (t1_count / t2_count != 2)
tc_stat(TC_STAT_END | TC_STAT_FAILED);
else
tc_done(TC_STAT_PASSED);
}
int _tc_thread_same_priority()
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+41 -38
View File
@@ -13,8 +13,10 @@
*
*/
#include <rtthread.h>
extern void *_SDA_BASE_;
extern void *_SDA2_BASE_;
extern void *_SDA_BASE_;
extern void *_SDA2_BASE_;
/**
* This function will initialize thread stack
@@ -26,43 +28,44 @@ extern void *_SDA2_BASE_;
*
* @return stack address
*/
rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_addr, void *texit)
rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
rt_uint8_t *stack_addr, void *texit)
{
unsigned long *stk;
unsigned long *stk;
stk = (unsigned long *) stack_addr;
stk--;
stk--;
*stk-- = 0; /* r31 */
*stk-- = 0; /* r30 */
*stk-- = 0; /* r29 */
*stk-- = 0; /* r28 */
*stk-- = 0; /* r27 */
*stk-- = 0; /* r26 */
*stk-- = 0; /* r25 */
*stk-- = 0; /* r24 */
*stk-- = 0; /* r23 */
*stk-- = 0; /* r22 */
*stk-- = 0; /* r21 */
*stk-- = 0; /* r20 */
*stk-- = 0; /* r19 */
*stk-- = 0; /* r18 */
*stk-- = 0; /* r17 */
*stk-- = (unsigned long) texit - 8; /* r15 = task return address*/
*stk-- = (unsigned long) tentry; /* r14 = entry address*/
*stk-- = (unsigned long) &_SDA_BASE_; /* r13 */
*stk-- = 0; /* r12 */
*stk-- = 0; /* r11 */
*stk-- = 0; /* r10 */
*stk-- = 0; /* r09 */
*stk-- = 0; /* r08 */
*stk-- = 0; /* r07 */
*stk-- = 0; /* r06 */
*stk-- = (unsigned long) parameter; /* r05 */
*stk-- = 0; /* r04 */
*stk-- = 0; /* r03 */
*stk-- = (unsigned long) &_SDA2_BASE_; /* r02 */
*stk = 2; /* enable interrupt */
return (rt_uint8_t *) stk;
stk = (unsigned long *)stack_addr;
stk--;
stk--;
*stk-- = 0; /* r31 */
*stk-- = 0; /* r30 */
*stk-- = 0; /* r29 */
*stk-- = 0; /* r28 */
*stk-- = 0; /* r27 */
*stk-- = 0; /* r26 */
*stk-- = 0; /* r25 */
*stk-- = 0; /* r24 */
*stk-- = 0; /* r23 */
*stk-- = 0; /* r22 */
*stk-- = 0; /* r21 */
*stk-- = 0; /* r20 */
*stk-- = 0; /* r19 */
*stk-- = 0; /* r18 */
*stk-- = 0; /* r17 */
*stk-- = (unsigned long)texit - 8; /* r15 = task return address*/
*stk-- = (unsigned long)tentry; /* r14 = entry address*/
*stk-- = (unsigned long)&_SDA_BASE_; /* r13 */
*stk-- = 0; /* r12 */
*stk-- = 0; /* r11 */
*stk-- = 0; /* r10 */
*stk-- = 0; /* r09 */
*stk-- = 0; /* r08 */
*stk-- = 0; /* r07 */
*stk-- = 0; /* r06 */
*stk-- = (unsigned long) parameter; /* r05 */
*stk-- = 0; /* r04 */
*stk-- = 0; /* r03 */
*stk-- = (unsigned long)&_SDA2_BASE_; /* r02 */
*stk = 2; /* enable interrupt */
return (rt_uint8_t *)stk;
}
File diff suppressed because it is too large Load Diff