moved to 0x13c000
This commit is contained in:
parent
bd59d4924f
commit
0be9113381
47
at91_init0.s
47
at91_init0.s
@ -31,7 +31,7 @@
|
|||||||
.equ I_BIT, 0x80
|
.equ I_BIT, 0x80
|
||||||
.equ F_BIT, 0x40
|
.equ F_BIT, 0x40
|
||||||
|
|
||||||
.section .init
|
.section .init_dummy, "x"
|
||||||
.global _hwstart
|
.global _hwstart
|
||||||
.func _hwstart
|
.func _hwstart
|
||||||
_hwstart:
|
_hwstart:
|
||||||
@ -44,15 +44,15 @@ _hwstart:
|
|||||||
ldr pc, [pc, #4] /* 0x18 IRQ */
|
ldr pc, [pc, #4] /* 0x18 IRQ */
|
||||||
ldr pc, [pc, #0] /* 0x1c FIQ */
|
ldr pc, [pc, #0] /* 0x1c FIQ */
|
||||||
|
|
||||||
.word _blrelocate /* + 0x13c000 */
|
.word _relocate + 0x13c000
|
||||||
.word 0x80000000
|
.word 0x80000000
|
||||||
|
|
||||||
.endfunc
|
.endfunc
|
||||||
|
|
||||||
.section .init
|
.section .init, "x"
|
||||||
.global _blrelocate
|
.global _relocate
|
||||||
.func _blrelocate
|
.func _relocate
|
||||||
_blrelocate:
|
_relocate:
|
||||||
msr CPSR_c, #ARM_MODE_SVC | I_BIT | F_BIT
|
msr CPSR_c, #ARM_MODE_SVC | I_BIT | F_BIT
|
||||||
|
|
||||||
/* Remap RAM to 0x00000000 */
|
/* Remap RAM to 0x00000000 */
|
||||||
@ -60,22 +60,14 @@ _blrelocate:
|
|||||||
mov r2, #0x01
|
mov r2, #0x01
|
||||||
str r2, [r1]
|
str r2, [r1]
|
||||||
|
|
||||||
/* Relocate .data section */
|
/* Relocate .text section */
|
||||||
ldr r1, =__init_end__
|
ldr r1, =__text_copy_start__
|
||||||
ldr r2, =__text_start__
|
ldr r2, =__text_start__
|
||||||
ldr r3, =__data_end__
|
ldr r3, =__text_end__
|
||||||
LoopRel: cmp r2, r3
|
_relocate1: cmp r2, r3
|
||||||
ldrlo r0, [r1], #4
|
ldrlo r0, [r1], #4
|
||||||
strlo r0, [r2], #4
|
strlo r0, [r2], #4
|
||||||
blo LoopRel
|
blo _relocate1
|
||||||
|
|
||||||
/* 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
|
ldr r0, =InitReset
|
||||||
mov pc, r0
|
mov pc, r0
|
||||||
@ -144,6 +136,23 @@ InitReset:
|
|||||||
msr CPSR_c, #ARM_MODE_SVC
|
msr CPSR_c, #ARM_MODE_SVC
|
||||||
mov sp, r0
|
mov sp, r0
|
||||||
|
|
||||||
|
/* Relocate .data section */
|
||||||
|
ldr r1, =__data_copy_start__
|
||||||
|
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() */
|
/* Start main() */
|
||||||
ldr lr, =exit
|
ldr lr, =exit
|
||||||
ldr r0, =main
|
ldr r0, =main
|
||||||
|
15
ldscript.ld
15
ldscript.ld
@ -1,26 +1,23 @@
|
|||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
FLASH(rx) : ORIGIN = 0x00100000, LENGTH = 256k
|
FLASH(rx) : ORIGIN = 0x00100000, LENGTH = 256k
|
||||||
*/
|
CODE (rx) : ORIGIN = 0x0013C000, LENGTH = 16k
|
||||||
CODE (rx) : ORIGIN = 0x00100000, LENGTH = 16k
|
|
||||||
DATA (rwx) : ORIGIN = 0x00000000, LENGTH = 64k
|
DATA (rwx) : ORIGIN = 0x00000000, LENGTH = 64k
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
. = ORIGIN(FLASH);
|
. = ORIGIN(FLASH);
|
||||||
|
|
||||||
.text.dummy : {
|
.init_dummy : {
|
||||||
*(.text.dummy)
|
*(.init_dummy)
|
||||||
} >FLASH =0
|
} >FLASH =0
|
||||||
*/
|
|
||||||
. = ORIGIN(CODE);
|
. = ORIGIN(CODE);
|
||||||
|
|
||||||
.init : {
|
.init : {
|
||||||
*(.init)
|
*(.init)
|
||||||
__init_end__ = .;
|
__text_copy_start__ = .;
|
||||||
} >CODE =0
|
} >CODE =0
|
||||||
|
|
||||||
.text : AT (LOADADDR(.init) + SIZEOF(.init)) {
|
.text : AT (LOADADDR(.init) + SIZEOF(.init)) {
|
||||||
@ -43,6 +40,8 @@ SECTIONS
|
|||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
*(.rodata)
|
*(.rodata)
|
||||||
*(.rodata.*)
|
*(.rodata.*)
|
||||||
|
|
||||||
|
__data_copy_start__ = (__text_copy_start__ + (__text_end__ - __text_start__));
|
||||||
} >DATA =0
|
} >DATA =0
|
||||||
|
|
||||||
__text_start__ = ADDR(.text);
|
__text_start__ = ADDR(.text);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (C) 01/2008 by Olaf Rempel *
|
* Copyright (C) 03/2008 by Olaf Rempel *
|
||||||
* razzor@kopf-tisch.de *
|
* razzor@kopf-tisch.de *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
Loading…
Reference in New Issue
Block a user