浏览代码

update GCC startup assemble file and ld link script.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1954 bbd45198-f89e-11dd-88c7-29a3b14d5316
bernard.xiong@gmail.com 13 年之前
父节点
当前提交
c11a30dbc1

+ 59 - 70
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 >>> *** 
-*/
-
-
-/*
-// <h> Stack Configuration
-//   <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
-// </h>
-*/
-
-    .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
-
-
-/*
-// <h> Heap Configuration
-//   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
-// </h>
-*/
-
-    .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"
 

+ 0 - 1
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')

+ 6 - 19
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 <rtthread.h>
 
 #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;
 }
-
-/*@}*/

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

+ 2 - 2
bsp/lpc176x/rtconfig.h

@@ -120,13 +120,13 @@
 // </section>
 
 // <section name="RT_USING_LWIP" description="lwip, a lightweight TCP/IP protocol stack" default="true" >
-#define RT_USING_LWIP
+// #define RT_USING_LWIP
 // <bool name="RT_LWIP_USING_RT_MEM" description="Using RT-Thread memory management for LwIP" default="true" />
 #define RT_LWIP_USING_RT_MEM
 // <bool name="RT_LWIP_ICMP" description="Enable ICMP protocol" default="true" />
 #define RT_LWIP_ICMP
 // <bool name="RT_LWIP_IGMP" description="Enable IGMP protocol" default="false" />
-#define RT_LWIP_IGMP
+// #define RT_LWIP_IGMP
 // <bool name="RT_LWIP_UDP" description="Enable UDP protocol" default="true" />
 #define RT_LWIP_UDP
 // <bool name="RT_LWIP_TCP" description="Enable TCP protocol" default="true" />