diff --git a/build/libraries/mi/ARM9/mi_init_mainMemory.c b/build/libraries/mi/ARM9/mi_init_mainMemory.c index 8cbe30f0..7f46fd53 100644 --- a/build/libraries/mi/ARM9/mi_init_mainMemory.c +++ b/build/libraries/mi/ARM9/mi_init_mainMemory.c @@ -63,8 +63,8 @@ asm void MIi_InitMainMemCR( void ) { mov r12, lr - mov r0, #0x8000 // low period 0.97ms - bl OS_SpinWait + mov r0, #0x10000 // low period 0.97ms + bl OS_SpinWaitCpuCycles ldr r3, =REG_EXMEMCNT_ADDR mov r1, #REG_MI_EXMEMCNT_CE2_MASK @@ -74,8 +74,8 @@ asm void MIi_InitMainMemCR( void ) strh r1, [r3] - mov r0, #0x8000 // high period 0.97ms - bl OS_SpinWait + mov r0, #0x10000 // high period 0.97ms + bl OS_SpinWaitCpuCycles ldr r3, =HW_WRAM_AREA - 2 #ifdef SDK_BB diff --git a/build/libraries/os/common/os_boot.c b/build/libraries/os/common/os_boot.c index 7a092069..2aeca68c 100644 --- a/build/libraries/os/common/os_boot.c +++ b/build/libraries/os/common/os_boot.c @@ -54,7 +54,7 @@ void OSi_Boot( void* entry, MIHeader_WramRegs* w ) #ifdef SDK_ARM9 OSBootCore = (void*)HW_ITCM; #else // SDK_ARM7 - OSBootCore = (void*)HW_EXT_WRAM; + OSBootCore = (void*)(HW_PRV_WRAM_SYS_STACK_DEFAULT - 0x200); #endif // SDK_ARM7 MI_CpuCopyFast( OSi_BootCore, OSBootCore, 0x200 ); diff --git a/build/nandfirm/nandfirm-loader/ARM7/main.c b/build/nandfirm/nandfirm-loader/ARM7/main.c index 33f462bb..167396a1 100644 --- a/build/nandfirm/nandfirm-loader/ARM7/main.c +++ b/build/nandfirm/nandfirm-loader/ARM7/main.c @@ -81,13 +81,17 @@ static void PreInit(void) void TwlSpMain( void ) { -#ifdef FIRM_ENABLE_JTAG - reg_SCFG_JTAG = REG_SCFG_JTAG_CPUJE_MASK | REG_SCFG_JTAG_ARM7SEL_MASK; -#endif // FIRM_ENABLE_JTAG + // OS_InitDebugLED and OS_SetDebugLED are able to call after OS_Init +#ifndef SDK_FINALROM + I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x03, 0x00); + I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x01, ++step); +#endif PreInit(); #ifndef SDK_FINALROM + I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x01, ++step); + // 0: before PXI profile[pf_cnt++] = (u32)OS_TicksToMicroSeconds(OS_GetTick()); #endif @@ -99,7 +103,6 @@ void TwlSpMain( void ) profile[pf_cnt++] = (u32)OS_TicksToMicroSeconds(OS_GetTick()); #endif - OS_InitDebugLED(); OS_SetDebugLED(++step); PM_InitFIRM(); @@ -199,7 +202,7 @@ void TwlSpMain( void ) { #ifndef SDK_FINALROM // 127: before BootMenu - pf_cnt = 127; + pf_cnt = PRFILE_MAX-1; profile[pf_cnt++] = (u32)OS_TicksToMicroSeconds(OS_GetTick()); #endif OS_SetDebugLED(++step); diff --git a/build/nandfirm/nandfirm-loader/ARM9/main.c b/build/nandfirm/nandfirm-loader/ARM9/main.c index 430247a1..968d5ddd 100644 --- a/build/nandfirm/nandfirm-loader/ARM9/main.c +++ b/build/nandfirm/nandfirm-loader/ARM9/main.c @@ -34,6 +34,7 @@ static const u8 rsa_key[128] = 0xa1, 0x96, 0xc6, 0xf7, 0x61, 0x68, 0x66, 0xe6, 0x65, 0x12, 0xb7, 0xf1, 0x49 }; #else + /* 鍵はどこへ? */ #define RSA_KEY_ADDR OSi_GetFromBromAddr()->rsa_pubkey[7] #endif @@ -74,7 +75,9 @@ static void PreInit(void) // メインメモリ関連 // SHARED領域クリア (IS-TWL-DEBUGGERの更新待ち) - //MIi_CpuClearFast( 0, (void*)HW_MAIN_MEM_SHARED, HW_MAIN_MEM_SHARED_END-HW_MAIN_MEM_SHARED ); +#ifdef SDK_FINALROM + MIi_CpuClearFast( 0, (void*)HW_MAIN_MEM_SHARED, HW_MAIN_MEM_SHARED_END-HW_MAIN_MEM_SHARED ); +#endif } void TwlMain( void ) @@ -100,7 +103,7 @@ void TwlMain( void ) { #ifndef SDK_FINALROM // 127: before BootMenu - pf_cnt = 127; + pf_cnt = PRFILE_MAX-1; profile[pf_cnt++] = (u32)OS_TicksToMicroSeconds(OS_GetTick()); #endif diff --git a/include/firm/pm/ARM7/pm_reg_ex.h b/include/firm/pm/ARM7/pm_reg_ex.h index 389c2618..432c1172 100644 --- a/include/firm/pm/ARM7/pm_reg_ex.h +++ b/include/firm/pm/ARM7/pm_reg_ex.h @@ -113,6 +113,8 @@ extern "C" { //---- PMIC_BT_CRCT #define PMIC_BT_CRCT_TEMP_ON (1<< 0) #define PMIC_BT_CRCT_AMPR_ON (1<< 1) +#define PMIC_BT_CRCT_BT2_ON (1<< 2) +#define PMIC_BT_CRCT_BT3_ON (1<< 3) #define PMIC_BT_CRCT_AK_SHIFT 4 #define PMIC_BT_CRCT_AK_MASK (0x3<< PMIC_BT_CRCT_AK_SHIFT) #define PMIC_BT_CRCT_TK_SHIFT 6 diff --git a/include/firm/specfiles/ARM7-TS-FIRM.lcf.template b/include/firm/specfiles/ARM7-TS-FIRM.lcf.template index 6dbe2122..a15e4e05 100644 --- a/include/firm/specfiles/ARM7-TS-FIRM.lcf.template +++ b/include/firm/specfiles/ARM7-TS-FIRM.lcf.template @@ -139,6 +139,18 @@ SECTIONS + + + + + + + + + + + + #:::::::::: data SDK_STATIC_DATA_END =.; . = ALIGN(4); @@ -180,6 +192,18 @@ SECTIONS + + + + + + + + + + + + #:::::::::: bss . = ALIGN(4); SDK_STATIC_BSS_END = .; diff --git a/include/firm/specfiles/ARM7-TS-FIRM.lsf b/include/firm/specfiles/ARM7-TS-FIRM.lsf index d4f5d88b..10fc59e7 100644 --- a/include/firm/specfiles/ARM7-TS-FIRM.lsf +++ b/include/firm/specfiles/ARM7-TS-FIRM.lsf @@ -23,6 +23,9 @@ Static $(TARGET_NAME) Address 0x037f8000 Object $(OBJS_STATIC) Library $(LLIBS) $(GLIBS) $(CW_LIBS) + Object * (.etable) Object * (.wram) - StackSize 1024 512 + Object * (.ltdwram) + Object * (.ltdmain) + StackSize 1024 1024 } diff --git a/include/firm/specfiles/ARM9-TS-FIRM.lcf.template b/include/firm/specfiles/ARM9-TS-FIRM.lcf.template index 10efd461..2f19742a 100644 --- a/include/firm/specfiles/ARM9-TS-FIRM.lcf.template +++ b/include/firm/specfiles/ARM9-TS-FIRM.lcf.template @@ -470,6 +470,12 @@ SECTIONS . = ALIGN(32); SDK_OVERLAY..DATA_START =.; #:::::::::: data + + + + + + @@ -510,6 +516,12 @@ SECTIONS # SDK_OVERLAY..BSS_START = .; #:::::::::: bss + + + + + + diff --git a/include/firm/specfiles/ARM9-TS-FIRM.lsf b/include/firm/specfiles/ARM9-TS-FIRM.lsf index 653e6b3d..913dadcd 100644 --- a/include/firm/specfiles/ARM9-TS-FIRM.lsf +++ b/include/firm/specfiles/ARM9-TS-FIRM.lsf @@ -23,28 +23,31 @@ Static $(TARGET_NAME) Address 0x03800000 Object $(OBJS_STATIC) Library $(LLIBS) $(GLIBS) $(CW_LIBS) + Object * (.itcm) + Object $(OBJS_AUTOLOAD) (.text) + Object $(OBJS_AUTOLOAD) (.rodata) + Object * (.ltdmain) + Object $(OBJS_LTDAUTOLOAD) + Library $(GLTDLIBS) + Object * (.dtcm) + Object $(OBJS_AUTOLOAD) (.data) + Object $(OBJS_AUTOLOAD) (.sdata) + Object $(OBJS_AUTOLOAD) (.bss) + Object $(OBJS_AUTOLOAD) (.sbss) } Autoload ITCM { Address 0x01ff8000 - Object * (.itcm) - Object $(OBJS_AUTOLOAD) (.text) } Autoload DTCM { - Address 0x027e0000 - Object * (.dtcm) - Object $(OBJS_AUTOLOAD) (.data) - Object $(OBJS_AUTOLOAD) (.bss) + Address $(ADDRESS_DTCM) } Ltdautoload LTDMAIN { # NITRO/TWL 共有のオーバーレイが在る場合は、さらにその後ろに配置する必要があります。 After $(TARGET_NAME) - Object * (.ltdmain) - Object $(OBJS_LTDAUTOLOAD) - Library $(GLTDLIBS) }