Bugfixes on startup routine
Memory addresses should be preceded by '#' when referring to them as integers
This commit is contained in:
parent
46783fd76b
commit
e801690e4f
|
@ -278,23 +278,31 @@ stm8_genInitStartup (FILE *of)
|
|||
fprintf(of,
|
||||
"\t.global _start\n"
|
||||
"_start:\n"
|
||||
"\t; Zeroing .bss\n"
|
||||
"\tldw x, __bss_start\n"
|
||||
"\t; Check if there is at least one byte allocated on .bss\n"
|
||||
"\tldw x, #__bss_start\n"
|
||||
"\tcpw x, #__bss_end\n"
|
||||
"\tjreq 1$\n"
|
||||
"0$:\n"
|
||||
"\t; Zeroing .bss\n"
|
||||
"\tclr (x)\n"
|
||||
"\tincw x\n"
|
||||
"\tcpw x, __bss_end\n"
|
||||
"\tcpw x, #__bss_end\n"
|
||||
"\tjrne 0$\n"
|
||||
"\t; Transfer .data from ROM to RAM\n"
|
||||
"\tldw x, __data_load_start\n"
|
||||
"\tldw y, __data_start\n"
|
||||
"1$:\n"
|
||||
"\t; Check if there is at least one byte allocated on .data\n"
|
||||
"\tldw y, #__data_start\n"
|
||||
"\tcpw y, #_edata\n"
|
||||
"\tjreq 3$\n"
|
||||
"\t; Transfer .data from ROM to RAM\n"
|
||||
"\tldw x, #__data_load_start\n"
|
||||
"2$:\n"
|
||||
"\tld a, (x)\n"
|
||||
"\tld (y), a\n"
|
||||
"\tincw x\n"
|
||||
"\tincw y\n"
|
||||
"\tcpw y, _edata\n"
|
||||
"\tjrne 1$\n");
|
||||
"\tcpw y, #_edata\n"
|
||||
"\tjrne 2$\n"
|
||||
"3$:\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue