mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 06:34:18 -04:00
nubinit work, breaks when linking
This commit is contained in:
@@ -355,10 +355,12 @@ DVDERR_CFLAGS = CFLAGS + [
|
||||
TRK_CFLAGS = [
|
||||
"-O4,p",
|
||||
"-sdata 0",
|
||||
"-sdata2 0",
|
||||
"-fp hard",
|
||||
"-enum int",
|
||||
"-char unsigned",
|
||||
"-inline deferred"
|
||||
"-inline deferred",
|
||||
"-rostr"
|
||||
] + DOL_DEFINES
|
||||
BASE_REL_CFLAGS = CFLAGS + [
|
||||
"-sdata 0",
|
||||
|
||||
@@ -194,6 +194,10 @@ TRK/mainloop.c:
|
||||
TRK/nubevent.c:
|
||||
.text: [0x800A20EC, 0x800A2314]
|
||||
.bss: [0x802095C8, 0x802095F0]
|
||||
#TRK/nubinit.c: #breaks .init and .text
|
||||
# .text: [0x800A2314, 0x800A2494]
|
||||
# .rodata: [0x800AF750, 0x800AF770]
|
||||
# .bss: [0x802095F0, 0x802095F8]
|
||||
dolphin/odenotstub/odenotstub.c:
|
||||
.text: [0x800a9770, 0x800a9780]
|
||||
dolphin/amcstubs/AmcExi2Stubs.c:
|
||||
|
||||
+1
-1
@@ -647,7 +647,7 @@ class CSource(Source):
|
||||
self.cc = c.CC
|
||||
self.cflags = c.DOL_CPPFLAGS
|
||||
self.frank = False
|
||||
elif path == "src/TRK/mainloop.c" or path == "src/TRK/nubevent.c":
|
||||
elif path == "src/TRK/mainloop.c" or path == "src/TRK/nubevent.c" or path == "src/TRK/nubinit.c":
|
||||
self.cc = c.CC
|
||||
self.cflags = c.DOL_TRK_CFLAGS
|
||||
self.frank = False
|
||||
|
||||
@@ -9,6 +9,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
TRKResult TRKDispatchMessage(MessageBuffer* mBuf);
|
||||
TRKResult TRKInitializeDispatcher();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#ifndef DOLPHIN_TRK_H
|
||||
#define DOLPHIN_TRK_H
|
||||
#include "types.h"
|
||||
#include "TRK/trk.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
void InitMetroTRK(void);
|
||||
void exit(void);
|
||||
TRKResult TRKInitializeTarget();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef DOLPHIN_TRK_GLUE_H
|
||||
#define DOLPHIN_TRK_GLUE_H
|
||||
#include "types.h"
|
||||
#include "TRK/trk.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
|
||||
TRKResult TRKInitializeIntDrivenUART(u32, u32, u32, void*);
|
||||
void TRK_board_display(const char*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -16,6 +16,7 @@ typedef struct MessageBuffer {
|
||||
|
||||
MessageBuffer* TRKGetBuffer(int);
|
||||
void TRKReleaseBuffer(int);
|
||||
TRKResult TRKInitializeMessageBuffers();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef TRK_NUBINIT
|
||||
#define TRK_NUBINIT
|
||||
#include "types.h"
|
||||
#include "TRK/trk.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
TRKResult TRKInitializeNub(void);
|
||||
TRKResult TRKTerminateNub(void);
|
||||
void TRKNubWelcome(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -6,6 +6,8 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
void TRKGetInput();
|
||||
TRKResult TRKInitializeSerialHandler();
|
||||
TRKResult TRKTerminateSerialHandler();
|
||||
|
||||
extern u8* gTRKInputPendingPtr;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ void TRKTargeInterrupt(TRKEvent*);
|
||||
void TRKTargetSupportRequest();
|
||||
BOOL TRKTargetStopped();
|
||||
void TRKTargetContinue();
|
||||
void TRKTargetSetInputPendingPtr(void*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef TRK_USER_PUT
|
||||
#define TRK_USER_PUT
|
||||
#include "types.h"
|
||||
#include "TRK/trk.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
TRKResult usr_put_initialize();
|
||||
TRKResult usr_put_serial(const char*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,84 @@
|
||||
#include "TRK/nubinit.h"
|
||||
#include "TRK/usr_put.h"
|
||||
#include "TRK/nubevent.h"
|
||||
#include "TRK/msgbuf.h"
|
||||
#include "TRK/dispatch.h"
|
||||
#include "TRK/dolphin_trk_glue.h"
|
||||
#include "TRK/targimpl.h"
|
||||
#include "TRK/serpoll.h"
|
||||
#include "TRK/dolphin_trk.h"
|
||||
|
||||
BOOL gTRKBigEndian;
|
||||
|
||||
inline BOOL TRK_InitializeEndian(void)
|
||||
{
|
||||
BOOL res = FALSE;
|
||||
u8 bendian[4];
|
||||
u32 load;
|
||||
gTRKBigEndian = TRUE;
|
||||
|
||||
bendian[0] = 0x12;
|
||||
bendian[1] = 0x34;
|
||||
bendian[2] = 0x56;
|
||||
bendian[3] = 0x78;
|
||||
|
||||
load = *(u32*)bendian;
|
||||
if (load == 0x12345678) {
|
||||
gTRKBigEndian = TRUE;
|
||||
} else if (load == 0x78563412) {
|
||||
gTRKBigEndian = FALSE;
|
||||
} else {
|
||||
res = TRUE;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
TRKResult TRKInitializeNub (void){
|
||||
int res;
|
||||
res = TRK_InitializeEndian();
|
||||
|
||||
if (res == 0){
|
||||
usr_put_initialize();
|
||||
}
|
||||
|
||||
if(res == 0){
|
||||
res = TRKInitializeEventQueue();
|
||||
}
|
||||
|
||||
if(res == TRKSuccess){
|
||||
res = TRKInitializeMessageBuffers();
|
||||
}
|
||||
|
||||
if(res == TRKSuccess){
|
||||
res = TRKInitializeDispatcher();
|
||||
}
|
||||
|
||||
if(res == TRKSuccess){
|
||||
TRKResult ures = TRKInitializeIntDrivenUART(0xE100, 1, 0, &gTRKInputPendingPtr);
|
||||
TRKTargetSetInputPendingPtr(gTRKInputPendingPtr);
|
||||
if(ures != TRKSuccess){
|
||||
res = ures;
|
||||
}
|
||||
}
|
||||
|
||||
if(res == TRKSuccess){
|
||||
res = TRKInitializeSerialHandler();
|
||||
}
|
||||
|
||||
if(res == TRKSuccess){
|
||||
res = TRKInitializeTarget();
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
TRKResult TRKTerminateNub(void){
|
||||
|
||||
TRKTerminateSerialHandler();
|
||||
return TRKSuccess;
|
||||
}
|
||||
|
||||
void TRKNubWelcome(void){
|
||||
TRK_board_display("MetroTRK for GAMECUBE v0.10");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user