diff --git a/build/components/hyena.TWL/hyena.lsf b/build/components/hyena.TWL/hyena.lsf index 65af713f..e31c0590 100644 --- a/build/components/hyena.TWL/hyena.lsf +++ b/build/components/hyena.TWL/hyena.lsf @@ -55,6 +55,8 @@ Autoload WRAM librtc_sp.TWL$(CODEGEN).a \ libwvr_sp.TWL$(CODEGEN).a \ libaes_sp.TWL$(CODEGEN).a \ + libaes_sp.TWL$(CODEGEN).a \ + libboot_sp.TWL$(CODEGEN).a \ $(ISTD_LIBS) Library libsdio_hcd_twl.TWL$(CODEGEN).a \ diff --git a/build/components/hyena.TWL/src/main.c b/build/components/hyena.TWL/src/main.c index d7bbcbfb..cb535b48 100644 --- a/build/components/hyena.TWL/src/main.c +++ b/build/components/hyena.TWL/src/main.c @@ -34,6 +34,7 @@ #include #include #include "nvram_sp.h" +#include /*---------------------------------------------------------------------------* 定数定義 @@ -124,6 +125,8 @@ TwlSpMain(void) // SPI 初期化 SPI_Init(THREAD_PRIO_SPI); + + BOOT_Init(); while (TRUE) { @@ -133,6 +136,7 @@ TwlSpMain(void) { OS_ResetSystem(); } + BOOT_WaitStart(); } } diff --git a/build/libraries_sysmenu/boot/ARM7/Makefile b/build/libraries_sysmenu/boot/ARM7/Makefile index 497866ca..b1cb08fd 100644 --- a/build/libraries_sysmenu/boot/ARM7/Makefile +++ b/build/libraries_sysmenu/boot/ARM7/Makefile @@ -26,11 +26,11 @@ TWL_PROC = ARM7 #---------------------------------------------------------------------------- -SRCDIR = ../common/src +SRCDIR = ./src INCDIR = ../common/include -SRCS = boot.c +SRCS = bootAPI.c boot.c TARGET_LIB = libboot_sp$(TWL_LIBSUFFIX).a diff --git a/build/libraries_sysmenu/boot/ARM7/src/boot.c b/build/libraries_sysmenu/boot/ARM7/src/boot.c index 3e4ef5c8..21c6cca5 100644 --- a/build/libraries_sysmenu/boot/ARM7/src/boot.c +++ b/build/libraries_sysmenu/boot/ARM7/src/boot.c @@ -16,6 +16,7 @@ *---------------------------------------------------------------------------*/ #include +#include //#include "loader.h" //#include "mb_child.h" @@ -24,7 +25,6 @@ // extern data------------------------------------------------------- // function's prototype---------------------------------------------- -void BOOT_Core( void ); static void Venner_R1( void ); static void ClearMemory( void ); @@ -58,7 +58,7 @@ static asm void ClearMemory( void ) // bl CpuClear32Byte ldr r0, = HW_WRAM // ARM7WRAMのクリア - ldr r1, = RETURN_FROM_MAIN_ARM7_FUNCP + ldr r1, = 1//RETURN_FROM_MAIN_ARM7_FUNCP bl CpuClear32Byte @@ -107,7 +107,7 @@ static asm void ClearBankREG_Stack( void ) bl CpuClear32Byte #endif // ISDBG_MB_CHILD_ - sub r0, r2, #( HW_PRV_WRAM_END - RETURN_FROM_MAIN_ARM7_FUNCP ) + sub r0, r2, #1 //#( HW_PRV_WRAM_END - RETURN_FROM_MAIN_ARM7_FUNCP ) ldr r1, = ClearMemory bl CpuClear32Byte diff --git a/build/libraries_sysmenu/boot/ARM7/src/bootAPI.c b/build/libraries_sysmenu/boot/ARM7/src/bootAPI.c index c7f9104c..f020e251 100644 --- a/build/libraries_sysmenu/boot/ARM7/src/bootAPI.c +++ b/build/libraries_sysmenu/boot/ARM7/src/bootAPI.c @@ -16,6 +16,7 @@ *---------------------------------------------------------------------------*/ #include +#include //#include "loader.h" //#include "mb_child.h" @@ -25,8 +26,6 @@ // extern data------------------------------------------------------- // function's prototype---------------------------------------------- -void BOOT_Init( void ); -void BOOT_WaitStart( void ); static void BOOTi_ClearREG_RAM( void ); @@ -55,7 +54,7 @@ BOOL BOOT_WaitStart( void ) InsertWLPatch(); } */ - BOOi_ClearREG_RAM(); // ARM7側のメモリ&レジスタクリア。 + BOOTi_ClearREG_RAM(); // ARM7側のメモリ&レジスタクリア。 reg_PXI_MAINPINTF = MAINP_SEND_IF | 0x0100; // ARM9に対してブートするようIRQで要求+ARM7のステートを1にする。 BOOT_Core(); // never return } @@ -82,4 +81,3 @@ static void BOOTi_ClearREG_RAM( void ) // クリアしていないレジスタは、VCOUNT, JOY, PIFCNT, MC-, EXMEMCNT, IME, PAUSE, POWLCDCNT, 他セキュリティ系です。 (void)OS_ResetRequestIrqMask(~0); } -} \ No newline at end of file diff --git a/build/libraries_sysmenu/boot/ARM9/Makefile b/build/libraries_sysmenu/boot/ARM9/Makefile index 12566b85..f65fa531 100644 --- a/build/libraries_sysmenu/boot/ARM9/Makefile +++ b/build/libraries_sysmenu/boot/ARM9/Makefile @@ -26,11 +26,11 @@ TWL_PROC = ARM9 #---------------------------------------------------------------------------- -SRCDIR = ../common/src +SRCDIR = ./src INCDIR = ../common/include -SRCS = boot.c +SRCS = boot.c bootAPI.c TARGET_LIB = libboot$(TWL_LIBSUFFIX).a diff --git a/build/libraries_sysmenu/boot/ARM9/src/boot.c b/build/libraries_sysmenu/boot/ARM9/src/boot.c index ec6c1573..2efefb21 100644 --- a/build/libraries_sysmenu/boot/ARM9/src/boot.c +++ b/build/libraries_sysmenu/boot/ARM9/src/boot.c @@ -16,6 +16,7 @@ *---------------------------------------------------------------------------*/ #include +#include //#include //#include "IPL2_work.h" //#include "define.h" @@ -29,7 +30,7 @@ // extern data------------------------------------------------------- // from LCF -extern void SDK_IRQ_STACKSIZE( void ); +//extern void SDK_IRQ_STACKSIZE( void ); // function's prototype---------------------------------------------- void BOOT_Core( void ); diff --git a/build/libraries_sysmenu/boot/ARM9/src/bootAPI.c b/build/libraries_sysmenu/boot/ARM9/src/bootAPI.c index 9733a1ac..cbd6738d 100644 --- a/build/libraries_sysmenu/boot/ARM9/src/bootAPI.c +++ b/build/libraries_sysmenu/boot/ARM9/src/bootAPI.c @@ -16,6 +16,7 @@ *---------------------------------------------------------------------------*/ #include +#include //#include //#include "IPL2_work.h" //#include "define.h" @@ -56,7 +57,7 @@ void BOOT_Ready( void ) (void)GX_VBlankIntr( FALSE ); (void)OS_SetIrqFunction( OS_IE_SUBP, NULL ); (void)OS_SetIrqMask( OS_IE_SUBP ); // サブプロセッサ割り込みのみを許可。 - reg_PXI_SUBPINTF = SUBP_RECV_IF_ENABLE | 0x0f00; // ARM9ステートを "0x0f" に +// reg_PXI_SUBPINTF = SUBP_RECV_IF_ENABLE | 0x0f00; // ARM9ステートを "0x0f" に // ※もうFIFOはクリア済みなので、使わない。 // ARM7からの通知待ち diff --git a/build/libraries_sysmenu/sysmenu/ARM9/src/sysmenu_lib.c b/build/libraries_sysmenu/sysmenu/ARM9/src/sysmenu_lib.c index d01dede3..c3db9075 100644 --- a/build/libraries_sysmenu/sysmenu/ARM9/src/sysmenu_lib.c +++ b/build/libraries_sysmenu/sysmenu/ARM9/src/sysmenu_lib.c @@ -22,6 +22,7 @@ #include "sysmenu_card.h" #include "spi.h" #include "mb_child.h" +#include // define data----------------------------------------------------------------- @@ -357,9 +358,11 @@ AuthResult SYSM_LoadAndAuthenticateTitle( TitleProperty *pBootTitle ) // アプリロード // アプリ認証 - // 実験用。実際にはこれ使えない(静的に8MBも退避メモリを確保してくれるので無理) - // ので、自前のロードプログラムが必要。 - //NAM_LaunchTitle(pBootTitle->titleID); + // 実験用。namを改造している。ロードするだけ。 + NAM_LaunchTitle(pBootTitle->titleID); + + // 起動。 + BOOT_Ready(); // パラメータチェック if( !SYSMi_CheckTitlePointer( pBootTitle ) ) { diff --git a/build/systemMenu_RED/Launcher/ARM9/Makefile b/build/systemMenu_RED/Launcher/ARM9/Makefile index 3a1272d0..d173ad32 100644 --- a/build/systemMenu_RED/Launcher/ARM9/Makefile +++ b/build/systemMenu_RED/Launcher/ARM9/Makefile @@ -41,8 +41,10 @@ LINCLUDES = $(SRCDIR)/$(LOGO_DIR) #LDEPENDS_NEF = LLIBRARIES += libnam$(TWL_LIBSUFFIX).a\ - libese$(TWL_LIBSUFFIX).a + libese$(TWL_LIBSUFFIX).a\ + libboot$(TWL_LIBSUFFIX).a +ADDRESS_DTCM = 0x0e000000 DEFAULT_COMP_ARM7 = hyena DEFAULT_MAKEROM_ARM7_BASE = $(TWLIPL_ROOT)/components/$(DEFAULT_COMP_ARM7)/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) diff --git a/build/systemMenu_RED/Launcher/ARM9/src/launcher.c b/build/systemMenu_RED/Launcher/ARM9/src/launcher.c index d43db7b8..4fdf1981 100644 --- a/build/systemMenu_RED/Launcher/ARM9/src/launcher.c +++ b/build/systemMenu_RED/Launcher/ARM9/src/launcher.c @@ -312,7 +312,7 @@ void LauncherInit( TitleProperty *pTitleList ) int i; GX_DispOff(); GXS_DispOff(); - NNS_G2dCharCanvasClear( &gCanvas, TXT_UCOLOR_GRAY ); + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_WHITE ); DrawBackLightSwitch(); @@ -414,8 +414,8 @@ TitleProperty *LauncherMain( TitleProperty *pTitleList ) if(pTitleList[selected].titleID != 0) { NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_WHITE ); - //return &pTitleList[selected]; - return NULL; + return &pTitleList[selected]; + //return NULL; } } diff --git a/build/systemMenu_RED/Launcher/ARM9/src/main.c b/build/systemMenu_RED/Launcher/ARM9/src/main.c index 8a3a1ba2..db8d3771 100644 --- a/build/systemMenu_RED/Launcher/ARM9/src/main.c +++ b/build/systemMenu_RED/Launcher/ARM9/src/main.c @@ -68,6 +68,9 @@ void TwlMain( void ) FS_Init( FS_DMA_NOT_USE ); GX_Init(); + + // プロテクションユニット領域変更 + OS_SetProtectionRegion( 2, 0x02280000, 512KB ); // 割り込み許可-------------------- (void)OS_SetIrqFunction(OS_IE_V_BLANK, INTR_VBlank); diff --git a/include/sysmenu/boot/common/boot.h b/include/sysmenu/boot/common/boot.h new file mode 100644 index 00000000..e537b9ce --- /dev/null +++ b/include/sysmenu/boot/common/boot.h @@ -0,0 +1,81 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: boot.h + + 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:: 2007-11-8#$ + $Rev: $ + $Author: yoshida_teruhisa $ + *---------------------------------------------------------------------------*/ + +#if !defined(_SYSMENU_BOOT_H_) +#define _SYSMENU_BOOT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Type definition + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + functions + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: BOOT_Core + + Description: ブートのコア関数 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void BOOT_Core( void ); + +/*---------------------------------------------------------------------------* + Name: BOOT_Init + + Description: ブートのための初期化 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void BOOT_Init( void ); + +/*---------------------------------------------------------------------------* + Name: BOOT_WaitStart + + Description: スタート待ち(ARM7) + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +BOOL BOOT_WaitStart( void ); + +/*---------------------------------------------------------------------------* + Name: BOOT_WaitStart + + Description: ブート開始及びARM7への通知及び待機(ARM9) + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void BOOT_Ready( void ); + +#ifdef __cplusplus +} +#endif + +#endif /* _SYSMENU_BOOT_H_ */