support GCC compiler

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@371 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
qiuyiuestc 2010-02-04 14:46:09 +00:00
parent c05af1b737
commit 95fd101d51
12 changed files with 121 additions and 84 deletions

View File

@ -21,88 +21,90 @@ key_power GPG11
static void key_thread_entry(void *parameter) static void key_thread_entry(void *parameter)
{ {
rt_time_t next_delay; rt_time_t next_delay;
struct rtgui_event_kbd kbd_event; struct rtgui_event_kbd kbd_event;
/* init gpio configuration */ /* init gpio configuration */
GPGCON = GPGCON & (~((3<<22)|(3<<6)|(3<<0)|(3<<10)|(3<<12)|(3<<14))) | GPGCON = GPGCON & (~((3<<22)|(3<<6)|(3<<0)|(3<<10)|(3<<12)|(3<<14))) |
((2<<22)|(2<<6)|(2<<0)|(2<<10)|(2<<12)|(2<<14)); ((2<<22)|(2<<6)|(2<<0)|(2<<10)|(2<<12)|(2<<14));
/* init keyboard event */ /* init keyboard event */
RTGUI_EVENT_KBD_INIT(&kbd_event); RTGUI_EVENT_KBD_INIT(&kbd_event);
kbd_event.mod = RTGUI_KMOD_NONE; kbd_event.mod = RTGUI_KMOD_NONE;
kbd_event.unicode = 0; kbd_event.unicode = 0;
while (1) while (1)
{ {
next_delay = 20; next_delay = 20;
kbd_event.key = RTGUIK_UNKNOWN; kbd_event.key = RTGUIK_UNKNOWN;
kbd_event.type = RTGUI_KEYDOWN; kbd_event.type = RTGUI_KEYDOWN;
if ( key_enter_GETVALUE() == 0 ) if ( key_enter_GETVALUE() == 0 )
{ {
rt_thread_delay(next_delay); rt_thread_delay(next_delay);
if (key_enter_GETVALUE() == 0) if (key_enter_GETVALUE() == 0)
{ {
/* HOME key */ /* HOME key */
rt_kprintf("key_home\n"); rt_kprintf("key_home\n");
kbd_event.key = RTGUIK_HOME; kbd_event.key = RTGUIK_HOME;
} }
else else
{ {
rt_kprintf("key_enter\n"); rt_kprintf("key_enter\n");
kbd_event.key = RTGUIK_RETURN; kbd_event.key = RTGUIK_RETURN;
} }
} }
if ( key_down_GETVALUE() == 0 ) if ( key_down_GETVALUE() == 0 )
{ {
rt_kprintf("key_down\n"); rt_kprintf("key_down\n");
kbd_event.key = RTGUIK_DOWN; kbd_event.key = RTGUIK_DOWN;
} }
if ( key_up_GETVALUE() == 0 ) if ( key_up_GETVALUE() == 0 )
{ {
rt_kprintf("key_up\n"); rt_kprintf("key_up\n");
kbd_event.key = RTGUIK_UP; kbd_event.key = RTGUIK_UP;
} }
if ( key_right_GETVALUE() == 0 ) if ( key_right_GETVALUE() == 0 )
{ {
rt_kprintf("key_right\n"); rt_kprintf("key_right\n");
kbd_event.key = RTGUIK_RIGHT; kbd_event.key = RTGUIK_RIGHT;
} }
if ( key_left_GETVALUE() == 0 ) if ( key_left_GETVALUE() == 0 )
{ {
rt_kprintf("key_left\n"); rt_kprintf("key_left\n");
kbd_event.key = RTGUIK_LEFT; kbd_event.key = RTGUIK_LEFT;
} }
if (kbd_event.key != RTGUIK_UNKNOWN) if (kbd_event.key != RTGUIK_UNKNOWN)
{ {
/* post down event */ /* post down event */
rtgui_server_post_event(&(kbd_event.parent), sizeof(kbd_event)); rtgui_server_post_event(&(kbd_event.parent), sizeof(kbd_event));
next_delay = 10; next_delay = 10;
/* delay to post up event */ /* delay to post up event */
rt_thread_delay(next_delay); rt_thread_delay(next_delay);
/* post up event */ /* post up event */
kbd_event.type = RTGUI_KEYUP; kbd_event.type = RTGUI_KEYUP;
rtgui_server_post_event(&(kbd_event.parent), sizeof(kbd_event)); rtgui_server_post_event(&(kbd_event.parent), sizeof(kbd_event));
} }
/* wait next key press */ /* wait next key press */
rt_thread_delay(next_delay); rt_thread_delay(next_delay);
} }
} }
void rt_hw_key_init() void rt_hw_key_init()
{ {
rt_thread_t key_tid; #if 0
key_tid = rt_thread_create("key", rt_thread_t key_tid;
key_thread_entry, RT_NULL, key_tid = rt_thread_create("key",
512, 30, 5); key_thread_entry, RT_NULL,
if (key_tid != RT_NULL) rt_thread_startup(key_tid); 512, 30, 5);
if (key_tid != RT_NULL) rt_thread_startup(key_tid);
#endif
} }

