moved to 0x13c000

This commit is contained in:
Olaf Rempel 2008-03-03 23:50:40 +01:00
parent bd59d4924f
commit 0be9113381
3 changed files with 36 additions and 28 deletions

View File

@ -31,7 +31,7 @@
.equ I_BIT, 0x80
.equ F_BIT, 0x40
.section .init
.section .init_dummy, "x"
.global _hwstart
.func _hwstart
_hwstart:
@ -44,15 +44,15 @@ _hwstart:
ldr pc, [pc, #4] /* 0x18 IRQ */
ldr pc, [pc, #0] /* 0x1c FIQ */
.word _blrelocate /* + 0x13c000 */
.word _relocate + 0x13c000
.word 0x80000000
.endfunc
.section .init
.global _blrelocate
.func _blrelocate
_blrelocate:
.section .init, "x"
.global _relocate
.func _relocate
_relocate:
msr CPSR_c, #ARM_MODE_SVC | I_BIT | F_BIT
/* Remap RAM to 0x00000000 */
@ -60,22 +60,14 @@ _blrelocate:
mov r2, #0x01
str r2, [r1]
/* Relocate .data section */
ldr r1, =__init_end__
/* Relocate .text section */
ldr r1, =__text_copy_start__
ldr r2, =__text_start__
ldr r3, =__data_end__
LoopRel: cmp r2, r3
ldr r3, =__text_end__
_relocate1: 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
blo _relocate1
ldr r0, =InitReset
mov pc, r0
@ -144,6 +136,23 @@ InitReset:
msr CPSR_c, #ARM_MODE_SVC
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() */
ldr lr, =exit
ldr r0, =main

View File

@ -1,26 +1,23 @@
MEMORY
{
/*
FLASH(rx) : ORIGIN = 0x00100000, LENGTH = 256k
*/
CODE (rx) : ORIGIN = 0x00100000, LENGTH = 16k
CODE (rx) : ORIGIN = 0x0013C000, LENGTH = 16k
DATA (rwx) : ORIGIN = 0x00000000, LENGTH = 64k
}
SECTIONS
{
/*
. = ORIGIN(FLASH);
.text.dummy : {
*(.text.dummy)
.init_dummy : {
*(.init_dummy)
} >FLASH =0
*/
. = ORIGIN(CODE);
.init : {
*(.init)
__init_end__ = .;
__text_copy_start__ = .;
} >CODE =0
.text : AT (LOADADDR(.init) + SIZEOF(.init)) {
@ -43,6 +40,8 @@ SECTIONS
. = ALIGN(4);
*(.rodata)
*(.rodata.*)
__data_copy_start__ = (__text_copy_start__ + (__text_end__ - __text_start__));
} >DATA =0
__text_start__ = ADDR(.text);

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 01/2008 by Olaf Rempel *
* Copyright (C) 03/2008 by Olaf Rempel *
* razzor@kopf-tisch.de *
* *
* This program is free software; you can redistribute it and/or modify *