From aa631825fcf8661f7ef57afe0cb652a4147ca77a Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Thu, 16 Jan 2020 07:28:23 +0800 Subject: [PATCH] resolve data sections --- common_syms/{librfu.txt => librfu_rfu.txt} | 1 - common_syms/librfu_sio32id.txt | 1 + data/librfu_rodata.s | 17 ----------------- include/librfu.h | 1 - ld_script.txt | 3 ++- ld_script_modern.txt | 5 +++-- src/librfu.c | 9 --------- src/librfu_rfu.c | 20 +++++++------------- src/librfu_sio32id.c | 9 +++------ sym_common.txt | 3 ++- 10 files changed, 18 insertions(+), 51 deletions(-) rename common_syms/{librfu.txt => librfu_rfu.txt} (85%) create mode 100644 common_syms/librfu_sio32id.txt delete mode 100644 data/librfu_rodata.s delete mode 100644 src/librfu.c diff --git a/common_syms/librfu.txt b/common_syms/librfu_rfu.txt similarity index 85% rename from common_syms/librfu.txt rename to common_syms/librfu_rfu.txt index 820c865bef..4b742dcd25 100644 --- a/common_syms/librfu.txt +++ b/common_syms/librfu_rfu.txt @@ -3,4 +3,3 @@ gRfuSlotStatusNI gRfuLinkStatus gRfuStatic gRfuFixed -gRfuSIO32Id diff --git a/common_syms/librfu_sio32id.txt b/common_syms/librfu_sio32id.txt new file mode 100644 index 0000000000..97395e84b3 --- /dev/null +++ b/common_syms/librfu_sio32id.txt @@ -0,0 +1 @@ +gRfuSIO32Id diff --git a/data/librfu_rodata.s b/data/librfu_rodata.s deleted file mode 100644 index 679256541d..0000000000 --- a/data/librfu_rodata.s +++ /dev/null @@ -1,17 +0,0 @@ - .section .rodata - -llsf_struct:: @ 89A3220 - .byte 2, 14, 0, 10, 9, 5, 7, 2 - .byte 0, 15, 1, 3, 3, 0, 31, 0 - .byte 3, 22, 18, 14, 13, 9, 11, 3 - .byte 15, 15, 1, 3, 3, 0, 0x7f, 0 - - .asciz "RFU_V1026" - - .align 2 -str_checkMbootLL:: @ 89A324C - .asciz "RFU-MBOOT" - - .align 2 -Sio32ConnectionData:: @ 89A3258 - .asciz "NINTENDOSio32ID_030820" diff --git a/include/librfu.h b/include/librfu.h index 8dd25541f6..39cc68319f 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -5,7 +5,6 @@ #include "main.h" /* TODOs: - * - split files * - documentation * - decompile librfu_intr.s once arm support is back again (for internal structs not documented in SDK) diff --git a/ld_script.txt b/ld_script.txt index 6719b69075..b7cb97a17d 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -1235,7 +1235,8 @@ SECTIONS { src/agb_flash_mx.o(.rodata); src/agb_flash_le.o(.rodata); src/siirtc.o(.rodata); - data/librfu_rodata.o(.rodata); + src/librfu_rfu.o(.rodata); + src/librfu_sio32id.o(.rodata); *libgcc.a:_divdi3.o(.rodata); *libgcc.a:_udivdi3.o(.rodata); *libc.a(.rodata); diff --git a/ld_script_modern.txt b/ld_script_modern.txt index bf575857e6..52b08fd4b3 100644 --- a/ld_script_modern.txt +++ b/ld_script_modern.txt @@ -70,7 +70,7 @@ SECTIONS { src/librfu_intr.o(.text); asm/librfu_intr.o(.text); src/librfu_rfu.o(.text); - asm/librfu.o(.text); + src/librfu_sio32id.o(.text); *libagbsyscall.a:*.o(.text*); *libgcc.a:*.o(.text*); *libc.a:*.o(.text*); @@ -100,7 +100,8 @@ SECTIONS { src/agb_flash_mx.o(.rodata); src/agb_flash_le.o(.rodata); src/siirtc.o(.rodata); - data/librfu_rodata.o(.rodata); + src/librfu_rfu.o(.rodata); + src/librfu_sio32id.o(.rodata); *libgcc.a:*.o(.rodata*); *libc.a:*.o(.rodata*); *libc.a:*.o(.data*); diff --git a/src/librfu.c b/src/librfu.c deleted file mode 100644 index 1a295fd48c..0000000000 --- a/src/librfu.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "global.h" -#include "librfu.h" - -struct RfuSlotStatusUNI* gRfuSlotStatusUNI[4]; -struct RfuSlotStatusNI* gRfuSlotStatusNI[4]; -struct RfuLinkStatus *gRfuLinkStatus; -struct RfuStatic *gRfuStatic; -struct RfuFixed* gRfuFixed; -struct RfuSIO32Id gRfuSIO32Id; diff --git a/src/librfu_rfu.c b/src/librfu_rfu.c index f5f13cc5d4..732cc532d2 100644 --- a/src/librfu_rfu.c +++ b/src/librfu_rfu.c @@ -67,13 +67,13 @@ static void rfu_STC_NI_receive_Sender(u8, u8, const struct RfuLocalStruct *, __a static void rfu_STC_NI_initSlot_asRecvDataEntity(u8, struct NIComm *); static void rfu_STC_NI_initSlot_asRecvControllData(u8, struct NIComm *); -//struct RfuSlotStatusUNI *gRfuSlotStatusUNI[RFU_CHILD_MAX]; -//struct RfuSlotStatusNI *gRfuSlotStatusNI[RFU_CHILD_MAX]; -//struct RfuLinkStatus *gRfuLinkStatus; -//struct RfuStatic *gRfuStatic; -//struct RfuFixed *gRfuFixed; +struct RfuSlotStatusUNI *gRfuSlotStatusUNI[RFU_CHILD_MAX]; +struct RfuSlotStatusNI *gRfuSlotStatusNI[RFU_CHILD_MAX]; +struct RfuLinkStatus *gRfuLinkStatus; +struct RfuStatic *gRfuStatic; +struct RfuFixed *gRfuFixed; -/*static const struct LLSFStruct llsf_struct[2] = { +static const struct LLSFStruct llsf_struct[2] = { { 2, 14, 0, 10, 9, 5, 7, 2, 0, 15, 1, 3, 3, 0x1f @@ -83,16 +83,9 @@ static void rfu_STC_NI_initSlot_asRecvControllData(u8, struct NIComm *); } }; -#ifdef EMERALD static const char lib_ver[] = "RFU_V1026"; -#else -static const char lib_ver[] = "RFU_V1024"; -#endif static const char str_checkMbootLL[] = "RFU-MBOOT"; -*/ -extern const struct LLSFStruct llsf_struct[2]; -extern const char str_checkMbootLL[];// = "RFU-MBOOT"; u16 rfu_initializeAPI(struct RfuAPIBuffer *APIBuffer, u16 buffByteSize, IntrFunc *sioIntrTable_p, bool8 copyInterruptToRam) { @@ -2031,6 +2024,7 @@ static void rfu_STC_NI_receive_Sender(u8 r0, u8 r10, const struct RfuLocalStruct } } _081E30AE: + ; } else if (r12->state == SLOT_STATE_SEND_LAST) { diff --git a/src/librfu_sio32id.c b/src/librfu_sio32id.c index f5d652348f..fc57019865 100644 --- a/src/librfu_sio32id.c +++ b/src/librfu_sio32id.c @@ -4,13 +4,10 @@ static void Sio32IDIntr(void); static void Sio32IDInit(void); static s32 Sio32IDMain(void); -//struct RfuSIO32Id gRfuSIO32Id; +struct RfuSIO32Id gRfuSIO32Id; -//static const u16 Sio32ConnectionData[] = { 0x494e, 0x544e, 0x4e45, 0x4f44 }; // NINTENDO -//static const char Sio32IDLib_Var[] = "Sio32ID_030820"; - -extern const u16 Sio32ConnectionData[]; -extern const char Sio32IDLib_Var[]; +static const u16 Sio32ConnectionData[] = { 0x494e, 0x544e, 0x4e45, 0x4f44 }; // NINTENDO +static const char Sio32IDLib_Var[] = "Sio32ID_030820"; s32 AgbRFU_checkID(u8 r5) { diff --git a/sym_common.txt b/sym_common.txt index 8f08952071..a804a76e76 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -77,4 +77,5 @@ gReservedSpritePaletteCount: .include "m4a.o" .include "agb_flash.o" .include "librfu_stwi.o" - .include "librfu.o" + .include "librfu_rfu.o" + .include "librfu_sio32id.o"