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
This commit is contained in:
bernard.xiong@gmail.com 2012-02-17 16:24:20 +00:00
parent 4cc052e155
commit c11a30dbc1
5 changed files with 68 additions and 93 deletions

View File

@ -1,62 +1,27 @@
/*****************************************************************************/ /**
/* startup_LPC17xx.s: Startup file for LPC17xx device series */ * startup_LPC17xx.s
/*****************************************************************************/ */
/* Version: CodeSourcery Sourcery G++ Lite (with CS3) */
/*****************************************************************************/
.syntax unified
.cpu cortex-m3
.fpu softvfp
.thumb
/* .word _sidata
//*** <<< Use Configuration Wizard in Context Menu >>> *** .word _sdata
*/ .word _edata
.word _sbss
.word _ebss
/*
// <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:
/* Vector Table */ /* Vector Table */
.section ".cs3.interrupt_vector" .section ".interrupt_vector"
.globl __cs3_interrupt_vector_cortex_m .globl __interrupt_vector
.type __cs3_interrupt_vector_cortex_m, %object .type __interrupt_vector, %object
__cs3_interrupt_vector_cortex_m: __interrupt_vector:
.long __cs3_stack /* Top of Stack */ .long _estack /* Top of Stack */
.long __cs3_reset /* Reset Handler */ .long Reset_Handler /* Reset Handler */
.long NMI_Handler /* NMI Handler */ .long NMI_Handler /* NMI Handler */
.long HardFault_Handler /* Hard Fault Handler */ .long HardFault_Handler /* Hard Fault Handler */
.long MemManage_Handler /* MPU 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 QEI_IRQHandler /* 47: Quadrature Encoder Interface */
.long PLL1_IRQHandler /* 48: PLL1 Lock (USB PLL) */ .long PLL1_IRQHandler /* 48: PLL1 Lock (USB PLL) */
.size __cs3_interrupt_vector_cortex_m, . - __cs3_interrupt_vector_cortex_m .size __interrupt_vector, . - __interrupt_vector
.thumb
/* Reset Handler */ /* Reset Handler */
.section .text.Reset_Handler
.section .cs3.reset,"x",%progbits .weak Reset_Handler
.thumb_func .type Reset_Handler, %function
.globl __cs3_reset_cortex_m Reset_Handler:
.type __cs3_reset_cortex_m, %function
__cs3_reset_cortex_m:
.fnstart .fnstart
LDR R0, =SystemInit
BLX R0 /* Copy the data segment initializers from flash to SRAM */
LDR R0,=_start movs r1, #0
BX R0 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 .pool
.cantunwind .cantunwind
.fnend .fnend
.size __cs3_reset_cortex_m,.-__cs3_reset_cortex_m .size Reset_Handler,.-Reset_Handler
.section ".text" .section ".text"

View File

@ -16,7 +16,6 @@ env = Environment(tools = ['mingw'],
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc', AR = rtconfig.AR, ARFLAGS = '-rc',
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
Export('RTT_ROOT') Export('RTT_ROOT')
Export('rtconfig') Export('rtconfig')

View File

@ -15,11 +15,6 @@
* 2010-05-24 Bernard add filesystem initialization and move led function to led.c * 2010-05-24 Bernard add filesystem initialization and move led function to led.c
*/ */
/**
* @addtogroup LPC17
*/
/*@{*/
#include <rtthread.h> #include <rtthread.h>
#ifdef RT_USING_DFS #ifdef RT_USING_DFS
@ -65,7 +60,7 @@ void rt_init_thread_entry(void *parameter)
eth_system_device_init(); eth_system_device_init();
/* register ethernetif device */ /* register Ethernet interface device */
lpc17xx_emac_hw_init(); lpc17xx_emac_hw_init();
/* init all device */ /* init all device */
rt_device_init_all(); rt_device_init_all();
@ -79,20 +74,12 @@ void rt_init_thread_entry(void *parameter)
int rt_application_init() int rt_application_init()
{ {
rt_thread_t init_thread; rt_thread_t tid;
#if (RT_THREAD_PRIORITY_MAX == 32) tid = rt_thread_create("init",
init_thread = rt_thread_create("init", rt_init_thread_entry, RT_NULL,
rt_init_thread_entry, RT_NULL, 2048, RT_THREAD_PRIORITY_MAX/3, 20);
2048, 8, 20); if (tid != RT_NULL) rt_thread_startup(tid);
#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);
return 0; return 0;
} }
/*@}*/

View File

@ -10,14 +10,14 @@ MEMORY
DATA (rw) : ORIGIN = 0x10000000, LENGTH = 0x00008000 DATA (rw) : ORIGIN = 0x10000000, LENGTH = 0x00008000
} }
ENTRY(Reset_Handler) ENTRY(Reset_Handler)
_system_stack_size = 0x100; _system_stack_size = 0x200;
SECTIONS SECTIONS
{ {
.text : .text :
{ {
. = ALIGN(4); . = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */ KEEP(*(.interrupt_vector)) /* Startup code */
. = ALIGN(4); . = ALIGN(4);
*(.text) /* remaining code */ *(.text) /* remaining code */
*(.text.*) /* remaining code */ *(.text.*) /* remaining code */

View File

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