get ldscript working
This commit is contained in:
parent
773cc44a09
commit
192c3e132c
58
at91_init0.s
58
at91_init0.s
@ -17,6 +17,7 @@
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
.equ AT91C_BASE_AIC, (0xFFFFF000)
|
||||
.equ AT91C_BASE_MC, (0xFFFFFF00)
|
||||
|
||||
.equ IRQ_Stack_Size, (3 * 8 * 4)
|
||||
.equ FIQ_Stack_Size, (0 * 8 * 4)
|
||||
@ -30,6 +31,46 @@
|
||||
.equ I_BIT, 0x80
|
||||
.equ F_BIT, 0x40
|
||||
|
||||
.section .dummy
|
||||
.global _hwstart
|
||||
.func _hwstart
|
||||
_hwstart:
|
||||
ldr pc, =0x13c000
|
||||
|
||||
.endfunc
|
||||
|
||||
.section .init
|
||||
.global _blrelocate
|
||||
.func _blrelocate
|
||||
msr CPSR_c, #ARM_MODE_SVC | I_BIT | F_BIT
|
||||
|
||||
/* Remap RAM to 0x00000000 */
|
||||
ldr r1, =AT91C_BASE_MC
|
||||
mov r2, #0x01
|
||||
str r2, [r1]
|
||||
|
||||
/* Relocate .data section */
|
||||
ldr r1, =__init_end__
|
||||
ldr r2, =__text_start__
|
||||
ldr r3, =__data_end__
|
||||
LoopRel: cmp r2, r3
|
||||
ldrlo r0, [r1], #4
|
||||
strlo r0, [r2], #4
|
||||
blo LoopRel
|
||||
|
||||
/* Clear .bss section */
|
||||
mov r0, #0
|
||||
ldr r1, =__bss_start__
|
||||
ldr r2, =__bss_end__
|
||||
LoopZI: cmp r1, r2
|
||||
strlo r0, [r1], #4
|
||||
BLO LoopZI
|
||||
|
||||
ldr r0, =InitReset
|
||||
mov pc, r0
|
||||
|
||||
.endfunc
|
||||
|
||||
.section .text
|
||||
.global _start
|
||||
.func _start
|
||||
@ -92,23 +133,6 @@ InitReset:
|
||||
msr CPSR_c, #ARM_MODE_SVC
|
||||
mov sp, r0
|
||||
|
||||
/* Relocate .data section */
|
||||
ldr r1, =__text_end__
|
||||
ldr r2, =__data_start__
|
||||
ldr r3, =__data_end__
|
||||
LoopRel: cmp r2, r3
|
||||
ldrlo r0, [r1], #4
|
||||
strlo r0, [r2], #4
|
||||
blo LoopRel
|
||||
|
||||
/* Clear .bss section */
|
||||
mov r0, #0
|
||||
ldr r1, =__bss_start__
|
||||
ldr r2, =__bss_end__
|
||||
LoopZI: cmp r1, r2
|
||||
strlo r0, [r1], #4
|
||||
BLO LoopZI
|
||||
|
||||
/* Start main() */
|
||||
ldr lr, =exit
|
||||
ldr r0, =main
|
||||
|
30
ldscript.ld
30
ldscript.ld
@ -1,15 +1,28 @@
|
||||
MEMORY
|
||||
{
|
||||
CODE (rx) : ORIGIN = 0x00100000, LENGTH = 256k
|
||||
DATA (rwx) : ORIGIN = 0x00200000, LENGTH = 64k
|
||||
FLASH(rx) : ORIGIN = 0x00100000, LENGTH = 256k
|
||||
CODE (rx) : ORIGIN = 0x0013c000, LENGTH = 16k
|
||||
DATA (rwx) : ORIGIN = 0x00000000, LENGTH = 64k
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = ORIGIN(FLASH);
|
||||
|
||||
.dummy : {
|
||||
*(.dummy)
|
||||
} >FLASH =0
|
||||
|
||||
. = ORIGIN(CODE);
|
||||
.text : {
|
||||
*at91_init0.o (.text)
|
||||
*at91_init1.o (.text)
|
||||
|
||||
.init : {
|
||||
*(.init)
|
||||
__init_end__ = .;
|
||||
} >CODE =0
|
||||
|
||||
.text : AT (LOADADDR(.init) + SIZEOF(.init)) {
|
||||
*at91_init0.o(*.text)
|
||||
*at91_init1.o(*.text)
|
||||
*(.text)
|
||||
*(.glue_7t)
|
||||
*(.glue_7)
|
||||
@ -27,11 +40,12 @@ SECTIONS
|
||||
. = ALIGN(4);
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
} >DATA =0
|
||||
|
||||
__text_end__ = .;
|
||||
} >CODE =0
|
||||
__text_start__ = ADDR(.text);
|
||||
__text_end__ = ADDR(.text) + SIZEOF(.text);
|
||||
|
||||
.data : AT (ADDR(.text) + SIZEOF(.text)) {
|
||||
.data : AT (LOADADDR(.text) + SIZEOF(.text)) {
|
||||
*(.data)
|
||||
} >DATA =0
|
||||
|
||||
|
@ -217,7 +217,7 @@ void at91_twi_test(void)
|
||||
cmd.size = 0;
|
||||
ret = twi_cmd(i, &cmd);
|
||||
|
||||
for (x = 0; x < 200000; x++);
|
||||
for (x = 0; x < 400000; x++);
|
||||
|
||||
cmd.cmd = CMD_GET_INFO,
|
||||
cmd.mode = BLMC_CMD_READ | BLMC_CMD_0_ARG,
|
||||
|
Loading…
Reference in New Issue
Block a user