[gbastartup] Cleanup
This commit is contained in:
parent
7b7a8d75b4
commit
b32734d727
23
deps/gbastartup/cstartup.cpp
vendored
23
deps/gbastartup/cstartup.cpp
vendored
@ -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
|
* 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
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
@ -17,25 +17,20 @@
|
|||||||
// suppressed
|
// suppressed
|
||||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||||
|
|
||||||
#define MEM_WRAM_BEGIN reinterpret_cast<uint8_t*>(0x02000000)
|
#define MEM_EWRAM_BEGIN reinterpret_cast<uint8_t*>(0x02000000)
|
||||||
#define MEM_WRAM_END reinterpret_cast<uint8_t*>(0x0203FFFF)
|
#define MEM_EWRAM_END reinterpret_cast<uint8_t*>(0x0203FFFF)
|
||||||
|
|
||||||
#define HEAP_BEGIN reinterpret_cast<ox::heapmgr::HeapSegment*>(MEM_WRAM_BEGIN)
|
#define HEAP_BEGIN reinterpret_cast<ox::heapmgr::HeapSegment*>(MEM_EWRAM_BEGIN)
|
||||||
// set size to half of WRAM
|
// set size to half of EWRAM
|
||||||
#define HEAP_SIZE ((MEM_WRAM_END - MEM_WRAM_BEGIN) / 2)
|
#define HEAP_SIZE ((MEM_EWRAM_END - MEM_EWRAM_BEGIN) / 2)
|
||||||
#define HEAP_END reinterpret_cast<ox::heapmgr::HeapSegment*>(MEM_WRAM_BEGIN + HEAP_SIZE)
|
#define HEAP_END reinterpret_cast<ox::heapmgr::HeapSegment*>(MEM_EWRAM_BEGIN + HEAP_SIZE)
|
||||||
|
|
||||||
extern void (*__preinit_array_start[]) (void);
|
extern void (*__preinit_array_start[]) (void);
|
||||||
extern void (*__preinit_array_end[]) (void);
|
extern void (*__preinit_array_end[]) (void);
|
||||||
extern void (*__init_array_start[]) (void);
|
extern void (*__init_array_start[]) (void);
|
||||||
extern void (*__init_array_end[]) (void);
|
extern void (*__init_array_end[]) (void);
|
||||||
|
|
||||||
namespace ox::heapmgr {
|
int main(int argc, const char **argv);
|
||||||
|
|
||||||
void initHeap(char *heapBegin, char *heapEnd);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
@ -50,8 +45,6 @@ void __libc_init_array() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char **argv);
|
|
||||||
|
|
||||||
int c_start() {
|
int c_start() {
|
||||||
const char *args[2] = {"", "rom.oxfs"};
|
const char *args[2] = {"", "rom.oxfs"};
|
||||||
ox::heapmgr::initHeap(ox::bit_cast<char*>(HEAP_BEGIN), ox::bit_cast<char*>(HEAP_END));
|
ox::heapmgr::initHeap(ox::bit_cast<char*>(HEAP_BEGIN), ox::bit_cast<char*>(HEAP_END));
|
||||||
|
11
deps/gbastartup/gba_crt0.s
vendored
11
deps/gbastartup/gba_crt0.s
vendored
@ -178,13 +178,11 @@ CEW0Skip:
|
|||||||
@---------------------------------------------------------------------------------
|
@---------------------------------------------------------------------------------
|
||||||
@ global constructors
|
@ global constructors
|
||||||
@---------------------------------------------------------------------------------
|
@---------------------------------------------------------------------------------
|
||||||
ldr r3, =__libc_init_array
|
bl __libc_init_array
|
||||||
bl _blx_r3_stub
|
|
||||||
@---------------------------------------------------------------------------------
|
@---------------------------------------------------------------------------------
|
||||||
@ Jump to user code
|
@ Jump to user code
|
||||||
@---------------------------------------------------------------------------------
|
@---------------------------------------------------------------------------------
|
||||||
ldr r3, =c_start
|
bl c_start
|
||||||
bl _blx_r3_stub
|
|
||||||
@---------------------------------------------------------------------------------
|
@---------------------------------------------------------------------------------
|
||||||
@ Clear memory to 0x00 if length != 0
|
@ Clear memory to 0x00 if length != 0
|
||||||
@---------------------------------------------------------------------------------
|
@---------------------------------------------------------------------------------
|
||||||
@ -211,11 +209,6 @@ ClearMX:
|
|||||||
@---------------------------------------------------------------------------------
|
@---------------------------------------------------------------------------------
|
||||||
bx lr
|
bx lr
|
||||||
|
|
||||||
@---------------------------------------------------------------------------------
|
|
||||||
_blx_r3_stub:
|
|
||||||
@---------------------------------------------------------------------------------
|
|
||||||
bx r3
|
|
||||||
|
|
||||||
@---------------------------------------------------------------------------------
|
@---------------------------------------------------------------------------------
|
||||||
@ Copy memory if length != 0
|
@ Copy memory if length != 0
|
||||||
@---------------------------------------------------------------------------------
|
@---------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user