summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--1_hello_world/_rom.ld2
-rw-r--r--1_hello_world/startup.c9
2 files changed, 9 insertions, 2 deletions
diff --git a/1_hello_world/_rom.ld b/1_hello_world/_rom.ld
index 55106be..916d9d9 100644
--- a/1_hello_world/_rom.ld
+++ b/1_hello_world/_rom.ld
@@ -1,4 +1,5 @@
SECTIONS {
+ __rom_start = ORIGIN(ROM);
. = ORIGIN(ROM);
.text : {
KEEP(*(.stack))
@@ -12,4 +13,5 @@ SECTIONS {
*(.rodata*)
. = ALIGN(4);
} >ROM
+ __rom_end = .;
}
diff --git a/1_hello_world/startup.c b/1_hello_world/startup.c
index 06ca39e..e743214 100644
--- a/1_hello_world/startup.c
+++ b/1_hello_world/startup.c
@@ -29,6 +29,8 @@ static __attribute__((interrupt)) void VSYNC_handler(void);
static __attribute__((interrupt)) void CPUException_handler(void);
extern unsigned __stacktop;
+extern unsigned __rom_start;
+extern unsigned __rom_end;
__attribute__((section(".stack"), used)) unsigned *__stack_init = &__stacktop;
@@ -106,8 +108,8 @@ __attribute__((section(".smd_header"), used)) struct smd_header __smd_header = {
.version = "GM XXXXXXXX-XX",
.checksum = 0x0000,
.io_support = "J ",
- .rom_start = 0,
- .rom_end = 0xfffff,
+ .rom_start = (unsigned long)&__rom_start,
+ .rom_end = (unsigned long)&__rom_end-1,
.ram_start = 0xff0000,
.ram_end = 0xffffff,
.sram_enabled = 0x00000000,
@@ -124,8 +126,11 @@ static void __start(void)
{
main();
}
+
static void HSYNC_handler(void) {}
+
static void VSYNC_handler(void) {}
+
static void CPUException_handler(void)
{
asm inline volatile (" stop #2700");