summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbernard.xiong <[email protected]>2010-04-14 00:40:20 +0000
committerbernard.xiong <[email protected]>2010-04-14 00:40:20 +0000
commit23ea4f1b742ecb794e4ee657bfc1a3db0382bbcd (patch)
tree744e290790e9b407d0f6d8919ff77cc9705e705a
parent2fcd4bccbdc9ebc00ba4de3d4dd9327b325545bc (diff)
add __ICCM16C__ compiler support.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@621 bbd45198-f89e-11dd-88c7-29a3b14d5316
-rw-r--r--finsh/cmd.c24
-rw-r--r--finsh/finsh.h10
-rw-r--r--finsh/finsh_heap.c2
-rw-r--r--finsh/shell.c7
-rw-r--r--include/rtdef.h5
-rw-r--r--src/scheduler.c2
-rw-r--r--src/thread.c6
-rw-r--r--src/timer.c2
8 files changed, 32 insertions, 26 deletions
diff --git a/finsh/cmd.c b/finsh/cmd.c
index 023ea5a38b..e0e68a6ec8 100644
--- a/finsh/cmd.c
+++ b/finsh/cmd.c
@@ -48,7 +48,7 @@ rt_inline unsigned int rt_list_len(const rt_list_t *l)
return len;
}
-long hello()
+long hello(void)
{
rt_kprintf("Hello RT-Thread!\n");
@@ -57,7 +57,7 @@ long hello()
FINSH_FUNCTION_EXPORT(hello, say hello world);
extern void rt_show_version(void);
-long version()
+long version(void)
{
rt_show_version();
@@ -69,7 +69,7 @@ FINSH_FUNCTION_EXPORT(version, show RT-Thread version information);
((type *)((char *)(node) - (unsigned long)(&((type *)0)->member)))
extern struct rt_object_information rt_object_container[];
-int list_thread()
+long list_thread(void)
{
struct rt_thread *thread;
struct rt_list_node *list, *node;
@@ -117,7 +117,7 @@ static void show_wait_queue(struct rt_list_node* list)
}
#ifdef RT_USING_SEMAPHORE
-int list_sem()
+long list_sem(void)
{
struct rt_semaphore *sem;
struct rt_list_node *list, *node;
@@ -147,7 +147,7 @@ FINSH_FUNCTION_EXPORT(list_sem, list semaphone in system)
#endif
#ifdef RT_USING_EVENT
-int list_event()
+long list_event(void)
{
struct rt_event *e;
struct rt_list_node *list, *node;
@@ -168,7 +168,7 @@ FINSH_FUNCTION_EXPORT(list_event, list event in system)
#endif
#ifdef RT_USING_MUTEX
-int list_mutex()
+long list_mutex(void)
{
struct rt_mutex *m;
struct rt_list_node *list, *node;
@@ -189,7 +189,7 @@ FINSH_FUNCTION_EXPORT(list_mutex, list mutex in system)
#endif
#ifdef RT_USING_MAILBOX
-int list_mailbox()
+long list_mailbox(void)
{
struct rt_mailbox *m;
struct rt_list_node *list, *node;
@@ -219,7 +219,7 @@ FINSH_FUNCTION_EXPORT(list_mailbox, list mail box in system)
#endif
#ifdef RT_USING_MESSAGEQUEUE
-int list_msgqueue()
+long list_msgqueue(void)
{
struct rt_messagequeue *m;
struct rt_list_node *list, *node;
@@ -249,7 +249,7 @@ FINSH_FUNCTION_EXPORT(list_msgqueue, list message queue in system)
#endif
#ifdef RT_USING_MEMPOOL
-int list_mempool()
+long list_mempool(void)
{
struct rt_mempool *mp;
struct rt_list_node *list, *node;
@@ -282,7 +282,7 @@ int list_mempool()
FINSH_FUNCTION_EXPORT(list_mempool, list memory pool in system)
#endif
-int list_timer()
+long list_timer(void)
{
struct rt_timer *timer;
struct rt_list_node *list, *node;
@@ -306,7 +306,7 @@ int list_timer()
FINSH_FUNCTION_EXPORT(list_timer, list timer in system)
#ifdef RT_USING_DEVICE
-int list_device()
+long list_device(void)
{
struct rt_device *device;
struct rt_list_node *list, *node;
@@ -337,7 +337,7 @@ FINSH_FUNCTION_EXPORT(list_device, list device in system)
#endif
#ifdef RT_USING_MODULE
-int list_module()
+int list_module(void)
{
struct rt_module *module;
struct rt_list_node *list, *node;
diff --git a/finsh/finsh.h b/finsh/finsh.h
index af41b50c6c..6cd5233028 100644
--- a/finsh/finsh.h
+++ b/finsh/finsh.h
@@ -64,7 +64,7 @@ typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned long u_long;
-#if !defined(__CC_ARM) && !defined(__ICCARM__)
+#if !defined(__CC_ARM) && !defined(__ICCARM__) && !defined(__ICCM16C__)
typedef unsigned int size_t;
#ifndef NULL
@@ -81,9 +81,9 @@ char *strdup(const char *s);
int isalpha( int ch );
int atoi(const char* s);
-#else
-/* use libc of armcc */
-#include <ctype.h>
+#else
+/* use libc of armcc */
+#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#endif
@@ -283,7 +283,7 @@ int finsh_flush(struct finsh_parser* parser);
int finsh_reset(struct finsh_parser* parser);
#ifdef RT_USING_DEVICE
/* set finsh device */
-void finsh_set_device(char* device_name);
+void finsh_set_device(const char* device_name);
#endif
/* run finsh parser to generate abstract synatx tree */
diff --git a/finsh/finsh_heap.c b/finsh/finsh_heap.c
index 65449c414b..e0a23a2b14 100644
--- a/finsh/finsh_heap.c
+++ b/finsh/finsh_heap.c
@@ -36,7 +36,7 @@ static void finsh_block_remove(struct finsh_block_header** list, struct finsh_bl
static void finsh_block_split(struct finsh_block_header* header, size_t size);
static void finsh_block_merge(struct finsh_block_header** list, struct finsh_block_header* header);
-int finsh_heap_init()
+int finsh_heap_init(void)
{
/* clear heap to zero */
memset(&finsh_heap[0], 0, sizeof(finsh_heap));
diff --git a/finsh/shell.c b/finsh/shell.c
index 18ea6d5865..614563c593 100644
--- a/finsh/shell.c
+++ b/finsh/shell.c
@@ -115,7 +115,7 @@ char *strdup(const char *s)
}
#endif
-#if !defined(__CC_ARM) && !defined(__ICCARM__)
+#if !defined(__CC_ARM) && !defined(__ICCARM__) && !defined(__ICCM16C__)
int isalpha( int ch )
{
return (unsigned int)((ch | 0x20) - 'a') < 26u;
@@ -156,7 +156,7 @@ static rt_err_t finsh_rx_ind(rt_device_t dev, rt_size_t size)
return RT_EOK;
}
-void finsh_set_device(char* device_name)
+void finsh_set_device(const char* device_name)
{
rt_device_t dev = RT_NULL;
@@ -187,6 +187,7 @@ void finsh_auto_complete(char* prefix)
rt_kprintf("finsh>>%s", prefix);
}
+extern const char* finsh_error_string_table[];
void finsh_run_line(struct finsh_parser *parser, const char* line)
{
rt_kprintf("\n");
@@ -417,7 +418,7 @@ void finsh_system_var_init(void* begin, void* end)
}
/* init finsh */
-void finsh_system_init()
+void finsh_system_init(void)
{
rt_sem_init(&uart_sem, "uart", 0, 0);
diff --git a/include/rtdef.h b/include/rtdef.h
index d3868ae8d3..8307ff666c 100644
--- a/include/rtdef.h
+++ b/include/rtdef.h
@@ -91,6 +91,11 @@ typedef rt_uint32_t rt_off_t; /* Type for offset. */
#define UNUSED __attribute__((unused))
#define ALIGN(n) __attribute__((aligned(n)))
#define rt_inline static __inline
+#elif defined (__ICCM16C__) /* for IAR EW M16C Compiler */
+ #include <stdarg.h>
+ #define SECTION(x) @ x
+ #define UNUSED
+ #define rt_inline inline
#endif
/* event length */
diff --git a/src/scheduler.c b/src/scheduler.c
index a414840850..fdfd4289e1 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -29,7 +29,7 @@
/* #define SCHEDULER_DEBUG */
static rt_int16_t rt_scheduler_lock_nest;
-extern rt_uint32_t rt_interrupt_nest;
+extern volatile rt_uint8_t rt_interrupt_nest;
rt_list_t rt_thread_priority_table[RT_THREAD_PRIORITY_MAX];
struct rt_thread* rt_current_thread;
diff --git a/src/thread.c b/src/thread.c
index b8859f9a0c..d7320e3de0 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -212,10 +212,10 @@ rt_err_t rt_thread_startup (rt_thread_t thread)
/* calculate priority attribute */
#if RT_THREAD_PRIORITY_MAX > 32
thread->number = thread->current_priority >> 3; /* 5bit */
- thread->number_mask = 1 << thread->number;
- thread->high_mask = 1 << (thread->current_priority & 0x07); /* 3bit */
+ thread->number_mask = 1L << thread->number;
+ thread->high_mask = 1L << (thread->current_priority & 0x07); /* 3bit */
#else
- thread->number_mask = 1 << thread->current_priority;
+ thread->number_mask = 1L << thread->current_priority; //1L means long int,fixed compile mistake with IAR EW M16C v3.401,fify 20100410
#endif
#ifdef THREAD_DEBUG
diff --git a/src/timer.c b/src/timer.c
index a8e1f9b479..33efcbd22a 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -346,7 +346,7 @@ rt_err_t rt_timer_control(rt_timer_t timer, rt_uint8_t cmd, void* arg)
#ifdef RT_USING_TIMER_SOFT
void rt_soft_timer_tick_increase (void);
#endif
-void rt_timer_check()
+void rt_timer_check(void)
{
rt_tick_t current_tick;
rt_list_t *n;