summaryrefslogtreecommitdiff
path: root/bsp/upd70f3454
diff options
context:
space:
mode:
author[email protected] <[email protected]>2012-09-25 04:18:24 +0000
committer[email protected] <[email protected]>2012-09-25 04:18:24 +0000
commitc784dd2ed84f9bc771e82603b07cf55d8984b3f3 (patch)
tree9f6d447f5d20a05ee515b8b238dd591e0e2301a6 /bsp/upd70f3454
parent6dcb1207b1f45fb876725aace3d78f6c96250fb5 (diff)
update V850 BSP, now supporting scons + IAR
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2306 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'bsp/upd70f3454')
-rw-r--r--bsp/upd70f3454/SConscript12
-rw-r--r--bsp/upd70f3454/SConstruct37
-rw-r--r--bsp/upd70f3454/applications/SConscript9
-rw-r--r--bsp/upd70f3454/applications/application.c (renamed from bsp/upd70f3454/application.c)34
-rw-r--r--bsp/upd70f3454/applications/startup.c (renamed from bsp/upd70f3454/startup.c)220
-rw-r--r--bsp/upd70f3454/drivers/CG_macrodriver.h (renamed from bsp/upd70f3454/applilet3_src/CG_macrodriver.h)0
-rw-r--r--bsp/upd70f3454/drivers/CG_port.c (renamed from bsp/upd70f3454/applilet3_src/CG_port.c)0
-rw-r--r--bsp/upd70f3454/drivers/CG_port.h (renamed from bsp/upd70f3454/applilet3_src/CG_port.h)0
-rw-r--r--bsp/upd70f3454/drivers/CG_port_user.c (renamed from bsp/upd70f3454/applilet3_src/CG_port_user.c)0
-rw-r--r--bsp/upd70f3454/drivers/CG_system.c (renamed from bsp/upd70f3454/applilet3_src/CG_system.c)0
-rw-r--r--bsp/upd70f3454/drivers/CG_system.h (renamed from bsp/upd70f3454/applilet3_src/CG_system.h)0
-rw-r--r--bsp/upd70f3454/drivers/CG_system_user.c (renamed from bsp/upd70f3454/applilet3_src/CG_system_user.c)0
-rw-r--r--bsp/upd70f3454/drivers/CG_systeminit.c (renamed from bsp/upd70f3454/applilet3_src/CG_systeminit.c)0
-rw-r--r--bsp/upd70f3454/drivers/CG_timer.c (renamed from bsp/upd70f3454/applilet3_src/CG_timer.c)0
-rw-r--r--bsp/upd70f3454/drivers/CG_timer.h (renamed from bsp/upd70f3454/applilet3_src/CG_timer.h)0
-rw-r--r--bsp/upd70f3454/drivers/CG_timer_user.c (renamed from bsp/upd70f3454/applilet3_src/CG_timer_user.c)0
-rw-r--r--bsp/upd70f3454/drivers/CG_userdefine.h (renamed from bsp/upd70f3454/applilet3_src/CG_userdefine.h)0
-rw-r--r--bsp/upd70f3454/drivers/SConscript19
-rw-r--r--bsp/upd70f3454/drivers/board.c (renamed from bsp/upd70f3454/board.c)9
-rw-r--r--bsp/upd70f3454/drivers/board.h (renamed from bsp/upd70f3454/board.h)0
-rw-r--r--bsp/upd70f3454/drivers/cstartup.asm (renamed from bsp/upd70f3454/cstartup.s85)0
-rw-r--r--bsp/upd70f3454/drivers/io70f3454.h (renamed from bsp/upd70f3454/io70f3454.h)0
-rw-r--r--bsp/upd70f3454/drivers/uart.c247
-rw-r--r--bsp/upd70f3454/drivers/uart.h (renamed from bsp/upd70f3454/uart.h)0
-rw-r--r--bsp/upd70f3454/lnk70f3454.xcl2
-rw-r--r--bsp/upd70f3454/project.ewp (renamed from bsp/upd70f3454/upd70f3454.ewp)191
-rw-r--r--bsp/upd70f3454/project.eww (renamed from bsp/upd70f3454/upd70f3454.eww)18
-rw-r--r--bsp/upd70f3454/rtconfig.h63
-rw-r--r--bsp/upd70f3454/rtconfig.py111
-rw-r--r--bsp/upd70f3454/template.ewp1662
-rw-r--r--bsp/upd70f3454/uart.c247
31 files changed, 2312 insertions, 569 deletions
diff --git a/bsp/upd70f3454/SConscript b/bsp/upd70f3454/SConscript
new file mode 100644
index 0000000000..d9c64eb9f9
--- /dev/null
+++ b/bsp/upd70f3454/SConscript
@@ -0,0 +1,12 @@
+from building import *
+
+cwd = GetCurrentDir()
+objs = []
+list = os.listdir(cwd)
+
+for d in list:
+ path = os.path.join(cwd, d)
+ if os.path.isfile(os.path.join(path, 'SConscript')):
+ objs = objs + SConscript(os.path.join(d, 'SConscript'))
+
+Return('objs')
diff --git a/bsp/upd70f3454/SConstruct b/bsp/upd70f3454/SConstruct
new file mode 100644
index 0000000000..c71993c4ec
--- /dev/null
+++ b/bsp/upd70f3454/SConstruct
@@ -0,0 +1,37 @@
+import os
+import sys
+import rtconfig
+
+if os.getenv('RTT_ROOT'):
+ RTT_ROOT = os.getenv('RTT_ROOT')
+else:
+ RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
+
+sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
+from building import *
+
+TARGET = 'rtthread.' + rtconfig.TARGET_EXT
+
+env = Environment(tools = ['mingw'],
+ AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
+ CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
+ AR = rtconfig.AR, ARFLAGS = '-rc',
+ LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
+env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
+
+if rtconfig.PLATFORM == 'iar':
+ env.Replace(CCCOM = ['$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
+ env.Replace(LINKCOM = ['$LINK $SOURCES $LINKFLAGS -f lnk70f3454.xcl -l rtthread.map -Omotorola-s28=$TARGET'])
+ env.Replace(ARFLAGS = '')
+
+Export('RTT_ROOT')
+Export('rtconfig')
+
+# prepare building environment
+objs = PrepareBuilding(env, RTT_ROOT)
+
+# build program
+env.Program(TARGET, objs)
+
+# end building
+EndBuilding(TARGET)
diff --git a/bsp/upd70f3454/applications/SConscript b/bsp/upd70f3454/applications/SConscript
new file mode 100644
index 0000000000..4fe38ed0cf
--- /dev/null
+++ b/bsp/upd70f3454/applications/SConscript
@@ -0,0 +1,9 @@
+from building import *
+
+cwd = GetCurrentDir()
+src = Glob('*.c')
+CPPPATH = [cwd, str(Dir('#'))]
+
+group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/bsp/upd70f3454/application.c b/bsp/upd70f3454/applications/application.c
index 3901585f2d..1e1aae5415 100644
--- a/bsp/upd70f3454/application.c
+++ b/bsp/upd70f3454/applications/application.c
@@ -1,7 +1,7 @@
/*
* File : application.c
* This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2009, RT-Thread Development Team
+ * COPYRIGHT (C) 2009 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
@@ -28,19 +28,15 @@
static struct rt_thread led;
-#if defined(__ICCM16C__) || defined(__ICCV850__)
-#pragma data_alignment=4
-#endif
+ALIGN(RT_ALIGN_SIZE)
static rt_uint8_t led_stack[256];
-static void rt_thread_entry_led(void* parameter)
+static void rt_thread_entry_led(void *parameter)
{
while (1)
{
- /* led off */
led_off();
- rt_thread_delay(20); /* sleep 1 second and switch to other thread */
- /* led on */
+ rt_thread_delay(20);
led_on();
rt_thread_delay(40);
}
@@ -48,15 +44,19 @@ static void rt_thread_entry_led(void* parameter)
int rt_application_init(void)
{
- /* create led thread */
- rt_thread_init(&led,
- "led",
- rt_thread_entry_led, RT_NULL,
- &led_stack[0], sizeof(led_stack),
- 5, 32);
-
- if (&led != RT_NULL)
+ rt_err_t result;
+
+ result = rt_thread_init(&led,
+ "led",
+ rt_thread_entry_led,
+ RT_NULL,
+ &led_stack[0],
+ sizeof(led_stack),
+ RT_THREAD_PRIORITY_MAX / 2,
+ 32);
+
+ if (result == RT_EOK)
rt_thread_startup(&led);
-
+
return 0;
}
diff --git a/bsp/upd70f3454/startup.c b/bsp/upd70f3454/applications/startup.c
index d4f856c07a..f609fc7cbb 100644
--- a/bsp/upd70f3454/startup.c
+++ b/bsp/upd70f3454/applications/startup.c
@@ -1,110 +1,110 @@
-/*
- * File : startup.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2009, RT-Thread Development Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
- *
- * Change Logs:
- * Date Author Notes
- * 2009-01-05 Bernard first implementation
- * 2010-06-29 lgnq for V850
- */
-
-#include <rthw.h>
-#include <rtthread.h>
-
-#include "board.h"
-
-#include "CG_macrodriver.h"
-#include "CG_system.h"
-#include "CG_port.h"
-#include "CG_timer.h"
-/* Start user code for include. Do not edit comment generated here */
-/* End user code. Do not edit comment generated here */
-#include "CG_userdefine.h"
-
-extern int rt_application_init(void);
-
-#ifdef RT_USING_FINSH
-extern void finsh_system_init(void);
-extern void finsh_set_device(const char* device);
-#endif
-
-#ifdef RT_USING_HEAP
-#ifdef __ICCV850__
-#pragma section="RT_HEAP"
-#endif
-#endif
-
-/**
- * This function will startup RT-Thread RTOS.
- */
-void rtthread_startup(void)
-{
- /* init board */
- rt_hw_board_init();
-
- /* show version */
- rt_show_version();
-
- /* init tick */
- rt_system_tick_init();
-
- /* init kernel object */
- rt_system_object_init();
-
- /* init timer system */
- rt_system_timer_init();
-
-#ifdef RT_USING_HEAP
-#ifdef __ICCV850__
- rt_system_heap_init(__segment_begin("RT_HEAP"),__segment_end("RT_HEAP"));
-#endif
-#endif
-
- /* init scheduler system */
- rt_system_scheduler_init();
-
-#ifdef RT_USING_DEVICE
- /* init all device */
- rt_device_init_all();
-#endif
-
- /* init application */
- rt_application_init();
-
-#ifdef RT_USING_FINSH
- /* init finsh */
- finsh_system_init();
- finsh_set_device("uart0");
-#endif
-
- /* init timer thread */
- rt_system_timer_thread_init();
-
- /* init idle thread */
- rt_thread_idle_init();
-
- /* start scheduler */
- rt_system_scheduler_start();
-
- /* never reach here */
- return ;
-}
-
-int main(void)
-{
- /* disable interrupt first */
- rt_hw_interrupt_disable();
-
- /* init system setting */
- TAB0_Start();
-
- /* startup RT-Thread RTOS */
- rtthread_startup();
-
- return 0;
-}
+/*
+ * File : startup.c
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2009 - 2012, RT-Thread Development Team
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rt-thread.org/license/LICENSE
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2009-01-05 Bernard first implementation
+ * 2010-06-29 lgnq for V850
+ */
+
+#include <rthw.h>
+#include <rtthread.h>
+
+#include "board.h"
+
+#include "CG_macrodriver.h"
+#include "CG_system.h"
+#include "CG_port.h"
+#include "CG_timer.h"
+/* Start user code for include. Do not edit comment generated here */
+/* End user code. Do not edit comment generated here */
+#include "CG_userdefine.h"
+
+extern int rt_application_init(void);
+
+#ifdef RT_USING_FINSH
+extern void finsh_system_init(void);
+extern void finsh_set_device(const char *device);
+#endif
+
+#ifdef RT_USING_HEAP
+#ifdef __ICCV850__
+#pragma section="RT_HEAP"
+#endif
+#endif
+
+/**
+ * This function will startup RT-Thread RTOS.
+ */
+void rtthread_startup(void)
+{
+ /* init board */
+ rt_hw_board_init();
+
+ /* show version */
+ rt_show_version();
+
+ /* init tick */
+ rt_system_tick_init();
+
+ /* init kernel object */
+ rt_system_object_init();
+
+ /* init timer system */
+ rt_system_timer_init();
+
+#ifdef RT_USING_HEAP
+#ifdef __ICCV850__
+ rt_system_heap_init(__segment_begin("RT_HEAP"), __segment_end("RT_HEAP"));
+#endif
+#endif
+
+ /* init scheduler system */
+ rt_system_scheduler_init();
+
+#ifdef RT_USING_DEVICE
+ /* init all device */
+ rt_device_init_all();
+#endif
+
+ /* init application */
+ rt_application_init();
+
+#ifdef RT_USING_FINSH
+ /* init finsh */
+ finsh_system_init();
+ finsh_set_device("uart0");
+#endif
+
+ /* init timer thread */
+ rt_system_timer_thread_init();
+
+ /* init idle thread */
+ rt_thread_idle_init();
+
+ /* start scheduler */
+ rt_system_scheduler_start();
+
+ /* never reach here */
+ return ;
+}
+
+int main(void)
+{
+ /* disable interrupt first */
+ rt_hw_interrupt_disable();
+
+ /* init system setting */
+ TAB0_Start();
+
+ /* startup RT-Thread RTOS */
+ rtthread_startup();
+
+ return 0;
+}
diff --git a/bsp/upd70f3454/applilet3_src/CG_macrodriver.h b/bsp/upd70f3454/drivers/CG_macrodriver.h
index 748a140a20..748a140a20 100644
--- a/bsp/upd70f3454/applilet3_src/CG_macrodriver.h
+++ b/bsp/upd70f3454/drivers/CG_macrodriver.h
diff --git a/bsp/upd70f3454/applilet3_src/CG_port.c b/bsp/upd70f3454/drivers/CG_port.c
index 526f163f5a..526f163f5a 100644
--- a/bsp/upd70f3454/applilet3_src/CG_port.c
+++ b/bsp/upd70f3454/drivers/CG_port.c
diff --git a/bsp/upd70f3454/applilet3_src/CG_port.h b/bsp/upd70f3454/drivers/CG_port.h
index 91328c9661..91328c9661 100644
--- a/bsp/upd70f3454/applilet3_src/CG_port.h
+++ b/bsp/upd70f3454/drivers/CG_port.h
diff --git a/bsp/upd70f3454/applilet3_src/CG_port_user.c b/bsp/upd70f3454/drivers/CG_port_user.c
index d44e5fa283..d44e5fa283 100644
--- a/bsp/upd70f3454/applilet3_src/CG_port_user.c
+++ b/bsp/upd70f3454/drivers/CG_port_user.c
diff --git a/bsp/upd70f3454/applilet3_src/CG_system.c b/bsp/upd70f3454/drivers/CG_system.c
index 441048a5fa..441048a5fa 100644
--- a/bsp/upd70f3454/applilet3_src/CG_system.c
+++ b/bsp/upd70f3454/drivers/CG_system.c
diff --git a/bsp/upd70f3454/applilet3_src/CG_system.h b/bsp/upd70f3454/drivers/CG_system.h
index 0413bb3896..0413bb3896 100644
--- a/bsp/upd70f3454/applilet3_src/CG_system.h
+++ b/bsp/upd70f3454/drivers/CG_system.h
diff --git a/bsp/upd70f3454/applilet3_src/CG_system_user.c b/bsp/upd70f3454/drivers/CG_system_user.c
index 6b64abd79e..6b64abd79e 100644
--- a/bsp/upd70f3454/applilet3_src/CG_system_user.c
+++ b/bsp/upd70f3454/drivers/CG_system_user.c
diff --git a/bsp/upd70f3454/applilet3_src/CG_systeminit.c b/bsp/upd70f3454/drivers/CG_systeminit.c
index 78b6fba073..78b6fba073 100644
--- a/bsp/upd70f3454/applilet3_src/CG_systeminit.c
+++ b/bsp/upd70f3454/drivers/CG_systeminit.c
diff --git a/bsp/upd70f3454/applilet3_src/CG_timer.c b/bsp/upd70f3454/drivers/CG_timer.c
index bf2c928769..bf2c928769 100644
--- a/bsp/upd70f3454/applilet3_src/CG_timer.c
+++ b/bsp/upd70f3454/drivers/CG_timer.c
diff --git a/bsp/upd70f3454/applilet3_src/CG_timer.h b/bsp/upd70f3454/drivers/CG_timer.h
index 85c88dddd7..85c88dddd7 100644
--- a/bsp/upd70f3454/applilet3_src/CG_timer.h
+++ b/bsp/upd70f3454/drivers/CG_timer.h
diff --git a/bsp/upd70f3454/applilet3_src/CG_timer_user.c b/bsp/upd70f3454/drivers/CG_timer_user.c
index fabc547b7d..fabc547b7d 100644
--- a/bsp/upd70f3454/applilet3_src/CG_timer_user.c
+++ b/bsp/upd70f3454/drivers/CG_timer_user.c
diff --git a/bsp/upd70f3454/applilet3_src/CG_userdefine.h b/bsp/upd70f3454/drivers/CG_userdefine.h
index 33f5b2e773..33f5b2e773 100644
--- a/bsp/upd70f3454/applilet3_src/CG_userdefine.h
+++ b/bsp/upd70f3454/drivers/CG_userdefine.h
diff --git a/bsp/upd70f3454/drivers/SConscript b/bsp/upd70f3454/drivers/SConscript
new file mode 100644
index 0000000000..1558ca856e
--- /dev/null
+++ b/bsp/upd70f3454/drivers/SConscript
@@ -0,0 +1,19 @@
+from building import *
+import rtconfig
+
+cwd = GetCurrentDir()
+src_c = Glob('*.c')
+
+# add for startup script
+if rtconfig.CROSS_TOOL == 'gcc':
+ src_asm = ['start_gcc.S', 'vectors_gcc.S', 'interrupts_gcc.S']
+elif rtconfig.CROSS_TOOL == 'iar':
+ src_asm = ['cstartup.asm']
+
+src = File(src_c + src_asm)
+
+CPPPATH = [cwd]
+
+group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/bsp/upd70f3454/board.c b/bsp/upd70f3454/drivers/board.c
index 9209439cb6..d15c5005d3 100644
--- a/bsp/upd70f3454/board.c
+++ b/bsp/upd70f3454/drivers/board.c
@@ -1,7 +1,7 @@
/*
* File : board.c
* This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2009, RT-Thread Development Team
+ * COPYRIGHT (C) 2009 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
@@ -21,13 +21,12 @@
#include "uart.h"
#include "board.h"
-void rt_hw_board_init()
+void rt_hw_board_init(void)
{
#ifdef RT_USING_UART0
- rt_hw_uart_init();
- rt_console_set_device("uart0");
+ rt_hw_uart_init();
+ rt_console_set_device("uart0");
#endif
rt_kprintf("\r\n\r\nSystemInit......\r\n");
}
-
diff --git a/bsp/upd70f3454/board.h b/bsp/upd70f3454/drivers/board.h
index f2e2cb0724..f2e2cb0724 100644
--- a/bsp/upd70f3454/board.h
+++ b/bsp/upd70f3454/drivers/board.h
diff --git a/bsp/upd70f3454/cstartup.s85 b/bsp/upd70f3454/drivers/cstartup.asm
index fc3d8d9224..fc3d8d9224 100644
--- a/bsp/upd70f3454/cstartup.s85
+++ b/bsp/upd70f3454/drivers/cstartup.asm
diff --git a/bsp/upd70f3454/io70f3454.h b/bsp/upd70f3454/drivers/io70f3454.h
index 07d44dca4d..07d44dca4d 100644
--- a/bsp/upd70f3454/io70f3454.h
+++ b/bsp/upd70f3454/drivers/io70f3454.h
diff --git a/bsp/upd70f3454/drivers/uart.c b/bsp/upd70f3454/drivers/uart.c
new file mode 100644
index 0000000000..0e6d0a63f5
--- /dev/null
+++ b/bsp/upd70f3454/drivers/uart.c
@@ -0,0 +1,247 @@
+/*
+ * File : board.c
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2009 - 2012 RT-Thread Develop Team
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rt-thread.org/license/LICENSE
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2010-03-08 Bernard The first version for LPC17xx
+ * 2010-06-29 lgnq Modified for V850
+*/
+
+#include <rthw.h>
+#include <rtthread.h>
+#include "io70f3454.h"
+#include "uart.h"
+
+#if defined(RT_USING_UART0) && defined(RT_USING_DEVICE)
+
+struct rt_uart_v850
+{
+ struct rt_device parent;
+
+ /* buffer for reception */
+ rt_uint8_t read_index, save_index;
+ rt_uint8_t rx_buffer[RT_UART_RX_BUFFER_SIZE];
+}uart_device;
+
+void uarta1_receive_handler(void)
+{
+ rt_ubase_t level;
+ rt_uint8_t c;
+
+ struct rt_uart_v850 *uart = &uart_device;
+
+// while(ri_u0c1 == 0)
+// ;
+ c = (char) UA1RX;
+
+ /* Receive Data Available */
+ uart->rx_buffer[uart->save_index] = c;
+
+ level = rt_hw_interrupt_disable();
+ uart->save_index ++;
+ if (uart->save_index >= RT_UART_RX_BUFFER_SIZE)
+ uart->save_index = 0;
+ rt_hw_interrupt_enable(level);
+
+ /* invoke callback */
+ if (uart->parent.rx_indicate != RT_NULL)
+ {
+ rt_size_t length;
+ if (uart->read_index > uart->save_index)
+ length = RT_UART_RX_BUFFER_SIZE - uart->read_index + uart->save_index;
+ else
+ length = uart->save_index - uart->read_index;
+
+ uart->parent.rx_indicate(&uart->parent, length);
+ }
+}
+
+static rt_err_t rt_uart_init (rt_device_t dev)
+{
+ UA1TXE = 0U; /* disable UARTA1 transmission operation */
+ UA1RXE = 0U; /* disable UARTA1 reception operation */
+ UA1PWR = 0U; /* disable UARTA1 operation */
+ UA1TMK = 1U; /* disable INTUA1T interrupt */
+ UA1TIF = 0U; /* clear INTUA1T interrupt flag */
+ UA1RMK = 1U; /* disable INTUA1R interrupt */
+ UA1RIF = 0U; /* clear INTUA1R interrupt flag */
+ /* Set INTUA1T level low priority */
+ UA1TIC |= 0x07U;
+ /* Set INTUA1R level low priority */
+ UA1RIC |= 0x07U;
+ //BAUDRATE = 9600
+ UA1CTL1 = _03_UARTA_BASECLK_FXX_16;
+ UA1CTL2 = _11_UARTA1_BASECLK_DIVISION;
+ UA1CTL0 = _10_UARTA_TRANSFDIR_LSB | _00_UARTA_PARITY_NONE | _02_UARTA_DATALENGTH_8BIT | _00_UARTA_STOPLENGTH_1BIT;
+ UA1OPT0 = _14_UARTA_UAnOPT0_INITIALVALUE | _00_UARTA_TRAN_DATALEVEL_NORMAL | _00_UARTA_REC_DATALEVEL_NORMAL;
+ UA1PWR = 1U; /* enable UARTA1 operation */
+ /* Set TXDA1 pin */
+ /* Set RXDA1 pin */
+ PFC3_bit.no0 = 0;
+ PFCE3_bit.no0 = 0;
+ PMC3_bit.no0 = 1;
+
+ PFC3_bit.no1 = 0;
+ PFCE3_bit.no1 = 0;
+ PMC3_bit.no1 = 1;
+
+ return RT_EOK;
+}
+
+static rt_err_t rt_uart_open(rt_device_t dev, rt_uint16_t oflag)
+{
+ RT_ASSERT(dev != RT_NULL);
+ if (dev->flag & RT_DEVICE_FLAG_INT_RX)
+ {
+ /* Enable the UART Interrupt */
+ UA1TIF = 0U; /* clear INTUA1T interrupt flag */
+ UA1TMK = 1U; /* disable INTUA1T interrupt */
+ UA1RIF = 0U; /* clear INTUA1R interrupt flag */
+ UA1RMK = 0U; /* enable INTUA1R interrupt */
+ UA1TXE = 1U; /* enable UARTA1 transmission operation */
+ UA1RXE = 1U; /* enable UARTA1 reception operation */
+ }
+
+ return RT_EOK;
+}
+
+static rt_err_t rt_uart_close(rt_device_t dev)
+{
+ RT_ASSERT(dev != RT_NULL);
+ if (dev->flag & RT_DEVICE_FLAG_INT_RX)
+ {
+ /* Disable the UART Interrupt */
+ UA1TXE = 0U; /* disable UARTA1 transmission operation */
+ UA1RXE = 0U; /* disable UARTA1 reception operation */
+ UA1TMK = 1U; /* disable INTUA1T interrupt */
+ UA1TIF = 0U; /* clear INTUA1T interrupt flag */
+ UA1RMK = 1U; /* disable INTUA1R interrupt */
+ UA1RIF = 0U; /* clear INTUA1R interrupt flag */
+ }
+
+ return RT_EOK;
+}
+
+static rt_size_t rt_uart_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
+{
+ rt_uint8_t *ptr;
+ struct rt_uart_v850 *uart = (struct rt_uart_v850 *)dev;
+ RT_ASSERT(uart != RT_NULL);
+
+ /* point to buffer */
+ ptr = (rt_uint8_t *)buffer;
+ if (dev->flag & RT_DEVICE_FLAG_INT_RX)
+ {
+ while (size)
+ {
+ /* interrupt receive */
+ rt_base_t level;
+
+ /* disable interrupt */
+ level = rt_hw_interrupt_disable();
+ if (uart->read_index != uart->save_index)
+ {
+ *ptr = uart->rx_buffer[uart->read_index];
+
+ uart->read_index ++;
+ if (uart->read_index >= RT_UART_RX_BUFFER_SIZE)
+ uart->read_index = 0;
+ }
+ else
+ {
+ /* no data in rx buffer */
+
+ /* enable interrupt */
+ rt_hw_interrupt_enable(level);
+ break;
+ }
+
+ /* enable interrupt */
+ rt_hw_interrupt_enable(level);
+
+ ptr ++;
+ size --;
+ }
+
+ return (rt_uint32_t)ptr - (rt_uint32_t)buffer;
+ }
+
+ return 0;
+}
+
+static rt_size_t rt_uart_write(rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size)
+{
+ char *ptr;
+ ptr = (char*)buffer;
+
+ if (dev->flag & RT_DEVICE_FLAG_STREAM)
+ {
+ /* stream mode */
+ while (size)
+ {
+ if (*ptr == '\n')
+ {
+ while (UA1TSF == 1U)
+ ;
+ UA1TX = '\r';
+ }
+
+ /* THRE status, contain valid data */
+ while (UA1TSF == 1U)
+ ;
+ UA1TX = *ptr;
+
+ ptr ++;
+ size --;
+ }
+ }
+ else
+ {
+ while (size != 0)
+ {
+ /* THRE status, contain valid data */
+ while (UA1TSF == 1U)
+ ;
+ UA1TX = *ptr;
+
+ ptr ++;
+ size --;
+ }
+ }
+
+ return (rt_size_t)ptr - (rt_size_t)buffer;
+}
+
+void rt_hw_uart_init(void)
+{
+ struct rt_uart_v850 *uart;
+
+ /* get uart device */
+ uart = &uart_device;
+
+ /* device initialization */
+ uart->parent.type = RT_Device_Class_Char;
+ rt_memset(uart->rx_buffer, 0, sizeof(uart->rx_buffer));
+ uart->read_index = uart->save_index = 0;
+
+ /* device interface */
+ uart->parent.init = rt_uart_init;
+ uart->parent.open = rt_uart_open;
+ uart->parent.close = rt_uart_close;
+ uart->parent.read = rt_uart_read;
+ uart->parent.write = rt_uart_write;
+ uart->parent.control = RT_NULL;
+ uart->parent.user_data = RT_NULL;
+
+ rt_device_register(&uart->parent,
+ "uart0", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STREAM | RT_DEVICE_FLAG_INT_RX);
+}
+#endif /* end of UART */
+
+/*@}*/
diff --git a/bsp/upd70f3454/uart.h b/bsp/upd70f3454/drivers/uart.h
index c7ed52c98e..c7ed52c98e 100644
--- a/bsp/upd70f3454/uart.h
+++ b/bsp/upd70f3454/drivers/uart.h
diff --git a/bsp/upd70f3454/lnk70f3454.xcl b/bsp/upd70f3454/lnk70f3454.xcl
index 82f9cd79d7..21a15c9e11 100644
--- a/bsp/upd70f3454/lnk70f3454.xcl
+++ b/bsp/upd70f3454/lnk70f3454.xcl
@@ -150,7 +150,7 @@
// Set up near RT_HEAP
//fify 20100505 HEAP for RTT
--Z(DATA)RT_HEAP+400=FFFFC000-FFFFEFFF
+-Z(DATA)RT_HEAP+800=FFFFC000-FFFFEFFF
//-------------------------------------------------------------------------
// End of File
diff --git a/bsp/upd70f3454/upd70f3454.ewp b/bsp/upd70f3454/project.ewp
index 4cc0727688..fd1a78121a 100644
--- a/bsp/upd70f3454/upd70f3454.ewp
+++ b/bsp/upd70f3454/project.ewp
@@ -16,20 +16,6 @@
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
- <name>GeneralMisraVer</name>
- <state>0</state>
- </option>
- <option>
- <name>GeneralMisraRules04</name>
- <version>0</version>
- <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state>
- </option>
- <option>
- <name>GeneralMisraRules98</name>
- <version>0</version>
- <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
- </option>
- <option>
<name>GMemoryModel</name>
<state>0</state>
</option>
@@ -103,7 +89,7 @@
</option>
<option>
<name>GHeapSize</name>
- <state>4096</state>
+ <state>0</state>
</option>
<option>
<name>GeneralEnableMisra</name>
@@ -118,6 +104,20 @@
<state>70F3454 V850E - uPD70F3454</state>
</option>
<option>
+ <name>GeneralMisraVer</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GeneralMisraRules04</name>
+ <version>0</version>
+ <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state>
+ </option>
+ <option>
+ <name>GeneralMisraRules98</name>
+ <version>0</version>
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
+ </option>
+ <option>
<name>GFloatingPointUnit</name>
<version>0</version>
<state>0</state>
@@ -283,10 +283,13 @@
</option>
<option>
<name>CCIncludePath2</name>
- <state>$PROJ_DIR$\</state>
- <state>$PROJ_DIR$\applilet3_src\</state>
- <state>$PROJ_DIR$\..\..\include\</state>
+ <state>$PROJ_DIR$\..\..\libcpu\v850\70f34</state>
+ <state>$PROJ_DIR$\..\..\include</state>
+ <state>$PROJ_DIR$\drivers</state>
+ <state>$PROJ_DIR$\.</state>
+ <state>$PROJ_DIR$\applications</state>
<state>$PROJ_DIR$\..\..\components\finsh</state>
+ <state>$PROJ_DIR$\..\..\libcpu\v850\common</state>
</option>
<option>
<name>CCStdIncCheck</name>
@@ -550,12 +553,12 @@
</option>
<option>
<name>OutputFile</name>
- <state>upd70f3454.d85</state>
+ <state>project.d85</state>
</option>
<option>
<name>OutputFormat</name>
<version>11</version>
- <state>23</state>
+ <state>27</state>
</option>
<option>
<name>FormatVariant</name>
@@ -728,7 +731,7 @@
</option>
<option>
<name>ExtraOutputFile</name>
- <state>upd70f3454.hex</state>
+ <state>rtthread.hex</state>
</option>
<option>
<name>ExtraOutputFormat</name>
@@ -932,7 +935,7 @@
</option>
<option>
<name>GDeviceSelect</name>
- <state>70F3746 V850ES- uPD70F3746</state>
+ <state></state>
</option>
<option>
<name>GeneralMisraVer</name>
@@ -1066,7 +1069,7 @@
</option>
<option>
<name>CCEnableMigration</name>
- <state>1</state>
+ <state>0</state>
</option>
<option>
<name>IRegConstCompCheck</name>
@@ -1114,7 +1117,13 @@
</option>
<option>
<name>CCIncludePath2</name>
- <state></state>
+ <state>$PROJ_DIR$\..\..\libcpu\v850\70f34</state>
+ <state>$PROJ_DIR$\..\..\include</state>
+ <state>$PROJ_DIR$\drivers</state>
+ <state>$PROJ_DIR$\.</state>
+ <state>$PROJ_DIR$\applications</state>
+ <state>$PROJ_DIR$\..\..\components\finsh</state>
+ <state>$PROJ_DIR$\..\..\libcpu\v850\common</state>
</option>
<option>
<name>CCStdIncCheck</name>
@@ -1161,11 +1170,11 @@
<option>
<name>CCOptStrategy</name>
<version>0</version>
- <state>1</state>
+ <state>0</state>
</option>
<option>
<name>CCOptLevelSlave</name>
- <state>3</state>
+ <state>1</state>
</option>
<option>
<name>CCAggressiveInlining</name>
@@ -1661,94 +1670,100 @@
</settings>
</configuration>
<group>
- <name>finsh</name>
+ <name>70F34</name>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\cmd.c</name>
+ <name>$PROJ_DIR$\..\..\libcpu\v850\70f34\context_iar.asm</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\finsh.h</name>
+ <name>$PROJ_DIR$\..\..\libcpu\v850\70f34\cpuport.c</name>
</file>
+ </group>
+ <group>
+ <name>Applications</name>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\finsh_compiler.c</name>
+ <name>$PROJ_DIR$\applications\application.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\finsh_error.c</name>
+ <name>$PROJ_DIR$\applications\startup.c</name>
</file>
+ </group>
+ <group>
+ <name>Drivers</name>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\finsh_error.h</name>
+ <name>$PROJ_DIR$\drivers\board.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\finsh_heap.c</name>
+ <name>$PROJ_DIR$\drivers\CG_port.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\finsh_heap.h</name>
+ <name>$PROJ_DIR$\drivers\CG_port_user.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\finsh_init.c</name>
+ <name>$PROJ_DIR$\drivers\CG_system.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\finsh_node.c</name>
+ <name>$PROJ_DIR$\drivers\CG_system_user.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\finsh_node.h</name>
+ <name>$PROJ_DIR$\drivers\CG_systeminit.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\finsh_ops.c</name>
+ <name>$PROJ_DIR$\drivers\CG_timer.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\finsh_ops.h</name>
+ <name>$PROJ_DIR$\drivers\CG_timer_user.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\finsh_parser.c</name>
+ <name>$PROJ_DIR$\drivers\cstartup.asm</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\finsh_parser.h</name>
+ <name>$PROJ_DIR$\drivers\uart.c</name>
</file>
+ </group>
+ <group>
+ <name>finsh</name>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\finsh_token.c</name>
+ <name>$PROJ_DIR$\..\..\components\finsh\cmd.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\finsh_token.h</name>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_compiler.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\finsh_var.c</name>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_error.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\finsh_var.h</name>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_heap.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\finsh_vm.c</name>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_init.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\finsh_vm.h</name>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_node.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\shell.c</name>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_ops.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\shell.h</name>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_parser.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\components\finsh\symbol.c</name>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_token.c</name>
</file>
- </group>
- <group>
- <name>include</name>
<file>
- <name>$PROJ_DIR$\..\..\include\rtdef.h</name>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_var.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\include\rthw.h</name>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_vm.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\include\rtm.h</name>
+ <name>$PROJ_DIR$\..\..\components\finsh\shell.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\include\rtthread.h</name>
+ <name>$PROJ_DIR$\..\..\components\finsh\symbol.c</name>
</file>
</group>
<group>
- <name>kernel</name>
+ <name>Kernel</name>
<file>
<name>$PROJ_DIR$\..\..\src\clock.c</name>
</file>
@@ -1768,84 +1783,24 @@
<name>$PROJ_DIR$\..\..\src\kservice.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\src\kservice.h</name>
- </file>
- <file>
<name>$PROJ_DIR$\..\..\src\mem.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\mempool.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\src\module.c</name>
- </file>
- <file>
- <name>$PROJ_DIR$\..\..\src\module.h</name>
- </file>
- <file>
<name>$PROJ_DIR$\..\..\src\object.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\src\rtm.c</name>
- </file>
- <file>
<name>$PROJ_DIR$\..\..\src\scheduler.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\src\slab.c</name>
- </file>
- <file>
<name>$PROJ_DIR$\..\..\src\thread.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\timer.c</name>
</file>
</group>
- <group>
- <name>libcpu</name>
- <file>
- <name>$PROJ_DIR$\..\..\libcpu\v850\context.asm</name>
- </file>
- <file>
- <name>$PROJ_DIR$\..\..\libcpu\v850\cpuport.c</name>
- </file>
- </group>
- <file>
- <name>$PROJ_DIR$\application.c</name>
- </file>
- <file>
- <name>$PROJ_DIR$\board.c</name>
- </file>
- <file>
- <name>$PROJ_DIR$\applilet3_src\CG_port.c</name>
- </file>
- <file>
- <name>$PROJ_DIR$\applilet3_src\CG_port_user.c</name>
- </file>
- <file>
- <name>$PROJ_DIR$\applilet3_src\CG_system.c</name>
- </file>
- <file>
- <name>$PROJ_DIR$\applilet3_src\CG_system_user.c</name>
- </file>
- <file>
- <name>$PROJ_DIR$\applilet3_src\CG_systeminit.c</name>
- </file>
- <file>
- <name>$PROJ_DIR$\applilet3_src\CG_timer.c</name>
- </file>
- <file>
- <name>$PROJ_DIR$\applilet3_src\CG_timer_user.c</name>
- </file>
- <file>
- <name>$PROJ_DIR$\cstartup.s85</name>
- </file>
- <file>
- <name>$PROJ_DIR$\startup.c</name>
- </file>
- <file>
- <name>$PROJ_DIR$\uart.c</name>
- </file>
</project>
diff --git a/bsp/upd70f3454/upd70f3454.eww b/bsp/upd70f3454/project.eww
index 3fb65b7999..faa93f37cd 100644
--- a/bsp/upd70f3454/upd70f3454.eww
+++ b/bsp/upd70f3454/project.eww
@@ -1,8 +1,10 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-
-<workspace>
- <project>
- <path>$WS_DIR$\upd70f3454.ewp</path>
- </project>
- <batchBuild />
-</workspace>
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<workspace>
+ <project>
+ <path>$WS_DIR$\project.ewp</path>
+ </project>
+ <batchBuild/>
+</workspace>
+
+
diff --git a/bsp/upd70f3454/rtconfig.h b/bsp/upd70f3454/rtconfig.h
index 2e4c6ea55f..057715f961 100644
--- a/bsp/upd70f3454/rtconfig.h
+++ b/bsp/upd70f3454/rtconfig.h
@@ -86,67 +86,4 @@
/* the max number of cached sector */
///#define DFS_CACHE_MAX_NUM 4
-/* SECTION: lwip, a lighwight TCP/IP protocol stack */
-//#define RT_USING_LWIP
-
-/* Enable ICMP protocol*/
-///#define RT_LWIP_ICMP
-/* Enable UDP protocol*/
-///#define RT_LWIP_UDP
-/* Enable TCP protocol*/
-///#define RT_LWIP_TCP
-/* Enable DNS */
-///#define RT_LWIP_DNS
-
-/* the number of simulatenously active TCP connections*/
-///#define RT_LWIP_TCP_PCB_NUM 5
-
-/* ip address of target*/
-///#define RT_LWIP_IPADDR0 192
-///#define RT_LWIP_IPADDR1 168
-///#define RT_LWIP_IPADDR2 1
-///#define RT_LWIP_IPADDR3 30
-
-/* gateway address of target*/
-#define RT_LWIP_GWADDR0 192
-#define RT_LWIP_GWADDR1 168
-#define RT_LWIP_GWADDR2 1
-#define RT_LWIP_GWADDR3 1
-
-/* mask address of target*/
-#define RT_LWIP_MSKADDR0 255
-#define RT_LWIP_MSKADDR1 255
-#define RT_LWIP_MSKADDR2 255
-#define RT_LWIP_MSKADDR3 0
-
-/* tcp thread options */
-#define RT_LWIP_TCPTHREAD_PRIORITY 12
-#define RT_LWIP_TCPTHREAD_MBOX_SIZE 4
-#define RT_LWIP_TCPTHREAD_STACKSIZE 1024
-
-/* ethernet if thread options */
-#define RT_LWIP_ETHTHREAD_PRIORITY 15
-#define RT_LWIP_ETHTHREAD_MBOX_SIZE 4
-#define RT_LWIP_ETHTHREAD_STACKSIZE 512
-
-/* SECTION: RT-Thread/GUI */
-/* #define RT_USING_RTGUI */
-
-/* name length of RTGUI object */
-#define RTGUI_NAME_MAX 12
-/* support 16 weight font */
-#define RTGUI_USING_FONT16
-/* support Chinese font */
-#define RTGUI_USING_FONTHZ
-/* use DFS as file interface */
-#define RTGUI_USING_DFS_FILERW
-/* use font file as Chinese font */
-#define RTGUI_USING_HZ_FILE
-/* use small size in RTGUI */
-#define RTGUI_USING_SMALL_SIZE
-/* use mouse cursor */
-/* #define RTGUI_USING_MOUSE_CURSOR */
-/* default font size in RTGUI */
-#define RTGUI_DEFAULT_FONT_SIZE 16
-
#endif
diff --git a/bsp/upd70f3454/rtconfig.py b/bsp/upd70f3454/rtconfig.py
new file mode 100644
index 0000000000..6ab05bf35e
--- /dev/null
+++ b/bsp/upd70f3454/rtconfig.py
@@ -0,0 +1,111 @@
+import os
+
+# toolchains options
+ARCH = 'v850'
+CPU = '70f34'
+
+CROSS_TOOL = 'iar'
+
+if os.getenv('RTT_CC'):
+ CROSS_TOOL = os.getenv('RTT_CC')
+
+if CROSS_TOOL == 'gcc':
+ print '================ERROR============================'
+ print 'Not support gcc yet!'
+ print '================================================='
+ exit(0)
+elif CROSS_TOOL == 'iar':
+ PLATFORM = 'iar'
+ IAR_PATH = 'C:/Program Files/IAR Systems/Embedded Workbench 6.0 Evaluation_0'
+elif CROSS_TOOL == 'keil':
+ print '================ERROR============================'
+ print 'Not support keil yet!'
+ print '================================================='
+ exit(0)
+
+if os.getenv('RTT_EXEC_PATH'):
+ EXEC_PATH = os.getenv('RTT_EXEC_PATH')
+
+BUILD = 'debug'
+
+if PLATFORM == 'gcc':
+ # toolchains
+ PREFIX = 'm32c-elf-'
+ CC = PREFIX + 'gcc'
+ AS = PREFIX + 'gcc'
+ AR = PREFIX + 'ar'
+ LINK = PREFIX + 'gcc'
+ TARGET_EXT = 'out'
+ SIZE = PREFIX + 'size'
+ OBJDUMP = PREFIX + 'objdump'
+ OBJCPY = PREFIX + 'objcopy'
+
+ DEVICE = ' -mcpu=m16c'
+ CFLAGS = DEVICE
+ AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
+ LFLAGS = DEVICE + ' -nostartfiles' + ' -Wl,--gc-sections,-Map=rtthread_m16c.map,-cref,-u,_start -T m16c62p.ld'
+
+ CPATH = ''
+ LPATH = ''
+
+ if BUILD == 'debug':
+ CFLAGS += ' -O0 -gdwarf-2'
+ AFLAGS += ' -gdwarf-2'
+ else:
+ CFLAGS += ' -O2'
+
+ POST_ACTION = OBJCPY + ' -O srec $TARGET rtthread.mot\n' + SIZE + ' $TARGET \n'
+
+elif PLATFORM == 'iar':
+ # toolchains
+ CC = 'iccv850'
+ AS = 'av850'
+ AR = 'xar'
+ LINK = 'xlink'
+ TARGET_EXT = 'hex'
+
+ DEVICE = '--cpu V850'
+
+ EXEC_PATH = IAR_PATH + '/v850/bin'
+
+ AFLAGS = '-s+'
+ AFLAGS = ' -v1'
+# AFLAGS += ' -M<>'
+ AFLAGS += ' -s+'
+ AFLAGS += ' -DCODE_MODEL_NORMAL'
+ AFLAGS += ' -DDATA_MODEL_TINY'
+ AFLAGS += ' -w+'
+ AFLAGS += ' -r'
+ AFLAGS += ' -I"' + IAR_PATH + '/v850/INC"'
+
+ LFLAGS = '-xms'
+ LFLAGS += ' -I"' + IAR_PATH + '/v850/LIB"'
+ LFLAGS += ' -rt'
+ LFLAGS += ' -s __program_start'
+ LFLAGS += ' -D_CSTACK_SIZE=1000'
+ LFLAGS += ' "' + IAR_PATH + '/v850/LIB/dl85nn1.r85"'
+ LFLAGS += ' -D_HEAP_SIZE=0'
+
+# LFLAGS += ' "' + IAR_PATH + '/v850/lib/CLIB/clm16cfnffwc.r34"'
+# LFLAGS += ' -e_small_write=_formatted_write'
+# LFLAGS += ' -e_medium_read=_formatted_read'
+
+# CFLAGS = DEVICE
+ CFLAGS = '--diag_suppress Pa050'
+ CFLAGS += ' -v1'
+ CFLAGS += ' -mt'
+ CFLAGS += ' --code_model normal'
+ CFLAGS += ' --no_cse'
+ CFLAGS += ' --no_unroll'
+ CFLAGS += ' --no_inline'
+ CFLAGS += ' --no_code_motion'
+ CFLAGS += ' --dlib_config "' + IAR_PATH + '/v850/LIB/dl85nn1.h"'
+ CFLAGS += ' -I"' + IAR_PATH + '/v850/INC"'
+ CFLAGS += ' --no_tbaa'
+ CFLAGS += ' --debug'
+ CFLAGS += ' --lock_regs 0'
+ CFLAGS += ' --migration_preprocessor_extensions'
+ CFLAGS += ' -e'
+ CFLAGS += ' -Ol'
+
+ POST_ACTION = ''
diff --git a/bsp/upd70f3454/template.ewp b/bsp/upd70f3454/template.ewp
new file mode 100644
index 0000000000..9aa8a16e9b
--- /dev/null
+++ b/bsp/upd70f3454/template.ewp
@@ -0,0 +1,1662 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<project>
+ <fileVersion>2</fileVersion>
+ <configuration>
+ <name>Debug</name>
+ <toolchain>
+ <name>V850</name>
+ </toolchain>
+ <debug>1</debug>
+ <settings>
+ <name>General</name>
+ <archiveVersion>6</archiveVersion>
+ <data>
+ <version>7</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>1</debug>
+ <option>
+ <name>GMemoryModel</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GUseShort</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCodeModel</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ExePath</name>
+ <state>Debug\Exe</state>
+ </option>
+ <option>
+ <name>ObjPath</name>
+ <state>Debug\Obj</state>
+ </option>
+ <option>
+ <name>ListPath</name>
+ <state>Debug\List</state>
+ </option>
+ <option>
+ <name>GeneralStack</name>
+ <state>0x1000</state>
+ </option>
+ <option>
+ <name>GOutputBinary</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GRuntimeLibSelect</name>
+ <version>0</version>
+ <state>1</state>
+ </option>
+ <option>
+ <name>RTDescription</name>
+ <state>Use the normal configuration of the C/EC++ runtime library. No locale interface, C locale, no file descriptor support, no multibytes in printf and scanf, and no hex floats in strtod.</state>
+ </option>
+ <option>
+ <name>RTConfigPath</name>
+ <state>$TOOLKIT_DIR$\LIB\dl85nn1.h</state>
+ </option>
+ <option>
+ <name>RTLibraryPath</name>
+ <state>$TOOLKIT_DIR$\LIB\dl85nn1.r85</state>
+ </option>
+ <option>
+ <name>GRuntimeLibSelectSlave</name>
+ <version>0</version>
+ <state>1</state>
+ </option>
+ <option>
+ <name>Input variant</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>Input description</name>
+ <state>Full formatting.</state>
+ </option>
+ <option>
+ <name>Output variant</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>Output description</name>
+ <state>Full formatting.</state>
+ </option>
+ <option>
+ <name>GHeapSize</name>
+ <state>4096</state>
+ </option>
+ <option>
+ <name>GeneralEnableMisra</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GeneralMisraVerbose</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GDeviceSelect</name>
+ <state>70F3454 V850E - uPD70F3454</state>
+ </option>
+ <option>
+ <name>GeneralMisraVer</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GeneralMisraRules04</name>
+ <version>0</version>
+ <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state>
+ </option>
+ <option>
+ <name>GeneralMisraRules98</name>
+ <version>0</version>
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
+ </option>
+ <option>
+ <name>GFloatingPointUnit</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>ICCV850</name>
+ <archiveVersion>4</archiveVersion>
+ <data>
+ <version>16</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>1</debug>
+ <option>
+ <name>CCDefines</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCPreprocFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPreprocComments</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPreprocLine</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListCFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListCMnemonics</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListCMessages</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListAssFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListAssSource</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCEnableRemarks</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCDiagSuppress</name>
+ <state>Pa050</state>
+ </option>
+ <option>
+ <name>CCDiagRemark</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCDiagWarning</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCDiagError</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IMemory</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>ICode</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCObjPrefix</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCAllowList</name>
+ <version>1</version>
+ <state>00000</state>
+ </option>
+ <option>
+ <name>CCObjUseModuleName</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCObjModuleName</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCDebugInfo</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCLockedRegs</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IRegConstCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCDiagWarnAreErr</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCEnableMigration</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IRegConstCompCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCompilerRuntimeInfo</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCMultiByte</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCDisableSldSuppression</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OutputFile</name>
+ <state>$FILE_BNAME$.r85</state>
+ </option>
+ <option>
+ <name>CCLibConfigHeader</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCCharIs</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCExt</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CompilerMisraOverride</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>PreInclude</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCEnableMisalignedData</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCIncludePath2</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCStdIncCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCStdIncludePath</name>
+ <state>$TOOLKIT_DIR$\INC\</state>
+ </option>
+ <option>
+ <name>IccExtraOptionsCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccExtraOptions</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCOverrideModuleTypeDefault</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRadioModuleType</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRadioModuleTypeSlave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CompilerMisraRules04</name>
+ <version>0</version>
+ <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state>
+ </option>
+ <option>
+ <name>CompilerMisraRules98</name>
+ <version>0</version>
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
+ </option>
+ <option>
+ <name>CCOptLevel</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCOptStrategy</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCOptLevelSlave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCAggressiveInlining</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccLang</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRequirePrototypes2</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCppDialect</name>
+ <state>1</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>AV850</name>
+ <archiveVersion>4</archiveVersion>
+ <data>
+ <version>6</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>1</debug>
+ <option>
+ <name>AObjPrefix</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>MacroChars</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ACaseSensitivity</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AList</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AListHeader</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AListing</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>Includes</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MacDefs</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MacExps</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>MacExec</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OnlyAssed</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MultiLine</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>PageLengthCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>PageLength</name>
+ <state>80</state>
+ </option>
+ <option>
+ <name>TabSpacing</name>
+ <state>8</state>
+ </option>
+ <option>
+ <name>AXRef</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AXRefDefines</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AXRefInternal</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AXRefDual</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ADefines</name>
+ <state>CODE_MODEL_NORMAL</state>
+ <state>DATA_MODEL_TINY</state>
+ </option>
+ <option>
+ <name>AWarnEnable</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AWarnWhat</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AWarnOne</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AWarnRange1</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AWarnRange2</name>
+ <state></state>
+ </option>
+ <option>
+ <name>ADebugNew</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AMultiBytes</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OutputFile</name>
+ <state>$FILE_BNAME$.r85</state>
+ </option>
+ <option>
+ <name>Multibyte</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OAIncludePath2</name>
+ <state></state>
+ </option>
+ <option>
+ <name>OAStdIncCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OAStdIncludePath</name>
+ <state>$TOOLKIT_DIR$\INC\</state>
+ </option>
+ <option>
+ <name>AMaxErrChk</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AMaxNumErr</name>
+ <state>100</state>
+ </option>
+ <option>
+ <name>AsmExtraOptionsCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AsmExtraOptions</name>
+ <state></state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>CUSTOM</name>
+ <archiveVersion>3</archiveVersion>
+ <data>
+ <extensions></extensions>
+ <cmdline></cmdline>
+ </data>
+ </settings>
+ <settings>
+ <name>BICOMP</name>
+ <archiveVersion>0</archiveVersion>
+ <data/>
+ </settings>
+ <settings>
+ <name>BUILDACTION</name>
+ <archiveVersion>1</archiveVersion>
+ <data>
+ <prebuild></prebuild>
+ <postbuild></postbuild>
+ </data>
+ </settings>
+ <settings>
+ <name>XLINK</name>
+ <archiveVersion>4</archiveVersion>
+ <data>
+ <version>15</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>1</debug>
+ <option>
+ <name>XOutOverride</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OutputFile</name>
+ <state>project.d85</state>
+ </option>
+ <option>
+ <name>OutputFormat</name>
+ <version>11</version>
+ <state>27</state>
+ </option>
+ <option>
+ <name>FormatVariant</name>
+ <version>8</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>SecondaryOutputFile</name>
+ <state>(None for the selected format)</state>
+ </option>
+ <option>
+ <name>XDefines</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AlwaysOutput</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OverlapWarnings</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>NoGlobalCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>XList</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>SegmentMap</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>ListSymbols</name>
+ <state>2</state>
+ </option>
+ <option>
+ <name>PageLengthCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>PageLength</name>
+ <state>80</state>
+ </option>
+ <option>
+ <name>XIncludes</name>
+ <state>$TOOLKIT_DIR$\LIB\</state>
+ </option>
+ <option>
+ <name>ModuleStatus</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>XclOverride</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>XclFile</name>
+ <state>$PROJ_DIR$\lnk70f3454.xcl</state>
+ </option>
+ <option>
+ <name>XclFileSlave</name>
+ <state></state>
+ </option>
+ <option>
+ <name>XExtraOptionsCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>XExtraOptions</name>
+ <state></state>
+ </option>
+ <option>
+ <name>DoFill</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>FillerByte</name>
+ <state>0xFF</state>
+ </option>
+ <option>
+ <name>DoCrc</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CrcSize</name>
+ <version>0</version>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcAlgo</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcPoly</name>
+ <state>0x11021</state>
+ </option>
+ <option>
+ <name>CrcCompl</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>RangeCheckAlternatives</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>SuppressAllWarn</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>SuppressDiags</name>
+ <state></state>
+ </option>
+ <option>
+ <name>TreatAsWarn</name>
+ <state></state>
+ </option>
+ <option>
+ <name>TreatAsErr</name>
+ <state></state>
+ </option>
+ <option>
+ <name>ModuleLocalSym</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CrcBitOrder</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IncludeSuppressed</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ModuleSummary</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>xcProgramEntryLabel</name>
+ <state>__program_start</state>
+ </option>
+ <option>
+ <name>DebugInformation</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>RuntimeControl</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IoEmulation</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AllowExtraOutput</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>GenerateExtraOutput</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>XExtraOutOverride</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>ExtraOutputFile</name>
+ <state>rtthread.hex</state>
+ </option>
+ <option>
+ <name>ExtraOutputFormat</name>
+ <version>11</version>
+ <state>27</state>
+ </option>
+ <option>
+ <name>ExtraFormatVariant</name>
+ <version>8</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>xcOverrideProgramEntryLabel</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>xcProgramEntryLabelSelect</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ListOutputFormat</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>BufferedTermOutput</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>XlinkStackSize</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>XcRTLibraryFile</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OXLibIOConfig</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>XLibraryHeap</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>XLinkMisraHandler</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OverlaySystemMap</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>RawBinaryFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>RawBinarySymbol</name>
+ <state></state>
+ </option>
+ <option>
+ <name>RawBinarySegment</name>
+ <state></state>
+ </option>
+ <option>
+ <name>RawBinaryAlign</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CrcAlign</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcInitialValue</name>
+ <state>0x0</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>XAR</name>
+ <archiveVersion>4</archiveVersion>
+ <data>
+ <version>0</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>1</debug>
+ <option>
+ <name>XAROutOverride</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>XARInputs</name>
+ <state></state>
+ </option>
+ <option>
+ <name>OutputFile</name>
+ <state></state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>BILINK</name>
+ <archiveVersion>0</archiveVersion>
+ <data/>
+ </settings>
+ </configuration>
+ <configuration>
+ <name>Release</name>
+ <toolchain>
+ <name>V850</name>
+ </toolchain>
+ <debug>0</debug>
+ <settings>
+ <name>General</name>
+ <archiveVersion>6</archiveVersion>
+ <data>
+ <version>7</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>GMemoryModel</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GUseShort</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCodeModel</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ExePath</name>
+ <state>Release\Exe</state>
+ </option>
+ <option>
+ <name>ObjPath</name>
+ <state>Release\Obj</state>
+ </option>
+ <option>
+ <name>ListPath</name>
+ <state>Release\List</state>
+ </option>
+ <option>
+ <name>GeneralStack</name>
+ <state>###Uninitialized###</state>
+ </option>
+ <option>
+ <name>GOutputBinary</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GRuntimeLibSelect</name>
+ <version>0</version>
+ <state>1</state>
+ </option>
+ <option>
+ <name>RTDescription</name>
+ <state></state>
+ </option>
+ <option>
+ <name>RTConfigPath</name>
+ <state>xxx.h</state>
+ </option>
+ <option>
+ <name>RTLibraryPath</name>
+ <state>xxx.r85</state>
+ </option>
+ <option>
+ <name>GRuntimeLibSelectSlave</name>
+ <version>0</version>
+ <state>1</state>
+ </option>
+ <option>
+ <name>Input variant</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>Input description</name>
+ <state></state>
+ </option>
+ <option>
+ <name>Output variant</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>Output description</name>
+ <state></state>
+ </option>
+ <option>
+ <name>GHeapSize</name>
+ <state>###Uninitialized###</state>
+ </option>
+ <option>
+ <name>GeneralEnableMisra</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GeneralMisraVerbose</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GDeviceSelect</name>
+ <state></state>
+ </option>
+ <option>
+ <name>GeneralMisraVer</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GeneralMisraRules04</name>
+ <version>0</version>
+ <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state>
+ </option>
+ <option>
+ <name>GeneralMisraRules98</name>
+ <version>0</version>
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
+ </option>
+ <option>
+ <name>GFloatingPointUnit</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>ICCV850</name>
+ <archiveVersion>4</archiveVersion>
+ <data>
+ <version>16</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>CCDefines</name>
+ <state>NDEBUG</state>
+ </option>
+ <option>
+ <name>CCPreprocFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPreprocComments</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPreprocLine</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListCFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListCMnemonics</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListCMessages</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListAssFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListAssSource</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCEnableRemarks</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCDiagSuppress</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCDiagRemark</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCDiagWarning</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCDiagError</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IMemory</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>ICode</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCObjPrefix</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCAllowList</name>
+ <version>1</version>
+ <state>11111</state>
+ </option>
+ <option>
+ <name>CCObjUseModuleName</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCObjModuleName</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCDebugInfo</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCLockedRegs</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IRegConstCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCDiagWarnAreErr</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCEnableMigration</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IRegConstCompCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCompilerRuntimeInfo</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCMultiByte</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCDisableSldSuppression</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OutputFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCLibConfigHeader</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCCharIs</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCExt</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CompilerMisraOverride</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>PreInclude</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCEnableMisalignedData</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCIncludePath2</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCStdIncCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCStdIncludePath</name>
+ <state>###Uninitialized###</state>
+ </option>
+ <option>
+ <name>IccExtraOptionsCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccExtraOptions</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCOverrideModuleTypeDefault</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRadioModuleType</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRadioModuleTypeSlave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CompilerMisraRules04</name>
+ <version>0</version>
+ <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state>
+ </option>
+ <option>
+ <name>CompilerMisraRules98</name>
+ <version>0</version>
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
+ </option>
+ <option>
+ <name>CCOptLevel</name>
+ <state>3</state>
+ </option>
+ <option>
+ <name>CCOptStrategy</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCOptLevelSlave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCAggressiveInlining</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccLang</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRequirePrototypes2</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCppDialect</name>
+ <state>1</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>AV850</name>
+ <archiveVersion>4</archiveVersion>
+ <data>
+ <version>6</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>AObjPrefix</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>MacroChars</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ACaseSensitivity</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AList</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AListHeader</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AListing</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>Includes</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MacDefs</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MacExps</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>MacExec</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OnlyAssed</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MultiLine</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>PageLengthCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>PageLength</name>
+ <state>80</state>
+ </option>
+ <option>
+ <name>TabSpacing</name>
+ <state>8</state>
+ </option>
+ <option>
+ <name>AXRef</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AXRefDefines</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AXRefInternal</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AXRefDual</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ADefines</name>
+ <state>###Uninitialized###</state>
+ </option>
+ <option>
+ <name>AWarnEnable</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AWarnWhat</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AWarnOne</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AWarnRange1</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AWarnRange2</name>
+ <state></state>
+ </option>
+ <option>
+ <name>ADebugNew</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AMultiBytes</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OutputFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>Multibyte</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OAIncludePath2</name>
+ <state></state>
+ </option>
+ <option>
+ <name>OAStdIncCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OAStdIncludePath</name>
+ <state>###Uninitialized###</state>
+ </option>
+ <option>
+ <name>AMaxErrChk</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AMaxNumErr</name>
+ <state>100</state>
+ </option>
+ <option>
+ <name>AsmExtraOptionsCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AsmExtraOptions</name>
+ <state></state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>CUSTOM</name>
+ <archiveVersion>3</archiveVersion>
+ <data>
+ <extensions></extensions>
+ <cmdline></cmdline>
+ </data>
+ </settings>
+ <settings>
+ <name>BICOMP</name>
+ <archiveVersion>0</archiveVersion>
+ <data/>
+ </settings>
+ <settings>
+ <name>BUILDACTION</name>
+ <archiveVersion>1</archiveVersion>
+ <data>
+ <prebuild></prebuild>
+ <postbuild></postbuild>
+ </data>
+ </settings>
+ <settings>
+ <name>XLINK</name>
+ <archiveVersion>4</archiveVersion>
+ <data>
+ <version>15</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>XOutOverride</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OutputFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>OutputFormat</name>
+ <version>11</version>
+ <state>23</state>
+ </option>
+ <option>
+ <name>FormatVariant</name>
+ <version>8</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>SecondaryOutputFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>XDefines</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AlwaysOutput</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OverlapWarnings</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>NoGlobalCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>XList</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>SegmentMap</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>ListSymbols</name>
+ <state>2</state>
+ </option>
+ <option>
+ <name>PageLengthCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>PageLength</name>
+ <state>80</state>
+ </option>
+ <option>
+ <name>XIncludes</name>
+ <state>###Uninitialized###</state>
+ </option>
+ <option>
+ <name>ModuleStatus</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>XclOverride</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>XclFile</name>
+ <state>lnk0t.xcl</state>
+ </option>
+ <option>
+ <name>XclFileSlave</name>
+ <state></state>
+ </option>
+ <option>
+ <name>XExtraOptionsCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>XExtraOptions</name>
+ <state></state>
+ </option>
+ <option>
+ <name>DoFill</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>FillerByte</name>
+ <state>0xFF</state>
+ </option>
+ <option>
+ <name>DoCrc</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CrcSize</name>
+ <version>0</version>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcAlgo</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcPoly</name>
+ <state>0x11021</state>
+ </option>
+ <option>
+ <name>CrcCompl</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>RangeCheckAlternatives</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>SuppressAllWarn</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>SuppressDiags</name>
+ <state></state>
+ </option>
+ <option>
+ <name>TreatAsWarn</name>
+ <state></state>
+ </option>
+ <option>
+ <name>TreatAsErr</name>
+ <state></state>
+ </option>
+ <option>
+ <name>ModuleLocalSym</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CrcBitOrder</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IncludeSuppressed</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ModuleSummary</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>xcProgramEntryLabel</name>
+ <state></state>
+ </option>
+ <option>
+ <name>DebugInformation</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>RuntimeControl</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IoEmulation</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AllowExtraOutput</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GenerateExtraOutput</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>XExtraOutOverride</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ExtraOutputFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>ExtraOutputFormat</name>
+ <version>11</version>
+ <state>23</state>
+ </option>
+ <option>
+ <name>ExtraFormatVariant</name>
+ <version>8</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>xcOverrideProgramEntryLabel</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>xcProgramEntryLabelSelect</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ListOutputFormat</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>BufferedTermOutput</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>XlinkStackSize</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>XcRTLibraryFile</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OXLibIOConfig</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>XLibraryHeap</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>XLinkMisraHandler</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OverlaySystemMap</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>RawBinaryFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>RawBinarySymbol</name>
+ <state></state>
+ </option>
+ <option>
+ <name>RawBinarySegment</name>
+ <state></state>
+ </option>
+ <option>
+ <name>RawBinaryAlign</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CrcAlign</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcInitialValue</name>
+ <state>0x0</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>XAR</name>
+ <archiveVersion>4</archiveVersion>
+ <data>
+ <version>0</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>XAROutOverride</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>XARInputs</name>
+ <state></state>
+ </option>
+ <option>
+ <name>OutputFile</name>
+ <state></state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>BILINK</name>
+ <archiveVersion>0</archiveVersion>
+ <data/>
+ </settings>
+ </configuration>
+</project>
+
+
diff --git a/bsp/upd70f3454/uart.c b/bsp/upd70f3454/uart.c
deleted file mode 100644
index d660bcc45b..0000000000
--- a/bsp/upd70f3454/uart.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * File : board.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2009 RT-Thread Develop Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
- *
- * Change Logs:
- * Date Author Notes
- * 2010-03-08 Bernard The first version for LPC17xx
- * 2010-06-29 lgnq Modified for V850
-*/
-
-#include <rthw.h>
-#include <rtthread.h>
-#include "io70f3454.h"
-#include "uart.h"
-
-#if defined(RT_USING_UART0) && defined(RT_USING_DEVICE)
-
-struct rt_uart_v850
-{
- struct rt_device parent;
-
- /* buffer for reception */
- rt_uint8_t read_index, save_index;
- rt_uint8_t rx_buffer[RT_UART_RX_BUFFER_SIZE];
-}uart_device;
-
-void uarta1_receive_handler(void)
-{
- rt_ubase_t level;
- rt_uint8_t c;
-
- struct rt_uart_v850* uart = &uart_device;
-
-// while(ri_u0c1 == 0)
-// ;
- c = (char) UA1RX;
-
- /* Receive Data Available */
- uart->rx_buffer[uart->save_index] = c;
-
- level = rt_hw_interrupt_disable();
- uart->save_index ++;
- if (uart->save_index >= RT_UART_RX_BUFFER_SIZE)
- uart->save_index = 0;
- rt_hw_interrupt_enable(level);
-
- /* invoke callback */
- if(uart->parent.rx_indicate != RT_NULL)
- {
- rt_size_t length;
- if (uart->read_index > uart->save_index)
- length = RT_UART_RX_BUFFER_SIZE - uart->read_index + uart->save_index;
- else
- length = uart->save_index - uart->read_index;
-
- uart->parent.rx_indicate(&uart->parent, length);
- }
-}
-
-static rt_err_t rt_uart_init (rt_device_t dev)
-{
- UA1TXE = 0U; /* disable UARTA1 transmission operation */
- UA1RXE = 0U; /* disable UARTA1 reception operation */
- UA1PWR = 0U; /* disable UARTA1 operation */
- UA1TMK = 1U; /* disable INTUA1T interrupt */
- UA1TIF = 0U; /* clear INTUA1T interrupt flag */
- UA1RMK = 1U; /* disable INTUA1R interrupt */
- UA1RIF = 0U; /* clear INTUA1R interrupt flag */
- /* Set INTUA1T level low priority */
- UA1TIC |= 0x07U;
- /* Set INTUA1R level low priority */
- UA1RIC |= 0x07U;
- //BAUDRATE = 9600
- UA1CTL1 = _03_UARTA_BASECLK_FXX_16;
- UA1CTL2 = _11_UARTA1_BASECLK_DIVISION;
- UA1CTL0 = _10_UARTA_TRANSFDIR_LSB | _00_UARTA_PARITY_NONE | _02_UARTA_DATALENGTH_8BIT | _00_UARTA_STOPLENGTH_1BIT;
- UA1OPT0 = _14_UARTA_UAnOPT0_INITIALVALUE | _00_UARTA_TRAN_DATALEVEL_NORMAL | _00_UARTA_REC_DATALEVEL_NORMAL;
- UA1PWR = 1U; /* enable UARTA1 operation */
- /* Set TXDA1 pin */
- /* Set RXDA1 pin */
- PFC3_bit.no0 = 0;
- PFCE3_bit.no0 = 0;
- PMC3_bit.no0 = 1;
-
- PFC3_bit.no1 = 0;
- PFCE3_bit.no1 = 0;
- PMC3_bit.no1 = 1;
-
- return RT_EOK;
-}
-
-static rt_err_t rt_uart_open(rt_device_t dev, rt_uint16_t oflag)
-{
- RT_ASSERT(dev != RT_NULL);
- if (dev->flag & RT_DEVICE_FLAG_INT_RX)
- {
- /* Enable the UART Interrupt */
- UA1TIF = 0U; /* clear INTUA1T interrupt flag */
- UA1TMK = 1U; /* disable INTUA1T interrupt */
- UA1RIF = 0U; /* clear INTUA1R interrupt flag */
- UA1RMK = 0U; /* enable INTUA1R interrupt */
- UA1TXE = 1U; /* enable UARTA1 transmission operation */
- UA1RXE = 1U; /* enable UARTA1 reception operation */
- }
-
- return RT_EOK;
-}
-
-static rt_err_t rt_uart_close(rt_device_t dev)
-{
- RT_ASSERT(dev != RT_NULL);
- if (dev->flag & RT_DEVICE_FLAG_INT_RX)
- {
- /* Disable the UART Interrupt */
- UA1TXE = 0U; /* disable UARTA1 transmission operation */
- UA1RXE = 0U; /* disable UARTA1 reception operation */
- UA1TMK = 1U; /* disable INTUA1T interrupt */
- UA1TIF = 0U; /* clear INTUA1T interrupt flag */
- UA1RMK = 1U; /* disable INTUA1R interrupt */
- UA1RIF = 0U; /* clear INTUA1R interrupt flag */
- }
-
- return RT_EOK;
-}
-
-static rt_size_t rt_uart_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
-{
- rt_uint8_t* ptr;
- struct rt_uart_v850 *uart = (struct rt_uart_v850*)dev;
- RT_ASSERT(uart != RT_NULL);
-
- /* point to buffer */
- ptr = (rt_uint8_t*) buffer;
- if (dev->flag & RT_DEVICE_FLAG_INT_RX)
- {
- while (size)
- {
- /* interrupt receive */
- rt_base_t level;
-
- /* disable interrupt */
- level = rt_hw_interrupt_disable();
- if (uart->read_index != uart->save_index)
- {
- *ptr = uart->rx_buffer[uart->read_index];
-
- uart->read_index ++;
- if (uart->read_index >= RT_UART_RX_BUFFER_SIZE)
- uart->read_index = 0;
- }
- else
- {
- /* no data in rx buffer */
-
- /* enable interrupt */
- rt_hw_interrupt_enable(level);
- break;
- }
-
- /* enable interrupt */
- rt_hw_interrupt_enable(level);
-
- ptr ++;
- size --;
- }
-
- return (rt_uint32_t)ptr - (rt_uint32_t)buffer;
- }
-
- return 0;
-}
-
-static rt_size_t rt_uart_write(rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size)
-{
- char *ptr;
- ptr = (char*)buffer;
-
- if (dev->flag & RT_DEVICE_FLAG_STREAM)
- {
- /* stream mode */
- while (size)
- {
- if (*ptr == '\n')
- {
- while(UA1TSF == 1U)
- ;
- UA1TX = '\r';
- }
-
- /* THRE status, contain valid data */
- while(UA1TSF == 1U)
- ;
- UA1TX = *ptr;
-
- ptr ++;
- size --;
- }
- }
- else
- {
- while ( size != 0 )
- {
- /* THRE status, contain valid data */
- while(UA1TSF == 1U)
- ;
- UA1TX = *ptr;
-
- ptr++;
- size--;
- }
- }
-
- return (rt_size_t) ptr - (rt_size_t) buffer;
-}
-
-void rt_hw_uart_init(void)
-{
- struct rt_uart_v850* uart;
-
- /* get uart device */
- uart = &uart_device;
-
- /* device initialization */
- uart->parent.type = RT_Device_Class_Char;
- rt_memset(uart->rx_buffer, 0, sizeof(uart->rx_buffer));
- uart->read_index = uart->save_index = 0;
-
- /* device interface */
- uart->parent.init = rt_uart_init;
- uart->parent.open = rt_uart_open;
- uart->parent.close = rt_uart_close;
- uart->parent.read = rt_uart_read;
- uart->parent.write = rt_uart_write;
- uart->parent.control = RT_NULL;
- uart->parent.user_data = RT_NULL;
-
- rt_device_register(&uart->parent,
- "uart0", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STREAM | RT_DEVICE_FLAG_INT_RX);
-}
-#endif /* end of UART */
-
-/*@}*/