merge bsp/simlinux into bsp/simulator
This commit is contained in:
parent
29d63fe2bc
commit
fbbc4c8d18
|
@ -71,8 +71,8 @@ void rt_hw_exit(void)
|
||||||
/* *
|
/* *
|
||||||
* getchar reads key from buffer, while finsh need an non-buffer getchar
|
* getchar reads key from buffer, while finsh need an non-buffer getchar
|
||||||
* in windows, getch is such an function, in linux, we had to change
|
* in windows, getch is such an function, in linux, we had to change
|
||||||
* the behaviour of terminal to get an non-buffer getchar.
|
* the behaviour of terminal to get an non-buffer getchar.
|
||||||
* in usart_sim.c, set_stty is called to do this work
|
* in usart_sim.c, set_stty is called to do this work
|
||||||
* */
|
* */
|
||||||
{
|
{
|
||||||
extern void restore_stty(void);
|
extern void restore_stty(void);
|
||||||
|
|
|
@ -123,7 +123,7 @@ static int savekey(unsigned char key)
|
||||||
|
|
||||||
serial_device.rx_indicate(&serial_device, rx_length);
|
serial_device.rx_indicate(&serial_device, rx_length);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static DWORD WINAPI ThreadforKeyGet(LPVOID lpParam)
|
static DWORD WINAPI ThreadforKeyGet(LPVOID lpParam)
|
||||||
|
@ -131,7 +131,7 @@ static DWORD WINAPI ThreadforKeyGet(LPVOID lpParam)
|
||||||
|
|
||||||
static struct termios oldt, newt;
|
static struct termios oldt, newt;
|
||||||
/*simulate windows' getch(), it works!!*/
|
/*simulate windows' getch(), it works!!*/
|
||||||
void set_stty(void)
|
void set_stty(void)
|
||||||
{
|
{
|
||||||
/* get terminal input's attribute */
|
/* get terminal input's attribute */
|
||||||
tcgetattr(STDIN_FILENO, &oldt);
|
tcgetattr(STDIN_FILENO, &oldt);
|
||||||
|
|
|
@ -18,38 +18,44 @@ else:
|
||||||
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
||||||
from building import *
|
from building import *
|
||||||
|
|
||||||
TARGET = 'rtthread-win32.' + rtconfig.TARGET_EXT
|
|
||||||
|
|
||||||
env = Environment()
|
env = Environment()
|
||||||
|
|
||||||
Export('RTT_ROOT')
|
Export('RTT_ROOT')
|
||||||
Export('rtconfig')
|
Export('rtconfig')
|
||||||
|
|
||||||
libs = Split('''
|
if rtconfig.PLATFORM == 'cl':
|
||||||
winmm
|
TARGET = 'rtthread-win32.' + rtconfig.TARGET_EXT
|
||||||
gdi32
|
|
||||||
winspool
|
libs = Split('''
|
||||||
comdlg32
|
winmm
|
||||||
advapi32
|
gdi32
|
||||||
shell32
|
winspool
|
||||||
ole32
|
comdlg32
|
||||||
oleaut32
|
advapi32
|
||||||
uuid
|
shell32
|
||||||
odbc32
|
ole32
|
||||||
odbccp32
|
oleaut32
|
||||||
''')
|
uuid
|
||||||
definitions = Split('''
|
odbc32
|
||||||
WIN32
|
odbccp32
|
||||||
_DEBUG
|
''')
|
||||||
_CONSOLE
|
definitions = Split('''
|
||||||
MSVC
|
WIN32
|
||||||
_TIME_T_DEFINED
|
_DEBUG
|
||||||
''')
|
_CONSOLE
|
||||||
|
MSVC
|
||||||
|
_TIME_T_DEFINED
|
||||||
|
''')
|
||||||
|
env.Append(CCFLAGS=rtconfig.CFLAGS)
|
||||||
|
env.Append(LINKFLAGS=rtconfig.LFLAGS)
|
||||||
|
env['LIBS']=libs
|
||||||
|
env['CPPDEFINES']=definitions
|
||||||
|
else:
|
||||||
|
TARGET = 'rtthread'
|
||||||
|
env.Append(CCFLAGS=rtconfig.CFLAGS)
|
||||||
|
env.Append(LINKFLAGS=rtconfig.LFLAGS)
|
||||||
|
|
||||||
env.Append(CCFLAGS=rtconfig.CFLAGS)
|
|
||||||
env.Append(LINKFLAGS=rtconfig.LFLAGS)
|
|
||||||
env['LIBS']=libs
|
|
||||||
env['CPPDEFINES']=definitions
|
|
||||||
|
|
||||||
# prepare building environment
|
# prepare building environment
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
from building import *
|
from building import *
|
||||||
|
|
||||||
cwd = GetCurrentDir()
|
cwd = GetCurrentDir()
|
||||||
src = Glob('*.c')
|
src = Glob('*.c')
|
||||||
|
|
||||||
|
# remove no need file.
|
||||||
|
if GetDepend('RT_USING_DFS_WINSHAREDIR') == False:
|
||||||
|
SrcRemove(src, 'dfs_win32.c')
|
||||||
CPPPATH = [cwd, str(Dir('#'))]
|
CPPPATH = [cwd, str(Dir('#'))]
|
||||||
|
|
||||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
|
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include <components.h>
|
#include <components.h>
|
||||||
|
|
||||||
|
|
||||||
void rt_init_thread_entry(void *parameter)
|
void rt_init_thread_entry(void *parameter)
|
||||||
{
|
{
|
||||||
#ifdef RT_USING_LWIP
|
#ifdef RT_USING_LWIP
|
||||||
|
@ -49,7 +50,8 @@ void rt_init_thread_entry(void *parameter)
|
||||||
|
|
||||||
#ifdef RT_USING_DFS_ELMFAT
|
#ifdef RT_USING_DFS_ELMFAT
|
||||||
/* mount sd card fatfs as root directory */
|
/* mount sd card fatfs as root directory */
|
||||||
if (dfs_mount("sd0", "/disk/sd", "elm", 0, 0) == 0)
|
//if (dfs_mount("sd0", "/disk/sd", "elm", 0, 0) == 0)
|
||||||
|
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
|
||||||
rt_kprintf("fatfs initialized!\n");
|
rt_kprintf("fatfs initialized!\n");
|
||||||
else
|
else
|
||||||
rt_kprintf("fatfs initialization failed!\n");
|
rt_kprintf("fatfs initialization failed!\n");
|
||||||
|
@ -74,30 +76,23 @@ void rt_init_thread_entry(void *parameter)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
|
||||||
{
|
|
||||||
extern void application_init(void);
|
|
||||||
rt_thread_delay(RT_TICK_PER_SECOND);
|
|
||||||
application_init();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(RT_USING_RTGUI)
|
#if defined(RT_USING_RTGUI)
|
||||||
rt_thread_delay(3000);
|
//rt_thread_delay(RT_TICK_PER_SECOND);
|
||||||
snake_main();
|
//snake_main();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rt_test_thread_entry(void *parameter)
|
static void rt_test_thread_entry(void *parameter)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 10; i++)
|
for (i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
rt_kprintf("hello, world\n");
|
rt_kprintf("hello, world\n");
|
||||||
rt_thread_delay(100);
|
rt_thread_delay(RT_TICK_PER_SECOND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int rt_application_init()
|
int rt_application_init()
|
||||||
{
|
{
|
||||||
rt_thread_t tid;
|
rt_thread_t tid;
|
||||||
|
@ -118,5 +113,4 @@ int rt_application_init()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup simulator on win32
|
* @addtogroup simulator on win32
|
||||||
|
@ -30,29 +29,56 @@ rt_uint8_t *rt_hw_sram_init(void)
|
||||||
if (heap == RT_NULL)
|
if (heap == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("there is no memory in pc.");
|
rt_kprintf("there is no memory in pc.");
|
||||||
|
#ifdef _WIN32
|
||||||
_exit(1);
|
_exit(1);
|
||||||
|
#else
|
||||||
|
exit(1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return heap;
|
return heap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
void rt_hw_win32_low_cpu(void)
|
void rt_hw_win32_low_cpu(void)
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
/* in windows */
|
||||||
Sleep(1000);
|
Sleep(1000);
|
||||||
|
#else
|
||||||
|
/* in linux */
|
||||||
|
sleep(1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(RT_USING_FINSH)
|
#ifdef _WIN32
|
||||||
|
|
||||||
#ifndef _CRT_TERMINATE_DEFINED
|
#ifndef _CRT_TERMINATE_DEFINED
|
||||||
#define _CRT_TERMINATE_DEFINED
|
#define _CRT_TERMINATE_DEFINED
|
||||||
_CRTIMP __declspec(noreturn) void __cdecl exit(__in int _Code);
|
_CRTIMP __declspec(noreturn) void __cdecl exit(__in int _Code);
|
||||||
_CRTIMP __declspec(noreturn) void __cdecl _exit(__in int _Code);
|
_CRTIMP __declspec(noreturn) void __cdecl _exit(__in int _Code);
|
||||||
_CRTIMP void __cdecl abort(void);
|
_CRTIMP void __cdecl abort(void);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(RT_USING_FINSH)
|
||||||
#include <finsh.h>
|
#include <finsh.h>
|
||||||
void rt_hw_exit(void)
|
void rt_hw_exit(void)
|
||||||
{
|
{
|
||||||
rt_kprintf("RT-Thread, bye\n");
|
rt_kprintf("RT-Thread, bye\n");
|
||||||
|
#if !defined(_WIN32) && defined(__GNUC__)
|
||||||
|
/* *
|
||||||
|
* getchar reads key from buffer, while finsh need an non-buffer getchar
|
||||||
|
* in windows, getch is such an function, in linux, we had to change
|
||||||
|
* the behaviour of terminal to get an non-buffer getchar.
|
||||||
|
* in usart_sim.c, set_stty is called to do this work
|
||||||
|
* */
|
||||||
|
{
|
||||||
|
extern void restore_stty(void);
|
||||||
|
restore_stty();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
FINSH_FUNCTION_EXPORT_ALIAS(rt_hw_exit, exit, exit rt - thread);
|
FINSH_FUNCTION_EXPORT_ALIAS(rt_hw_exit, exit, exit rt - thread);
|
||||||
|
@ -66,8 +92,11 @@ void rt_hw_board_init()
|
||||||
/* init system memory */
|
/* init system memory */
|
||||||
heap = rt_hw_sram_init();
|
heap = rt_hw_sram_init();
|
||||||
|
|
||||||
#if defined(RT_USING_CONSOLE)
|
//#if defined(RT_USING_USART)
|
||||||
rt_hw_usart_init();
|
rt_hw_usart_init();
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
#if defined(RT_USING_CONSOLE)
|
||||||
rt_hw_serial_init();
|
rt_hw_serial_init();
|
||||||
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
|
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
//#include <stdlib.h>
|
||||||
#include <string.h>
|
//#include <string.h>
|
||||||
#include <dfs_def.h>
|
#include <dfs_def.h>
|
||||||
|
|
||||||
// #define SD_TRACE rt_kprintf
|
// #define SD_TRACE rt_kprintf
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
#include <sdl.h>
|
#include <sdl.h>
|
||||||
|
#else
|
||||||
|
#include <SDL/SDL.h>
|
||||||
|
#endif
|
||||||
#include <rtdevice.h>
|
#include <rtdevice.h>
|
||||||
#include <rtgui/driver.h>
|
#include <rtgui/driver.h>
|
||||||
|
|
||||||
|
@ -104,7 +108,7 @@ static void sdlfb_hw_init(void)
|
||||||
//_putenv("SDL_VIDEODRIVER=windib");
|
//_putenv("SDL_VIDEODRIVER=windib");
|
||||||
|
|
||||||
//if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO) < 0)
|
//if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO) < 0)
|
||||||
if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
|
if (SDL_Init(SDL_INIT_VIDEO) < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -132,16 +136,24 @@ static void sdlfb_hw_init(void)
|
||||||
sdllock = rt_mutex_create("fb", RT_IPC_FLAG_FIFO);
|
sdllock = rt_mutex_create("fb", RT_IPC_FLAG_FIFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
|
#else
|
||||||
|
#include <pthread.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sdl.h>
|
|
||||||
#include <rtgui/event.h>
|
#include <rtgui/event.h>
|
||||||
#include <rtgui/kbddef.h>
|
#include <rtgui/kbddef.h>
|
||||||
#include <rtgui/rtgui_server.h>
|
#include <rtgui/rtgui_server.h>
|
||||||
#include <rtgui/rtgui_system.h>
|
#include <rtgui/rtgui_system.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
static DWORD WINAPI sdl_loop(LPVOID lpParam)
|
static DWORD WINAPI sdl_loop(LPVOID lpParam)
|
||||||
|
#else
|
||||||
|
static void *sdl_loop(void *lpParam)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
int quit = 0;
|
int quit = 0;
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
@ -284,6 +296,7 @@ static DWORD WINAPI sdl_loop(LPVOID lpParam)
|
||||||
/* start sdl thread */
|
/* start sdl thread */
|
||||||
void rt_hw_sdl_start(void)
|
void rt_hw_sdl_start(void)
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
HANDLE thread;
|
HANDLE thread;
|
||||||
DWORD thread_id;
|
DWORD thread_id;
|
||||||
|
|
||||||
|
@ -301,4 +314,15 @@ void rt_hw_sdl_start(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ResumeThread(thread);
|
ResumeThread(thread);
|
||||||
|
#else
|
||||||
|
/* Linux */
|
||||||
|
pthread_t pid;
|
||||||
|
int res;
|
||||||
|
res = pthread_create(&pid, NULL, &sdl_loop, NULL);
|
||||||
|
if (res)
|
||||||
|
{
|
||||||
|
printf("pthread create sdl thread faild, <%d>\n", res);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,12 @@
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
struct rt_device serial_device;
|
struct rt_device serial_device;
|
||||||
extern struct serial_int_rx serial_rx;
|
//extern struct serial_int_rx serial_rx;
|
||||||
|
struct serial_int_rx serial_rx;
|
||||||
|
|
||||||
|
#if 0
|
||||||
static FILE *fp = RT_NULL;
|
static FILE *fp = RT_NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*@{*/
|
/*@{*/
|
||||||
|
|
||||||
|
@ -109,13 +113,16 @@ static rt_size_t rt_serial_write(rt_device_t dev, rt_off_t pos, const void *buff
|
||||||
#if _DEBUG_SERIAL==1
|
#if _DEBUG_SERIAL==1
|
||||||
printf("in rt_serial_write()\n");
|
printf("in rt_serial_write()\n");
|
||||||
#endif
|
#endif
|
||||||
|
#if 0
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
fp = fopen("log.txt", "wb+");
|
fp = fopen("log.txt", "wb+");
|
||||||
|
|
||||||
if (fp != NULL)
|
if (fp != NULL)
|
||||||
fwrite(buffer, size, 1, fp);
|
fwrite(buffer, size, 1, fp);
|
||||||
|
#endif
|
||||||
|
|
||||||
printf("%s", (char *)buffer);
|
printf("%s", (char *)buffer);
|
||||||
|
fflush(stdout);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,19 @@
|
||||||
#include <rthw.h>
|
#include <rthw.h>
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
|
|
||||||
struct serial_int_rx serial_rx;
|
struct serial_int_rx serial_rx;
|
||||||
extern struct rt_device serial_device;
|
extern struct rt_device serial_device;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
/*
|
/*
|
||||||
* Handler for OSKey Thread
|
* Handler for OSKey Thread
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +23,6 @@ static DWORD OSKey_ThreadID;
|
||||||
static DWORD WINAPI ThreadforKeyGet(LPVOID lpParam);
|
static DWORD WINAPI ThreadforKeyGet(LPVOID lpParam);
|
||||||
void rt_hw_usart_init(void)
|
void rt_hw_usart_init(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* create serial thread that receive key input from keyboard
|
* create serial thread that receive key input from keyboard
|
||||||
*/
|
*/
|
||||||
|
@ -46,9 +49,31 @@ void rt_hw_usart_init(void)
|
||||||
* Start OS get key Thread
|
* Start OS get key Thread
|
||||||
*/
|
*/
|
||||||
ResumeThread(OSKey_Thread);
|
ResumeThread(OSKey_Thread);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else /* POSIX version */
|
||||||
|
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <semaphore.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <termios.h> /* for tcxxxattr, ECHO, etc */
|
||||||
|
#include <unistd.h> /* for STDIN_FILENO */
|
||||||
|
|
||||||
|
|
||||||
|
static void * ThreadforKeyGet(void * lpParam);
|
||||||
|
static pthread_t OSKey_Thread;
|
||||||
|
void rt_hw_usart_init(void)
|
||||||
|
{
|
||||||
|
int res;
|
||||||
|
res = pthread_create(&OSKey_Thread, NULL, &ThreadforKeyGet, NULL);
|
||||||
|
if (res)
|
||||||
|
{
|
||||||
|
printf("pthread create faild, <%d>\n", res);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* ·½Ïò¼ü(¡û)£º 0xe04b
|
* ·½Ïò¼ü(¡û)£º 0xe04b
|
||||||
* ·½Ïò¼ü(¡ü)£º 0xe048
|
* ·½Ïò¼ü(¡ü)£º 0xe048
|
||||||
|
@ -100,15 +125,48 @@ static int savekey(unsigned char key)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#ifdef _WIN32
|
||||||
static DWORD WINAPI ThreadforKeyGet(LPVOID lpParam)
|
static DWORD WINAPI ThreadforKeyGet(LPVOID lpParam)
|
||||||
|
#else
|
||||||
|
|
||||||
|
static struct termios oldt, newt;
|
||||||
|
/*simulate windows' getch(), it works!!*/
|
||||||
|
void set_stty(void)
|
||||||
|
{
|
||||||
|
/* get terminal input's attribute */
|
||||||
|
tcgetattr(STDIN_FILENO, &oldt);
|
||||||
|
newt = oldt;
|
||||||
|
|
||||||
|
/* set termios' local mode */
|
||||||
|
newt.c_lflag &= ~(ECHO|ICANON);
|
||||||
|
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void restore_stty(void)
|
||||||
|
{
|
||||||
|
/* recover terminal's attribute */
|
||||||
|
tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define getch getchar
|
||||||
|
|
||||||
|
static void * ThreadforKeyGet(void * lpParam)
|
||||||
|
#endif /* not _WIN32*/
|
||||||
{
|
{
|
||||||
unsigned char key;
|
unsigned char key;
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
sigset_t sigmask, oldmask;
|
||||||
|
/* set the getchar without buffer */
|
||||||
|
sigfillset(&sigmask);
|
||||||
|
pthread_sigmask(SIG_BLOCK, &sigmask, &oldmask);
|
||||||
|
set_stty();
|
||||||
|
#endif
|
||||||
(void)lpParam; //prevent compiler warnings
|
(void)lpParam; //prevent compiler warnings
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
key = getch();
|
key = getch();
|
||||||
|
#ifdef _WIN32
|
||||||
if (key == 0xE0)
|
if (key == 0xE0)
|
||||||
{
|
{
|
||||||
key = getch();
|
key = getch();
|
||||||
|
@ -128,7 +186,7 @@ static DWORD WINAPI ThreadforKeyGet(LPVOID lpParam)
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
savekey(key);
|
savekey(key);
|
||||||
}
|
}
|
||||||
} /*** ThreadforKeyGet ***/
|
} /*** ThreadforKeyGet ***/
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
#ifndef __RTTHREAD_CFG_H__
|
#ifndef __RTTHREAD_CFG_H__
|
||||||
#define __RTTHREAD_CFG_H__
|
#define __RTTHREAD_CFG_H__
|
||||||
|
|
||||||
|
#define RT_HEAP_SIZE (1024*1024*2)
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
/* SECTION: port for visual studio */
|
/* SECTION: port for visual studio */
|
||||||
#ifdef _MSC_VER
|
|
||||||
#undef RT_USING_NEWLIB
|
#undef RT_USING_NEWLIB
|
||||||
#undef RT_USING_MINILIBC
|
#undef RT_USING_MINILIBC
|
||||||
#define NORESOURCE //RT_VESRION in winuser.h
|
#define NORESOURCE //RT_VESRION in winuser.h
|
||||||
#define _CRT_ERRNO_DEFINED //errno macro redefinition
|
#define _CRT_ERRNO_DEFINED //errno macro redefinition
|
||||||
|
|
||||||
#define RT_HEAP_SIZE (1024*1024*2)
|
|
||||||
|
|
||||||
/* disable some warning in MSC */
|
/* disable some warning in MSC */
|
||||||
#pragma warning(disable:4273) /* to ignore: warning C4273: inconsistent dll linkage */
|
#pragma warning(disable:4273) /* to ignore: warning C4273: inconsistent dll linkage */
|
||||||
#pragma warning(disable:4312) /* to ignore: warning C4312: 'type cast' : conversion from 'rt_uint32_t' to 'rt_uint32_t *' */
|
#pragma warning(disable:4312) /* to ignore: warning C4312: 'type cast' : conversion from 'rt_uint32_t' to 'rt_uint32_t *' */
|
||||||
|
@ -18,6 +18,9 @@
|
||||||
#pragma warning(disable:4996) /* to ignore: warning C4996: The POSIX name for this item is deprecated. */
|
#pragma warning(disable:4996) /* to ignore: warning C4996: The POSIX name for this item is deprecated. */
|
||||||
#pragma warning(disable:4267) /* to ignore: warning C4267: conversion from 'size_t' to 'rt_size_t', possible loss of data */
|
#pragma warning(disable:4267) /* to ignore: warning C4267: conversion from 'size_t' to 'rt_size_t', possible loss of data */
|
||||||
#pragma warning(disable:4244) /* to ignore: warning C4244: '=' : conversion from '__w64 int' to 'rt_size_t', possible loss of data */
|
#pragma warning(disable:4244) /* to ignore: warning C4244: '=' : conversion from '__w64 int' to 'rt_size_t', possible loss of data */
|
||||||
|
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#define RT_USING_NOLIBC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* SECTION: basic kernel options */
|
/* SECTION: basic kernel options */
|
||||||
|
@ -31,11 +34,12 @@
|
||||||
#define RT_THREAD_PRIORITY_MAX 32
|
#define RT_THREAD_PRIORITY_MAX 32
|
||||||
|
|
||||||
/* Tick per Second */
|
/* Tick per Second */
|
||||||
#define RT_TICK_PER_SECOND 1000
|
#define RT_TICK_PER_SECOND 100
|
||||||
|
|
||||||
/* SECTION: RT_DEBUG */
|
/* SECTION: RT_DEBUG */
|
||||||
/* Thread Debug */
|
/* Thread Debug */
|
||||||
#define RT_DEBUG
|
#define RT_DEBUG
|
||||||
|
//#define RT_DEBUG_SCHEDULER 1
|
||||||
#define RT_THREAD_DEBUG
|
#define RT_THREAD_DEBUG
|
||||||
|
|
||||||
#define RT_USING_OVERFLOW_CHECK
|
#define RT_USING_OVERFLOW_CHECK
|
||||||
|
@ -129,11 +133,11 @@
|
||||||
/* #define RT_UFFS_USE_CHECK_MARK_FUNCITON */
|
/* #define RT_UFFS_USE_CHECK_MARK_FUNCITON */
|
||||||
|
|
||||||
/* DFS: JFFS2 nor flash file system options */
|
/* DFS: JFFS2 nor flash file system options */
|
||||||
#define RT_USING_DFS_JFFS2
|
//#define RT_USING_DFS_JFFS2
|
||||||
|
|
||||||
/* DFS: windows share directory mounted to rt-thread/dfs */
|
/* DFS: windows share directory mounted to rt-thread/dfs */
|
||||||
/* only used in bsp/simulator */
|
/* only used in bsp/simulator */
|
||||||
#define RT_USING_DFS_WINSHAREDIR
|
//#define RT_USING_DFS_WINSHAREDIR
|
||||||
|
|
||||||
/* the max number of mounted file system */
|
/* the max number of mounted file system */
|
||||||
#define DFS_FILESYSTEMS_MAX 4
|
#define DFS_FILESYSTEMS_MAX 4
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
# toolchains options
|
# toolchains options
|
||||||
ARCH='sim'
|
ARCH='sim'
|
||||||
CPU='win32' #CPU='posix'
|
#CPU='win32'
|
||||||
CROSS_TOOL='msvc' #win32
|
#CPU='posix'
|
||||||
|
CPU='posix'
|
||||||
|
CROSS_TOOL='gcc' #msvc # gcc
|
||||||
|
|
||||||
# lcd panel options
|
# lcd panel options
|
||||||
# 'FMT0371','ILI932X', 'SSD1289'
|
# 'FMT0371','ILI932X', 'SSD1289'
|
||||||
|
@ -33,16 +35,19 @@ if PLATFORM == 'gcc':
|
||||||
OBJCPY = PREFIX + 'objcopy'
|
OBJCPY = PREFIX + 'objcopy'
|
||||||
|
|
||||||
DEVICE = ' -ffunction-sections -fdata-sections'
|
DEVICE = ' -ffunction-sections -fdata-sections'
|
||||||
CFLAGS = DEVICE
|
DEVICE = ' '
|
||||||
|
CFLAGS = DEVICE + ' -I/usr/include -w -D_REENTRANT'
|
||||||
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
|
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
|
||||||
#LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-linux.map,-cref,-u,Reset_Handler -T stm32_rom.ld'
|
#LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-linux.map,-cref,-u,Reset_Handler -T stm32_rom.ld'
|
||||||
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-linux.map -lpthread'
|
#LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-linux.map -lpthread'
|
||||||
|
#LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-linux.map -pthread'
|
||||||
|
LFLAGS = DEVICE + ' -Wl,-Map=rtthread-linux.map -pthread -T gcc.ld'
|
||||||
|
|
||||||
CPATH = ''
|
CPATH = ''
|
||||||
LPATH = ''
|
LPATH = ''
|
||||||
|
|
||||||
if BUILD == 'debug':
|
if BUILD == 'debug':
|
||||||
CFLAGS += ' -O0 -gdwarf-2'
|
CFLAGS += ' -g -O0 -gdwarf-2'
|
||||||
AFLAGS += ' -gdwarf-2'
|
AFLAGS += ' -gdwarf-2'
|
||||||
else:
|
else:
|
||||||
CFLAGS += ' -O2'
|
CFLAGS += ' -O2'
|
||||||
|
|
Loading…
Reference in New Issue