summaryrefslogtreecommitdiff
path: root/bsp/lpc2148
diff options
context:
space:
mode:
authorbernard.xiong <[email protected]>2009-07-02 23:19:19 +0000
committerbernard.xiong <[email protected]>2009-07-02 23:19:19 +0000
commitc462da5dd02f77e4440958cdfb12173cb3cc8cf3 (patch)
treeb20fe8ab9aa22f6bc08a7deced7a3240ebe3b815 /bsp/lpc2148
parent99922cdf19851bf89989d997ae4a0c02f6eed523 (diff)
import lm3s, lpc2148/lpc2478, x86/qemu, AT91SAM7S/7X, s3c44b0, STM32F103ZE bsp
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@5 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'bsp/lpc2148')
-rw-r--r--bsp/lpc2148/application.c140
-rw-r--r--bsp/lpc2148/board.c106
-rw-r--r--bsp/lpc2148/board.h28
-rw-r--r--bsp/lpc2148/dm9000.c157
-rw-r--r--bsp/lpc2148/dm9000.h6
-rw-r--r--bsp/lpc2148/project.Opt130
-rw-r--r--bsp/lpc2148/project.Uv2193
-rw-r--r--bsp/lpc2148/rtconfig.h138
-rw-r--r--bsp/lpc2148/sd.c93
-rw-r--r--bsp/lpc2148/sd.h6
-rw-r--r--bsp/lpc2148/startup.c140
11 files changed, 1137 insertions, 0 deletions
diff --git a/bsp/lpc2148/application.c b/bsp/lpc2148/application.c
new file mode 100644
index 0000000000..6c1f0113cc
--- /dev/null
+++ b/bsp/lpc2148/application.c
@@ -0,0 +1,140 @@
+/*
+ * File : app.c
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2006, 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
+ * 2006-06-05 Bernard the first version
+ */
+
+#include <rtthread.h>
+#include <finsh.h>
+
+/**
+ * @addtogroup LPC2148
+ */
+/*@{*/
+
+#ifdef RT_USING_DFS
+/* dfs init */
+#include <dfs_init.h>
+/* dfs filesystem:FAT filesystem init */
+#include <dfs_fat.h>
+/* dfs filesystem:EFS filesystem init */
+#include <dfs_efs.h>
+/* dfs Filesystem APIs */
+#include <dfs_fs.h>
+#endif
+
+#ifdef RT_USING_LWIP
+#include <lwip/sys.h>
+#endif
+
+#ifdef RT_USING_RTGUI
+#include <rtgui/rtgui.h>
+#endif
+
+/* thread phase init */
+void rt_init_thread_entry(void *parameter)
+{
+/* Filesystem Initialization */
+#ifdef RT_USING_DFS
+ {
+ /* init the device filesystem */
+ dfs_init();
+ /* init the efsl filesystam*/
+ efsl_init();
+
+ /* mount sd card fat partition 1 as root directory */
+ if (dfs_mount("sd0", "/", "efs", 0, 0) == 0)
+ rt_kprintf("File System initialized!\n");
+ else
+ rt_kprintf("File System init failed!\n");
+ }
+#endif
+
+/* LwIP Initialization */
+#ifdef RT_USING_LWIP
+ {
+ extern void lwip_sys_init(void);
+
+ /* init lwip system */
+ lwip_sys_init();
+ rt_kprintf("TCP/IP initialized!\n");
+ }
+#endif
+}
+
+/************** LED BLINK *******************/
+#include "lpc214x.h"
+#define LED1 ( 1<<16) //P1
+#define LED2 ( 1<<17) //P1
+#define LED3 ( 1<<18) //P1
+#define LED4 ( 1<<19) //P1
+char thread3_stack[512];
+struct rt_thread thread3;
+void thread3_entry(void* parameter)
+{
+ volatile unsigned int i;
+ IO1DIR |= LED1;
+ while(1)
+ {
+ IO1CLR = LED1;
+ rt_thread_delay(20);
+ IO1SET = LED1;
+ rt_thread_delay(20);
+ }
+}
+
+char thread4_stack[512];
+struct rt_thread thread4;
+void thread4_entry(void* parameter)
+{
+ volatile unsigned int i;
+ IO1DIR |= LED2;
+ while(1)
+ {
+ IO1CLR = LED2;
+ rt_thread_delay(30);
+ IO1SET = LED2;
+ rt_thread_delay(30);
+ }
+}
+/************** LED BLINK *******************/
+
+int rt_application_init()
+{
+ rt_thread_init(&thread3,
+ "led1",
+ thread3_entry, RT_NULL,
+ &thread3_stack[0], sizeof(thread3_stack),
+ 20, 10);
+
+ rt_thread_init(&thread4,
+ "led2",
+ thread4_entry, RT_NULL,
+ &thread4_stack[0], sizeof(thread4_stack),
+ 25, 8);
+ rt_thread_startup(&thread3);
+ rt_thread_startup(&thread4);
+
+ {
+ rt_thread_t init_thread;
+
+ init_thread = rt_thread_create("init",
+ rt_init_thread_entry, RT_NULL,
+ 1024, 8, 5);
+ rt_thread_startup(init_thread);
+ }
+
+ rt_kprintf("enter list() to get function list!\n");
+
+ return 0;
+}
+
+/*@}*/
diff --git a/bsp/lpc2148/board.c b/bsp/lpc2148/board.c
new file mode 100644
index 0000000000..6d029a4a80
--- /dev/null
+++ b/bsp/lpc2148/board.c
@@ -0,0 +1,106 @@
+/*
+ * File : board.c
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2006, 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://openlab.rt-thread.com/license/LICENSE
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2006-08-23 Bernard first implementation
+ */
+
+#include <rthw.h>
+#include <rtthread.h>
+
+#include "lpc214x.h"
+#include "board.h"
+
+/**
+ * @addtogroup LPC2148
+ */
+/*@{*/
+
+/**
+ * This is the timer interrupt service routine.
+ * @param vector the irq number for timer
+ */
+void rt_hw_timer_handler(int vector)
+{
+ rt_tick_increase();
+
+ /* clear interrupt flag */
+ T0IR |= 0x01;
+
+ /* acknowledge Interrupt */
+ VICVectAddr = 0;
+}
+
+/**
+ * This function is used to display a string on console, normally, it's
+ * invoked by rt_kprintf
+ *
+ * @param str the displayed string
+ */
+void rt_hw_console_output(const char* str)
+{
+ while (*str)
+ {
+ if (*str=='\n')
+ {
+ while (!(U0LSR & 0x20));
+ U0THR = '\r';
+ }
+
+ while (!(U0LSR & 0x20));
+ U0THR = *str;
+
+ str ++;
+ }
+}
+
+#define BAUD_RATE 115200
+#define U0PINS 0x05
+void rt_hw_console_init()
+{
+ /* Enable RxD and TxD pins */
+ PINSEL0 = U0PINS;
+
+ /* 8 bits, no Parity, 1 Stop bit */
+ U0LCR = 0x83;
+
+ /* Setup Baudrate */
+ U0DLL = (PCLK/16/BAUD_RATE) & 0xFF;
+ U0DLM = ((PCLK/16/BAUD_RATE) >> 8) & 0xFF;
+
+ /* DLAB = 0 */
+ U0LCR = 0x03;
+}
+
+/**
+ * This function will initial sam7x256 board.
+ */
+void rt_hw_board_init()
+{
+ /* console init */
+ rt_hw_console_init();
+
+ /* prescaler = 0*/
+ T0PR = 0;
+ T0PC = 0;
+
+ /* reset and enable MR0 interrupt */
+ T0MCR = 0x3;
+ T0MR0 = PCLK / RT_TICK_PER_SECOND;
+
+ /* enable timer 0 */
+ T0TCR = 1;
+
+ /* install timer handler */
+ rt_hw_interrupt_install(TIMER0_INT, rt_hw_timer_handler, RT_NULL);
+ rt_hw_interrupt_umask(TIMER0_INT);
+}
+
+/*@}*/
diff --git a/bsp/lpc2148/board.h b/bsp/lpc2148/board.h
new file mode 100644
index 0000000000..beec781a62
--- /dev/null
+++ b/bsp/lpc2148/board.h
@@ -0,0 +1,28 @@
+/*
+ * File : board.h
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2006, 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://openlab.rt-thread.com/license/LICENSE
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2009-02-16 Bernard add board.h to this bsp
+ */
+
+#ifndef __BOARD_H__
+#define __BOARD_H__
+#include <rtthread.h>
+
+#define CCLK 60000000 /* Fosc = 12MHz, M = 5 */
+#define PCLK 15000000 /* CCLK/4, use default */
+
+void rt_hw_board_init(void);
+
+#ifdef RT_USING_FINSH
+void rt_hw_finsh_init(void);
+#endif
+
+#endif
diff --git a/bsp/lpc2148/dm9000.c b/bsp/lpc2148/dm9000.c
new file mode 100644
index 0000000000..f64dbde160
--- /dev/null
+++ b/bsp/lpc2148/dm9000.c
@@ -0,0 +1,157 @@
+#include <rtthread.h>
+#include "dm9000.h"
+
+#include <netif/ethernetif.h>
+#include "lwipopts.h"
+
+#define MAX_ADDR_LEN 6
+struct rt_dm9000_eth
+{
+ /* inherit from ethernet device */
+ struct eth_device parent;
+
+ /* interface address info. */
+ rt_uint8_t dev_addr[MAX_ADDR_LEN]; /* hw address */
+};
+static struct rt_dm9000_eth dm9000_device;
+
+/* interrupt service routine */
+void rt_dm9000_isr(int irqno)
+{
+ rt_uint32_t status;
+
+ if (status) // if receive packet
+ {
+ rt_err_t result;
+
+ /* a frame has been received */
+ result = eth_device_ready(&(dm9000_device.parent));
+ RT_ASSERT(result == RT_EOK);
+ }
+
+ if (status) // if finished packet transmission
+ {
+ }
+}
+
+/* RT-Thread Device Interface */
+/* initialize the interface */
+
+static rt_err_t rt_dm9000_init(rt_device_t dev)
+{
+ return RT_EOK;
+}
+
+static rt_err_t rt_dm9000_open(rt_device_t dev, rt_uint16_t oflag)
+{
+ return RT_EOK;
+}
+
+static rt_err_t rt_dm9000_close(rt_device_t dev)
+{
+ return RT_EOK;
+}
+
+static rt_size_t rt_dm9000_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
+{
+ rt_set_errno(-RT_ENOSYS);
+ return 0;
+}
+
+static rt_size_t rt_dm9000_write (rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size)
+{
+ rt_set_errno(-RT_ENOSYS);
+ return 0;
+}
+
+static rt_err_t rt_dm9000_control(rt_device_t dev, rt_uint8_t cmd, void *args)
+{
+ switch(cmd)
+ {
+ case NIOCTL_GADDR:
+ /* get mac address */
+ if(args) rt_memcpy(args, dm9000_device.dev_addr, 6);
+ else return -RT_ERROR;
+ break;
+
+ default :
+ break;
+ }
+
+ return RT_EOK;
+}
+
+/* ethernet device interface */
+/* transmit packet. */
+rt_err_t rt_dm9000_tx( rt_device_t dev, struct pbuf* p)
+{
+ struct pbuf* q;
+ rt_uint32_t len;
+ rt_uint8_t* ptr;
+
+ for (q = p; q != NULL; q = q->next)
+ {
+ len = q->len;
+ ptr = q->payload;
+
+ /* write data to device */
+ }
+
+ return RT_EOK;
+}
+
+/* reception packet. */
+struct pbuf *rt_dm9000_rx(rt_device_t dev)
+{
+ struct pbuf* p;
+ rt_uint32_t len;
+
+ /* init p pointer */
+ p = RT_NULL;
+
+ if (1) // if there is packet in device
+ {
+ /* get one packet length */
+ len = 0; // packet length
+
+ /* allocate buffer */
+ p = pbuf_alloc(PBUF_LINK, len, PBUF_RAM);
+
+ if (p != RT_NULL)
+ {
+ rt_uint8_t* data;
+ struct pbuf* q;
+
+ for (q = p; q != RT_NULL; q= q->next)
+ {
+ data = q->payload;
+ len = q->len;
+
+ /* read data from device */
+ }
+ }
+ }
+ else
+ {
+ /* restore interrupt */
+ }
+
+ return p;
+}
+
+void rt_hw_dm9000_init()
+{
+ dm9000_device.parent.parent.init = rt_dm9000_init;
+ dm9000_device.parent.parent.open = rt_dm9000_open;
+ dm9000_device.parent.parent.close = rt_dm9000_close;
+ dm9000_device.parent.parent.read = rt_dm9000_read;
+ dm9000_device.parent.parent.write = rt_dm9000_write;
+ dm9000_device.parent.parent.control = rt_dm9000_control;
+ dm9000_device.parent.parent.private = RT_NULL;
+
+ dm9000_device.parent.eth_rx = rt_dm9000_rx;
+ dm9000_device.parent.eth_tx = rt_dm9000_tx;
+
+ rt_device_register((rt_device_t)&dm9000_device,
+ "E0", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_INT_TX);
+}
diff --git a/bsp/lpc2148/dm9000.h b/bsp/lpc2148/dm9000.h
new file mode 100644
index 0000000000..402a2fe7ff
--- /dev/null
+++ b/bsp/lpc2148/dm9000.h
@@ -0,0 +1,6 @@
+#ifndef __DM9000_H__
+#define __DM9000_H__
+
+void rt_hw_dm9000_init(void);
+
+#endif
diff --git a/bsp/lpc2148/project.Opt b/bsp/lpc2148/project.Opt
new file mode 100644
index 0000000000..55b3f79ea0
--- /dev/null
+++ b/bsp/lpc2148/project.Opt
@@ -0,0 +1,130 @@
+### uVision2 Project, (C) Keil Software
+### Do not modify !
+
+ cExt (*.c)
+ aExt (*.s*; *.src; *.a*)
+ oExt (*.obj)
+ lExt (*.lib)
+ tExt (*.txt; *.h; *.inc)
+ pExt (*.plm)
+ CppX (*.cpp)
+ DaveTm { 0,0,0,0,0,0,0,0 }
+
+Target (RT-Thread/LPC2148), 0x0004 // Tools: 'ARM-ADS'
+GRPOPT 1,(Startup),1,0,0
+GRPOPT 2,(Kernel),0,0,0
+GRPOPT 3,(LPC214x),0,0,0
+GRPOPT 4,(finsh),0,0,0
+GRPOPT 5,(Filesystem),0,0,0
+GRPOPT 6,(LwIP),0,0,0
+
+OPTFFF 1,1,1,150994944,0,0,0,0,<.\application.c><application.c>
+OPTFFF 1,2,1,0,0,0,0,0,<.\board.c><board.c>
+OPTFFF 1,3,1,0,0,0,0,0,<.\startup.c><startup.c>
+OPTFFF 1,4,1,0,0,0,0,0,<.\dm9000.c><dm9000.c>
+OPTFFF 1,5,1,0,0,0,0,0,<.\sd.c><sd.c>
+OPTFFF 1,6,5,0,0,0,0,0,<.\rtconfig.h><rtconfig.h>
+OPTFFF 2,7,1,0,0,0,0,0,<..\..\src\clock.c><clock.c>
+OPTFFF 2,8,1,150994944,0,0,0,0,<..\..\src\device.c><device.c>
+OPTFFF 2,9,1,0,0,0,0,0,<..\..\src\ipc.c><ipc.c>
+OPTFFF 2,10,1,0,0,0,0,0,<..\..\src\mempool.c><mempool.c>
+OPTFFF 2,11,1,0,0,0,0,0,<..\..\src\object.c><object.c>
+OPTFFF 2,12,1,0,0,0,0,0,<..\..\src\timer.c><timer.c>
+OPTFFF 2,13,1,0,0,0,0,0,<..\..\src\idle.c><idle.c>
+OPTFFF 2,14,1,0,0,0,0,0,<..\..\src\irq.c><irq.c>
+OPTFFF 2,15,1,0,0,0,0,0,<..\..\src\mem.c><mem.c>
+OPTFFF 2,16,1,0,0,0,0,0,<..\..\src\scheduler.c><scheduler.c>
+OPTFFF 2,17,1,0,0,0,0,0,<..\..\src\slab.c><slab.c>
+OPTFFF 2,18,1,0,0,0,0,0,<..\..\src\thread.c><thread.c>
+OPTFFF 2,19,1,0,0,0,0,0,<..\..\src\kservice.c><kservice.c>
+OPTFFF 3,20,1,0,0,0,0,0,<..\..\libcpu\arm\lpc214x\serial.c><serial.c>
+OPTFFF 3,21,1,0,0,0,0,0,<..\..\libcpu\arm\lpc214x\interrupt.c><interrupt.c>
+OPTFFF 3,22,1,0,0,0,0,0,<..\..\libcpu\arm\lpc214x\cpu.c><cpu.c>
+OPTFFF 3,23,1,0,0,0,0,0,<..\..\libcpu\arm\lpc214x\trap.c><trap.c>
+OPTFFF 3,24,1,0,0,0,0,0,<..\..\libcpu\arm\lpc214x\stack.c><stack.c>
+OPTFFF 3,25,2,0,0,0,0,0,<..\..\libcpu\arm\lpc214x\start_rvds.s><start_rvds.s>
+OPTFFF 3,26,2,0,0,0,0,0,<..\..\libcpu\arm\lpc214x\context_rvds.s><context_rvds.s>
+OPTFFF 4,27,1,0,0,0,0,0,<..\..\finsh\finsh_compiler.c><finsh_compiler.c>
+OPTFFF 4,28,1,0,0,0,0,0,<..\..\finsh\finsh_error.c><finsh_error.c>
+OPTFFF 4,29,1,0,0,0,0,0,<..\..\finsh\finsh_heap.c><finsh_heap.c>
+OPTFFF 4,30,1,0,0,0,0,0,<..\..\finsh\finsh_init.c><finsh_init.c>
+OPTFFF 4,31,1,0,0,0,0,0,<..\..\finsh\finsh_node.c><finsh_node.c>
+OPTFFF 4,32,1,0,0,0,0,0,<..\..\finsh\finsh_ops.c><finsh_ops.c>
+OPTFFF 4,33,1,0,0,0,0,0,<..\..\finsh\finsh_token.c><finsh_token.c>
+OPTFFF 4,34,1,0,0,0,0,0,<..\..\finsh\finsh_var.c><finsh_var.c>
+OPTFFF 4,35,1,0,0,0,0,0,<..\..\finsh\finsh_vm.c><finsh_vm.c>
+OPTFFF 4,36,1,0,0,0,0,0,<..\..\finsh\shell.c><shell.c>
+OPTFFF 4,37,1,0,0,0,0,0,<..\..\finsh\symbol.c><symbol.c>
+OPTFFF 4,38,1,0,0,0,0,0,<..\..\finsh\cmd.c><cmd.c>
+OPTFFF 4,39,1,0,0,0,0,0,<..\..\finsh\finsh_parser.c><finsh_parser.c>
+OPTFFF 5,40,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_util.c><dfs_util.c>
+OPTFFF 5,41,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_cache.c><dfs_cache.c>
+OPTFFF 5,42,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_fs.c><dfs_fs.c>
+OPTFFF 5,43,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_init.c><dfs_init.c>
+OPTFFF 5,44,1,301989888,0,0,0,0,<..\..\filesystem\dfs\src\dfs_posix.c><dfs_posix.c>
+OPTFFF 5,45,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_raw.c><dfs_raw.c>
+OPTFFF 5,46,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\plibc.c><plibc.c>
+OPTFFF 5,47,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c><efs.c>
+OPTFFF 5,48,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\extract.c><extract.c>
+OPTFFF 5,49,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\partition.c><partition.c>
+OPTFFF 5,50,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\dir.c><dir.c>
+OPTFFF 5,51,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fat.c><fat.c>
+OPTFFF 5,52,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\file.c><file.c>
+OPTFFF 5,53,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fs.c><fs.c>
+OPTFFF 5,54,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ls.c><ls.c>
+OPTFFF 5,55,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ui.c><ui.c>
+OPTFFF 5,56,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\time.c><time.c>
+OPTFFF 6,57,1,0,0,0,0,0,<..\..\net\lwip\src\netif\etharp.c><etharp.c>
+OPTFFF 6,58,1,150994944,0,0,0,0,<..\..\net\lwip\src\netif\ethernetif.c><ethernetif.c>
+OPTFFF 6,59,1,0,0,0,0,0,<..\..\net\lwip\src\core\udp.c><udp.c>
+OPTFFF 6,60,1,0,0,0,0,0,<..\..\net\lwip\src\core\dhcp.c><dhcp.c>
+OPTFFF 6,61,1,0,0,0,0,0,<..\..\net\lwip\src\core\dns.c><dns.c>
+OPTFFF 6,62,1,0,0,0,0,0,<..\..\net\lwip\src\core\init.c><init.c>
+OPTFFF 6,63,1,0,0,0,0,0,<..\..\net\lwip\src\core\memp_tiny.c><memp_tiny.c>
+OPTFFF 6,64,1,0,0,0,0,0,<..\..\net\lwip\src\core\netif.c><netif.c>
+OPTFFF 6,65,1,0,0,0,0,0,<..\..\net\lwip\src\core\pbuf.c><pbuf.c>
+OPTFFF 6,66,1,0,0,0,0,0,<..\..\net\lwip\src\core\raw.c><raw.c>
+OPTFFF 6,67,1,0,0,0,0,0,<..\..\net\lwip\src\core\stats.c><stats.c>
+OPTFFF 6,68,1,0,0,0,0,0,<..\..\net\lwip\src\core\sys.c><sys.c>
+OPTFFF 6,69,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp.c><tcp.c>
+OPTFFF 6,70,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp_in.c><tcp_in.c>
+OPTFFF 6,71,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp_out.c><tcp_out.c>
+OPTFFF 6,72,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip_frag.c><ip_frag.c>
+OPTFFF 6,73,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\autoip.c><autoip.c>
+OPTFFF 6,74,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\icmp.c><icmp.c>
+OPTFFF 6,75,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\igmp.c><igmp.c>
+OPTFFF 6,76,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\inet.c><inet.c>
+OPTFFF 6,77,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\inet_chksum.c><inet_chksum.c>
+OPTFFF 6,78,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip.c><ip.c>
+OPTFFF 6,79,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip_addr.c><ip_addr.c>
+OPTFFF 6,80,1,0,0,0,0,0,<..\..\net\lwip\src\api\tcpip.c><tcpip.c>
+OPTFFF 6,81,1,0,0,0,0,0,<..\..\net\lwip\src\api\api_lib.c><api_lib.c>
+OPTFFF 6,82,1,0,0,0,0,0,<..\..\net\lwip\src\api\api_msg.c><api_msg.c>
+OPTFFF 6,83,1,0,0,0,0,0,<..\..\net\lwip\src\api\err.c><err.c>
+OPTFFF 6,84,1,0,0,0,0,0,<..\..\net\lwip\src\api\netbuf.c><netbuf.c>
+OPTFFF 6,85,1,0,0,0,0,0,<..\..\net\lwip\src\api\netdb.c><netdb.c>
+OPTFFF 6,86,1,0,0,0,0,0,<..\..\net\lwip\src\api\netifapi.c><netifapi.c>
+OPTFFF 6,87,1,0,0,0,0,0,<..\..\net\lwip\src\api\sockets.c><sockets.c>
+OPTFFF 6,88,1,0,0,0,0,0,<..\..\net\lwip\src\arch\sys_arch_init.c><sys_arch_init.c>
+OPTFFF 6,89,1,0,0,0,0,0,<..\..\net\lwip\src\arch\sys_arch.c><sys_arch.c>
+
+
+TARGOPT 1, (RT-Thread/LPC2148)
+ ADSCLK=12000000
+ OPTTT 1,1,1,0
+ OPTHX 1,65535,0,0,0
+ OPTLX 79,66,8,<.\objs\>
+ OPTOX 16
+ OPTLT 1,1,1,0,1,1,0,1,0,0,0,0
+ OPTXL 1,1,1,1,1,1,1,0,0
+ OPTFL 1,0,1
+ OPTAX 0
+ OPTDL (SARM.DLL)(-cLPC2100)(DARMP.DLL)(-pLPC2148)(SARM.DLL)()(TARMP.DLL)(-pLPC2148)
+ OPTDBG 48125,6,()()()()()()()()()() (Segger\JLTAgdi.dll)()()()
+ OPTKEY 0,(DLGDARM)((134=-1,-1,-1,-1,0)(135=-1,-1,-1,-1,0)(153=-1,-1,-1,-1,0)(154=-1,-1,-1,-1,0)(108=-1,-1,-1,-1,0)(106=-1,-1,-1,-1,0)(105=-1,-1,-1,-1,0)(145=-1,-1,-1,-1,0)(147=-1,-1,-1,-1,0)(80=-1,-1,-1,-1,0)(104=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(101=-1,-1,-1,-1,0)(160=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(113=556,103,931,655,0)(112=-1,-1,-1,-1,0)(137=-1,-1,-1,-1,0)(138=-1,-1,-1,-1,0)(117=-1,-1,-1,-1,0)(146=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(114=-1,-1,-1,-1,0)(141=-1,-1,-1,-1,0)(142=-1,-1,-1,-1,0)(143=-1,-1,-1,-1,0)(144=-1,-1,-1,-1,0)(115=-1,-1,-1,-1,0)(116=-1,-1,-1,-1,0))
+ OPTKEY 0,(ARMDBGFLAGS)(-T5F)
+ OPTDF 0xB0
+ OPTLE <>
+ OPTLC <>
+EndOpt
+
diff --git a/bsp/lpc2148/project.Uv2 b/bsp/lpc2148/project.Uv2
new file mode 100644
index 0000000000..f1f82c90c8
--- /dev/null
+++ b/bsp/lpc2148/project.Uv2
@@ -0,0 +1,193 @@
+### uVision2 Project, (C) Keil Software
+### Do not modify !
+
+Target (RT-Thread/LPC2148), 0x0004 // Tools: 'ARM-ADS'
+
+Group (Startup)
+Group (Kernel)
+Group (LPC214x)
+Group (finsh)
+Group (Filesystem)
+Group (LwIP)
+
+File 1,1,<.\application.c><application.c>
+File 1,1,<.\board.c><board.c>
+File 1,1,<.\startup.c><startup.c>
+File 1,1,<.\dm9000.c><dm9000.c>
+File 1,1,<.\sd.c><sd.c>
+File 1,5,<.\rtconfig.h><rtconfig.h>
+File 2,1,<..\..\src\clock.c><clock.c>
+File 2,1,<..\..\src\device.c><device.c>
+File 2,1,<..\..\src\ipc.c><ipc.c>
+File 2,1,<..\..\src\mempool.c><mempool.c>
+File 2,1,<..\..\src\object.c><object.c>
+File 2,1,<..\..\src\timer.c><timer.c>
+File 2,1,<..\..\src\idle.c><idle.c>
+File 2,1,<..\..\src\irq.c><irq.c>
+File 2,1,<..\..\src\mem.c><mem.c>
+File 2,1,<..\..\src\scheduler.c><scheduler.c>
+File 2,1,<..\..\src\slab.c><slab.c>
+File 2,1,<..\..\src\thread.c><thread.c>
+File 2,1,<..\..\src\kservice.c><kservice.c>
+File 3,1,<..\..\libcpu\arm\lpc214x\serial.c><serial.c>
+File 3,1,<..\..\libcpu\arm\lpc214x\interrupt.c><interrupt.c>
+File 3,1,<..\..\libcpu\arm\lpc214x\cpu.c><cpu.c>
+File 3,1,<..\..\libcpu\arm\lpc214x\trap.c><trap.c>
+File 3,1,<..\..\libcpu\arm\lpc214x\stack.c><stack.c>
+File 3,2,<..\..\libcpu\arm\lpc214x\start_rvds.s><start_rvds.s>
+File 3,2,<..\..\libcpu\arm\lpc214x\context_rvds.s><context_rvds.s>
+File 4,1,<..\..\finsh\finsh_compiler.c><finsh_compiler.c>
+File 4,1,<..\..\finsh\finsh_error.c><finsh_error.c>
+File 4,1,<..\..\finsh\finsh_heap.c><finsh_heap.c>
+File 4,1,<..\..\finsh\finsh_init.c><finsh_init.c>
+File 4,1,<..\..\finsh\finsh_node.c><finsh_node.c>
+File 4,1,<..\..\finsh\finsh_ops.c><finsh_ops.c>
+File 4,1,<..\..\finsh\finsh_token.c><finsh_token.c>
+File 4,1,<..\..\finsh\finsh_var.c><finsh_var.c>
+File 4,1,<..\..\finsh\finsh_vm.c><finsh_vm.c>
+File 4,1,<..\..\finsh\shell.c><shell.c>
+File 4,1,<..\..\finsh\symbol.c><symbol.c>
+File 4,1,<..\..\finsh\cmd.c><cmd.c>
+File 4,1,<..\..\finsh\finsh_parser.c><finsh_parser.c>
+File 5,1,<..\..\filesystem\dfs\src\dfs_util.c><dfs_util.c>
+File 5,1,<..\..\filesystem\dfs\src\dfs_cache.c><dfs_cache.c>
+File 5,1,<..\..\filesystem\dfs\src\dfs_fs.c><dfs_fs.c>
+File 5,1,<..\..\filesystem\dfs\src\dfs_init.c><dfs_init.c>
+File 5,1,<..\..\filesystem\dfs\src\dfs_posix.c><dfs_posix.c>
+File 5,1,<..\..\filesystem\dfs\src\dfs_raw.c><dfs_raw.c>
+File 5,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\plibc.c><plibc.c>
+File 5,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c><efs.c>
+File 5,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\extract.c><extract.c>
+File 5,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\partition.c><partition.c>
+File 5,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\dir.c><dir.c>
+File 5,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fat.c><fat.c>
+File 5,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\file.c><file.c>
+File 5,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fs.c><fs.c>
+File 5,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ls.c><ls.c>
+File 5,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ui.c><ui.c>
+File 5,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\time.c><time.c>
+File 6,1,<..\..\net\lwip\src\netif\etharp.c><etharp.c>
+File 6,1,<..\..\net\lwip\src\netif\ethernetif.c><ethernetif.c>
+File 6,1,<..\..\net\lwip\src\core\udp.c><udp.c>
+File 6,1,<..\..\net\lwip\src\core\dhcp.c><dhcp.c>
+File 6,1,<..\..\net\lwip\src\core\dns.c><dns.c>
+File 6,1,<..\..\net\lwip\src\core\init.c><init.c>
+File 6,1,<..\..\net\lwip\src\core\memp_tiny.c><memp_tiny.c>
+File 6,1,<..\..\net\lwip\src\core\netif.c><netif.c>
+File 6,1,<..\..\net\lwip\src\core\pbuf.c><pbuf.c>
+File 6,1,<..\..\net\lwip\src\core\raw.c><raw.c>
+File 6,1,<..\..\net\lwip\src\core\stats.c><stats.c>
+File 6,1,<..\..\net\lwip\src\core\sys.c><sys.c>
+File 6,1,<..\..\net\lwip\src\core\tcp.c><tcp.c>
+File 6,1,<..\..\net\lwip\src\core\tcp_in.c><tcp_in.c>
+File 6,1,<..\..\net\lwip\src\core\tcp_out.c><tcp_out.c>
+File 6,1,<..\..\net\lwip\src\core\ipv4\ip_frag.c><ip_frag.c>
+File 6,1,<..\..\net\lwip\src\core\ipv4\autoip.c><autoip.c>
+File 6,1,<..\..\net\lwip\src\core\ipv4\icmp.c><icmp.c>
+File 6,1,<..\..\net\lwip\src\core\ipv4\igmp.c><igmp.c>
+File 6,1,<..\..\net\lwip\src\core\ipv4\inet.c><inet.c>
+File 6,1,<..\..\net\lwip\src\core\ipv4\inet_chksum.c><inet_chksum.c>
+File 6,1,<..\..\net\lwip\src\core\ipv4\ip.c><ip.c>
+File 6,1,<..\..\net\lwip\src\core\ipv4\ip_addr.c><ip_addr.c>
+File 6,1,<..\..\net\lwip\src\api\tcpip.c><tcpip.c>
+File 6,1,<..\..\net\lwip\src\api\api_lib.c><api_lib.c>
+File 6,1,<..\..\net\lwip\src\api\api_msg.c><api_msg.c>
+File 6,1,<..\..\net\lwip\src\api\err.c><err.c>
+File 6,1,<..\..\net\lwip\src\api\netbuf.c><netbuf.c>
+File 6,1,<..\..\net\lwip\src\api\netdb.c><netdb.c>
+File 6,1,<..\..\net\lwip\src\api\netifapi.c><netifapi.c>
+File 6,1,<..\..\net\lwip\src\api\sockets.c><sockets.c>
+File 6,1,<..\..\net\lwip\src\arch\sys_arch_init.c><sys_arch_init.c>
+File 6,1,<..\..\net\lwip\src\arch\sys_arch.c><sys_arch.c>
+
+
+Options 1,0,0 // Target 'RT-Thread/LPC2148'
+ Device (LPC2148)
+ Vendor (NXP (founded by Philips))
+ Cpu (IRAM(0x40000000-0x40007FFF) IROM(0-0x7FFFF) CLOCK(12000000) CPUTYPE(ARM7TDMI))
+ FlashUt (LPC210x_ISP.EXE ("#H" ^X $D COM1: 38400 1))
+ StupF ("STARTUP\Philips\Startup.s" ("Philips LPC2100 Startup Code"))
+ FlashDR (UL2ARM(-U268761108 -O7 -C0 -FO15 -FD40000000 -FC800 -FN1 -FF0LPC_IAP2_512 -FS00 -FL07D000))
+ DevID (3880)
+ Rgf (LPC214X.H)
+ Mem ()
+ C ()
+ A ()
+ RL ()
+ OH ()
+ DBC_IFX ()
+ DBC_CMS ()
+ DBC_AMS ()
+ DBC_LMS ()
+ UseEnv=0
+ EnvBin ()
+ EnvInc ()
+ EnvLib ()
+ EnvReg (�Philips\)
+ OrgReg (�Philips\)
+ TgStat=16
+ OutDir (.\objs\)
+ OutName (rtthread-lpc2148)
+ GenApp=1
+ GenLib=0
+ GenHex=0
+ Debug=1
+ Browse=1
+ LstDir (.\objs\)
+ HexSel=1
+ MG32K=0
+ TGMORE=0
+ RunUsr 0 0 <>
+ RunUsr 1 0 <>
+ BrunUsr 0 0 <>
+ BrunUsr 1 0 <>
+ CrunUsr 0 0 <>
+ CrunUsr 1 0 <>
+ SVCSID <>
+ GLFLAGS=1790
+ ADSFLGA { 243,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
+ ACPUTYP (ARM7TDMI)
+ RVDEV ()
+ ADSTFLGA { 0,12,0,2,99,0,1,66,0,0,0,0,0,0,0,0,0,0,0,0 }
+ OCMADSOCM { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
+ OCMADSIRAM { 0,0,0,0,64,0,128,0,0 }
+ OCMADSIROM { 1,0,0,0,0,0,0,8,0 }
+ OCMADSXRAM { 0,0,0,0,0,0,0,0,0 }
+ OCR_RVCT { 1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,8,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,128,0,0,0,0,0,0,0,0,0,0,0 }
+ RV_STAVEC ()
+ ADSCCFLG { 5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
+ ADSCMISC ()
+ ADSCDEFN ()
+ ADSCUDEF ()
+ ADSCINCD (.;..\..\include;..\..\libcpu\arm\lpc214x;..\..\finsh;..\..\net\lwip\src;..\..\net\lwip\src\include;..\..\net\lwip\src\arch\include;..\..\net\lwip\src\include\ipv4;..\..\filesystem\dfs;..\..\filesystem\dfs\include;..\..\filesystem\dfs\filesystems\efsl\src\include;..\..\filesystem\dfs\filesystems\efsl\src\base\include;..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\include)
+ ADSASFLG { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
+ ADSAMISC ()
+ ADSADEFN ()
+ ADSAUDEF ()
+ ADSAINCD ()
+ PropFld { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
+ IncBld=1
+ AlwaysBuild=0
+ GenAsm=0
+ AsmAsm=0
+ PublicsOnly=0
+ StopCode=3
+ CustArgs ()
+ LibMods ()
+ ADSLDFG { 17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
+ ADSLDTA (0x00000000)
+ ADSLDDA (0x40000000)
+ ADSLDSC (.\rtthread-lpc2148.sct)
+ ADSLDIB ()
+ ADSLDIC ()
+ ADSLDMC (--keep __fsym_* --keep __vsym_*)
+ ADSLDIF ()
+ ADSLDDW ()
+ OPTDL (SARM.DLL)(-cLPC2100)(DARMP.DLL)(-pLPC2148)(SARM.DLL)()(TARMP.DLL)(-pLPC2148)
+ OPTDBG 48125,6,()()()()()()()()()() (Segger\JLTAgdi.dll)()()()
+ FLASH1 { 2,0,0,0,1,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0 }
+ FLASH2 (BIN\UL2ARM.DLL)
+ FLASH3 ("LPC210x_ISP.EXE" ("#H" ^X $D COM1: 38400 1))
+ FLASH4 ()
+EndOpt
+
diff --git a/bsp/lpc2148/rtconfig.h b/bsp/lpc2148/rtconfig.h
new file mode 100644
index 0000000000..14d1ef4e1a
--- /dev/null
+++ b/bsp/lpc2148/rtconfig.h
@@ -0,0 +1,138 @@
+/* RT-Thread config file */
+#ifndef __RTTHREAD_CFG_H__
+#define __RTTHREAD_CFG_H__
+
+/* RT_NAME_MAX*/
+#define RT_NAME_MAX 8
+
+/* RT_ALIGN_SIZE*/
+#define RT_ALIGN_SIZE 4
+
+/* PRIORITY_MAX*/
+#define RT_THREAD_PRIORITY_MAX 32
+
+/* Tick per Second*/
+#define RT_TICK_PER_SECOND 100
+
+/* SECTION: RT_DEBUG */
+/* Thread Debug*/
+/* #define RT_THREAD_DEBUG */
+
+/* Using Hook*/
+#define RT_USING_HOOK
+
+/* SECTION: IPC */
+/* Using Semaphore*/
+#define RT_USING_SEMAPHORE
+
+/* Using Mutex*/
+#define RT_USING_MUTEX
+
+/* Using Event*/
+#define RT_USING_EVENT
+
+/* Using Faset Event*/
+/* #define RT_USING_FASTEVENT */
+
+/* Using MailBox*/
+#define RT_USING_MAILBOX
+
+/* Using Message Queue*/
+#define RT_USING_MESSAGEQUEUE
+
+/* SECTION: Memory Management */
+/* Using Memory Pool Management*/
+#define RT_USING_MEMPOOL
+
+/* Using Dynamic Heap Management*/
+#define RT_USING_HEAP
+
+/* Using Small MM*/
+#define RT_USING_SMALL_MEM
+
+/* Using SLAB Allocator*/
+/* #define RT_USING_SLAB */
+
+/* SECTION: Device System */
+/* Using Device System*/
+#define RT_USING_DEVICE
+#define RT_USING_UART1
+#define RT_USING_UART2
+#define RT_UART_RX_BUFFER_SIZE 64
+
+/* SECTION: Console options */
+/* the buffer size of console*/
+#define RT_CONSOLEBUF_SIZE 128
+
+/* SECTION: FinSH shell options */
+/* Using FinSH as Shell*/
+#define RT_USING_FINSH
+/* Using symbol table */
+#define FINSH_USING_SYMTAB
+#define FINSH_USING_DESCRIPTION
+
+/* SECTION: emulator options */
+/* Using QEMU or SkyEye*/
+/* #define RT_USING_EMULATOR */
+
+/* SECTION: a mini libc */
+/* Using mini libc library*/
+/* #define RT_USING_MINILIBC */
+
+/* SECTION: C++ support */
+/* Using C++ support*/
+/* #define RT_USING_CPLUSPLUS */
+
+/* SECTION: DFS options */
+#define RT_USING_DFS
+/* the max number of mounted filesystem */
+#define DFS_FILESYSTEMS_MAX 2
+/* the max number of opened files */
+#define DFS_FD_MAX 4
+/* the max number of cached sector */
+#define DFS_CACHE_MAX_NUM 8
+
+/* SECTION: lwip, a lighwight TCP/IP protocol stack */
+/* Using lighweight TCP/IP protocol stack*/
+#define RT_USING_LWIP
+
+/* Trace LwIP protocol*/
+/* #define RT_LWIP_DEBUG */
+
+/* Enable ICMP protocol*/
+#define RT_LWIP_ICMP
+
+/* Enable IGMP protocol*/
+#define RT_LWIP_IGMP
+
+/* Enable UDP protocol*/
+#define RT_LWIP_UDP
+
+/* Enable TCP protocol*/
+#define RT_LWIP_TCP
+
+/* Enable SNMP protocol*/
+/* #define RT_LWIP_SNMP */
+
+/* Using DHCP*/
+/* #define RT_LWIP_DHCP */
+
+/* ip address of target*/
+#define RT_LWIP_IPADDR0 192
+#define RT_LWIP_IPADDR1 168
+#define RT_LWIP_IPADDR2 0
+#define RT_LWIP_IPADDR3 30
+
+/* gateway address of target*/
+#define RT_LWIP_GWADDR0 192
+#define RT_LWIP_GWADDR1 168
+#define RT_LWIP_GWADDR2 0
+#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
+
+#endif
diff --git a/bsp/lpc2148/sd.c b/bsp/lpc2148/sd.c
new file mode 100644
index 0000000000..9961cee5ec
--- /dev/null
+++ b/bsp/lpc2148/sd.c
@@ -0,0 +1,93 @@
+#include <rtthread.h>
+#include <dfs_fs.h>
+#include <lpc214x.h>
+
+#include "sd.h"
+
+static struct rt_device sd;
+static struct dfs_partition part;
+
+static rt_err_t rt_sdcard_init(rt_device_t dev)
+{
+ return RT_EOK;
+}
+
+static rt_err_t rt_sdcard_open(rt_device_t dev, rt_uint16_t oflag)
+{
+ return RT_EOK;
+}
+
+static rt_err_t rt_sdcard_close(rt_device_t dev)
+{
+ return RT_EOK;
+}
+
+static rt_size_t rt_sdcard_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
+{
+ /* append partition offset */
+ pos += part.offset * 512;
+
+ return 0;
+}
+
+static rt_size_t rt_sdcard_write (rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size)
+{
+ /* append partition offset */
+ pos += part.offset * 512;
+
+ return 0;
+}
+
+static rt_err_t rt_sdcard_control(rt_device_t dev, rt_uint8_t cmd, void *args)
+{
+ return RT_EOK;
+}
+
+void rt_hw_sdcard_init()
+{
+ rt_size_t length;
+ rt_uint8_t* sector;
+
+ /* sdcard hardware init */
+
+ sd.type = RT_Device_Class_Block;
+ sd.init = rt_sdcard_init;
+ sd.open = rt_sdcard_open;
+ sd.close = rt_sdcard_close;
+ sd.read = rt_sdcard_read;
+ sd.write = rt_sdcard_write;
+ sd.control = rt_sdcard_control;
+ sd.private = RT_NULL;
+
+ /* get the first sector to read partition table */
+ sector = (rt_uint8_t*) rt_malloc (512);
+ if (sector == RT_NULL)
+ {
+ rt_kprintf("allocate partition sector buffer failed\n");
+ return;
+ }
+
+ length = rt_sdcard_read((rt_device_t)&sd, 0, sector, 512);
+ if (length == 512)
+ {
+ rt_err_t status;
+
+ /* get the first partition */
+ status = dfs_filesystem_get_partition(&part, sector, 0);
+ if (status != RT_EOK)
+ {
+ /* there is no partition table */
+ part.offset = 0;
+ part.size = 0;
+ }
+ }
+ else
+ {
+ /* there is no partition table */
+ part.offset = 0;
+ part.size = 0;
+ }
+
+ rt_device_register(&sd,
+ "sd", RT_DEVICE_FLAG_RDWR);
+}
diff --git a/bsp/lpc2148/sd.h b/bsp/lpc2148/sd.h
new file mode 100644
index 0000000000..0f38e06dfb
--- /dev/null
+++ b/bsp/lpc2148/sd.h
@@ -0,0 +1,6 @@
+#ifndef __SPI_SD_H__
+#define __SPI_SD_H__
+
+void rt_hw_sdcard_init(void);
+
+#endif
diff --git a/bsp/lpc2148/startup.c b/bsp/lpc2148/startup.c
new file mode 100644
index 0000000000..eb9b5d065b
--- /dev/null
+++ b/bsp/lpc2148/startup.c
@@ -0,0 +1,140 @@
+/*
+ * File : startup.c
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2006, 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
+ * 2009-02-16 Bernard first implementation
+ */
+
+#include <rthw.h>
+#include <rtthread.h>
+#ifdef RT_USING_FINSH
+#include <finsh.h>
+#endif
+
+#include "board.h"
+#ifdef RT_USING_LWIP
+#include <netif/ethernetif.h>
+#include "dm9000.h"
+#endif
+#ifdef RT_USING_DFS
+#include "sd.h"
+#endif
+
+/**
+ * @addtogroup lpc2148
+ */
+
+/*@{*/
+
+#ifdef RT_USING_FINSH
+extern void finsh_system_init(void);
+#endif
+
+extern int rt_application_init(void);
+extern void rt_show_version(void);
+#ifdef RT_USING_DEVICE
+extern rt_err_t rt_hw_serial_init(void);
+#endif
+#ifdef RT_USING_FINSH
+extern void finsh_system_init(void);
+#endif
+
+#ifdef __CC_ARM
+extern int Image$$RW_IRAM1$$ZI$$Limit;
+#else
+extern int __bss_end;
+#endif
+
+/**
+ * This function will startup RT-Thread RTOS.
+ */
+void rtthread_startup(void)
+{
+ /* init hardware interrupt */
+ rt_hw_interrupt_init();
+
+ /* init board */
+ rt_hw_board_init();
+
+ /* init tick */
+ rt_system_tick_init();
+
+ /* init kernel object */
+ rt_system_object_init();
+
+ rt_show_version();
+
+ /* init timer system */
+ rt_system_timer_init();
+
+#ifdef RT_USING_HEAP
+#ifdef __CC_ARM
+ rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)0x40008000);
+#else
+ /* init memory system */
+ rt_system_heap_init((void*)&__bss_end, (void*)0x40008000);
+#endif
+#endif
+
+ /* init scheduler system */
+ rt_system_scheduler_init();
+
+#ifdef RT_USING_HOOK /* if the hook is used */
+ /* set idle thread hook */
+ rt_thread_idle_sethook(0);
+#endif
+
+#ifdef RT_USING_DEVICE
+#ifdef RT_USING_DFS
+ /* init sd card */
+ rt_hw_sdcard_init();
+#endif
+
+#ifdef RT_USING_LWIP
+ eth_system_device_init();
+ /* init ethernetif device */
+ rt_hw_dm9000_init();
+#endif
+
+ /* init hardware serial device */
+ rt_hw_serial_init();
+
+ /*init all registed devices*/
+ rt_device_init_all();
+#endif
+
+ /* init application */
+ rt_application_init();
+
+#ifdef RT_USING_FINSH
+ /* init finsh */
+ finsh_system_init();
+ finsh_set_device("uart1");
+#endif
+
+ /* init idle thread */
+ rt_thread_idle_init();
+
+ /* start scheduler */
+ rt_system_scheduler_start();
+
+ /* never reach here */
+ return ;
+}
+
+int main (void)
+{
+ /* invoke rtthread_startup */
+ rtthread_startup();
+
+ return 0;
+}
+
+/*@}*/