[gbastartup] Cleanup

This commit is contained in:
Gary Talent 2020-07-12 18:35:18 -05:00
parent 7b7a8d75b4
commit b32734d727
2 changed files with 10 additions and 24 deletions

View File

@ -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<uint8_t*>(0x02000000)
#define MEM_WRAM_END reinterpret_cast<uint8_t*>(0x0203FFFF)
#define MEM_EWRAM_BEGIN reinterpret_cast<uint8_t*>(0x02000000)
#define MEM_EWRAM_END reinterpret_cast<uint8_t*>(0x0203FFFF)
#define HEAP_BEGIN reinterpret_cast<ox::heapmgr::HeapSegment*>(MEM_WRAM_BEGIN)
// set size to half of WRAM
#define HEAP_SIZE ((MEM_WRAM_END - MEM_WRAM_BEGIN) / 2)
#define HEAP_END reinterpret_cast<ox::heapmgr::HeapSegment*>(MEM_WRAM_BEGIN + HEAP_SIZE)
#define HEAP_BEGIN reinterpret_cast<ox::heapmgr::HeapSegment*>(MEM_EWRAM_BEGIN)
// set size to half of EWRAM
#define HEAP_SIZE ((MEM_EWRAM_END - MEM_EWRAM_BEGIN) / 2)
#define HEAP_END reinterpret_cast<ox::heapmgr::HeapSegment*>(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<char*>(HEAP_BEGIN), ox::bit_cast<char*>(HEAP_END));

View File

@ -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
@---------------------------------------------------------------------------------