diff --git a/bsp/lpc176x/CMSIS/CM3/DeviceSupport/NXP/LPC17xx/startup/gcc/startup_LPC17xx.s b/bsp/lpc176x/CMSIS/CM3/DeviceSupport/NXP/LPC17xx/startup/gcc/startup_LPC17xx.s
index bd01a3ad00e2ca31131686178565f908e9ddbcb7..24f0805667c63011a2bff8097e360acfa5a8798b 100644
--- a/bsp/lpc176x/CMSIS/CM3/DeviceSupport/NXP/LPC17xx/startup/gcc/startup_LPC17xx.s
+++ b/bsp/lpc176x/CMSIS/CM3/DeviceSupport/NXP/LPC17xx/startup/gcc/startup_LPC17xx.s
@@ -1,62 +1,27 @@
-/*****************************************************************************/
-/* startup_LPC17xx.s: Startup file for LPC17xx device series */
-/*****************************************************************************/
-/* Version: CodeSourcery Sourcery G++ Lite (with CS3) */
-/*****************************************************************************/
-
-
-/*
-//*** <<< Use Configuration Wizard in Context Menu >>> ***
-*/
-
-
-/*
-// Stack Configuration
-// Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
-//
-*/
-
- .equ Stack_Size, 0x00000100
- .section ".stack", "w"
- .align 3
- .globl __cs3_stack_mem
- .globl __cs3_stack_size
-__cs3_stack_mem:
- .if Stack_Size
- .space Stack_Size
- .endif
- .size __cs3_stack_mem, . - __cs3_stack_mem
- .set __cs3_stack_size, . - __cs3_stack_mem
-
-
-/*
-// Heap Configuration
-// Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
-//
-*/
-
- .equ Heap_Size, 0x00001000
-
- .section ".heap", "w"
- .align 3
- .globl __cs3_heap_start
- .globl __cs3_heap_end
-__cs3_heap_start:
- .if Heap_Size
- .space Heap_Size
- .endif
-__cs3_heap_end:
+/**
+ * startup_LPC17xx.s
+ */
+ .syntax unified
+ .cpu cortex-m3
+ .fpu softvfp
+ .thumb
+
+ .word _sidata
+ .word _sdata
+ .word _edata
+ .word _sbss
+ .word _ebss
/* Vector Table */
- .section ".cs3.interrupt_vector"
- .globl __cs3_interrupt_vector_cortex_m
- .type __cs3_interrupt_vector_cortex_m, %object
+ .section ".interrupt_vector"
+ .globl __interrupt_vector
+ .type __interrupt_vector, %object
-__cs3_interrupt_vector_cortex_m:
- .long __cs3_stack /* Top of Stack */
- .long __cs3_reset /* Reset Handler */
+__interrupt_vector:
+ .long _estack /* Top of Stack */
+ .long Reset_Handler /* Reset Handler */
.long NMI_Handler /* NMI Handler */
.long HardFault_Handler /* Hard Fault Handler */
.long MemManage_Handler /* MPU Fault Handler */
@@ -107,28 +72,52 @@ __cs3_interrupt_vector_cortex_m:
.long QEI_IRQHandler /* 47: Quadrature Encoder Interface */
.long PLL1_IRQHandler /* 48: PLL1 Lock (USB PLL) */
- .size __cs3_interrupt_vector_cortex_m, . - __cs3_interrupt_vector_cortex_m
-
-
- .thumb
-
+ .size __interrupt_vector, . - __interrupt_vector
/* Reset Handler */
-
- .section .cs3.reset,"x",%progbits
- .thumb_func
- .globl __cs3_reset_cortex_m
- .type __cs3_reset_cortex_m, %function
-__cs3_reset_cortex_m:
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
.fnstart
- LDR R0, =SystemInit
- BLX R0
- LDR R0,=_start
- BX R0
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ add r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ add r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl main
+ bx lr
+
.pool
.cantunwind
.fnend
- .size __cs3_reset_cortex_m,.-__cs3_reset_cortex_m
+ .size Reset_Handler,.-Reset_Handler
.section ".text"
diff --git a/bsp/lpc176x/SConstruct b/bsp/lpc176x/SConstruct
index 9e9229fa3a01f78832ba62ef0b60421842539e3f..827da21b313aa7f14eebf78dce2fafb07859fa02 100644
--- a/bsp/lpc176x/SConstruct
+++ b/bsp/lpc176x/SConstruct
@@ -16,7 +16,6 @@ env = Environment(tools = ['mingw'],
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
-env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
Export('RTT_ROOT')
Export('rtconfig')
diff --git a/bsp/lpc176x/application.c b/bsp/lpc176x/application.c
index 5afc70a32cf2201496bebd4ae82379e8e293179d..456c08e93fbf1a45a7b09bfaf655478335eae828 100644
--- a/bsp/lpc176x/application.c
+++ b/bsp/lpc176x/application.c
@@ -15,11 +15,6 @@
* 2010-05-24 Bernard add filesystem initialization and move led function to led.c
*/
-/**
- * @addtogroup LPC17
- */
-/*@{*/
-
#include
#ifdef RT_USING_DFS
@@ -65,7 +60,7 @@ void rt_init_thread_entry(void *parameter)
eth_system_device_init();
- /* register ethernetif device */
+ /* register Ethernet interface device */
lpc17xx_emac_hw_init();
/* init all device */
rt_device_init_all();
@@ -79,20 +74,12 @@ void rt_init_thread_entry(void *parameter)
int rt_application_init()
{
- rt_thread_t init_thread;
+ rt_thread_t tid;
-#if (RT_THREAD_PRIORITY_MAX == 32)
- init_thread = rt_thread_create("init",
- rt_init_thread_entry, RT_NULL,
- 2048, 8, 20);
-#else
- init_thread = rt_thread_create("init",
- rt_init_thread_entry, RT_NULL,
- 2048, 80, 20);
-#endif
- if (init_thread != RT_NULL) rt_thread_startup(init_thread);
+ tid = rt_thread_create("init",
+ rt_init_thread_entry, RT_NULL,
+ 2048, RT_THREAD_PRIORITY_MAX/3, 20);
+ if (tid != RT_NULL) rt_thread_startup(tid);
return 0;
}
-
-/*@}*/
diff --git a/bsp/lpc176x/lpc17xx_rom.ld b/bsp/lpc176x/lpc17xx_rom.ld
index 0f36fb15aa8987b55484d70b7059d53c40b279f0..ba5d419e2359381b47a266280701ed35695c442c 100644
--- a/bsp/lpc176x/lpc17xx_rom.ld
+++ b/bsp/lpc176x/lpc17xx_rom.ld
@@ -10,14 +10,14 @@ MEMORY
DATA (rw) : ORIGIN = 0x10000000, LENGTH = 0x00008000
}
ENTRY(Reset_Handler)
-_system_stack_size = 0x100;
+_system_stack_size = 0x200;
SECTIONS
{
.text :
{
. = ALIGN(4);
- KEEP(*(.isr_vector)) /* Startup code */
+ KEEP(*(.interrupt_vector)) /* Startup code */
. = ALIGN(4);
*(.text) /* remaining code */
*(.text.*) /* remaining code */
diff --git a/bsp/lpc176x/rtconfig.h b/bsp/lpc176x/rtconfig.h
index a080333f760d99198cba6b58f43ed8b992275836..bdcde8fbbe8cc3859a4d7807118d0de05803dde0 100644
--- a/bsp/lpc176x/rtconfig.h
+++ b/bsp/lpc176x/rtconfig.h
@@ -120,13 +120,13 @@
//
//
-#define RT_USING_LWIP
+// #define RT_USING_LWIP
//
#define RT_LWIP_USING_RT_MEM
//
#define RT_LWIP_ICMP
//
-#define RT_LWIP_IGMP
+// #define RT_LWIP_IGMP
//
#define RT_LWIP_UDP
//