View File

@ -70,9 +70,6 @@
/* SECTION: finsh, a C-Express shell */ /* SECTION: finsh, a C-Express shell */
/* Using FinSH as Shell*/ /* Using FinSH as Shell*/
#define RT_USING_FINSH #define RT_USING_FINSH
/* Using symbol table */
#define FINSH_USING_SYMTAB
#define FINSH_USING_DESCRIPTION
/* SECTION: a runtime libc library */ /* SECTION: a runtime libc library */
/* a runtime libc library */ /* a runtime libc library */
@ -94,7 +91,7 @@
#define RT_USING_DFS_EFSL #define RT_USING_DFS_EFSL
#define RT_USING_DFS_YAFFS2 #define RT_USING_DFS_YAFFS2
#define RT_USING_WORKDIR /* #define DFS_USING_WORKDIR */
/* the max number of mounted filesystem */ /* the max number of mounted filesystem */
#define DFS_FILESYSTEMS_MAX 2 #define DFS_FILESYSTEMS_MAX 2

View File

@ -25,10 +25,10 @@ ARCH='arm'
CPU='s3c24x0' CPU='s3c24x0'
TextBase='0x30000000' TextBase='0x30000000'
#PLATFORM = 'gcc' PLATFORM = 'gcc'
#EXEC_PATH = 'E:/Program Files/CodeSourcery/Sourcery G++ Lite/bin' EXEC_PATH = 'E:/Program Files/CodeSourcery/Sourcery G++ Lite/bin'
PLATFORM = 'armcc' #PLATFORM = 'armcc'
EXEC_PATH = 'E:/Keil' #EXEC_PATH = 'E:/Keil'
BUILD = 'debug' BUILD = 'debug'
if PLATFORM == 'gcc': if PLATFORM == 'gcc':
@ -38,15 +38,15 @@ if PLATFORM == 'gcc':
AS = PREFIX + 'gcc' AS = PREFIX + 'gcc'
AR = PREFIX + 'ar' AR = PREFIX + 'ar'
LINK = PREFIX + 'gcc' LINK = PREFIX + 'gcc'
TARGET_EXT = 'elf' TARGET_EXT = 'axf'
SIZE = PREFIX + 'size' SIZE = PREFIX + 'size'
OBJDUMP = PREFIX + 'objdump' OBJDUMP = PREFIX + 'objdump'
OBJCPY = PREFIX + 'objcopy' OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=arm920t' DEVICE = ' -mcpu=arm920t'
CFLAGS = DEVICE + ' -Dsourcerygxx' + ' -nostdinc' CFLAGS = DEVICE + ' -DRT_USING_MINILIBC' + ' -nostdinc -nostdlib -fno-builtin'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp' + ' -DTEXT_BASE=' + TextBase
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=main.elf.map,-cref,-u,Reset_Handler -T mini2440_ram.ld' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=main.elf.map,-cref,-u,_start -T mini2440_ram.ld' + ' -Ttext ' + TextBase
CPATH = '' CPATH = ''
LPATH = '' LPATH = ''
@ -89,6 +89,7 @@ elif PLATFORM == 'armcc':
RT_USING_MINILIBC = False RT_USING_MINILIBC = False
if RT_USING_FINSH: if RT_USING_FINSH:
CFLAGS += ' -D FINSH_USING_SYMTAB -DFINSH_USING_DESCRIPTION'
LFLAGS += ' --keep __fsym_* --keep __vsym_*' LFLAGS += ' --keep __fsym_* --keep __vsym_*'
if RT_USING_WEBSERVER: if RT_USING_WEBSERVER:
CFLAGS += ' -DWEBS -DUEMF -DRTT -D__NO_FCNTL=1 -DRT_USING_WEBSERVER' CFLAGS += ' -DWEBS -DUEMF -DRTT -D__NO_FCNTL=1 -DRT_USING_WEBSERVER'

