aboutsummaryrefslogtreecommitdiffhomepage
path: root/targets
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2020-01-06 11:48:09 +0100
committerRon Evans <[email protected]>2020-01-27 21:56:17 +0100
commitf14127be7629eb131add86f97acadc1840ecc926 (patch)
treee0248724bb3c27ce43a7ab3bc5e5f1a05dc90eb3 /targets
parenta9b2d8c2945707e719283b5e39076ddcdd926652 (diff)
downloadtinygo-f14127be7629eb131add86f97acadc1840ecc926.tar.gz
tinygo-f14127be7629eb131add86f97acadc1840ecc926.zip
targets/gba: make linker script cleaner
Make it clearer where the stack is located. Additionally, get the heap to work (the GC needs to have _stack_top defined to work correctly).
Diffstat (limited to 'targets')
-rw-r--r--targets/gameboy-advance.ld10
-rw-r--r--targets/gameboy-advance.s4
2 files changed, 7 insertions, 7 deletions
diff --git a/targets/gameboy-advance.ld b/targets/gameboy-advance.ld
index 5fd516964..0d7f8cd50 100644
--- a/targets/gameboy-advance.ld
+++ b/targets/gameboy-advance.ld
@@ -7,10 +7,8 @@ MEMORY {
rom : ORIGIN = 0x08000000, LENGTH = 32M /* flash ROM */
}
-__iwram_top = ORIGIN(iwram) + LENGTH(iwram);;
-_stack_size = 3K;
-__sp_irq = _stack_top;
-__sp_usr = _stack_top - 1K;
+__stack_size_irq = 1K;
+__stack_size_usr = 2K;
SECTIONS
{
@@ -35,8 +33,10 @@ SECTIONS
.stack (NOLOAD) :
{
. = ALIGN(4);
- . += _stack_size;
+ _stack_top_irq = .;
+ . += __stack_size_irq;
_stack_top = .;
+ . += __stack_size_usr;
} >iwram
/* Start address (in flash) of .data, used by startup code. */
diff --git a/targets/gameboy-advance.s b/targets/gameboy-advance.s
index d00ec8798..f72b8a562 100644
--- a/targets/gameboy-advance.s
+++ b/targets/gameboy-advance.s
@@ -22,10 +22,10 @@ start_vector:
mov r0, #0x12 // Switch to IRQ Mode
msr cpsr, r0
- ldr sp, =__sp_irq // Set IRQ stack
+ ldr sp, =_stack_top_irq // Set IRQ stack
mov r0, #0x1f // Switch to System Mode
msr cpsr, r0
- ldr sp, =__sp_usr // Set user stack
+ ldr sp, =_stack_top // Set user stack
// Jump to user code (switching to Thumb mode)
ldr r3, =main