summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaforge <laforge@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2006-09-20 07:52:39 +0000
committerlaforge <laforge@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2006-09-20 07:52:39 +0000
commit4c36166be2785c225ab6f03a3a38b607d033dad5 (patch)
tree2e1722cf14fe35cd07fb68de90d4ae538c3036b3
parent17f754fdb6e4bc7c59bff34589191a0823cfd6db (diff)
- fix relocation of _data_shared segment
git-svn-id: https://svn.openpcd.org:2342/trunk@205 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
-rw-r--r--firmware/link/AT91SAM7S128-ROM-sam7dfu-dfu.ld13
-rw-r--r--firmware/link/AT91SAM7S256-ROM-sam7dfu-dfu.ld6
-rw-r--r--firmware/src/start/Cstartup.S33
3 files changed, 40 insertions, 12 deletions
diff --git a/firmware/link/AT91SAM7S128-ROM-sam7dfu-dfu.ld b/firmware/link/AT91SAM7S128-ROM-sam7dfu-dfu.ld
index 23c981b..f71249d 100644
--- a/firmware/link/AT91SAM7S128-ROM-sam7dfu-dfu.ld
+++ b/firmware/link/AT91SAM7S128-ROM-sam7dfu-dfu.ld
@@ -26,12 +26,17 @@ SECTIONS
PROVIDE (etext = .);
.data.shared (0x00200020): AT (LOADADDR(.text) + SIZEOF(.text)) {
+ _data_shared = . ;
* (.data.shared)
. = ALIGN(4);
} >DATA
+ _edata_shared = . ;
+ PROVIDE (edata_shared = .);
+
/* 0x00200000 ... */
- .data (0x00200000 + SIZEOF(.text)): AT ( LOADADDR(.text) + SIZEOF(.text) + SIZEOF(.data.shared)) {
+ .data (0x00200000 + SIZEOF(.text)): AT
+ ( LOADADDR(.text) + SIZEOF(.text) + SIZEOF(.data.shared)) {
_data = . ;
* (.vectram)
* (.data)
@@ -41,9 +46,9 @@ SECTIONS
_edata = . ;
PROVIDE (edata = .);
- /* dfu.functab addresses are valid as long as DFU is in flash, i.e. only while
- * application calls those functions. Once executing in DFU mode, we are
- * re-located to ram */
+ /* dfu.functab addresses are valid as long as DFU is in flash, i.e.
+ * only while application calls those functions. Once executing in
+ * DFU mode, we are re-located to ram */
.dfu.functab 0x00000fd0: AT ( ADDR(.dfu.functab) - ADDR(.text) ) {
*(.dfu.functab)
. = ALIGN(4096);
diff --git a/firmware/link/AT91SAM7S256-ROM-sam7dfu-dfu.ld b/firmware/link/AT91SAM7S256-ROM-sam7dfu-dfu.ld
index b81d44c..0fa1a06 100644
--- a/firmware/link/AT91SAM7S256-ROM-sam7dfu-dfu.ld
+++ b/firmware/link/AT91SAM7S256-ROM-sam7dfu-dfu.ld
@@ -26,10 +26,14 @@ SECTIONS
PROVIDE (etext = .);
.data.shared (0x00200020): AT (LOADADDR(.text) + SIZEOF(.text)) {
+ _data_shared = . ;
* (.data.shared)
. = ALIGN(4);
} >DATA
+ _edata_shared = . ;
+ PROVIDE (edata_shared = .);
+
/* 0x00200000 ... */
.data (0x00200000 + SIZEOF(.text)): AT ( LOADADDR(.text) + SIZEOF(.text) + SIZEOF(.data.shared)) {
_data = . ;
@@ -44,7 +48,7 @@ SECTIONS
/* dfu.functab addresses are valid as long as DFU is in flash, i.e. only while
* application calls those functions. Once executing in DFU mode, we are
* re-located to ram */
- .dfu.functab 0x00000fd0: AT ( ADDR(.dfu.functab) - ADDR(.text) ) {
+ .dfu.functab 0x00010fd0: AT ( ADDR(.dfu.functab) - ADDR(.text) ) {
*(.dfu.functab)
. = ALIGN(4096);
} >FLASH
diff --git a/firmware/src/start/Cstartup.S b/firmware/src/start/Cstartup.S
index 5ed2712..f1c341e 100644
--- a/firmware/src/start/Cstartup.S
+++ b/firmware/src/start/Cstartup.S
@@ -312,15 +312,16 @@ InitReset:
msr CPSR_c, #ARM_MODE_SVC
mov r13, r0 /* Init stack Sup */
-# Relocate DFU .data section (Copy from ROM to RAM)
+# Relocate DFU .data.shared section (Copy from ROM to RAM)
LDR R1, =_etext
- LDR R2, =_data
- LDR R3, =_edata
-LoopRel: CMP R2, R3
+ LDR R2, =_data_shared
+ LDR R3, =_edata_shared
+LoopRelDS: CMP R2, R3
LDRLO R0, [R1], #4
STRLO R0, [R2], #4
- BLO LoopRel
+ BLO LoopRelDS
+/*
# Clear DFU .bss section (Zero init)
MOV R0, #0
LDR R1, =__bss_start__
@@ -328,6 +329,7 @@ LoopRel: CMP R2, R3
LoopZI: CMP R1, R2
STRLO R0, [R1], #4
BLO LoopZI
+*/
/* prepare c function call to main */
mov r0, #0 /* argc = 0 */
@@ -343,13 +345,30 @@ LoopZI: CMP R1, R2
ldr r1, =AT91C_BASE_PIOA
ldr r2, [r1, #PIOA_PDSR]
tst r2, #PIO_BOOTLDR
- bne _reloc_dfu_text
+ bne _reloc_dfu
#endif
bx r10
-_reloc_dfu_text:
+_reloc_dfu:
+ /* Relocate DFU .data section (Copy from ROM to RAM) */
+ LDR R1, =_edata_shared
+ LDR R2, =_data
+ LDR R3, =_edata
+LoopRel: CMP R2, R3
+ LDRLO R0, [R1], #4
+ STRLO R0, [R2], #4
+ BLO LoopRel
+
+ /* Clear DFU .bss section (Zero init) */
+ MOV R0, #0
+ LDR R1, =__bss_start__
+ LDR R2, =__bss_end__
+LoopZI: CMP R1, R2
+ STRLO R0, [R1], #4
+ BLO LoopZI
+ /* relocate DFU .text into RAM */
ldr r1, =0x00100000
ldr r2, =0x00200000
ldr r3, =_etext
personal git repositories of Harald Welte. Your mileage may vary