diff --git a/build/buildtools/commondefs b/build/buildtools/commondefs index e5c82932..98c45b61 100644 --- a/build/buildtools/commondefs +++ b/build/buildtools/commondefs @@ -18,6 +18,7 @@ ifndef TWL_IPL_COMMONDEFS_ TWL_IPL_COMMONDEFS_ = TRUE +FIRM_USE_TWLSDK_KEYS = TRUE ifeq ($(TARGET_FIRM),SYSTEMMENU) include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs.sysmenu @@ -25,6 +26,10 @@ else include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs.firm endif +ifdef FIRM_USE_TWLSDK_KEYS +MACRO_FLAGS += -DFIRM_USE_TWLSDK_KEYS=$(FIRM_USE_TWLSDK_KEYS) +endif + #---------------------------------------------------------------------------- endif # TWL_IPL_COMMONDEFS_ #----- End of commondefs ----- diff --git a/build/libraries/os/common/os_boot.c b/build/libraries/os/common/os_boot.c index e4b2195d..dc7f9911 100644 --- a/build/libraries/os/common/os_boot.c +++ b/build/libraries/os/common/os_boot.c @@ -76,6 +76,19 @@ void OS_BootWithRomHeaderFromFIRM( ROM_Header* rom_header ) // post clear mem_list[i++] = NULL; SDK_ASSERT(i <= sizeof(mem_list)/sizeof(mem_list[0])); + +#ifdef FIRM_USE_TWLSDK_KEYS + // TwlSDK内の鍵を使っている時は量産用CPUではブートしない +#ifdef SDK_ARM9 + if ( ! ((*(u8*)OS_CHIPTYPE_DEBUGGER_ADDR & OS_CHIPTYPE_DEBUGGER_MASK)) ) +#else // SDK_ARM7 + if ( ! ((*(u8*)HWi_WSYS08_ADDR & HWi_WSYS08_OP_OPT_MASK)) ) +#endif // SDK_ARM7 + { + OS_Terminate(); + } +#endif // FIRM_USE_SDK_KEYS + REBOOT_Execute(entry, wram_reg, mem_list, code_buf, stack_top, target, scfg, jtag); OS_Terminate(); }