View File

@ -48,10 +48,34 @@ extern struct rt_device uart0_device;
extern int Image$$ER_ZI$$ZI$$Base; extern int Image$$ER_ZI$$ZI$$Base;
extern int Image$$ER_ZI$$ZI$$Length; extern int Image$$ER_ZI$$ZI$$Length;
extern int Image$$ER_ZI$$ZI$$Limit; extern int Image$$ER_ZI$$ZI$$Limit;
#else #elif (defined (__GNUC__))
rt_uint8_t _irq_stack_start[1024];
rt_uint8_t _fiq_stack_start[1024];
rt_uint8_t _undefined_stack_start[512];
rt_uint8_t _abort_stack_start[512];
rt_uint8_t _svc_stack_start[1024] SECTION(".nobss");
extern int __bss_end; extern int __bss_end;
#endif #endif
/**
* Fix me
*/
#if (defined (__GNUC__))
void *_sbrk (int incr)
{
extern int __bss_end; /* Set by linker. */
static char * heap_end;
char * prev_heap_end;
if (heap_end == 0)
heap_end = & __bss_end;
prev_heap_end = heap_end;
heap_end += incr;
return (void *) prev_heap_end;
}
#endif
#ifdef RT_USING_FINSH #ifdef RT_USING_FINSH
extern void finsh_system_init(void); extern void finsh_system_init(void);

View File

@ -4,6 +4,7 @@
#include <rtthread.h> #include <rtthread.h>
#include <dfs_posix.h> #include <dfs_posix.h>
#include <lwip/sockets.h> #include <lwip/sockets.h>
#include <time.h>
#define FTP_PORT 21 #define FTP_PORT 21
#define FTP_SRV_ROOT "/" #define FTP_SRV_ROOT "/"

View File

@ -59,6 +59,11 @@ typedef rt_uint32_t mem_ptr_t;
#define LWIP_PROVIDE_ERRNO #define LWIP_PROVIDE_ERRNO
#endif #endif
#ifdef RT_USING_MINILIBC
#include <time.h>
#define LWIP_TIMEVAL_PRIVATE 0
#endif
#if defined(__CC_ARM) /* ARMCC compiler */ #if defined(__CC_ARM) /* ARMCC compiler */
#define PACK_STRUCT_FIELD(x) x #define PACK_STRUCT_FIELD(x) x
#define PACK_STRUCT_STRUCT __attribute__ ((__packed__)) #define PACK_STRUCT_STRUCT __attribute__ ((__packed__))
@ -76,10 +81,10 @@ typedef rt_uint32_t mem_ptr_t;
#define PACK_STRUCT_BEGIN #define PACK_STRUCT_BEGIN
#define PACK_STRUCT_END #define PACK_STRUCT_END
#endif #endif
void sys_arch_assert(const char* file, int line); void sys_arch_assert(const char* file, int line);
#define LWIP_PLATFORM_DIAG(x) do {rt_kprintf x;} while(0) #define LWIP_PLATFORM_DIAG(x) do {rt_kprintf x;} while(0)
#define LWIP_PLATFORM_ASSERT(x) { rt_kprintf(x); sys_arch_assert(__FILE__, __LINE__); } #define LWIP_PLATFORM_ASSERT(x) { rt_kprintf(x); sys_arch_assert(__FILE__, __LINE__); }
#define SYS_ARCH_DECL_PROTECT(x) #define SYS_ARCH_DECL_PROTECT(x)
#define SYS_ARCH_PROTECT(x) #define SYS_ARCH_PROTECT(x)

View File

