diff --git a/build/buildtools/commondefs b/build/buildtools/commondefs index e0f0b9c9..114614f5 100644 --- a/build/buildtools/commondefs +++ b/build/buildtools/commondefs @@ -11,8 +11,9 @@ # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # -# $Log: $ -# $NoKeywords: $ +# $Date:: $ +# $Rev:$ +# $Author:$ #---------------------------------------------------------------------------- ifndef TWLFIRM_COMMONDEFS_ TWLFIRM_COMMONDEFS_ = TRUE diff --git a/build/buildtools/modulerules b/build/buildtools/modulerules index e9fb4278..c1937764 100644 --- a/build/buildtools/modulerules +++ b/build/buildtools/modulerules @@ -11,8 +11,9 @@ # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # -# $Log: $ -# $NoKeywords: $ +# $Date:: $ +# $Rev:$ +# $Author:$ #---------------------------------------------------------------------------- ifndef TWLFIRM_MODULERULES_ diff --git a/build/tools/Makefile b/build/tools/Makefile index dceeabab..9246e82d 100644 --- a/build/tools/Makefile +++ b/build/tools/Makefile @@ -11,8 +11,9 @@ # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # -# $Log: $ -# $NoKeywords: $ +# $Date:: $ +# $Rev:$ +# $Author:$ #---------------------------------------------------------------------------- include $(TWLSDK_ROOT)/build/buildtools/commondefs diff --git a/build/tools/makegcdfirm/Makefile b/build/tools/makegcdfirm/Makefile index 6e91da85..68b7cbbf 100644 --- a/build/tools/makegcdfirm/Makefile +++ b/build/tools/makegcdfirm/Makefile @@ -15,87 +15,89 @@ # $NoKeywords: $ #--------------------------------------------------------------------------- -SUPPORT_ECC = 0 +TARGET_PLATFORM = TWL + +SUPPORT_ECC = 0 ifeq ($(SUPPORT_ECC),1) -ECC_SRCDIR = ../../libraries/acsign_ecc/common \ - ../../libraries/acsign_ecc/common/algae/common/ecc \ - ../../libraries/acsign_ecc/common/algae/cmp \ - ../../libraries/acsign_ecc/common/algae/ecsource \ +ECC_SRCDIR = ../../libraries/acsign_ecc/common \ + ../../libraries/acsign_ecc/common/algae/common/ecc \ + ../../libraries/acsign_ecc/common/algae/cmp \ + ../../libraries/acsign_ecc/common/algae/ecsource \ -ECC_INCDIR = ../../libraries/acsign_ecc/include \ - ../../libraries/acsign_ecc/common/algae/include \ - ../../libraries/acsign_ecc/common/algae/common/include \ +ECC_INCDIR = ../../libraries/acsign_ecc/include \ + ../../libraries/acsign_ecc/common/algae/include \ + ../../libraries/acsign_ecc/common/algae/common/include \ -ECC_SRCS = acsign_ecc.c acsign_cryptoc.c \ - \ - cmparith.c cmpbits.c cmpcnv.c cmpdiv.c cmpmem.c \ - cmpmod.c cmpmuldv.c cmpspprt.c cmpsqr.c cmpvectr.c \ - computem.c ecfpatbl.c ecfpsmul.c \ - spcprime.c secfpcom.c \ - \ - p224v1.c p224v1a.c \ +ECC_SRCS = acsign_ecc.c acsign_cryptoc.c \ + \ + cmparith.c cmpbits.c cmpcnv.c cmpdiv.c cmpmem.c \ + cmpmod.c cmpmuldv.c cmpspprt.c cmpsqr.c cmpvectr.c \ + computem.c ecfpatbl.c ecfpsmul.c \ + spcprime.c secfpcom.c \ + \ + p224v1.c p224v1a.c \ -ECC_DEFS = -DRSA_PROTOTYPES=RSA_ENABLED \ - -DRCOM_BUILD=RSA_ENABLED -DRSA_FAST_INVERSE=RSA_ENABLED \ - -DRSA_STD_MEM_FUNCS=RSA_ENABLED -DRSA_STD_ALLOC_FUNCS=RSA_ENABLED \ +ECC_DEFS = -DRSA_PROTOTYPES=RSA_ENABLED \ + -DRCOM_BUILD=RSA_ENABLED -DRSA_FAST_INVERSE=RSA_ENABLED \ + -DRSA_STD_MEM_FUNCS=RSA_ENABLED -DRSA_STD_ALLOC_FUNCS=RSA_ENABLED \ else -ECC_SRCDIR = -ECC_INCDIR = -ECC_SRCS = -ECC_DEFS = +ECC_SRCDIR = +ECC_INCDIR = +ECC_SRCS = +ECC_DEFS = endif -SRCDIR += ../acsign $(ECC_SRCDIR) -INCDIR += ../acsign/include $(ECC_INCDIR) $(ECC_SRCDIR) +SRCDIR += ../acsign $(ECC_SRCDIR) +INCDIR += ../acsign/include $(ECC_INCDIR) $(ECC_SRCDIR) include $(TWLFIRM_ROOT)/build/buildtools/commondefs -TARGETS = makegcdfirm.exe +TARGETS = makegcdfirm.exe -SOURCES_C = makegcdfirm.c \ - out_gcdfirm.c \ - misc.c \ - path.c \ - defval.c \ - compress.c \ - wram_regs.c \ - acsign.c \ - acsign_gcd.c \ - aes2.c \ - $(ECC_SRCS) +SOURCES_C = makegcdfirm.c \ + out_gcdfirm.c \ + misc.c \ + path.c \ + defval.c \ + compress.c \ + wram_regs.c \ + acsign.c \ + acsign_gcd.c \ + aes2.c \ + $(ECC_SRCS) -SOURCES = $(SORUCES_C) +SOURCES = $(SORUCES_C) -OBJECTS = $(SOURCES_C:.c=.o) +OBJECTS = $(SOURCES_C:.c=.o) -HEADERS = format_nlist.h \ - makegcdfirm.h \ - path.h \ - format_rom.h \ - misc.h \ - defval.h \ - compress.h \ +HEADERS = format_nlist.h \ + makegcdfirm.h \ + path.h \ + format_rom.h \ + misc.h \ + defval.h \ + compress.h \ -MACROS += -DSMALL_CODE_SIZE \ - -DSTANDALONE \ - -DOPT_32_BIT \ - -DNO_SPLIT \ - -DNO_FP_API \ - -DNO_R_DIAG \ - $(ECC_DEFS) +MACROS += -DSMALL_CODE_SIZE \ + -DSTANDALONE \ + -DOPT_32_BIT \ + -DNO_SPLIT \ + -DNO_FP_API \ + -DNO_R_DIAG \ + $(ECC_DEFS) -INSTALL_DIR = $(FIRM_INSTALL_TOOLSDIR)/bin -INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(FIRM_INSTALL_TOOLSDIR)/bin +INSTALL_TARGETS = $(TARGETS) -LDIRT_CLEAN = $(OBJECTS) $(TARGETS) version.h +LDIRT_CLEAN = $(OBJECTS) $(TARGETS) version.h -VPATH = $(SRCDIR) -NITRO_INCDIR := $(FIRM_INCDIR) -I$(TWL_INCDIR) -I$(NITRO_INCDIR) $(addprefix -I,$(INCDIR)) +VPATH = $(SRCDIR) +TWL_INCDIR := $(TWL_INCDIR) $(addprefix -I,$(INCDIR)) $(addprefix -I,$(FIRM_INCDIR)) -include $(TWL_NITROSDK_ROOT)/build/buildtools/modulerules.x86 +include $(TWLSDK_ROOT)/build/buildtools/twl/modulerules.x86 #---------------------------------------------------------------------------- # build diff --git a/build/tools/makegcdfirm/compress.c b/build/tools/makegcdfirm/compress.c index 023e49f4..6b7fd76b 100644 --- a/build/tools/makegcdfirm/compress.c +++ b/build/tools/makegcdfirm/compress.c @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #include #include // atoi() diff --git a/build/tools/makegcdfirm/compress.h b/build/tools/makegcdfirm/compress.h index fcdb3ac0..6b655946 100644 --- a/build/tools/makegcdfirm/compress.h +++ b/build/tools/makegcdfirm/compress.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef COMPRESS_H_ #define COMPRESS_H_ diff --git a/build/tools/makegcdfirm/format_nlist.h b/build/tools/makegcdfirm/format_nlist.h index 87db583a..2cedc0a3 100644 --- a/build/tools/makegcdfirm/format_nlist.h +++ b/build/tools/makegcdfirm/format_nlist.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FORMAT_NLIST_H_ #define FORMAT_NLIST_H_ diff --git a/build/tools/makegcdfirm/format_rom.h b/build/tools/makegcdfirm/format_rom.h index ca2dfd18..f0230e11 100644 --- a/build/tools/makegcdfirm/format_rom.h +++ b/build/tools/makegcdfirm/format_rom.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FORMAT_ROM_H_ #define FORMAT_ROM_H_ diff --git a/build/tools/makegcdfirm/format_sign.h b/build/tools/makegcdfirm/format_sign.h index e5cc43df..686ba207 100644 --- a/build/tools/makegcdfirm/format_sign.h +++ b/build/tools/makegcdfirm/format_sign.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_MAKENORFIRM_ACSIGN_FORMAT_H_ #define FIRM_MAKENORFIRM_ACSIGN_FORMAT_H_ diff --git a/build/tools/makegcdfirm/makegcdfirm.c b/build/tools/makegcdfirm/makegcdfirm.c index 5d7c2abd..23b15998 100644 --- a/build/tools/makegcdfirm/makegcdfirm.c +++ b/build/tools/makegcdfirm/makegcdfirm.c @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #include #include diff --git a/build/tools/makegcdfirm/makegcdfirm.h b/build/tools/makegcdfirm/makegcdfirm.h index 6120c48f..0cdab5cb 100644 --- a/build/tools/makegcdfirm/makegcdfirm.h +++ b/build/tools/makegcdfirm/makegcdfirm.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef MAKEGCDFIRM_H_ #define MAKEGCDFIRM_H_ diff --git a/build/tools/makegcdfirm/misc.c b/build/tools/makegcdfirm/misc.c index e11bd855..798ac060 100644 --- a/build/tools/makegcdfirm/misc.c +++ b/build/tools/makegcdfirm/misc.c @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #include #include // calloc() diff --git a/build/tools/makegcdfirm/misc.h b/build/tools/makegcdfirm/misc.h index 5c2bf179..2b3d87e2 100644 --- a/build/tools/makegcdfirm/misc.h +++ b/build/tools/makegcdfirm/misc.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef MISC_H_ #define MISC_H_ @@ -32,6 +33,8 @@ typedef signed char s8; typedef signed short int s16; typedef signed long int s32; typedef signed long long s64; +typedef volatile u32 vu32; +typedef vu32 REGType32v; #define error(...) do { fprintf(stderr, "Error: "); \ fprintf(stderr, __VA_ARGS__); \ diff --git a/build/tools/makegcdfirm/out_gcdfirm.c b/build/tools/makegcdfirm/out_gcdfirm.c index eddf95eb..73a33bc2 100644 --- a/build/tools/makegcdfirm/out_gcdfirm.c +++ b/build/tools/makegcdfirm/out_gcdfirm.c @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #include #include // atoi() @@ -33,7 +34,6 @@ #include "compress.h" #define SDK_ASM -#include #include #include "../acsign/aes2.h" diff --git a/build/tools/makegcdfirm/test/test.gcdsf b/build/tools/makegcdfirm/test/test.gcdsf index 788e8e87..88d50675 100644 --- a/build/tools/makegcdfirm/test/test.gcdsf +++ b/build/tools/makegcdfirm/test/test.gcdsf @@ -18,8 +18,5 @@ ARM9_X2 : TRUE # TRUE or FALSE NML_OFS : 0x80000 TWL_OFS : 0x100000 -NORFIRM : ./norfirm_print.nor -NANDFIRM : ./nandfirm_print.nand - ERROR : ARM7_HASH # SIGN, HEADER_HASH, ARM9_HASH, ARM7_HASH, HASH_TABLE_HASH or FINAL_HASH ERROR : HEADER_FOOTER # for debug diff --git a/build/tools/makegcdfirm/test/wram_rbin/Makefile b/build/tools/makegcdfirm/test/wram_rbin/Makefile index 310ef0c2..e1c3309d 100644 --- a/build/tools/makegcdfirm/test/wram_rbin/Makefile +++ b/build/tools/makegcdfirm/test/wram_rbin/Makefile @@ -11,8 +11,9 @@ # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # -# $Log: $ -# $NoKeywords: $ +# $Date:: $ +# $Rev:$ +# $Author:$ #---------------------------------------------------------------------------- SUBDIRS = diff --git a/build/tools/makegcdfirm/test/wram_rbin/wram_regs.c b/build/tools/makegcdfirm/test/wram_rbin/wram_regs.c index ade0c709..80ddd9ff 100644 --- a/build/tools/makegcdfirm/test/wram_rbin/wram_regs.c +++ b/build/tools/makegcdfirm/test/wram_rbin/wram_regs.c @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #include #include diff --git a/build/tools/makegcdfirm/wram_regs.c b/build/tools/makegcdfirm/wram_regs.c index 9472c5e8..4cfa0e5b 100644 --- a/build/tools/makegcdfirm/wram_regs.c +++ b/build/tools/makegcdfirm/wram_regs.c @@ -10,70 +10,86 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #include "format_rom.h" -#define SDK_ASM -#include +//#define SDK_ASM +#define NITRO_TYPES_H_ +#include +#include #include +// define macro ------------------------------------------- +#define MI_WRAM_MAP_NULL HW_WRAM_AREA + +#define REG_WRAM_MAP_CONV_ADDR( regno, abc, border, addr ) \ +( \ + ((((addr) - HW_WRAM_AREA) / MI_WRAM_##abc##_SLOT_SIZE) & \ + (REG_MI_MBK##regno##_W##abc##_##border##_MASK >> \ + REG_MI_MBK##regno##_W##abc##_##border##_SHIFT)) \ +) + + +// global variables---------------------------------------- MIHeader_WramRegs wram_regs_init = { // ARM9 { - REG_WRAM_A_BNK_PACK(0, MI_WRAM_A_ARM7, MI_WRAM_A_OFS_0KB, TRUE), - REG_WRAM_A_BNK_PACK(1, MI_WRAM_A_ARM7, MI_WRAM_A_OFS_64KB, TRUE), - REG_WRAM_A_BNK_PACK(2, MI_WRAM_A_ARM7, MI_WRAM_A_OFS_128KB, TRUE), - REG_WRAM_A_BNK_PACK(3, MI_WRAM_A_ARM7, MI_WRAM_A_OFS_192KB, TRUE), + REG_MI_MBK_A0_FIELD( 1, MI_WRAM_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_A1_FIELD( 1, MI_WRAM_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_A2_FIELD( 1, MI_WRAM_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_A3_FIELD( 1, MI_WRAM_OFFSET_192KB, MI_WRAM_ARM7 ), }, { - REG_WRAM_B_BNK_PACK(0, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_0KB, TRUE), - REG_WRAM_B_BNK_PACK(1, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_32KB, TRUE), - REG_WRAM_B_BNK_PACK(2, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_64KB, TRUE), - REG_WRAM_B_BNK_PACK(3, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_96KB, TRUE), - REG_WRAM_B_BNK_PACK(4, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_128KB, TRUE), - REG_WRAM_B_BNK_PACK(5, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_160KB, TRUE), - REG_WRAM_B_BNK_PACK(6, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_192KB, TRUE), - REG_WRAM_B_BNK_PACK(7, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_224KB, TRUE), + REG_MI_MBK_B0_FIELD( 1, MI_WRAM_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B1_FIELD( 1, MI_WRAM_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B2_FIELD( 1, MI_WRAM_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B3_FIELD( 1, MI_WRAM_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B4_FIELD( 1, MI_WRAM_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B5_FIELD( 1, MI_WRAM_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B6_FIELD( 1, MI_WRAM_OFFSET_192KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B7_FIELD( 1, MI_WRAM_OFFSET_224KB, MI_WRAM_ARM7 ), }, { - REG_WRAM_C_BNK_PACK(0, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_0KB, TRUE), - REG_WRAM_C_BNK_PACK(1, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_32KB, TRUE), - REG_WRAM_C_BNK_PACK(2, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_64KB, TRUE), - REG_WRAM_C_BNK_PACK(3, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_96KB, TRUE), - REG_WRAM_C_BNK_PACK(4, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_128KB, TRUE), - REG_WRAM_C_BNK_PACK(5, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_160KB, TRUE), - REG_WRAM_C_BNK_PACK(6, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_192KB, TRUE), - REG_WRAM_C_BNK_PACK(7, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_224KB, TRUE), + REG_MI_MBK_C0_FIELD( 1, MI_WRAM_OFFSET_0KB , MI_WRAM_ARM9 ), + REG_MI_MBK_C1_FIELD( 1, MI_WRAM_OFFSET_32KB , MI_WRAM_ARM9 ), + REG_MI_MBK_C2_FIELD( 1, MI_WRAM_OFFSET_64KB , MI_WRAM_ARM9 ), + REG_MI_MBK_C3_FIELD( 1, MI_WRAM_OFFSET_96KB , MI_WRAM_ARM9 ), + REG_MI_MBK_C4_FIELD( 1, MI_WRAM_OFFSET_128KB, MI_WRAM_ARM9 ), + REG_MI_MBK_C5_FIELD( 1, MI_WRAM_OFFSET_160KB, MI_WRAM_ARM9 ), + REG_MI_MBK_C6_FIELD( 1, MI_WRAM_OFFSET_192KB, MI_WRAM_ARM9 ), + REG_MI_MBK_C7_FIELD( 1, MI_WRAM_OFFSET_224KB, MI_WRAM_ARM9 ), }, - REG_WRAM_A_MAP_PACK(MI_WRAM_MAP_NULL, - MI_WRAM_MAP_NULL, - MI_WRAM_A_IMG_128KB - ), - REG_WRAM_B_MAP_PACK(MI_WRAM_MAP_NULL, - MI_WRAM_MAP_NULL, - MI_WRAM_B_IMG_128KB - ), - REG_WRAM_C_MAP_PACK(HW_WRAM_AREA_HALF, - HW_WRAM_AREA_HALF + 0x00020000, - MI_WRAM_C_IMG_128KB - ), + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_128KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, MI_WRAM_MAP_NULL ) + ), + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_128KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, MI_WRAM_MAP_NULL ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, HW_WRAM_AREA_HALF + 0x00020000 ), + MI_WRAM_IMAGE_128KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, HW_WRAM_AREA_HALF ) + ), // ARM7 - REG_WRAM_A_MAP_PACK(HW_WRAM_AREA_HALF, - HW_WRAM_AREA_HALF + 0x00020000, - MI_WRAM_A_IMG_128KB - ), - REG_WRAM_B_MAP_PACK(HW_WRAM_AREA_HALF + 0x00020000, - HW_WRAM_AREA_HALF + 0x00040000, - MI_WRAM_B_IMG_128KB - ), - REG_WRAM_C_MAP_PACK(MI_WRAM_MAP_NULL, - MI_WRAM_MAP_NULL, - MI_WRAM_C_IMG_128KB - ), - // WRAM Lock + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, HW_WRAM_AREA_HALF + 0x00020000 ), + MI_WRAM_IMAGE_128KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, HW_WRAM_AREA_HALF ) + ), + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA_HALF + 0x00040000 ), + MI_WRAM_IMAGE_128KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA_HALF + 0x00020000 ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_128KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, MI_WRAM_MAP_NULL ) + ), + + // WRAM Lock { 0, 0, diff --git a/build/tools/makenandfirm/Makefile b/build/tools/makenandfirm/Makefile index 2e8c7b9c..aac06d5f 100644 --- a/build/tools/makenandfirm/Makefile +++ b/build/tools/makenandfirm/Makefile @@ -15,87 +15,89 @@ # $NoKeywords: $ #--------------------------------------------------------------------------- -SUPPORT_ECC = 0 +TARGET_PLATFORM = TWL + +SUPPORT_ECC = 0 ifeq ($(SUPPORT_ECC),1) -ECC_SRCDIR = ../../libraries/acsign_ecc/common \ - ../../libraries/acsign_ecc/common/algae/common/ecc \ - ../../libraries/acsign_ecc/common/algae/cmp \ - ../../libraries/acsign_ecc/common/algae/ecsource \ +ECC_SRCDIR = ../../libraries/acsign_ecc/common \ + ../../libraries/acsign_ecc/common/algae/common/ecc \ + ../../libraries/acsign_ecc/common/algae/cmp \ + ../../libraries/acsign_ecc/common/algae/ecsource \ -ECC_INCDIR = ../../libraries/acsign_ecc/include \ - ../../libraries/acsign_ecc/common/algae/include \ - ../../libraries/acsign_ecc/common/algae/common/include \ +ECC_INCDIR = ../../libraries/acsign_ecc/include \ + ../../libraries/acsign_ecc/common/algae/include \ + ../../libraries/acsign_ecc/common/algae/common/include \ -ECC_SRCS = acsign_ecc.c acsign_cryptoc.c \ - \ - cmparith.c cmpbits.c cmpcnv.c cmpdiv.c cmpmem.c \ - cmpmod.c cmpmuldv.c cmpspprt.c cmpsqr.c cmpvectr.c \ - computem.c ecfpatbl.c ecfpsmul.c \ - spcprime.c secfpcom.c \ - \ - p224v1.c p224v1a.c \ +ECC_SRCS = acsign_ecc.c acsign_cryptoc.c \ + \ + cmparith.c cmpbits.c cmpcnv.c cmpdiv.c cmpmem.c \ + cmpmod.c cmpmuldv.c cmpspprt.c cmpsqr.c cmpvectr.c \ + computem.c ecfpatbl.c ecfpsmul.c \ + spcprime.c secfpcom.c \ + \ + p224v1.c p224v1a.c \ -ECC_DEFS = -DRSA_PROTOTYPES=RSA_ENABLED \ - -DRCOM_BUILD=RSA_ENABLED -DRSA_FAST_INVERSE=RSA_ENABLED \ - -DRSA_STD_MEM_FUNCS=RSA_ENABLED -DRSA_STD_ALLOC_FUNCS=RSA_ENABLED \ +ECC_DEFS = -DRSA_PROTOTYPES=RSA_ENABLED \ + -DRCOM_BUILD=RSA_ENABLED -DRSA_FAST_INVERSE=RSA_ENABLED \ + -DRSA_STD_MEM_FUNCS=RSA_ENABLED -DRSA_STD_ALLOC_FUNCS=RSA_ENABLED \ else -ECC_SRCDIR = -ECC_INCDIR = -ECC_SRCS = -ECC_DEFS = +ECC_SRCDIR = +ECC_INCDIR = +ECC_SRCS = +ECC_DEFS = endif -SRCDIR += ../acsign $(ECC_SRCDIR) -INCDIR += ../acsign/include $(ECC_INCDIR) $(ECC_SRCDIR) +SRCDIR += ../acsign $(ECC_SRCDIR) +INCDIR += ../acsign/include $(ECC_INCDIR) $(ECC_SRCDIR) include $(TWLFIRM_ROOT)/build/buildtools/commondefs -TARGETS = makenandfirm.exe +TARGETS = makenandfirm.exe -SOURCES_C = makenandfirm.c \ - out_nandfirm.c \ - misc.c \ - path.c \ - defval.c \ - compress.c \ - wram_regs.c \ - acsign.c \ - acsign_nand.c \ - aes2.c \ - $(ECC_SRCS) +SOURCES_C = makenandfirm.c \ + out_nandfirm.c \ + misc.c \ + path.c \ + defval.c \ + compress.c \ + wram_regs.c \ + acsign.c \ + acsign_nand.c \ + aes2.c \ + $(ECC_SRCS) -SOURCES = $(SORUCES_C) +SOURCES = $(SORUCES_C) -OBJECTS = $(SOURCES_C:.c=.o) +OBJECTS = $(SOURCES_C:.c=.o) -HEADERS = format_nlist.h \ - makenandfirm.h \ - path.h \ - format_rom.h \ - misc.h \ - defval.h \ - compress.h \ +HEADERS = format_nlist.h \ + makenandfirm.h \ + path.h \ + format_rom.h \ + misc.h \ + defval.h \ + compress.h \ -MACROS += -DSMALL_CODE_SIZE \ - -DSTANDALONE \ - -DOPT_32_BIT \ - -DNO_SPLIT \ - -DNO_FP_API \ - -DNO_R_DIAG \ - $(ECC_DEFS) +MACROS += -DSMALL_CODE_SIZE \ + -DSTANDALONE \ + -DOPT_32_BIT \ + -DNO_SPLIT \ + -DNO_FP_API \ + -DNO_R_DIAG \ + $(ECC_DEFS) -INSTALL_DIR = $(FIRM_INSTALL_TOOLSDIR)/bin -INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(FIRM_INSTALL_TOOLSDIR)/bin +INSTALL_TARGETS = $(TARGETS) -LDIRT_CLEAN = $(OBJECTS) $(TARGETS) version.h +LDIRT_CLEAN = $(OBJECTS) $(TARGETS) version.h -VPATH = $(SRCDIR) -NITRO_INCDIR := $(FIRM_INCDIR) -I$(TWL_INCDIR) -I$(NITRO_INCDIR) $(addprefix -I,$(INCDIR)) +VPATH = $(SRCDIR) +TWL_INCDIR := $(TWL_INCDIR) $(addprefix -I,$(INCDIR)) $(addprefix -I,$(FIRM_INCDIR)) -include $(TWL_NITROSDK_ROOT)/build/buildtools/modulerules.x86 +include $(TWLSDK_ROOT)/build/buildtools/twl/modulerules.x86 #---------------------------------------------------------------------------- # build diff --git a/build/tools/makenandfirm/compress.c b/build/tools/makenandfirm/compress.c index acc7fdd2..08b46a8d 100644 --- a/build/tools/makenandfirm/compress.c +++ b/build/tools/makenandfirm/compress.c @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #include #include // atoi() diff --git a/build/tools/makenandfirm/compress.h b/build/tools/makenandfirm/compress.h index d8aa290a..3d851578 100644 --- a/build/tools/makenandfirm/compress.h +++ b/build/tools/makenandfirm/compress.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef COMPRESS_H_ #define COMPRESS_H_ diff --git a/build/tools/makenandfirm/format_nlist.h b/build/tools/makenandfirm/format_nlist.h index e832edc0..6e0c28e2 100644 --- a/build/tools/makenandfirm/format_nlist.h +++ b/build/tools/makenandfirm/format_nlist.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FORMAT_NLIST_H_ #define FORMAT_NLIST_H_ diff --git a/build/tools/makenandfirm/format_rom.h b/build/tools/makenandfirm/format_rom.h index 43decb01..ee6972df 100644 --- a/build/tools/makenandfirm/format_rom.h +++ b/build/tools/makenandfirm/format_rom.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FORMAT_ROM_H_ #define FORMAT_ROM_H_ diff --git a/build/tools/makenandfirm/format_sign.h b/build/tools/makenandfirm/format_sign.h index a965863b..95e49129 100644 --- a/build/tools/makenandfirm/format_sign.h +++ b/build/tools/makenandfirm/format_sign.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_MAKENANDFIRM_ACSIGN_FORMAT_H_ #define FIRM_MAKENANDFIRM_ACSIGN_FORMAT_H_ diff --git a/build/tools/makenandfirm/makenandfirm.c b/build/tools/makenandfirm/makenandfirm.c index 48d08797..c5859039 100644 --- a/build/tools/makenandfirm/makenandfirm.c +++ b/build/tools/makenandfirm/makenandfirm.c @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #include #include diff --git a/build/tools/makenandfirm/makenandfirm.h b/build/tools/makenandfirm/makenandfirm.h index 69abe085..feacd303 100644 --- a/build/tools/makenandfirm/makenandfirm.h +++ b/build/tools/makenandfirm/makenandfirm.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef MAKENANDFIRM_H_ #define MAKENANDFIRM_H_ diff --git a/build/tools/makenandfirm/misc.c b/build/tools/makenandfirm/misc.c index 56f06bf6..97237633 100644 --- a/build/tools/makenandfirm/misc.c +++ b/build/tools/makenandfirm/misc.c @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #include #include // calloc() diff --git a/build/tools/makenandfirm/misc.h b/build/tools/makenandfirm/misc.h index e1367e81..423c9ce3 100644 --- a/build/tools/makenandfirm/misc.h +++ b/build/tools/makenandfirm/misc.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef MISC_H_ #define MISC_H_ @@ -32,6 +33,8 @@ typedef signed char s8; typedef signed short int s16; typedef signed long int s32; typedef signed long long s64; +typedef volatile u32 vu32; +typedef vu32 REGType32v; #define error(...) do { fprintf(stderr, "Error: "); \ fprintf(stderr, __VA_ARGS__); \ diff --git a/build/tools/makenandfirm/out_nandfirm.c b/build/tools/makenandfirm/out_nandfirm.c index 0cdfa4da..573abf5e 100644 --- a/build/tools/makenandfirm/out_nandfirm.c +++ b/build/tools/makenandfirm/out_nandfirm.c @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #include #include // atoi() @@ -33,7 +34,6 @@ #include "compress.h" #define SDK_ASM -#include #include #include "../acsign/aes2.h" diff --git a/build/tools/makenandfirm/test/wram_rbin/Makefile b/build/tools/makenandfirm/test/wram_rbin/Makefile index 562d9811..8be8394d 100644 --- a/build/tools/makenandfirm/test/wram_rbin/Makefile +++ b/build/tools/makenandfirm/test/wram_rbin/Makefile @@ -11,8 +11,9 @@ # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # -# $Log: $ -# $NoKeywords: $ +# $Date:: $ +# $Rev:$ +# $Author:$ #---------------------------------------------------------------------------- SUBDIRS = diff --git a/build/tools/makenandfirm/test/wram_rbin/wram_regs.c b/build/tools/makenandfirm/test/wram_rbin/wram_regs.c index 5d0c9b18..a99d0eb6 100644 --- a/build/tools/makenandfirm/test/wram_rbin/wram_regs.c +++ b/build/tools/makenandfirm/test/wram_rbin/wram_regs.c @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #include #include diff --git a/build/tools/makenandfirm/wram_regs.c b/build/tools/makenandfirm/wram_regs.c index 1350f138..ec2d5ec8 100644 --- a/build/tools/makenandfirm/wram_regs.c +++ b/build/tools/makenandfirm/wram_regs.c @@ -10,70 +10,86 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #include "format_rom.h" -#define SDK_ASM -#include +//#define SDK_ASM +#define NITRO_TYPES_H_ +#include +#include #include +// define macro ------------------------------------------- +#define MI_WRAM_MAP_NULL HW_WRAM_AREA + +#define REG_WRAM_MAP_CONV_ADDR( regno, abc, border, addr ) \ +( \ + ((((addr) - HW_WRAM_AREA) / MI_WRAM_##abc##_SLOT_SIZE) & \ + (REG_MI_MBK##regno##_W##abc##_##border##_MASK >> \ + REG_MI_MBK##regno##_W##abc##_##border##_SHIFT)) \ +) + + +// global variables---------------------------------------- MIHeader_WramRegs wram_regs_init = { // ARM9 { - REG_WRAM_A_BNK_PACK(0, MI_WRAM_A_ARM7, MI_WRAM_A_OFS_0KB, TRUE), - REG_WRAM_A_BNK_PACK(1, MI_WRAM_A_ARM7, MI_WRAM_A_OFS_64KB, TRUE), - REG_WRAM_A_BNK_PACK(2, MI_WRAM_A_ARM7, MI_WRAM_A_OFS_128KB, TRUE), - REG_WRAM_A_BNK_PACK(3, MI_WRAM_A_ARM7, MI_WRAM_A_OFS_192KB, TRUE), + REG_MI_MBK_A0_FIELD( 1, MI_WRAM_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_A1_FIELD( 1, MI_WRAM_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_A2_FIELD( 1, MI_WRAM_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_A3_FIELD( 1, MI_WRAM_OFFSET_192KB, MI_WRAM_ARM7 ), }, { - REG_WRAM_B_BNK_PACK(0, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_0KB, TRUE), - REG_WRAM_B_BNK_PACK(1, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_32KB, TRUE), - REG_WRAM_B_BNK_PACK(2, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_64KB, TRUE), - REG_WRAM_B_BNK_PACK(3, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_96KB, TRUE), - REG_WRAM_B_BNK_PACK(4, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_128KB, TRUE), - REG_WRAM_B_BNK_PACK(5, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_160KB, TRUE), - REG_WRAM_B_BNK_PACK(6, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_192KB, TRUE), - REG_WRAM_B_BNK_PACK(7, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_224KB, TRUE), + REG_MI_MBK_B0_FIELD( 1, MI_WRAM_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B1_FIELD( 1, MI_WRAM_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B2_FIELD( 1, MI_WRAM_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B3_FIELD( 1, MI_WRAM_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B4_FIELD( 1, MI_WRAM_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B5_FIELD( 1, MI_WRAM_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B6_FIELD( 1, MI_WRAM_OFFSET_192KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B7_FIELD( 1, MI_WRAM_OFFSET_224KB, MI_WRAM_ARM7 ), }, { - REG_WRAM_C_BNK_PACK(0, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_0KB, TRUE), - REG_WRAM_C_BNK_PACK(1, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_32KB, TRUE), - REG_WRAM_C_BNK_PACK(2, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_64KB, TRUE), - REG_WRAM_C_BNK_PACK(3, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_96KB, TRUE), - REG_WRAM_C_BNK_PACK(4, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_128KB, TRUE), - REG_WRAM_C_BNK_PACK(5, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_160KB, TRUE), - REG_WRAM_C_BNK_PACK(6, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_192KB, TRUE), - REG_WRAM_C_BNK_PACK(7, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_224KB, TRUE), + REG_MI_MBK_C0_FIELD( 1, MI_WRAM_OFFSET_0KB , MI_WRAM_ARM9 ), + REG_MI_MBK_C1_FIELD( 1, MI_WRAM_OFFSET_32KB , MI_WRAM_ARM9 ), + REG_MI_MBK_C2_FIELD( 1, MI_WRAM_OFFSET_64KB , MI_WRAM_ARM9 ), + REG_MI_MBK_C3_FIELD( 1, MI_WRAM_OFFSET_96KB , MI_WRAM_ARM9 ), + REG_MI_MBK_C4_FIELD( 1, MI_WRAM_OFFSET_128KB, MI_WRAM_ARM9 ), + REG_MI_MBK_C5_FIELD( 1, MI_WRAM_OFFSET_160KB, MI_WRAM_ARM9 ), + REG_MI_MBK_C6_FIELD( 1, MI_WRAM_OFFSET_192KB, MI_WRAM_ARM9 ), + REG_MI_MBK_C7_FIELD( 1, MI_WRAM_OFFSET_224KB, MI_WRAM_ARM9 ), }, - REG_WRAM_A_MAP_PACK(MI_WRAM_MAP_NULL, - MI_WRAM_MAP_NULL, - MI_WRAM_A_IMG_128KB - ), - REG_WRAM_B_MAP_PACK(MI_WRAM_MAP_NULL, - MI_WRAM_MAP_NULL, - MI_WRAM_B_IMG_128KB - ), - REG_WRAM_C_MAP_PACK(HW_WRAM_AREA_HALF, - HW_WRAM_AREA_HALF + 0x00020000, - MI_WRAM_C_IMG_128KB - ), + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_128KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, MI_WRAM_MAP_NULL ) + ), + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_128KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, MI_WRAM_MAP_NULL ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, HW_WRAM_AREA_HALF + 0x00020000 ), + MI_WRAM_IMAGE_128KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, HW_WRAM_AREA_HALF ) + ), // ARM7 - REG_WRAM_A_MAP_PACK(HW_WRAM_AREA_HALF, - HW_WRAM_AREA_HALF + 0x00020000, - MI_WRAM_A_IMG_128KB - ), - REG_WRAM_B_MAP_PACK(HW_WRAM_AREA_HALF + 0x00020000, - HW_WRAM_AREA_HALF + 0x00040000, - MI_WRAM_B_IMG_128KB - ), - REG_WRAM_C_MAP_PACK(MI_WRAM_MAP_NULL, - MI_WRAM_MAP_NULL, - MI_WRAM_C_IMG_128KB - ), - // WRAM Lock + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, HW_WRAM_AREA_HALF + 0x00020000 ), + MI_WRAM_IMAGE_128KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, HW_WRAM_AREA_HALF ) + ), + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA_HALF + 0x00040000 ), + MI_WRAM_IMAGE_128KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA_HALF + 0x00020000 ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_128KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, MI_WRAM_MAP_NULL ) + ), + + // WRAM Lock { 0, 0, diff --git a/build/tools/makenorfirm/Makefile b/build/tools/makenorfirm/Makefile index 990fb2ac..fb342e4b 100644 --- a/build/tools/makenorfirm/Makefile +++ b/build/tools/makenorfirm/Makefile @@ -15,87 +15,89 @@ # $NoKeywords: $ #--------------------------------------------------------------------------- -SUPPORT_ECC = 0 +TARGET_PLATFORM = TWL + +SUPPORT_ECC = 0 ifeq ($(SUPPORT_ECC),1) -ECC_SRCDIR = ../../libraries/acsign_ecc/common \ - ../../libraries/acsign_ecc/common/algae/common/ecc \ - ../../libraries/acsign_ecc/common/algae/cmp \ - ../../libraries/acsign_ecc/common/algae/ecsource \ +ECC_SRCDIR = ../../libraries/acsign_ecc/common \ + ../../libraries/acsign_ecc/common/algae/common/ecc \ + ../../libraries/acsign_ecc/common/algae/cmp \ + ../../libraries/acsign_ecc/common/algae/ecsource \ -ECC_INCDIR = ../../libraries/acsign_ecc/include \ - ../../libraries/acsign_ecc/common/algae/include \ - ../../libraries/acsign_ecc/common/algae/common/include \ +ECC_INCDIR = ../../libraries/acsign_ecc/include \ + ../../libraries/acsign_ecc/common/algae/include \ + ../../libraries/acsign_ecc/common/algae/common/include \ -ECC_SRCS = acsign_ecc.c acsign_cryptoc.c \ - \ - cmparith.c cmpbits.c cmpcnv.c cmpdiv.c cmpmem.c \ - cmpmod.c cmpmuldv.c cmpspprt.c cmpsqr.c cmpvectr.c \ - computem.c ecfpatbl.c ecfpsmul.c \ - spcprime.c secfpcom.c \ - \ - p224v1.c p224v1a.c \ +ECC_SRCS = acsign_ecc.c acsign_cryptoc.c \ + \ + cmparith.c cmpbits.c cmpcnv.c cmpdiv.c cmpmem.c \ + cmpmod.c cmpmuldv.c cmpspprt.c cmpsqr.c cmpvectr.c \ + computem.c ecfpatbl.c ecfpsmul.c \ + spcprime.c secfpcom.c \ + \ + p224v1.c p224v1a.c \ -ECC_DEFS = -DRSA_PROTOTYPES=RSA_ENABLED \ - -DRCOM_BUILD=RSA_ENABLED -DRSA_FAST_INVERSE=RSA_ENABLED \ - -DRSA_STD_MEM_FUNCS=RSA_ENABLED -DRSA_STD_ALLOC_FUNCS=RSA_ENABLED \ +ECC_DEFS = -DRSA_PROTOTYPES=RSA_ENABLED \ + -DRCOM_BUILD=RSA_ENABLED -DRSA_FAST_INVERSE=RSA_ENABLED \ + -DRSA_STD_MEM_FUNCS=RSA_ENABLED -DRSA_STD_ALLOC_FUNCS=RSA_ENABLED \ else -ECC_SRCDIR = -ECC_INCDIR = -ECC_SRCS = -ECC_DEFS = +ECC_SRCDIR = +ECC_INCDIR = +ECC_SRCS = +ECC_DEFS = endif -SRCDIR += ../acsign $(ECC_SRCDIR) -INCDIR += ../acsign/include $(ECC_INCDIR) $(ECC_SRCDIR) +SRCDIR += ../acsign $(ECC_SRCDIR) +INCDIR += ../acsign/include $(ECC_INCDIR) $(ECC_SRCDIR) include $(TWLFIRM_ROOT)/build/buildtools/commondefs -TARGETS = makenorfirm.exe +TARGETS = makenorfirm.exe -SOURCES_C = makenorfirm.c \ - out_norfirm.c \ - misc.c \ - path.c \ - defval.c \ - compress.c \ - wram_regs.c \ - acsign.c \ - acsign_nor.c \ - aes2.c \ - $(ECC_SRCS) +SOURCES_C = makenorfirm.c \ + out_norfirm.c \ + misc.c \ + path.c \ + defval.c \ + compress.c \ + wram_regs.c \ + acsign.c \ + acsign_nor.c \ + aes2.c \ + $(ECC_SRCS) -SOURCES = $(SORUCES_C) +SOURCES = $(SORUCES_C) -OBJECTS = $(SOURCES_C:.c=.o) +OBJECTS = $(SOURCES_C:.c=.o) -HEADERS = format_nlist.h \ - makenorfirm.h \ - path.h \ - format_rom.h \ - misc.h \ - defval.h \ - compress.h \ +HEADERS = format_nlist.h \ + makenorfirm.h \ + path.h \ + format_rom.h \ + misc.h \ + defval.h \ + compress.h \ -MACROS += -DSMALL_CODE_SIZE \ - -DSTANDALONE \ - -DOPT_32_BIT \ - -DNO_SPLIT \ - -DNO_FP_API \ - -DNO_R_DIAG \ - $(ECC_DEFS) +MACROS += -DSMALL_CODE_SIZE \ + -DSTANDALONE \ + -DOPT_32_BIT \ + -DNO_SPLIT \ + -DNO_FP_API \ + -DNO_R_DIAG \ + $(ECC_DEFS) -INSTALL_DIR = $(FIRM_INSTALL_TOOLSDIR)/bin -INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(FIRM_INSTALL_TOOLSDIR)/bin +INSTALL_TARGETS = $(TARGETS) -LDIRT_CLEAN = $(OBJECTS) $(TARGETS) version.h +LDIRT_CLEAN = $(OBJECTS) $(TARGETS) version.h -VPATH = $(SRCDIR) -NITRO_INCDIR := $(FIRM_INCDIR) -I$(TWL_INCDIR) -I$(NITRO_INCDIR) $(addprefix -I,$(INCDIR)) +VPATH = $(SRCDIR) +TWL_INCDIR := $(TWL_INCDIR) $(addprefix -I,$(INCDIR)) $(addprefix -I,$(FIRM_INCDIR)) -include $(TWL_NITROSDK_ROOT)/build/buildtools/modulerules.x86 +include $(TWLSDK_ROOT)/build/buildtools/twl/modulerules.x86 #---------------------------------------------------------------------------- # build diff --git a/build/tools/makenorfirm/compress.c b/build/tools/makenorfirm/compress.c index 903adf77..3316140c 100644 --- a/build/tools/makenorfirm/compress.c +++ b/build/tools/makenorfirm/compress.c @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #include #include // atoi() diff --git a/build/tools/makenorfirm/compress.h b/build/tools/makenorfirm/compress.h index fcdb3ac0..6b655946 100644 --- a/build/tools/makenorfirm/compress.h +++ b/build/tools/makenorfirm/compress.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef COMPRESS_H_ #define COMPRESS_H_ diff --git a/build/tools/makenorfirm/format_nlist.h b/build/tools/makenorfirm/format_nlist.h index 06c99d0e..e6290bee 100644 --- a/build/tools/makenorfirm/format_nlist.h +++ b/build/tools/makenorfirm/format_nlist.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FORMAT_NLIST_H_ #define FORMAT_NLIST_H_ diff --git a/build/tools/makenorfirm/format_rom.h b/build/tools/makenorfirm/format_rom.h index 13cea6b1..01a16883 100644 --- a/build/tools/makenorfirm/format_rom.h +++ b/build/tools/makenorfirm/format_rom.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FORMAT_ROM_H_ #define FORMAT_ROM_H_ diff --git a/build/tools/makenorfirm/format_sign.h b/build/tools/makenorfirm/format_sign.h index e5cc43df..686ba207 100644 --- a/build/tools/makenorfirm/format_sign.h +++ b/build/tools/makenorfirm/format_sign.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_MAKENORFIRM_ACSIGN_FORMAT_H_ #define FIRM_MAKENORFIRM_ACSIGN_FORMAT_H_ diff --git a/build/tools/makenorfirm/makenorfirm.c b/build/tools/makenorfirm/makenorfirm.c index 19a8cde0..66071c1f 100644 --- a/build/tools/makenorfirm/makenorfirm.c +++ b/build/tools/makenorfirm/makenorfirm.c @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #include #include diff --git a/build/tools/makenorfirm/makenorfirm.h b/build/tools/makenorfirm/makenorfirm.h index 79dc4fb7..6e239fcd 100644 --- a/build/tools/makenorfirm/makenorfirm.h +++ b/build/tools/makenorfirm/makenorfirm.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef MAKENORFIRM_H_ #define MAKENORFIRM_H_ diff --git a/build/tools/makenorfirm/misc.c b/build/tools/makenorfirm/misc.c index e11bd855..798ac060 100644 --- a/build/tools/makenorfirm/misc.c +++ b/build/tools/makenorfirm/misc.c @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #include #include // calloc() diff --git a/build/tools/makenorfirm/misc.h b/build/tools/makenorfirm/misc.h index ade571ed..6b36c8c0 100644 --- a/build/tools/makenorfirm/misc.h +++ b/build/tools/makenorfirm/misc.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef MISC_H_ #define MISC_H_ @@ -32,6 +33,8 @@ typedef signed char s8; typedef signed short int s16; typedef signed long int s32; typedef signed long long s64; +typedef volatile u32 vu32; +typedef vu32 REGType32v; #define error(...) do { fprintf(stderr, "Error: "); \ fprintf(stderr, __VA_ARGS__); \ diff --git a/build/tools/makenorfirm/out_norfirm.c b/build/tools/makenorfirm/out_norfirm.c index 42a287fa..cd48fa17 100644 --- a/build/tools/makenorfirm/out_norfirm.c +++ b/build/tools/makenorfirm/out_norfirm.c @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #include #include // atoi() @@ -33,7 +34,6 @@ #include "compress.h" #define SDK_ASM -#include #include #include "../acsign/aes2.h" diff --git a/build/tools/makenorfirm/test/wram_rbin/Makefile b/build/tools/makenorfirm/test/wram_rbin/Makefile index 2d5f2eac..7c687c34 100644 --- a/build/tools/makenorfirm/test/wram_rbin/Makefile +++ b/build/tools/makenorfirm/test/wram_rbin/Makefile @@ -11,8 +11,9 @@ # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # -# $Log: $ -# $NoKeywords: $ +# $Date:: $ +# $Rev:$ +# $Author:$ #---------------------------------------------------------------------------- SUBDIRS = diff --git a/build/tools/makenorfirm/test/wram_rbin/wram_regs.c b/build/tools/makenorfirm/test/wram_rbin/wram_regs.c index b87e8ba5..6d21595e 100644 --- a/build/tools/makenorfirm/test/wram_rbin/wram_regs.c +++ b/build/tools/makenorfirm/test/wram_rbin/wram_regs.c @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #include #include diff --git a/build/tools/makenorfirm/wram_regs.c b/build/tools/makenorfirm/wram_regs.c index b303c52e..abb43bf9 100644 --- a/build/tools/makenorfirm/wram_regs.c +++ b/build/tools/makenorfirm/wram_regs.c @@ -10,70 +10,86 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #include "format_rom.h" -#define SDK_ASM -#include +//#define SDK_ASM +#define NITRO_TYPES_H_ +#include +#include #include +// define macro ------------------------------------------- +#define MI_WRAM_MAP_NULL HW_WRAM_AREA + +#define REG_WRAM_MAP_CONV_ADDR( regno, abc, border, addr ) \ +( \ + ((((addr) - HW_WRAM_AREA) / MI_WRAM_##abc##_SLOT_SIZE) & \ + (REG_MI_MBK##regno##_W##abc##_##border##_MASK >> \ + REG_MI_MBK##regno##_W##abc##_##border##_SHIFT)) \ +) + + +// global variables---------------------------------------- MIHeader_WramRegs wram_regs_init = { // ARM9 { - REG_WRAM_A_BNK_PACK(0, MI_WRAM_A_ARM7, MI_WRAM_A_OFS_0KB, TRUE), - REG_WRAM_A_BNK_PACK(1, MI_WRAM_A_ARM7, MI_WRAM_A_OFS_64KB, TRUE), - REG_WRAM_A_BNK_PACK(2, MI_WRAM_A_ARM7, MI_WRAM_A_OFS_128KB, TRUE), - REG_WRAM_A_BNK_PACK(3, MI_WRAM_A_ARM7, MI_WRAM_A_OFS_192KB, TRUE), + REG_MI_MBK_A0_FIELD( 1, MI_WRAM_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_A1_FIELD( 1, MI_WRAM_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_A2_FIELD( 1, MI_WRAM_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_A3_FIELD( 1, MI_WRAM_OFFSET_192KB, MI_WRAM_ARM7 ), }, { - REG_WRAM_B_BNK_PACK(0, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_0KB, TRUE), - REG_WRAM_B_BNK_PACK(1, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_32KB, TRUE), - REG_WRAM_B_BNK_PACK(2, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_64KB, TRUE), - REG_WRAM_B_BNK_PACK(3, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_96KB, TRUE), - REG_WRAM_B_BNK_PACK(4, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_128KB, TRUE), - REG_WRAM_B_BNK_PACK(5, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_160KB, TRUE), - REG_WRAM_B_BNK_PACK(6, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_192KB, TRUE), - REG_WRAM_B_BNK_PACK(7, MI_WRAM_B_ARM7, MI_WRAM_B_OFS_224KB, TRUE), + REG_MI_MBK_B0_FIELD( 1, MI_WRAM_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B1_FIELD( 1, MI_WRAM_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B2_FIELD( 1, MI_WRAM_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B3_FIELD( 1, MI_WRAM_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B4_FIELD( 1, MI_WRAM_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B5_FIELD( 1, MI_WRAM_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B6_FIELD( 1, MI_WRAM_OFFSET_192KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B7_FIELD( 1, MI_WRAM_OFFSET_224KB, MI_WRAM_ARM7 ), }, { - REG_WRAM_C_BNK_PACK(0, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_0KB, TRUE), - REG_WRAM_C_BNK_PACK(1, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_32KB, TRUE), - REG_WRAM_C_BNK_PACK(2, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_64KB, TRUE), - REG_WRAM_C_BNK_PACK(3, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_96KB, TRUE), - REG_WRAM_C_BNK_PACK(4, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_128KB, TRUE), - REG_WRAM_C_BNK_PACK(5, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_160KB, TRUE), - REG_WRAM_C_BNK_PACK(6, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_192KB, TRUE), - REG_WRAM_C_BNK_PACK(7, MI_WRAM_C_ARM9, MI_WRAM_C_OFS_224KB, TRUE), + REG_MI_MBK_C0_FIELD( 1, MI_WRAM_OFFSET_0KB , MI_WRAM_ARM9 ), + REG_MI_MBK_C1_FIELD( 1, MI_WRAM_OFFSET_32KB , MI_WRAM_ARM9 ), + REG_MI_MBK_C2_FIELD( 1, MI_WRAM_OFFSET_64KB , MI_WRAM_ARM9 ), + REG_MI_MBK_C3_FIELD( 1, MI_WRAM_OFFSET_96KB , MI_WRAM_ARM9 ), + REG_MI_MBK_C4_FIELD( 1, MI_WRAM_OFFSET_128KB, MI_WRAM_ARM9 ), + REG_MI_MBK_C5_FIELD( 1, MI_WRAM_OFFSET_160KB, MI_WRAM_ARM9 ), + REG_MI_MBK_C6_FIELD( 1, MI_WRAM_OFFSET_192KB, MI_WRAM_ARM9 ), + REG_MI_MBK_C7_FIELD( 1, MI_WRAM_OFFSET_224KB, MI_WRAM_ARM9 ), }, - REG_WRAM_A_MAP_PACK(MI_WRAM_MAP_NULL, - MI_WRAM_MAP_NULL, - MI_WRAM_A_IMG_128KB - ), - REG_WRAM_B_MAP_PACK(MI_WRAM_MAP_NULL, - MI_WRAM_MAP_NULL, - MI_WRAM_B_IMG_128KB - ), - REG_WRAM_C_MAP_PACK(HW_WRAM_AREA_HALF, - HW_WRAM_AREA_HALF + 0x00020000, - MI_WRAM_C_IMG_128KB - ), + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_128KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, MI_WRAM_MAP_NULL ) + ), + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_128KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, MI_WRAM_MAP_NULL ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, HW_WRAM_AREA_HALF + 0x00020000 ), + MI_WRAM_IMAGE_128KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, HW_WRAM_AREA_HALF ) + ), // ARM7 - REG_WRAM_A_MAP_PACK(HW_WRAM_AREA_HALF, - HW_WRAM_AREA_HALF + 0x00020000, - MI_WRAM_A_IMG_128KB - ), - REG_WRAM_B_MAP_PACK(HW_WRAM_AREA_HALF + 0x00020000, - HW_WRAM_AREA_HALF + 0x00040000, - MI_WRAM_B_IMG_128KB - ), - REG_WRAM_C_MAP_PACK(MI_WRAM_MAP_NULL, - MI_WRAM_MAP_NULL, - MI_WRAM_C_IMG_128KB - ), - // WRAM Lock + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, HW_WRAM_AREA_HALF + 0x00020000 ), + MI_WRAM_IMAGE_128KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, HW_WRAM_AREA_HALF ) + ), + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA_HALF + 0x00040000 ), + MI_WRAM_IMAGE_128KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA_HALF + 0x00020000 ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_128KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, MI_WRAM_MAP_NULL ) + ), + + // WRAM Lock { 0, 0, diff --git a/include/firm.h b/include/firm.h index a44dcc38..af7021f3 100644 --- a/include/firm.h +++ b/include/firm.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_H_ #define FIRM_H_ diff --git a/include/firm/acsign.h b/include/firm/acsign.h index 2ccfcced..c540460b 100644 --- a/include/firm/acsign.h +++ b/include/firm/acsign.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_ACSIGN_H_ diff --git a/include/firm/aes.h b/include/firm/aes.h index 403eec4a..56a5fc99 100644 --- a/include/firm/aes.h +++ b/include/firm/aes.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_AES_H_ #define FIRM_AES_H_ diff --git a/include/firm/aes/ARM7/aes_ids.h b/include/firm/aes/ARM7/aes_ids.h index 53b19963..a5c8aaa8 100644 --- a/include/firm/aes/ARM7/aes_ids.h +++ b/include/firm/aes/ARM7/aes_ids.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef TWL_AES_AES_IDS_H_ diff --git a/include/firm/aes/ARM7/aes_init.h b/include/firm/aes/ARM7/aes_init.h index cc787258..6e4db63c 100644 --- a/include/firm/aes/ARM7/aes_init.h +++ b/include/firm/aes/ARM7/aes_init.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef TWL_AES_AES_INIT_H_ diff --git a/include/firm/format/firm_common.h b/include/firm/format/firm_common.h index 21816c18..b45dd000 100644 --- a/include/firm/format/firm_common.h +++ b/include/firm/format/firm_common.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_FORMAT_FIRM_COMMON_H_ #define FIRM_FORMAT_FIRM_COMMON_H_ diff --git a/include/firm/format/from_brom.h b/include/firm/format/from_brom.h index de165174..29433016 100644 --- a/include/firm/format/from_brom.h +++ b/include/firm/format/from_brom.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_FORMAT_FROM_BROM_H_ #define FIRM_FORMAT_FROM_BROM_H_ diff --git a/include/firm/format/gcdfirm.h b/include/firm/format/gcdfirm.h index 1c8b771b..111a186d 100644 --- a/include/firm/format/gcdfirm.h +++ b/include/firm/format/gcdfirm.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_FORMAT_GCDFIRM_H_ #define FIRM_FORMAT_GCDFIRM_H_ diff --git a/include/firm/format/nandfirm.h b/include/firm/format/nandfirm.h index 1ec292c0..b79975a8 100644 --- a/include/firm/format/nandfirm.h +++ b/include/firm/format/nandfirm.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_FORMAT_NAND_H_ #define FIRM_FORMAT_NAND_H_ diff --git a/include/firm/format/norfirm.h b/include/firm/format/norfirm.h index 6eafc329..d09395fa 100644 --- a/include/firm/format/norfirm.h +++ b/include/firm/format/norfirm.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_FORMAT_NOR_H_ #define FIRM_FORMAT_NOR_H_ diff --git a/include/firm/format/sign.h b/include/firm/format/sign.h index 7dc5d7e9..b625fcbc 100644 --- a/include/firm/format/sign.h +++ b/include/firm/format/sign.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FORMAT_SIGN_H_ #define FORMAT_SIGN_H_ diff --git a/include/firm/format/wram_regs.h b/include/firm/format/wram_regs.h index 10e8347c..95b52be6 100644 --- a/include/firm/format/wram_regs.h +++ b/include/firm/format/wram_regs.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_FORMAT_WRAM_REGS_H_ #define FIRM_FORMAT_WRAM_REGS_H_ diff --git a/include/firm/gcd.h b/include/firm/gcd.h index 8f2404c6..eb304c5a 100644 --- a/include/firm/gcd.h +++ b/include/firm/gcd.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_GCD_H_ diff --git a/include/firm/gcd/blowfish.h b/include/firm/gcd/blowfish.h index 6d33d599..223933a6 100644 --- a/include/firm/gcd/blowfish.h +++ b/include/firm/gcd/blowfish.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_GCD_BLOWFISH_H #define FIRM_GCD_BLOWFISH_H diff --git a/include/firm/gcd/gcd.h b/include/firm/gcd/gcd.h index 347d84c3..3210986e 100644 --- a/include/firm/gcd/gcd.h +++ b/include/firm/gcd/gcd.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_GCD_GCD_H_ diff --git a/include/firm/gcd/gcd_misc.h b/include/firm/gcd/gcd_misc.h index cf136ea3..36b28586 100644 --- a/include/firm/gcd/gcd_misc.h +++ b/include/firm/gcd/gcd_misc.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_GCD_GCD_MISC_H_ diff --git a/include/firm/hw/ARM7/mmap_firm.h b/include/firm/hw/ARM7/mmap_firm.h index dfec8855..3e7571f6 100644 --- a/include/firm/hw/ARM7/mmap_firm.h +++ b/include/firm/hw/ARM7/mmap_firm.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_HW_MMAP_FIRM_H_ #define FIRM_HW_MMAP_FIRM_H_ diff --git a/include/firm/hw/ARM9/mmap_firm.h b/include/firm/hw/ARM9/mmap_firm.h index cecda941..7562a7bd 100644 --- a/include/firm/hw/ARM9/mmap_firm.h +++ b/include/firm/hw/ARM9/mmap_firm.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_HW_MMAP_FIRM_H_ #define FIRM_HW_MMAP_FIRM_H_ diff --git a/include/firm/memorymap.h b/include/firm/memorymap.h index a6150eeb..80b829c5 100644 --- a/include/firm/memorymap.h +++ b/include/firm/memorymap.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_MEMORYMAP_H_ #define FIRM_MEMORYMAP_H_ diff --git a/include/firm/mi.h b/include/firm/mi.h index e644867d..7da0cc9f 100644 --- a/include/firm/mi.h +++ b/include/firm/mi.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_MI_H_ diff --git a/include/firm/mi/mainMemory.h b/include/firm/mi/mainMemory.h index 29b47e62..0cdf3124 100644 --- a/include/firm/mi/mainMemory.h +++ b/include/firm/mi/mainMemory.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_MI_MAINMEMORY_H_ diff --git a/include/firm/misc.h b/include/firm/misc.h index 21ff27e0..201ddce3 100644 --- a/include/firm/misc.h +++ b/include/firm/misc.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_MISC_H_ #define FIRM_MISC_H_ diff --git a/include/firm/nvram.h b/include/firm/nvram.h index c9b8ffd4..77428a3d 100644 --- a/include/firm/nvram.h +++ b/include/firm/nvram.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_NVRAM_H_ diff --git a/include/firm/os.h b/include/firm/os.h index 3d1afa41..2147cf5d 100644 --- a/include/firm/os.h +++ b/include/firm/os.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_OS_H_ diff --git a/include/firm/os/common/boot.h b/include/firm/os/common/boot.h index 6f8c59f6..014cc920 100644 --- a/include/firm/os/common/boot.h +++ b/include/firm/os/common/boot.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_OS_BOOT_H_ #define FIRM_OS_BOOT_H_ diff --git a/include/firm/os/common/init.h b/include/firm/os/common/init.h index b6bf0f87..2806c59a 100644 --- a/include/firm/os/common/init.h +++ b/include/firm/os/common/init.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_OS_INIT_H_ #define FIRM_OS_INIT_H_ diff --git a/include/firm/os/common/systemCall.h b/include/firm/os/common/systemCall.h index b81d50bd..a0991b9b 100644 --- a/include/firm/os/common/systemCall.h +++ b/include/firm/os/common/systemCall.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_OS_SYSTEMCALL_H_ diff --git a/include/firm/os/common/tick_brom.h b/include/firm/os/common/tick_brom.h index c9b57557..77b5db9d 100644 --- a/include/firm/os/common/tick_brom.h +++ b/include/firm/os/common/tick_brom.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FRIM_OS_TICK_BROM_H_ diff --git a/include/firm/pm.h b/include/firm/pm.h index b471de66..30922725 100644 --- a/include/firm/pm.h +++ b/include/firm/pm.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef FIRM_PM_H_ diff --git a/include/firm/specfiles/ARM7-BB-GCDFIRM.lsf b/include/firm/specfiles/ARM7-BB-GCDFIRM.lsf index 6c472e66..8cb0b523 100644 --- a/include/firm/specfiles/ARM7-BB-GCDFIRM.lsf +++ b/include/firm/specfiles/ARM7-BB-GCDFIRM.lsf @@ -10,8 +10,9 @@ # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # -# $Log: $ -# $NoKeywords: $ +# $Date:: $ +# $Rev:$ +# $Author:$ #---------------------------------------------------------------------------- # # TwlFirm LCF SPEC FILE diff --git a/include/firm/specfiles/ARM7-BB-NORFIRM.lsf b/include/firm/specfiles/ARM7-BB-NORFIRM.lsf index 6c472e66..8cb0b523 100644 --- a/include/firm/specfiles/ARM7-BB-NORFIRM.lsf +++ b/include/firm/specfiles/ARM7-BB-NORFIRM.lsf @@ -10,8 +10,9 @@ # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # -# $Log: $ -# $NoKeywords: $ +# $Date:: $ +# $Rev:$ +# $Author:$ #---------------------------------------------------------------------------- # # TwlFirm LCF SPEC FILE diff --git a/include/firm/specfiles/ARM7-TS-GCDFIRM.lsf b/include/firm/specfiles/ARM7-TS-GCDFIRM.lsf index ef7f7d42..90e792e6 100644 --- a/include/firm/specfiles/ARM7-TS-GCDFIRM.lsf +++ b/include/firm/specfiles/ARM7-TS-GCDFIRM.lsf @@ -10,8 +10,9 @@ # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # -# $Log: $ -# $NoKeywords: $ +# $Date:: $ +# $Rev:$ +# $Author:$ #---------------------------------------------------------------------------- # # TwlFirm LCF SPEC FILE diff --git a/include/firm/specfiles/ARM7-TS-NORFIRM.lsf b/include/firm/specfiles/ARM7-TS-NORFIRM.lsf index ef7f7d42..90e792e6 100644 --- a/include/firm/specfiles/ARM7-TS-NORFIRM.lsf +++ b/include/firm/specfiles/ARM7-TS-NORFIRM.lsf @@ -10,8 +10,9 @@ # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # -# $Log: $ -# $NoKeywords: $ +# $Date:: $ +# $Rev:$ +# $Author:$ #---------------------------------------------------------------------------- # # TwlFirm LCF SPEC FILE diff --git a/include/firm/specfiles/ARM9-BB-GCDFIRM.lsf b/include/firm/specfiles/ARM9-BB-GCDFIRM.lsf index e6488a8b..3d233bd5 100644 --- a/include/firm/specfiles/ARM9-BB-GCDFIRM.lsf +++ b/include/firm/specfiles/ARM9-BB-GCDFIRM.lsf @@ -10,8 +10,9 @@ # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # -# $Log: $ -# $NoKeywords: $ +# $Date:: $ +# $Rev:$ +# $Author:$ #---------------------------------------------------------------------------- # # TwlFirm LCF SPEC FILE diff --git a/include/firm/specfiles/ARM9-BB-NORFIRM.lsf b/include/firm/specfiles/ARM9-BB-NORFIRM.lsf index e6488a8b..3d233bd5 100644 --- a/include/firm/specfiles/ARM9-BB-NORFIRM.lsf +++ b/include/firm/specfiles/ARM9-BB-NORFIRM.lsf @@ -10,8 +10,9 @@ # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # -# $Log: $ -# $NoKeywords: $ +# $Date:: $ +# $Rev:$ +# $Author:$ #---------------------------------------------------------------------------- # # TwlFirm LCF SPEC FILE diff --git a/include/firm/specfiles/ARM9-TS-GCDFIRM.lsf b/include/firm/specfiles/ARM9-TS-GCDFIRM.lsf index 05d913a8..a9a8ee43 100644 --- a/include/firm/specfiles/ARM9-TS-GCDFIRM.lsf +++ b/include/firm/specfiles/ARM9-TS-GCDFIRM.lsf @@ -10,8 +10,9 @@ # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # -# $Log: $ -# $NoKeywords: $ +# $Date:: $ +# $Rev:$ +# $Author:$ #---------------------------------------------------------------------------- # # TwlFirm LCF SPEC FILE diff --git a/include/firm/specfiles/ARM9-TS-NORFIRM.lsf b/include/firm/specfiles/ARM9-TS-NORFIRM.lsf index 05d913a8..a9a8ee43 100644 --- a/include/firm/specfiles/ARM9-TS-NORFIRM.lsf +++ b/include/firm/specfiles/ARM9-TS-NORFIRM.lsf @@ -10,8 +10,9 @@ # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # -# $Log: $ -# $NoKeywords: $ +# $Date:: $ +# $Rev:$ +# $Author:$ #---------------------------------------------------------------------------- # # TwlFirm LCF SPEC FILE diff --git a/include/twl/os/common/systemCall.h b/include/twl/os/common/systemCall.h index ed83d483..c53f77b5 100644 --- a/include/twl/os/common/systemCall.h +++ b/include/twl/os/common/systemCall.h @@ -10,8 +10,9 @@ not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. - $Log: $ - $NoKeywords: $ + $Date:: $ + $Rev:$ + $Author:$ *---------------------------------------------------------------------------*/ #ifndef TWL_OS_SYSTEMCALL_H_ diff --git a/tools/bin/makenorfirm.exe b/tools/bin/makenorfirm.exe index 743abd88..a4b3b2e7 100644 Binary files a/tools/bin/makenorfirm.exe and b/tools/bin/makenorfirm.exe differ