mirror of
https://github.com/italicsjenga/gba.git
synced 2025-01-10 02:51:31 +11:00
Added .iwram section (#118)
* Added .iwram section * Use the same section for .data and .text_iwram
This commit is contained in:
parent
40ced658f3
commit
c375b5ac7a
13
linker.ld
13
linker.ld
|
@ -18,12 +18,21 @@ SECTIONS {
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} >rom = 0xff
|
} >rom = 0xff
|
||||||
|
|
||||||
__data_lma = .;
|
__iwram_lma = .;
|
||||||
.data : {
|
.iwram : {
|
||||||
|
__iwram_start = ABSOLUTE(.);
|
||||||
|
|
||||||
__data_start = ABSOLUTE(.);
|
__data_start = ABSOLUTE(.);
|
||||||
*(.data .data.*);
|
*(.data .data.*);
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
__data_end = ABSOLUTE(.);
|
__data_end = ABSOLUTE(.);
|
||||||
|
|
||||||
|
__text_iwram_start = ABSOLUTE(.);
|
||||||
|
*(.text_iwram .text_iwram.*);
|
||||||
|
. = ALIGN(4);
|
||||||
|
__text_iwram_end = ABSOLUTE(.);
|
||||||
|
|
||||||
|
__iwram_end = ABSOLUTE(.);
|
||||||
} >iwram AT>rom = 0xff
|
} >iwram AT>rom = 0xff
|
||||||
|
|
||||||
.bss : {
|
.bss : {
|
||||||
|
|
10
src/rsrt0.S
10
src/rsrt0.S
|
@ -21,13 +21,13 @@ __start:
|
||||||
msr CPSR_c, r0
|
msr CPSR_c, r0
|
||||||
ldr sp, =0x3007f00
|
ldr sp, =0x3007f00
|
||||||
|
|
||||||
@ copy .data section to IWRAM
|
@ copy .data and .text_iwram section to IWRAM
|
||||||
ldr r0, =__data_lma @ source address
|
ldr r0, =__iwram_lma @ source address
|
||||||
ldr r1, =__data_start @ destination address
|
ldr r1, =__iwram_start @ destination address
|
||||||
ldr r2, =__data_end
|
ldr r2, =__iwram_end
|
||||||
subs r2, r1 @ length
|
subs r2, r1 @ length
|
||||||
@ these instructions are only executed if r2 is nonzero
|
@ these instructions are only executed if r2 is nonzero
|
||||||
@ (i.e. don't bother copying an empty .data section)
|
@ (i.e. don't bother copying an empty .iwram section)
|
||||||
addne r2, #3
|
addne r2, #3
|
||||||
asrne r2, #2
|
asrne r2, #2
|
||||||
addne r2, #0x04000000
|
addne r2, #0x04000000
|
||||||
|
|
Loading…
Reference in a new issue