@ -23,6 +23,7 @@ common/image_hdc.c
common/region.c common/region.c
common/hz12font.c common/hz12font.c
common/hz16font.c common/hz16font.c
common/font_hz_bmp.c
""") """)
server_src = Split(""" server_src = Split("""

View File

@ -1,6 +1,9 @@
#include <rtgui/dc.h> #include <rtgui/dc.h>
#include <rtgui/font.h> #include <rtgui/font.h>
#ifdef RTGUI_USING_HZ_BMP
static void rtgui_hz_bitmap_font_draw_text(struct rtgui_font* font, struct rtgui_dc* dc, const rt_uint8_t* text, rt_ubase_t len, struct rtgui_rect* rect); static void rtgui_hz_bitmap_font_draw_text(struct rtgui_font* font, struct rtgui_dc* dc, const rt_uint8_t* text, rt_ubase_t len, struct rtgui_rect* rect);
static void rtgui_hz_bitmap_font_get_metrics(struct rtgui_font* font, const rt_uint8_t* text, rtgui_rect_t* rect); static void rtgui_hz_bitmap_font_get_metrics(struct rtgui_font* font, const rt_uint8_t* text, rtgui_rect_t* rect);
struct rtgui_font_engine hz_bmp_font_engine = struct rtgui_font_engine hz_bmp_font_engine =
@ -69,3 +72,5 @@ static void rtgui_hz_bitmap_font_get_metrics(struct rtgui_font* font, const rt_u
rect->x2 = (rt_int16_t)(bmp_font->width * rt_strlen((const char*)text)); rect->x2 = (rt_int16_t)(bmp_font->width * rt_strlen((const char*)text));
rect->y2 = bmp_font->height; rect->y2 = bmp_font->height;
} }
#endif

View File

@ -16746,7 +16746,7 @@ struct rtgui_font rtgui_font_hz16 =
16, /* height */ 16, /* height */
1, /* refer count */ 1, /* refer count */
&hz_bmp_font_engine,/* font engine */ &hz_bmp_font_engine,/* font engine */
&hz16, /* font private data */ (void *)&hz16, /* font private data */
}; };
/* size = 267616 bytes */ /* size = 267616 bytes */

View File

@ -343,8 +343,8 @@ rt_err_t rtgui_thread_send(rt_thread_t tid, rtgui_event_t* event, rt_size_t even
struct rtgui_thread* thread; struct rtgui_thread* thread;
rtgui_event_dump(tid, event); rtgui_event_dump(tid, event);
if (event->type != RTGUI_EVENT_TIMER) /* if (event->type != RTGUI_EVENT_TIMER)
rt_kprintf("event size: %d\n", event_size); rt_kprintf("event size: %d\n", event_size); */
/* find rtgui_thread */ /* find rtgui_thread */
thread = (struct rtgui_thread*) (tid->user_data); thread = (struct rtgui_thread*) (tid->user_data);

View File

@ -29,11 +29,12 @@
#define RTGUI_USING_STDIO_FILERW #define RTGUI_USING_STDIO_FILERW
#define RTGUI_IMAGE_PNG #define RTGUI_IMAGE_PNG
#define RTGUI_IMAGE_JPEG #define RTGUI_IMAGE_JPEG
#define RTGUI_USING_FONT12 #define RTGUI_USING_FONT12
#else #else
#define RTGUI_USING_DFS_FILERW #define RTGUI_USING_DFS_FILERW
#define RTGUI_USING_HZ_FILE //#define RTGUI_USING_HZ_FILE
#define RTGUI_USING_HZ_BMP
#define RTGUI_USING_FONT12
#endif #endif
// #define RTGUI_USING_SMALL_SIZE // #define RTGUI_USING_SMALL_SIZE

View File

@ -457,7 +457,7 @@ rt_bool_t rtgui_filelist_view_event_handler(struct rtgui_widget* widget, struct
if (strcmp(view->items[view->current_item].name, ".") == 0) return RT_FALSE; if (strcmp(view->items[view->current_item].name, ".") == 0) return RT_FALSE;
if (strcmp(view->items[view->current_item].name, "..") == 0) if (strcmp(view->items[view->current_item].name, "..") == 0)
{ {
char *ptr; rt_uint8_t *ptr;
ptr = strrchr(view->current_directory, PATH_SEPARATOR); ptr = strrchr(view->current_directory, PATH_SEPARATOR);
if (ptr == RT_NULL) return RT_FALSE; if (ptr == RT_NULL) return RT_FALSE;