1
0
Эх сурвалжийг харах

add __ICCM16C__ compiler support.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@621 bbd45198-f89e-11dd-88c7-29a3b14d5316
bernard.xiong 15 жил өмнө
parent
commit
23ea4f1b74
8 өөрчлөгдсөн 32 нэмэгдсэн , 26 устгасан
  1. 12 12
      finsh/cmd.c
  2. 5 5
      finsh/finsh.h
  3. 1 1
      finsh/finsh_heap.c
  4. 4 3
      finsh/shell.c
  5. 5 0
      include/rtdef.h
  6. 1 1
      src/scheduler.c
  7. 3 3
      src/thread.c
  8. 1 1
      src/timer.c

+ 12 - 12
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;

+ 5 - 5
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 */

+ 1 - 1
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));

+ 4 - 3
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);
 

+ 5 - 0
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 			*/

+ 1 - 1
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;

+ 3 - 3
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

+ 1 - 1
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;