mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-02-06 09:02:20 +08:00
[simulator] 修复 linux simulator 编译运行失败
This commit is contained in:
committed by
Man, Jianting (Meco)
parent
0a7b08d00a
commit
22972409d4
@@ -49,8 +49,8 @@ static long interrupt_disable_flag;
|
||||
//static int systick_signal_flag;
|
||||
|
||||
/* flag in interrupt handling */
|
||||
rt_uint32_t rt_interrupt_from_thread, rt_interrupt_to_thread;
|
||||
rt_uint32_t rt_thread_switch_interrupt_flag;
|
||||
rt_ubase_t rt_interrupt_from_thread, rt_interrupt_to_thread;
|
||||
rt_ubase_t rt_thread_switch_interrupt_flag;
|
||||
|
||||
/* interrupt event mutex */
|
||||
static pthread_mutex_t *ptr_int_mutex;
|
||||
@@ -363,8 +363,8 @@ void rt_hw_interrupt_enable(rt_base_t level)
|
||||
/*TODO: It may need to unmask the signal */
|
||||
}
|
||||
|
||||
void rt_hw_context_switch(rt_uint32_t from,
|
||||
rt_uint32_t to)
|
||||
void rt_hw_context_switch(rt_ubase_t from,
|
||||
rt_ubase_t to)
|
||||
{
|
||||
struct rt_thread * tid;
|
||||
pthread_t pid;
|
||||
@@ -380,12 +380,12 @@ void rt_hw_context_switch(rt_uint32_t from,
|
||||
rt_thread_switch_interrupt_flag = 1;
|
||||
|
||||
// set rt_interrupt_from_thread
|
||||
rt_interrupt_from_thread = *((rt_uint32_t *)from);
|
||||
rt_interrupt_from_thread = *((rt_ubase_t *)from);
|
||||
}
|
||||
#endif
|
||||
pthread_mutex_lock(ptr_int_mutex);
|
||||
rt_interrupt_from_thread = *((rt_uint32_t *)from);
|
||||
rt_interrupt_to_thread = *((rt_uint32_t *)to);
|
||||
rt_interrupt_from_thread = *((rt_ubase_t *)from);
|
||||
rt_interrupt_to_thread = *((rt_ubase_t *)to);
|
||||
|
||||
/* 这个函数只是并不会真正执行中断处理函数,而只是简单的
|
||||
* 设置一下中断挂起标志位
|
||||
@@ -394,16 +394,16 @@ void rt_hw_context_switch(rt_uint32_t from,
|
||||
pthread_mutex_unlock(ptr_int_mutex);
|
||||
}
|
||||
|
||||
void rt_hw_context_switch_interrupt(rt_uint32_t from,
|
||||
rt_uint32_t to)
|
||||
void rt_hw_context_switch_interrupt(rt_ubase_t from,
|
||||
rt_ubase_t to)
|
||||
{
|
||||
rt_hw_context_switch(from, to);
|
||||
}
|
||||
|
||||
void rt_hw_context_switch_to(rt_uint32_t to)
|
||||
void rt_hw_context_switch_to(rt_ubase_t to)
|
||||
{
|
||||
//set to thread
|
||||
rt_interrupt_to_thread = *((rt_uint32_t *)(to));
|
||||
rt_interrupt_to_thread = *((rt_ubase_t *)(to));
|
||||
|
||||
//clear from thread
|
||||
rt_interrupt_from_thread = 0;
|
||||
|
||||
13
libcpu/sim/posix/startup.c
Normal file
13
libcpu/sim/posix/startup.c
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <rtthread.h>
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
int rtthread_startup(void);
|
||||
|
||||
static int start(void)
|
||||
{
|
||||
rtthread_startup();
|
||||
return 0;
|
||||
}
|
||||
__attribute__((section(".init_array"))) typeof(start) *__init = start;
|
||||
#endif
|
||||
Reference in New Issue
Block a user