diff --git a/build/systemMenu_tools/Makefile b/build/systemMenu_tools/Makefile index 7ee0dae1..b7769a9b 100644 --- a/build/systemMenu_tools/Makefile +++ b/build/systemMenu_tools/Makefile @@ -25,7 +25,8 @@ SUBDIRS_P = \ NandInitializerRed \ NandInitializerProduction \ NandInitializer \ - ImportJump + ImportJump \ + nandfirmVersionChecker #---------------------------------------------------------------------------- diff --git a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/kami_write_nandfirm.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/kami_write_nandfirm.c index 44d5ef33..fa300236 100644 --- a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/kami_write_nandfirm.c +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/kami_write_nandfirm.c @@ -40,8 +40,9 @@ 定数定義 *---------------------------------------------------------------------------*/ -#define NAND_BLOCK_BYTE 0x200 -#define NAND_FIRM_START_OFFSET 0x200 +#define NAND_BLOCK_BYTE 0x200 +#define NAND_FIRM_START_OFFSET 0x200 +#define NAND_FIRM_START_OFFSET_IN_FILE 0x200 #define NVRAM_PAGE_SIZE 0x100 #define NVRAM_NORFIRM_RESERVED_ADDRESS 0x200 @@ -74,8 +75,9 @@ BOOL kamiWriteNandfirm(const char* pFullPath, NAMAlloc allocFunc, NAMFree freeFu BOOL read_is_ok; u8* pTempBuf; u32 file_size; + u32 nandfirm_size; u32 alloc_size; - u32 write_size; + u32 write_block; BOOL result = TRUE; u16 crc_w1, crc_w2; u16 crc_r1, crc_r2; @@ -102,8 +104,12 @@ BOOL kamiWriteNandfirm(const char* pFullPath, NAMAlloc allocFunc, NAMFree freeFu return FALSE; } + nandfirm_size = file_size - NAND_FIRM_START_OFFSET_IN_FILE; + // バッファ確保 - alloc_size = ROUND_UP(file_size, 32) ; + // 書き込みがブロック単位(512byte)であることを考慮し+512 + // さらにDC_Flushのケアとして32byteアライメントを考慮 + alloc_size = ROUND_UP(file_size + 512, 32) ; pTempBuf = allocFunc( alloc_size ); if (pTempBuf == NULL) { @@ -112,10 +118,12 @@ BOOL kamiWriteNandfirm(const char* pFullPath, NAMAlloc allocFunc, NAMFree freeFu return FALSE; } + MI_CpuClear8( pTempBuf, alloc_size ); + // .nandファイルリード - DC_InvalidateRange(pTempBuf, alloc_size); + DC_FlushRange(pTempBuf, alloc_size); read_is_ok = FS_ReadFile( &file, pTempBuf, (s32)file_size ); - DC_StoreRange(pTempBuf, file_size); + DC_FlushRange(pTempBuf, file_size); if (!read_is_ok) { kamiFontPrintfConsoleEx(1, "Fail FS_ReadFile!\n"); @@ -129,7 +137,7 @@ BOOL kamiWriteNandfirm(const char* pFullPath, NAMAlloc allocFunc, NAMFree freeFu // 書き込み前のCRCを計算 crc_w1 = SVC_GetCRC16( 0xffff, pTempBuf, sizeof(NORHeaderDS) ); - crc_w2 = SVC_GetCRC16( 0xffff, pTempBuf+512, file_size-512 ); + crc_w2 = SVC_GetCRC16( 0xffff, pTempBuf+NAND_FIRM_START_OFFSET_IN_FILE, nandfirm_size ); // まずNORHeaderDS領域を書き込む(40byte?) if (NVRAMi_Write(0, sizeof(NORHeaderDS), (void*)pTempBuf) != NVRAM_RESULT_SUCCESS) @@ -147,7 +155,7 @@ BOOL kamiWriteNandfirm(const char* pFullPath, NAMAlloc allocFunc, NAMFree freeFu { kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Read()!\n"); } - DC_StoreRange(pTempBuf, sizeof(NORHeaderDS)); + DC_FlushRange(pTempBuf, sizeof(NORHeaderDS)); // 書き込み後のCRCを計算 crc_r1 = SVC_GetCRC16( 0xffff, pTempBuf, sizeof(NORHeaderDS) ); @@ -187,7 +195,7 @@ BOOL kamiWriteNandfirm(const char* pFullPath, NAMAlloc allocFunc, NAMFree freeFu } // 書き込み後のCRCを計算 - DC_StoreRange(sNvramPageSizeBuffer, NVRAM_PAGE_SIZE); + DC_FlushRange(sNvramPageSizeBuffer, NVRAM_PAGE_SIZE); crc_norfirm_reserved_area_r = SVC_GetCRC16( 0xffff, sNvramPageSizeBuffer, NVRAM_PAGE_SIZE ); // NORファームリザーブ領域のCRC比較 @@ -260,25 +268,25 @@ BOOL kamiWriteNandfirm(const char* pFullPath, NAMAlloc allocFunc, NAMFree freeFu // kamiFontPrintfConsoleEx(0, "NAND Firm Import Start!\n"); // NAND書き込み - write_size = file_size/NAND_BLOCK_BYTE + (file_size % NAND_BLOCK_BYTE != 0); - kamiNandWrite( NAND_FIRM_START_OFFSET/NAND_BLOCK_BYTE, pTempBuf+NAND_FIRM_START_OFFSET, write_size ); // ブロック単位、バイト単位、ブロック単位 + write_block = nandfirm_size/NAND_BLOCK_BYTE + (nandfirm_size % NAND_BLOCK_BYTE != 0); + kamiNandWrite( NAND_FIRM_START_OFFSET/NAND_BLOCK_BYTE, pTempBuf+NAND_FIRM_START_OFFSET, write_block ); // ブロック単位、バイト単位、ブロック単位 // kamiFontPrintfConsoleEx(0, "Start CRC check\n"); kamiFontLoadScreenData(); // CRCを計算するので念のためにクリアしてからリードする - MI_CpuClear8( pTempBuf, file_size ); - DC_FlushRange(pTempBuf, file_size); + MI_CpuClear8( pTempBuf, nandfirm_size ); + DC_FlushRange(pTempBuf, nandfirm_size); // CRCチェックのためNandからリード - if (kamiNandRead(0, pTempBuf, file_size/512 ) == KAMI_RESULT_SEND_ERROR) + if (kamiNandRead(NAND_FIRM_START_OFFSET/NAND_BLOCK_BYTE, pTempBuf, write_block ) == KAMI_RESULT_SEND_ERROR) { kamiFontPrintfConsoleEx(1, "kamiNandRead ... %s!\n", "ERROR"); } - DC_StoreRange(pTempBuf, file_size); + DC_FlushRange(pTempBuf, nandfirm_size); // 書き込み後のCRCを計算 - crc_r2 = SVC_GetCRC16( 0xffff, pTempBuf+512, file_size-512 ); + crc_r2 = SVC_GetCRC16( 0xffff, pTempBuf, nandfirm_size ); // NAND部分についてのCRCチェック if (crc_w2 == crc_r2) diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_write_nandfirm.c b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_write_nandfirm.c index 488313c7..fa300236 100644 --- a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_write_nandfirm.c +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_write_nandfirm.c @@ -20,7 +20,6 @@ #include #include #include - #include "kami_font.h" #include "kami_pxi.h" @@ -41,8 +40,9 @@ 定数定義 *---------------------------------------------------------------------------*/ -#define NAND_BLOCK_BYTE 0x200 -#define NAND_FIRM_START_OFFSET 0x200 +#define NAND_BLOCK_BYTE 0x200 +#define NAND_FIRM_START_OFFSET 0x200 +#define NAND_FIRM_START_OFFSET_IN_FILE 0x200 #define NVRAM_PAGE_SIZE 0x100 #define NVRAM_NORFIRM_RESERVED_ADDRESS 0x200 @@ -75,8 +75,9 @@ BOOL kamiWriteNandfirm(const char* pFullPath, NAMAlloc allocFunc, NAMFree freeFu BOOL read_is_ok; u8* pTempBuf; u32 file_size; + u32 nandfirm_size; u32 alloc_size; - u32 write_size; + u32 write_block; BOOL result = TRUE; u16 crc_w1, crc_w2; u16 crc_r1, crc_r2; @@ -103,8 +104,12 @@ BOOL kamiWriteNandfirm(const char* pFullPath, NAMAlloc allocFunc, NAMFree freeFu return FALSE; } + nandfirm_size = file_size - NAND_FIRM_START_OFFSET_IN_FILE; + // バッファ確保 - alloc_size = ROUND_UP(file_size, 32) ; + // 書き込みがブロック単位(512byte)であることを考慮し+512 + // さらにDC_Flushのケアとして32byteアライメントを考慮 + alloc_size = ROUND_UP(file_size + 512, 32) ; pTempBuf = allocFunc( alloc_size ); if (pTempBuf == NULL) { @@ -113,10 +118,12 @@ BOOL kamiWriteNandfirm(const char* pFullPath, NAMAlloc allocFunc, NAMFree freeFu return FALSE; } + MI_CpuClear8( pTempBuf, alloc_size ); + // .nandファイルリード - DC_InvalidateRange(pTempBuf, alloc_size); + DC_FlushRange(pTempBuf, alloc_size); read_is_ok = FS_ReadFile( &file, pTempBuf, (s32)file_size ); - DC_StoreRange(pTempBuf, file_size); + DC_FlushRange(pTempBuf, file_size); if (!read_is_ok) { kamiFontPrintfConsoleEx(1, "Fail FS_ReadFile!\n"); @@ -130,7 +137,7 @@ BOOL kamiWriteNandfirm(const char* pFullPath, NAMAlloc allocFunc, NAMFree freeFu // 書き込み前のCRCを計算 crc_w1 = SVC_GetCRC16( 0xffff, pTempBuf, sizeof(NORHeaderDS) ); - crc_w2 = SVC_GetCRC16( 0xffff, pTempBuf+512, file_size-512 ); + crc_w2 = SVC_GetCRC16( 0xffff, pTempBuf+NAND_FIRM_START_OFFSET_IN_FILE, nandfirm_size ); // まずNORHeaderDS領域を書き込む(40byte?) if (NVRAMi_Write(0, sizeof(NORHeaderDS), (void*)pTempBuf) != NVRAM_RESULT_SUCCESS) @@ -148,7 +155,7 @@ BOOL kamiWriteNandfirm(const char* pFullPath, NAMAlloc allocFunc, NAMFree freeFu { kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Read()!\n"); } - DC_StoreRange(pTempBuf, sizeof(NORHeaderDS)); + DC_FlushRange(pTempBuf, sizeof(NORHeaderDS)); // 書き込み後のCRCを計算 crc_r1 = SVC_GetCRC16( 0xffff, pTempBuf, sizeof(NORHeaderDS) ); @@ -188,7 +195,7 @@ BOOL kamiWriteNandfirm(const char* pFullPath, NAMAlloc allocFunc, NAMFree freeFu } // 書き込み後のCRCを計算 - DC_StoreRange(sNvramPageSizeBuffer, NVRAM_PAGE_SIZE); + DC_FlushRange(sNvramPageSizeBuffer, NVRAM_PAGE_SIZE); crc_norfirm_reserved_area_r = SVC_GetCRC16( 0xffff, sNvramPageSizeBuffer, NVRAM_PAGE_SIZE ); // NORファームリザーブ領域のCRC比較 @@ -261,25 +268,25 @@ BOOL kamiWriteNandfirm(const char* pFullPath, NAMAlloc allocFunc, NAMFree freeFu // kamiFontPrintfConsoleEx(0, "NAND Firm Import Start!\n"); // NAND書き込み - write_size = file_size/NAND_BLOCK_BYTE + (file_size % NAND_BLOCK_BYTE != 0); - kamiNandWrite( NAND_FIRM_START_OFFSET/NAND_BLOCK_BYTE, pTempBuf+NAND_FIRM_START_OFFSET, write_size ); // ブロック単位、バイト単位、ブロック単位 + write_block = nandfirm_size/NAND_BLOCK_BYTE + (nandfirm_size % NAND_BLOCK_BYTE != 0); + kamiNandWrite( NAND_FIRM_START_OFFSET/NAND_BLOCK_BYTE, pTempBuf+NAND_FIRM_START_OFFSET, write_block ); // ブロック単位、バイト単位、ブロック単位 // kamiFontPrintfConsoleEx(0, "Start CRC check\n"); kamiFontLoadScreenData(); // CRCを計算するので念のためにクリアしてからリードする - MI_CpuClear8( pTempBuf, file_size ); - DC_FlushRange(pTempBuf, file_size); + MI_CpuClear8( pTempBuf, nandfirm_size ); + DC_FlushRange(pTempBuf, nandfirm_size); // CRCチェックのためNandからリード - if (kamiNandRead(0, pTempBuf, file_size/512 ) == KAMI_RESULT_SEND_ERROR) + if (kamiNandRead(NAND_FIRM_START_OFFSET/NAND_BLOCK_BYTE, pTempBuf, write_block ) == KAMI_RESULT_SEND_ERROR) { kamiFontPrintfConsoleEx(1, "kamiNandRead ... %s!\n", "ERROR"); } - DC_StoreRange(pTempBuf, file_size); + DC_FlushRange(pTempBuf, nandfirm_size); // 書き込み後のCRCを計算 - crc_r2 = SVC_GetCRC16( 0xffff, pTempBuf+512, file_size-512 ); + crc_r2 = SVC_GetCRC16( 0xffff, pTempBuf, nandfirm_size ); // NAND部分についてのCRCチェック if (crc_w2 == crc_r2) diff --git a/build/systemMenu_tools/nandfirmVersionChecker/ARM7.TWL/Makefile b/build/systemMenu_tools/nandfirmVersionChecker/ARM7.TWL/Makefile new file mode 100644 index 00000000..af17b0e1 --- /dev/null +++ b/build/systemMenu_tools/nandfirmVersionChecker/ARM7.TWL/Makefile @@ -0,0 +1,89 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: Makefile +# +# Copyright 2008 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# 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. +# +# $Date:: $ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TWL_PROC = ARM7 +override TWL_ARCHGEN = LIMITED +##override TWL_PLATFORM = TS +TWL_NO_STD_PCHDR = True +override TARGET_CODEGEN = ARM + +ifndef TWLSDK_NOCRYPTO +#---------------------------------------------------------------------------- + +SRCS = crt0.SCFG_NOLOCK.c \ + main.c \ + kami_pxi.c \ + formatter.c \ + mcu_firm.c + +TARGET_NAME = armadillo + +TARGET_NEF = $(TARGET_NAME).tef +LCFILE_SPEC = ../../NandInitializerRed/ARM7.TWL/$(TARGET_NAME).lsf +LCFILE_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).lcf.template +LDRES_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).response.template + +CRT0_O = crt0.SCFG_NOLOCK.o + +# スタック不足防止の為、インライン展開せずにコンパイルする +CCFLAGS_OPT = -O4 -inline off + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +MACRO_FLAGS += -DSDK_ARM7COMP_LTD -DSDK_SEA -DSDK_NOINIT + +MAKELCF_FLAGS += -DISDBG_LIBS_TWL='$(if $(ISDBG_LIBS_TWL),$(ISDBG_LIBS_TWL),libstubsistd_sp$(TWL_LIBSUFFIX).a)' \ + -DISDBG_LIBS_NITRO='libstubsisd_sp$(TWL_LIBSUFFIX).a' + +LINCLUDES = $(ROOT)/build/libraries/spi/ARM7/include \ + $(ROOT)/build/libraries/os/common/include \ + $(ROOT)/build/libraries/init/common/include \ + $(TWL_IPL_RED_ROOT)/include \ + ../../NandInitializerRed/common/include \ + ../../NandInitializerRed/ARM7.TWL/include \ + ../../common/ARM7/include \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include/fatfs \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include/twl/fatfs/ARM7 + +SRCDIR = ../../NandInitializerRed/ARM7.TWL/src \ + ../../common/ARM7/src + +LLIBRARY_DIRS += $(TWL_IPL_RED_ROOT)/lib/ARM7-TS/$(TWL_BUILD_DIR) \ + ./obj/ARM7-TS.LTD/$(TWL_BUILD_DIR) + +LLIBRARIES += libwl_sp$(TWL_LIBSUFFIX).a \ + libsdio_sp$(TWL_LIBSUFFIX).a \ + libathdrv_sp$(TWL_LIBSUFFIX).a \ + libwpa_sp$(TWL_LIBSUFFIX).a \ + libhotsw_sp$(TWL_LIBSUFFIX).a \ + libreloc_info_sp$(TWL_LIBSUFFIX).a + +LDEPENDS_NEF = $(TWL_LIBS) $(LLIBRARIES) + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +endif #ifndef TWLSDK_NOCRYPTO + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/nandfirmVersionChecker/ARM9.TWL/Makefile b/build/systemMenu_tools/nandfirmVersionChecker/ARM9.TWL/Makefile new file mode 100644 index 00000000..d517821b --- /dev/null +++ b/build/systemMenu_tools/nandfirmVersionChecker/ARM9.TWL/Makefile @@ -0,0 +1,73 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - systemMenu_tools - nandfirmVersionChecker +# File: Makefile +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# 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. +# +# $Date:: $ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- + +SYSM_DISABLE_DEBUG = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +#TARGET_CODEGEN = THUMB + +TITLEID_LO = 0NVA +#TARGET_TAD = + +TARGET_BIN = nandfirmVersionChecker.srl + +LCFILE_SPEC = ../../NandInitializerRed/ARM9.TWL/ARM9-TS.lsf +ROM_SPEC = ./main.rsf + +MAKEROM_ARM7_BASE = ../ARM7.TWL/bin/$(TWL_BUILDTYPE_ARM7)/armadillo +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +SRCS = main.c \ + kami_pxi.c \ + font_data.c \ + graphics.c \ + keypad.c \ + kami_font.c \ + sd_event.c \ + +LINCLUDES = ../../NandInitializerRed/common/include \ + ../../NandInitializerRed/ARM9.TWL/include + +SRCDIR = ./src \ + ../../NandInitializerRed/ARM9.TWL/src + +#LCFILE = # using default + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \ + -DCARD_REGION='$(CARD_REGION)' \ + -DDISABLE_DEBUG='$(SYSM_DISABLE_DEBUG)' + +MAKETAD_FLAGS += -s + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/nandfirmVersionChecker/ARM9.TWL/main.rsf b/build/systemMenu_tools/nandfirmVersionChecker/ARM9.TWL/main.rsf new file mode 100644 index 00000000..b9a91730 --- /dev/null +++ b/build/systemMenu_tools/nandfirmVersionChecker/ARM9.TWL/main.rsf @@ -0,0 +1,221 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# 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. +# +# $Date:: $ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + RomVersion 2 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + RomSize 64M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping MAP_TS_SCR + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + CommonClientKey FALSE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + HwAESSlotB FALSE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + HwAESSlotC FALSE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess FALSE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # DisableDebug :最終ROMでは、実行時にデバッグできないようにTRUEにする必要があります。 + # + DisableDebug $(DISABLE_DEBUG) + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType System + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL +} diff --git a/build/systemMenu_tools/nandfirmVersionChecker/ARM9.TWL/src/main.c b/build/systemMenu_tools/nandfirmVersionChecker/ARM9.TWL/src/main.c new file mode 100644 index 00000000..6b4f774c --- /dev/null +++ b/build/systemMenu_tools/nandfirmVersionChecker/ARM9.TWL/src/main.c @@ -0,0 +1,186 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - nandfirmVersionChecker + File: main.c + + Copyright 2008 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + 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. + + $Date:: $ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "kami_font.h" +#include "graphics.h" +#include "keypad.h" +#include "kami_pxi.h" + +#define SCRAMBLE_MASK 0x00406000 +#define NAND_BLOCK_SIZE 0x200 + +extern void HWInfoWriterInit( void ); + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static FSEventHook sSDHook; +static u8 tempBuf[NAND_BLOCK_SIZE]; +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void VBlankIntr(void); +static void InitAllocation(void); + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void +TwlMain() +{ + // 製品ビルドランチャー&デバッガ上での起動対応 + if ( OS_GetRunningConsoleType() & OS_CONSOLE_TWLDEBUGGER ) + { + ROM_Header *dh = (void *)HW_ROM_HEADER_BUF; + dh->s.game_cmd_param &= ~SCRAMBLE_MASK; + } + + OS_Init(); + OS_InitTick(); + OS_InitArena(); + PXI_Init(); + OS_InitLock(); + OS_InitArenaEx(); + OS_InitIrqTable(); + OS_SetIrqStackChecker(); + MI_Init(); + OS_InitVAlarm(); + OSi_InitVramExclusive(); + OS_InitThread(); + OS_InitReset(); + GX_Init(); + FX_Init(); + SND_Init(); + SNDEX_Init(); + TP_Init(); + RTC_Init(); + + KamiPxiInit(); /* 独自PXI初期化 */ + + // Vブランク割り込み設定 + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)OS_EnableIrqMask(OS_IE_FIFO_RECV); + (void)OS_EnableIrq(); + (void)GX_VBlankIntr(TRUE); + + // initialize file-system + FS_Init(FS_DMA_NOT_USE); + + // FS_Initの後の方が良い模様 + InitAllocation(); + + // 表示関連初期化 + InitGraphics(); + kamiFontInit(); + + /* always preload FS table for faster directory access. */ + { + u32 need_size = FS_GetTableSize(); + void *p_table = OS_Alloc(need_size); + SDK_ASSERT(p_table != NULL); + (void)FS_LoadTable(p_table, need_size); + } + + kamiFontPrintfConsole( CONSOLE_ORANGE, "+------------------------------+"); + kamiFontPrintfConsole( CONSOLE_ORANGE, "l nandfirm Version Checker l"); + kamiFontPrintfConsole( CONSOLE_ORANGE, "+------------------------------+\n"); + + DC_FlushRange(tempBuf, sizeof(tempBuf)); + + // ブロック単位、バイト単位、ブロック単位 + if (kamiNandRead(1, tempBuf, 1) == KAMI_RESULT_SEND_ERROR) + { + kamiFontPrintfConsoleEx(1, "kamiNandRead ... %s!\n", "ERROR"); + } + DC_FlushRange(tempBuf, NAND_BLOCK_SIZE); + + { + NANDHeaderLow* header = (NANDHeaderLow *)tempBuf; + u32 offsetbyte = header->sub_rom_offset + header->sub_size; + u32 offsetblock = offsetbyte / NAND_BLOCK_SIZE; + + // ブロック単位、バイト単位、ブロック単位 + if (kamiNandRead(offsetblock, tempBuf, 1) == KAMI_RESULT_SEND_ERROR) + { + kamiFontPrintfConsoleEx(1, "kamiNandRead ... %s!\n", "ERROR"); + } + DC_FlushRange(tempBuf, NAND_BLOCK_SIZE); + + kamiFontPrintfConsole( CONSOLE_ORANGE, "%s\n", tempBuf); + } + + while (1) + { + kamiPadRead(); + + // Vブランク待ち + OS_WaitVBlankIntr(); + + // フォントスクリーンデータロード + kamiFontLoadScreenData(); + } +} + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: VBlank割り込み処理 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +VBlankIntr(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt +} + +/*---------------------------------------------------------------------------* + Name: InitAllocation + + Description: ヒープの初期化. + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitAllocation(void) +{ + void *tmp; + OSHeapHandle hh; + + /* アリーナの初期化 */ + tmp = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tmp); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + OS_Panic("ARM9: Fail to create heap...\n"); + hh = OS_SetCurrentHeap(OS_ARENA_MAIN, hh); +} + diff --git a/build/systemMenu_tools/nandfirmVersionChecker/Makefile b/build/systemMenu_tools/nandfirmVersionChecker/Makefile new file mode 100644 index 00000000..a2c33b15 --- /dev/null +++ b/build/systemMenu_tools/nandfirmVersionChecker/Makefile @@ -0,0 +1,34 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - camera +# File: Makefile +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# 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. +# +# $Date:: $ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + banner \ + ARM7.TWL \ + ARM9.TWL \ + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/nandfirmVersionChecker/banner/Makefile b/build/systemMenu_tools/nandfirmVersionChecker/banner/Makefile new file mode 100644 index 00000000..e373c033 --- /dev/null +++ b/build/systemMenu_tools/nandfirmVersionChecker/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# 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. +# +# $Date:: $ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/systemMenu_tools/nandfirmVersionChecker/banner/banner_v3.bsf b/build/systemMenu_tools/nandfirmVersionChecker/banner/banner_v3.bsf new file mode 100644 index 00000000..746f3f40 Binary files /dev/null and b/build/systemMenu_tools/nandfirmVersionChecker/banner/banner_v3.bsf differ diff --git a/build/systemMenu_tools/nandfirmVersionChecker/banner/icon/gameIcon.bmp b/build/systemMenu_tools/nandfirmVersionChecker/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..daa57a80 Binary files /dev/null and b/build/systemMenu_tools/nandfirmVersionChecker/banner/icon/gameIcon.bmp differ