mirror of
https://github.com/italicsjenga/gba.git
synced 2025-01-09 18:41:30 +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);
|
||||
} >rom = 0xff
|
||||
|
||||
__data_lma = .;
|
||||
.data : {
|
||||
__iwram_lma = .;
|
||||
.iwram : {
|
||||
__iwram_start = ABSOLUTE(.);
|
||||
|
||||
__data_start = ABSOLUTE(.);
|
||||
*(.data .data.*);
|
||||
. = ALIGN(4);
|
||||
__data_end = ABSOLUTE(.);
|
||||
|
||||
__text_iwram_start = ABSOLUTE(.);
|
||||
*(.text_iwram .text_iwram.*);
|
||||
. = ALIGN(4);
|
||||
__text_iwram_end = ABSOLUTE(.);
|
||||
|
||||
__iwram_end = ABSOLUTE(.);
|
||||
} >iwram AT>rom = 0xff
|
||||
|
||||
.bss : {
|
||||
|
|
10
src/rsrt0.S
10
src/rsrt0.S
|
@ -21,13 +21,13 @@ __start:
|
|||
msr CPSR_c, r0
|
||||
ldr sp, =0x3007f00
|
||||
|
||||
@ copy .data section to IWRAM
|
||||
ldr r0, =__data_lma @ source address
|
||||
ldr r1, =__data_start @ destination address
|
||||
ldr r2, =__data_end
|
||||
@ copy .data and .text_iwram section to IWRAM
|
||||
ldr r0, =__iwram_lma @ source address
|
||||
ldr r1, =__iwram_start @ destination address
|
||||
ldr r2, =__iwram_end
|
||||
subs r2, r1 @ length
|
||||
@ 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
|
||||
asrne r2, #2
|
||||
addne r2, #0x04000000
|
||||
|
|
Loading…
Reference in a new issue