diff --git a/deps/gbastartup/cstartup.cpp b/deps/gbastartup/cstartup.cpp index c28408a0..bca8c639 100644 --- a/deps/gbastartup/cstartup.cpp +++ b/deps/gbastartup/cstartup.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2016 - 2020 gtalent2@gmail.com + * Copyright 2016 - 2020 gary@drinkingtea.net * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -17,25 +17,20 @@ // suppressed #pragma GCC diagnostic ignored "-Wcast-align" -#define MEM_WRAM_BEGIN reinterpret_cast(0x02000000) -#define MEM_WRAM_END reinterpret_cast(0x0203FFFF) +#define MEM_EWRAM_BEGIN reinterpret_cast(0x02000000) +#define MEM_EWRAM_END reinterpret_cast(0x0203FFFF) -#define HEAP_BEGIN reinterpret_cast(MEM_WRAM_BEGIN) -// set size to half of WRAM -#define HEAP_SIZE ((MEM_WRAM_END - MEM_WRAM_BEGIN) / 2) -#define HEAP_END reinterpret_cast(MEM_WRAM_BEGIN + HEAP_SIZE) +#define HEAP_BEGIN reinterpret_cast(MEM_EWRAM_BEGIN) +// set size to half of EWRAM +#define HEAP_SIZE ((MEM_EWRAM_END - MEM_EWRAM_BEGIN) / 2) +#define HEAP_END reinterpret_cast(MEM_EWRAM_BEGIN + HEAP_SIZE) extern void (*__preinit_array_start[]) (void); extern void (*__preinit_array_end[]) (void); extern void (*__init_array_start[]) (void); extern void (*__init_array_end[]) (void); -namespace ox::heapmgr { - -void initHeap(char *heapBegin, char *heapEnd); - -} - +int main(int argc, const char **argv); extern "C" { @@ -50,8 +45,6 @@ void __libc_init_array() { } } -int main(int argc, const char **argv); - int c_start() { const char *args[2] = {"", "rom.oxfs"}; ox::heapmgr::initHeap(ox::bit_cast(HEAP_BEGIN), ox::bit_cast(HEAP_END)); diff --git a/deps/gbastartup/gba_crt0.s b/deps/gbastartup/gba_crt0.s index 49e6e8a8..1641ac4b 100644 --- a/deps/gbastartup/gba_crt0.s +++ b/deps/gbastartup/gba_crt0.s @@ -178,13 +178,11 @@ CEW0Skip: @--------------------------------------------------------------------------------- @ global constructors @--------------------------------------------------------------------------------- - ldr r3, =__libc_init_array - bl _blx_r3_stub + bl __libc_init_array @--------------------------------------------------------------------------------- @ Jump to user code @--------------------------------------------------------------------------------- - ldr r3, =c_start - bl _blx_r3_stub + bl c_start @--------------------------------------------------------------------------------- @ Clear memory to 0x00 if length != 0 @--------------------------------------------------------------------------------- @@ -211,11 +209,6 @@ ClearMX: @--------------------------------------------------------------------------------- bx lr -@--------------------------------------------------------------------------------- -_blx_r3_stub: -@--------------------------------------------------------------------------------- - bx r3 - @--------------------------------------------------------------------------------- @ Copy memory if length != 0 @---------------------------------------------------------------------------------