support GCC compiler
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@371 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
c05af1b737
commit
95fd101d51
|
@ -21,88 +21,90 @@ key_power GPG11
|
|||
|
||||
static void key_thread_entry(void *parameter)
|
||||
{
|
||||
rt_time_t next_delay;
|
||||
struct rtgui_event_kbd kbd_event;
|
||||
rt_time_t next_delay;
|
||||
struct rtgui_event_kbd kbd_event;
|
||||
|
||||
/* init gpio configuration */
|
||||
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));
|
||||
/* init gpio configuration */
|
||||
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));
|
||||
|
||||
/* init keyboard event */
|
||||
RTGUI_EVENT_KBD_INIT(&kbd_event);
|
||||
kbd_event.mod = RTGUI_KMOD_NONE;
|
||||
kbd_event.unicode = 0;
|
||||
/* init keyboard event */
|
||||
RTGUI_EVENT_KBD_INIT(&kbd_event);
|
||||
kbd_event.mod = RTGUI_KMOD_NONE;
|
||||
kbd_event.unicode = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
next_delay = 20;
|
||||
while (1)
|
||||
{
|
||||
next_delay = 20;
|
||||
kbd_event.key = RTGUIK_UNKNOWN;
|
||||
|
||||
kbd_event.type = RTGUI_KEYDOWN;
|
||||
if ( key_enter_GETVALUE() == 0 )
|
||||
{
|
||||
rt_thread_delay(next_delay);
|
||||
if (key_enter_GETVALUE() == 0)
|
||||
{
|
||||
/* HOME key */
|
||||
rt_kprintf("key_home\n");
|
||||
kbd_event.key = RTGUIK_HOME;
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("key_enter\n");
|
||||
kbd_event.key = RTGUIK_RETURN;
|
||||
}
|
||||
}
|
||||
kbd_event.type = RTGUI_KEYDOWN;
|
||||
if ( key_enter_GETVALUE() == 0 )
|
||||
{
|
||||
rt_thread_delay(next_delay);
|
||||
if (key_enter_GETVALUE() == 0)
|
||||
{
|
||||
/* HOME key */
|
||||
rt_kprintf("key_home\n");
|
||||
kbd_event.key = RTGUIK_HOME;
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("key_enter\n");
|
||||
kbd_event.key = RTGUIK_RETURN;
|
||||
}
|
||||
}
|
||||
|
||||
if ( key_down_GETVALUE() == 0 )
|
||||
{
|
||||
rt_kprintf("key_down\n");
|
||||
kbd_event.key = RTGUIK_DOWN;
|
||||
}
|
||||
if ( key_down_GETVALUE() == 0 )
|
||||
{
|
||||
rt_kprintf("key_down\n");
|
||||
kbd_event.key = RTGUIK_DOWN;
|
||||
}
|
||||
|
||||
if ( key_up_GETVALUE() == 0 )
|
||||
{
|
||||
rt_kprintf("key_up\n");
|
||||
kbd_event.key = RTGUIK_UP;
|
||||
}
|
||||
if ( key_up_GETVALUE() == 0 )
|
||||
{
|
||||
rt_kprintf("key_up\n");
|
||||
kbd_event.key = RTGUIK_UP;
|
||||
}
|
||||
|
||||
if ( key_right_GETVALUE() == 0 )
|
||||
{
|
||||
rt_kprintf("key_right\n");
|
||||
kbd_event.key = RTGUIK_RIGHT;
|
||||
}
|
||||
if ( key_right_GETVALUE() == 0 )
|
||||
{
|
||||
rt_kprintf("key_right\n");
|
||||
kbd_event.key = RTGUIK_RIGHT;
|
||||
}
|
||||
|
||||
if ( key_left_GETVALUE() == 0 )
|
||||
{
|
||||
rt_kprintf("key_left\n");
|
||||
kbd_event.key = RTGUIK_LEFT;
|
||||
}
|
||||
if ( key_left_GETVALUE() == 0 )
|
||||
{
|
||||
rt_kprintf("key_left\n");
|
||||
kbd_event.key = RTGUIK_LEFT;
|
||||
}
|
||||
|
||||
if (kbd_event.key != RTGUIK_UNKNOWN)
|
||||
{
|
||||
/* post down event */
|
||||
rtgui_server_post_event(&(kbd_event.parent), sizeof(kbd_event));
|
||||
/* post down event */
|
||||
rtgui_server_post_event(&(kbd_event.parent), sizeof(kbd_event));
|
||||
|
||||
next_delay = 10;
|
||||
/* delay to post up event */
|
||||
rt_thread_delay(next_delay);
|
||||
/* delay to post up event */
|
||||
rt_thread_delay(next_delay);
|
||||
|
||||
/* post up event */
|
||||
kbd_event.type = RTGUI_KEYUP;
|
||||
rtgui_server_post_event(&(kbd_event.parent), sizeof(kbd_event));
|
||||
/* post up event */
|
||||
kbd_event.type = RTGUI_KEYUP;
|
||||
rtgui_server_post_event(&(kbd_event.parent), sizeof(kbd_event));
|
||||
}
|
||||
|
||||
/* wait next key press */
|
||||
rt_thread_delay(next_delay);
|
||||
}
|
||||
/* wait next key press */
|
||||
rt_thread_delay(next_delay);
|
||||
}
|
||||
}
|
||||
|
||||
void rt_hw_key_init()
|
||||
{
|
||||
rt_thread_t key_tid;
|
||||
key_tid = rt_thread_create("key",
|
||||
key_thread_entry, RT_NULL,
|
||||
512, 30, 5);
|
||||
if (key_tid != RT_NULL) rt_thread_startup(key_tid);
|
||||
#if 0
|
||||
rt_thread_t key_tid;
|
||||
key_tid = rt_thread_create("key",
|
||||
key_thread_entry, RT_NULL,
|
||||
512, 30, 5);
|
||||
if (key_tid != RT_NULL) rt_thread_startup(key_tid);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -70,9 +70,6 @@
|
|||
/* SECTION: finsh, a C-Express shell */
|
||||
/* Using FinSH as Shell*/
|
||||
#define RT_USING_FINSH
|
||||
/* Using symbol table */
|
||||
#define FINSH_USING_SYMTAB
|
||||
#define FINSH_USING_DESCRIPTION
|
||||
|
||||
/* SECTION: a runtime libc library */
|
||||
/* a runtime libc library */
|
||||
|
@ -94,7 +91,7 @@
|
|||
#define RT_USING_DFS_EFSL
|
||||
#define RT_USING_DFS_YAFFS2
|
||||
|
||||
#define RT_USING_WORKDIR
|
||||
/* #define DFS_USING_WORKDIR */
|
||||
|
||||
/* the max number of mounted filesystem */
|
||||
#define DFS_FILESYSTEMS_MAX 2
|
||||
|
|
|
@ -25,10 +25,10 @@ ARCH='arm'
|
|||
CPU='s3c24x0'
|
||||
TextBase='0x30000000'
|
||||
|
||||
#PLATFORM = 'gcc'
|
||||
#EXEC_PATH = 'E:/Program Files/CodeSourcery/Sourcery G++ Lite/bin'
|
||||
PLATFORM = 'armcc'
|
||||
EXEC_PATH = 'E:/Keil'
|
||||
PLATFORM = 'gcc'
|
||||
EXEC_PATH = 'E:/Program Files/CodeSourcery/Sourcery G++ Lite/bin'
|
||||
#PLATFORM = 'armcc'
|
||||
#EXEC_PATH = 'E:/Keil'
|
||||
BUILD = 'debug'
|
||||
|
||||
if PLATFORM == 'gcc':
|
||||
|
@ -38,15 +38,15 @@ if PLATFORM == 'gcc':
|
|||
AS = PREFIX + 'gcc'
|
||||
AR = PREFIX + 'ar'
|
||||
LINK = PREFIX + 'gcc'
|
||||
TARGET_EXT = 'elf'
|
||||
TARGET_EXT = 'axf'
|
||||
SIZE = PREFIX + 'size'
|
||||
OBJDUMP = PREFIX + 'objdump'
|
||||
OBJCPY = PREFIX + 'objcopy'
|
||||
|
||||
DEVICE = ' -mcpu=arm920t'
|
||||
CFLAGS = DEVICE + ' -Dsourcerygxx' + ' -nostdinc'
|
||||
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
|
||||
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=main.elf.map,-cref,-u,Reset_Handler -T mini2440_ram.ld'
|
||||
CFLAGS = DEVICE + ' -DRT_USING_MINILIBC' + ' -nostdinc -nostdlib -fno-builtin'
|
||||
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp' + ' -DTEXT_BASE=' + TextBase
|
||||
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=main.elf.map,-cref,-u,_start -T mini2440_ram.ld' + ' -Ttext ' + TextBase
|
||||
|
||||
CPATH = ''
|
||||
LPATH = ''
|
||||
|
@ -89,6 +89,7 @@ elif PLATFORM == 'armcc':
|
|||
|
||||
RT_USING_MINILIBC = False
|
||||
if RT_USING_FINSH:
|
||||
CFLAGS += ' -D FINSH_USING_SYMTAB -DFINSH_USING_DESCRIPTION'
|
||||
LFLAGS += ' --keep __fsym_* --keep __vsym_*'
|
||||
if RT_USING_WEBSERVER:
|
||||
CFLAGS += ' -DWEBS -DUEMF -DRTT -D__NO_FCNTL=1 -DRT_USING_WEBSERVER'
|
||||
|
|
|
@ -48,10 +48,34 @@ extern struct rt_device uart0_device;
|
|||
extern int Image$$ER_ZI$$ZI$$Base;
|
||||
extern int Image$$ER_ZI$$ZI$$Length;
|
||||
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;
|
||||
#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
|
||||
extern void finsh_system_init(void);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <rtthread.h>
|
||||
#include <dfs_posix.h>
|
||||
#include <lwip/sockets.h>
|
||||
#include <time.h>
|
||||
|
||||
#define FTP_PORT 21
|
||||
#define FTP_SRV_ROOT "/"
|
||||
|
|
|
@ -59,6 +59,11 @@ typedef rt_uint32_t mem_ptr_t;
|
|||
#define LWIP_PROVIDE_ERRNO
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_MINILIBC
|
||||
#include <time.h>
|
||||
#define LWIP_TIMEVAL_PRIVATE 0
|
||||
#endif
|
||||
|
||||
#if defined(__CC_ARM) /* ARMCC compiler */
|
||||
#define PACK_STRUCT_FIELD(x) x
|
||||
#define PACK_STRUCT_STRUCT __attribute__ ((__packed__))
|
||||
|
@ -76,10 +81,10 @@ typedef rt_uint32_t mem_ptr_t;
|
|||
#define PACK_STRUCT_BEGIN
|
||||
#define PACK_STRUCT_END
|
||||
#endif
|
||||
|
||||
|
||||
void sys_arch_assert(const char* file, int line);
|
||||
#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_PROTECT(x)
|
||||
|
|
|
@ -23,6 +23,7 @@ common/image_hdc.c
|
|||
common/region.c
|
||||
common/hz12font.c
|
||||
common/hz16font.c
|
||||
common/font_hz_bmp.c
|
||||
""")
|
||||
|
||||
server_src = Split("""
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
|
||||
#include <rtgui/dc.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_get_metrics(struct rtgui_font* font, const rt_uint8_t* text, rtgui_rect_t* rect);
|
||||
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->y2 = bmp_font->height;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -16746,7 +16746,7 @@ struct rtgui_font rtgui_font_hz16 =
|
|||
16, /* height */
|
||||
1, /* refer count */
|
||||
&hz_bmp_font_engine,/* font engine */
|
||||
&hz16, /* font private data */
|
||||
(void *)&hz16, /* font private data */
|
||||
};
|
||||
|
||||
/* size = 267616 bytes */
|
||||
|
|
|
@ -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;
|
||||
|
||||
rtgui_event_dump(tid, event);
|
||||
if (event->type != RTGUI_EVENT_TIMER)
|
||||
rt_kprintf("event size: %d\n", event_size);
|
||||
/* if (event->type != RTGUI_EVENT_TIMER)
|
||||
rt_kprintf("event size: %d\n", event_size); */
|
||||
|
||||
/* find rtgui_thread */
|
||||
thread = (struct rtgui_thread*) (tid->user_data);
|
||||
|
|
|
@ -29,11 +29,12 @@
|
|||
#define RTGUI_USING_STDIO_FILERW
|
||||
#define RTGUI_IMAGE_PNG
|
||||
#define RTGUI_IMAGE_JPEG
|
||||
|
||||
#define RTGUI_USING_FONT12
|
||||
#else
|
||||
#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
|
||||
|
||||
// #define RTGUI_USING_SMALL_SIZE
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
char *ptr;
|
||||
rt_uint8_t *ptr;
|
||||
ptr = strrchr(view->current_directory, PATH_SEPARATOR);
|
||||
|
||||
if (ptr == RT_NULL) return RT_FALSE;
|
||||
|
|
Loading…
Reference in New Issue