[gbastartup] Add main parameters for GBA build

This commit is contained in:
Gary Talent 2020-01-12 20:45:20 -06:00
parent 04727ae57a
commit 03fc6280c9
2 changed files with 18 additions and 4 deletions

View File

@ -1,10 +1,15 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
extern void (*__preinit_array_start[]) (void);
extern void (*__preinit_array_end[]) (void);
extern void (*__init_array_start[]) (void);
extern void (*__init_array_end[]) (void);
extern "C" void __libc_init_array() {
extern "C" {
void __libc_init_array() {
auto preInits = __preinit_array_end - __preinit_array_start;
for (decltype(preInits) i = 0; i < preInits; i++) {
__preinit_array_start[i]();
@ -14,3 +19,14 @@ extern "C" void __libc_init_array() {
__preinit_array_start[i]();
}
}
int main(int argc, const char **argv);
void c_start() {
const char *args[2] = {"", "rom.oxfs"};
main(2, args);
}
}
#pragma GCC diagnostic pop

View File

@ -183,9 +183,7 @@ CEW0Skip:
@---------------------------------------------------------------------------------
@ Jump to user code
@---------------------------------------------------------------------------------
mov r0, #0 @ int argc
mov r1, #0 @ char *argv[]
ldr r3, =main
ldr r3, =c_start
bl _blx_r3_stub
@---------------------------------------------------------------------------------
@ Clear memory to 0x00 if length != 0