Update GCC porting of LPC178x
This commit is contained in:
parent
8e6a534fa3
commit
aaf0186852
|
@ -9,6 +9,16 @@
|
||||||
//*** <<< Use Configuration Wizard in Context Menu >>> ***
|
//*** <<< Use Configuration Wizard in Context Menu >>> ***
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
.syntax unified
|
||||||
|
.cpu cortex-m3
|
||||||
|
.fpu softvfp
|
||||||
|
.thumb
|
||||||
|
|
||||||
|
.word _sidata
|
||||||
|
.word _sdata
|
||||||
|
.word _edata
|
||||||
|
.word _sbss
|
||||||
|
.word _ebss
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// <h> Stack Configuration
|
// <h> Stack Configuration
|
||||||
|
@ -16,7 +26,7 @@
|
||||||
// </h>
|
// </h>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.equ Stack_Size, 0x00000100
|
.equ Stack_Size, 0x00000200
|
||||||
.section ".stack", "w"
|
.section ".stack", "w"
|
||||||
.align 3
|
.align 3
|
||||||
.globl __cs3_stack_mem
|
.globl __cs3_stack_mem
|
||||||
|
@ -28,26 +38,6 @@ __cs3_stack_mem:
|
||||||
.size __cs3_stack_mem, . - __cs3_stack_mem
|
.size __cs3_stack_mem, . - __cs3_stack_mem
|
||||||
.set __cs3_stack_size, . - __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 ".cs3.interrupt_vector"
|
||||||
|
@ -56,7 +46,7 @@ __cs3_heap_end:
|
||||||
|
|
||||||
__cs3_interrupt_vector_cortex_m:
|
__cs3_interrupt_vector_cortex_m:
|
||||||
.long __cs3_stack /* Top of Stack */
|
.long __cs3_stack /* 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 */
|
||||||
|
@ -118,45 +108,49 @@ __cs3_interrupt_vector_cortex_m:
|
||||||
.size __cs3_interrupt_vector_cortex_m, . - __cs3_interrupt_vector_cortex_m
|
.size __cs3_interrupt_vector_cortex_m, . - __cs3_interrupt_vector_cortex_m
|
||||||
|
|
||||||
|
|
||||||
.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
|
||||||
#if (RAM_MODE)
|
/* Copy the data segment initializers from flash to SRAM */
|
||||||
/* Clear .bss section (Zero init) */
|
movs r1, #0
|
||||||
MOV R0, #0
|
b LoopCopyDataInit
|
||||||
LDR R1, =__bss_start__
|
|
||||||
LDR R2, =__bss_end__
|
CopyDataInit:
|
||||||
CMP R1,R2
|
ldr r3, =_sidata
|
||||||
BEQ BSSIsEmpty
|
ldr r3, [r3, r1]
|
||||||
LoopZI:
|
str r3, [r0, r1]
|
||||||
CMP R1, R2
|
add r1, r1, #4
|
||||||
BHS BSSIsEmpty
|
|
||||||
STR R0, [R1]
|
LoopCopyDataInit:
|
||||||
ADD R1, #4
|
ldr r0, =_sdata
|
||||||
BLO LoopZI
|
ldr r3, =_edata
|
||||||
BSSIsEmpty:
|
add r2, r0, r1
|
||||||
LDR R0, =SystemInit
|
cmp r2, r3
|
||||||
BLX R0
|
bcc CopyDataInit
|
||||||
LDR R0,=main
|
ldr r2, =_sbss
|
||||||
BX R0
|
b LoopFillZerobss
|
||||||
#else
|
/* Zero fill the bss segment. */
|
||||||
LDR R0, =SystemInit
|
FillZerobss:
|
||||||
BLX R0
|
movs r3, #0
|
||||||
LDR R0,=_start
|
str r3, [r2], #4
|
||||||
BX R0
|
|
||||||
#endif
|
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"
|
||||||
|
|
||||||
|
|
|
@ -1,133 +0,0 @@
|
||||||
/*
|
|
||||||
* linker script for LPC1788 (512kB Flash, 48kB + 48kB SRAM ) with GNU ld
|
|
||||||
* yiyue.fang 2012-04-14
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Program Entry, set to mark it as "used" and avoid gc */
|
|
||||||
MEMORY
|
|
||||||
{
|
|
||||||
CODE (rx) : ORIGIN = 0x00000000, LENGTH = 0x00080000
|
|
||||||
DATA (rw) : ORIGIN = 0x10000000, LENGTH = 0x00010000
|
|
||||||
}
|
|
||||||
ENTRY(Reset_Handler)
|
|
||||||
_system_stack_size = 0x200;
|
|
||||||
|
|
||||||
SECTIONS
|
|
||||||
{
|
|
||||||
.text :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
KEEP(*(.interrupt_vector)) /* Startup code */
|
|
||||||
. = ALIGN(4);
|
|
||||||
*(.text) /* remaining code */
|
|
||||||
*(.text.*) /* remaining code */
|
|
||||||
*(.rodata) /* read-only data (constants) */
|
|
||||||
*(.rodata*)
|
|
||||||
*(.glue_7)
|
|
||||||
*(.glue_7t)
|
|
||||||
*(.gnu.linkonce.t*)
|
|
||||||
|
|
||||||
/* section information for finsh shell */
|
|
||||||
. = ALIGN(4);
|
|
||||||
__fsymtab_start = .;
|
|
||||||
KEEP(*(FSymTab))
|
|
||||||
__fsymtab_end = .;
|
|
||||||
. = ALIGN(4);
|
|
||||||
__vsymtab_start = .;
|
|
||||||
KEEP(*(VSymTab))
|
|
||||||
__vsymtab_end = .;
|
|
||||||
. = ALIGN(4);
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
_etext = .;
|
|
||||||
} > CODE = 0
|
|
||||||
|
|
||||||
/* .ARM.exidx is sorted, so has to go in its own output section. */
|
|
||||||
__exidx_start = .;
|
|
||||||
.ARM.exidx :
|
|
||||||
{
|
|
||||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
|
||||||
|
|
||||||
/* This is used by the startup in order to initialize the .data secion */
|
|
||||||
_sidata = .;
|
|
||||||
} > CODE
|
|
||||||
__exidx_end = .;
|
|
||||||
|
|
||||||
/* .data section which is used for initialized data */
|
|
||||||
|
|
||||||
.data : AT (_sidata)
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
/* This is used by the startup in order to initialize the .data secion */
|
|
||||||
_sdata = . ;
|
|
||||||
|
|
||||||
*(.data)
|
|
||||||
*(.data.*)
|
|
||||||
*(.gnu.linkonce.d*)
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
/* This is used by the startup in order to initialize the .data secion */
|
|
||||||
_edata = . ;
|
|
||||||
} >DATA
|
|
||||||
|
|
||||||
.stack :
|
|
||||||
{
|
|
||||||
. = . + _system_stack_size;
|
|
||||||
. = ALIGN(4);
|
|
||||||
_estack = .;
|
|
||||||
} >DATA
|
|
||||||
|
|
||||||
__bss_start = .;
|
|
||||||
.bss :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
/* This is used by the startup in order to initialize the .bss secion */
|
|
||||||
_sbss = .;
|
|
||||||
|
|
||||||
*(.bss)
|
|
||||||
*(.bss.*)
|
|
||||||
*(COMMON)
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
/* This is used by the startup in order to initialize the .bss secion */
|
|
||||||
_ebss = . ;
|
|
||||||
*(.bss.init)
|
|
||||||
} > DATA
|
|
||||||
__bss_end = .;
|
|
||||||
|
|
||||||
_end = .;
|
|
||||||
|
|
||||||
/* Stabs debugging sections. */
|
|
||||||
.stab 0 : { *(.stab) }
|
|
||||||
.stabstr 0 : { *(.stabstr) }
|
|
||||||
.stab.excl 0 : { *(.stab.excl) }
|
|
||||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
|
||||||
.stab.index 0 : { *(.stab.index) }
|
|
||||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
|
||||||
.comment 0 : { *(.comment) }
|
|
||||||
/* DWARF debug sections.
|
|
||||||
* Symbols in the DWARF debugging sections are relative to the beginning
|
|
||||||
* of the section so we begin them at 0. */
|
|
||||||
/* DWARF 1 */
|
|
||||||
.debug 0 : { *(.debug) }
|
|
||||||
.line 0 : { *(.line) }
|
|
||||||
/* GNU DWARF 1 extensions */
|
|
||||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
|
||||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
|
||||||
/* DWARF 1.1 and DWARF 2 */
|
|
||||||
.debug_aranges 0 : { *(.debug_aranges) }
|
|
||||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
|
||||||
/* DWARF 2 */
|
|
||||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
|
||||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
|
||||||
.debug_line 0 : { *(.debug_line) }
|
|
||||||
.debug_frame 0 : { *(.debug_frame) }
|
|
||||||
.debug_str 0 : { *(.debug_str) }
|
|
||||||
.debug_loc 0 : { *(.debug_loc) }
|
|
||||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
|
||||||
/* SGI/MIPS DWARF 2 extensions */
|
|
||||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
|
||||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
|
||||||
.debug_typenames 0 : { *(.debug_typenames) }
|
|
||||||
.debug_varnames 0 : { *(.debug_varnames) }
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
; *************************************************************
|
|
||||||
; *** Scatter-Loading Description File generated by uVision ***
|
|
||||||
; *************************************************************
|
|
||||||
|
|
||||||
LR_IROM1 0x00000000 0x00080000 { ; load region size_region
|
|
||||||
ER_IROM1 0x00000000 0x00080000 { ; load address = execution address
|
|
||||||
*.o (RESET, +First)
|
|
||||||
*(InRoot$$Sections)
|
|
||||||
.ANY (+RO)
|
|
||||||
}
|
|
||||||
RW_IRAM1 0x10000000 0x00010000 { ; RW data
|
|
||||||
.ANY (+RW +ZI)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue