[gbastartup] Cleanup, make an object lib, and make dependency public
This commit is contained in:
parent
be31ad48a1
commit
763955a9bb
4
deps/gbastartup/CMakeLists.txt
vendored
4
deps/gbastartup/CMakeLists.txt
vendored
@ -1,12 +1,12 @@
|
|||||||
enable_language(C ASM)
|
enable_language(C ASM)
|
||||||
|
|
||||||
add_library(
|
add_library(
|
||||||
GbaStartup
|
GbaStartup OBJECT
|
||||||
gba_crt0.s
|
gba_crt0.s
|
||||||
cstartup.cpp
|
cstartup.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
GbaStartup
|
GbaStartup PUBLIC
|
||||||
OxStd
|
OxStd
|
||||||
)
|
)
|
||||||
|
29
deps/gbastartup/cstartup.cpp
vendored
29
deps/gbastartup/cstartup.cpp
vendored
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2020 gary@drinkingtea.net
|
* Copyright 2016 - 2021 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
|
||||||
@ -9,21 +9,13 @@
|
|||||||
#include <ox/std/bit.hpp>
|
#include <ox/std/bit.hpp>
|
||||||
#include <ox/std/heapmgr.hpp>
|
#include <ox/std/heapmgr.hpp>
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#define MEM_EWRAM_BEGIN ox::bit_cast<char*>(0x02000000)
|
||||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
#define MEM_EWRAM_END ox::bit_cast<char*>(0x0203FFFF)
|
||||||
|
|
||||||
// this warning is too dumb to realize that it can actually confirm the hard
|
#define HEAP_BEGIN ox::bit_cast<char*>(MEM_EWRAM_BEGIN)
|
||||||
// coded address aligns with the requirement of HeapSegment, so it must be
|
|
||||||
// suppressed
|
|
||||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
|
||||||
|
|
||||||
#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_EWRAM_BEGIN)
|
|
||||||
// set size to half of EWRAM
|
// set size to half of EWRAM
|
||||||
#define HEAP_SIZE ((MEM_EWRAM_END - MEM_EWRAM_BEGIN) / 2)
|
#define HEAP_SIZE ((MEM_EWRAM_END - MEM_EWRAM_BEGIN) / 2)
|
||||||
#define HEAP_END reinterpret_cast<ox::heapmgr::HeapSegment*>(MEM_EWRAM_BEGIN + HEAP_SIZE)
|
#define HEAP_END ox::bit_cast<char*>(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);
|
||||||
@ -47,10 +39,11 @@ void __libc_init_array() {
|
|||||||
|
|
||||||
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(HEAP_BEGIN, HEAP_END);
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||||
return main(2, args);
|
return main(2, args);
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user