・NORファームがビルドできるよう変更。

・とりあえずテスト用にnorfirm-printがビルドできるように変更。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@7 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
yosiokat 2007-09-06 08:37:12 +00:00
parent a5de32578d
commit 9501084c1d
19 changed files with 1227 additions and 18 deletions

View File

@ -20,8 +20,6 @@ TWLFIRM_COMMONDEFS_ = TRUE
NITRO_NO_STD_PCHDR = TRUE # プリコンパイルヘッダ抑止
#TWLFIRM_ROOT ?= $(shell cygpath -am ../../)
export TWLBROM_ROOT := $(TWLFIRM_ROOT)/bootrom
@ -166,9 +164,9 @@ ifeq ($(CODEGEN_PROC),ARM9)
FIRM_LIBS_BASE ?= \
libos \
libmi \
libgcd \
libacsign \
# libmi \
# libgcd \
# libacsign \
FIRM_TWL_LIBS_BASE ?= \
@ -176,11 +174,11 @@ else # ($(CODEGEN_PROC),ARM7)
FIRM_LIBS_BASE ?= \
libos_sp \
libnvram_sp \
libgcd_sp \
libaes_sp \
libacsign_sp \
libfirmsd_sp \
# libnvram_sp \
# libgcd_sp \
# libaes_sp \
# libacsign_sp \
# libfirmsd_sp \
FIRM_TWL_LIBS_BASE ?= \
@ -245,6 +243,14 @@ FIRM_INSTALL_ADDINS := $(FIRM_INSTALL_ROOT)/add-ins
#
MACRO_FLAGS += -DFIRM_TARGET_$(FIRM_TARGET)
#----------------------------------------------------------------------------
# Makelcf change for build firmware
#
ifneq ($(filter NORFIRM NANDFIRM GCDFIRM,$(FIRM_TARGET)),)
MAKELCF := $(NITROSDK_ROOT)/tools/bin/makelcf.exe
endif
#----------------------------------------------------------------------------
endif # TWLFIRM_COMMONDEFS_
#----- End of commondefs -----

View File

@ -56,16 +56,16 @@ firmlib:
@$(MAKE) -C $(TWLFIRM_ROOT)/build/libraries
# .nor
$(BINDIR)/%.nor: $(SDEPENDS_BIN) $(ROM_SPEC) $(LDEPENDS_BIN) $(EDEPENDS_BIN) $(MAKEFILE) $(MAKENORFIRM) $(MAKEFIRM_RSA_PRVKEY)
$(MAKENORFIRM) $(MAKEFIRM_FLAGS) $(MAKEFIRM_DEFS) $(ROM_SPEC) $@
$(BINDIR)/%.nor: $(SDEPENDS_BIN) $(FIRM_SPEC) $(LDEPENDS_BIN) $(EDEPENDS_BIN) $(MAKEFILE) $(MAKENORFIRM) $(MAKEFIRM_RSA_PRVKEY)
$(MAKENORFIRM) $(MAKEFIRM_FLAGS) $(MAKEFIRM_DEFS) $(FIRM_SPEC) $@
# .nand
$(BINDIR)/%.nand: $(SDEPENDS_BIN) $(ROM_SPEC) $(LDEPENDS_BIN) $(EDEPENDS_BIN) $(MAKEFILE) $(MAKENANDFIRM) $(MAKEFIRM_RSA_PRVKEY)
$(MAKENANDFIRM) $(MAKEFIRM_FLAGS) $(MAKEFIRM_DEFS) $(ROM_SPEC) $@
$(BINDIR)/%.nand: $(SDEPENDS_BIN) $(FIRM_SPEC) $(LDEPENDS_BIN) $(EDEPENDS_BIN) $(MAKEFILE) $(MAKENANDFIRM) $(MAKEFIRM_RSA_PRVKEY)
$(MAKENANDFIRM) $(MAKEFIRM_FLAGS) $(MAKEFIRM_DEFS) $(FIRM_SPEC) $@
# .gcd
$(BINDIR)/%.gcd: $(SDEPENDS_BIN) $(ROM_SPEC) $(LDEPENDS_BIN) $(EDEPENDS_BIN) $(MAKEFILE) $(MAKEGCDFIRM) $(MAKEFIRM_RSA_PRVKEY)
$(MAKEGCDFIRM) $(MAKEFIRM_FLAGS) $(MAKEFIRM_DEFS) $(ROM_SPEC) $@
$(BINDIR)/%.gcd: $(SDEPENDS_BIN) $(FIRM_SPEC) $(LDEPENDS_BIN) $(EDEPENDS_BIN) $(MAKEFILE) $(MAKEGCDFIRM) $(MAKEFIRM_RSA_PRVKEY)
$(MAKEGCDFIRM) $(MAKEFIRM_FLAGS) $(MAKEFIRM_DEFS) $(FIRM_SPEC) $@
# .rbin
$(BINDIR)/$(TARGET_BIN_BASENAME).rbin: $(OBJS)
@ -73,7 +73,18 @@ $(BINDIR)/$(TARGET_BIN_BASENAME).rbin: $(OBJS)
# .axf
$(BINDIR)/$(TARGET_BIN_BASENAME).axf: $(OBJS) $(LCFILE) $(MAKEFILE) $(LDEPENDS_NEF) $(EDEPENDS_NEF) $(ALIBRARIES) $(LDRES_FILE) $(CW_LIBCXX)
$(LD) $(LDFLAGS) $(LIBRARY_DIRS) @$(call empath,$(LDRES_FILE)) $(call empath,$(LCFILE)) -o $(call empath,$@)
ifeq ($(NITRO_CCTYPE),RVCT)
$(LD) $(LDFLAGS) $(LIBRARY_DIRS) -o $@ $(GLIBRARIES) $(OBJS)
else
$(LD) $(LDFLAGS) $(LIBRARY_DIRS) @$(LDRES_FILE) $(LCFILE) -o $@
ifeq ($(TWL_PLATFORM),TS)
cp $(BINDIR)/$(TARGET_BIN_BASENAME).axf $(BINDIR)/$(TARGET_BIN_BASENAME).nef
else # ($(TWL_PLATFORM),BB)
ifdef FIRM_STRIP_AXF
$(OBJCOPY) $@ $(BINDIR)/$(TARGET_BIN_BASENAME).sbin
endif
endif
endif
#----------------------------------------------------------------------------
TWLFIRM_MODULERULES_ = TRUE

41
build/libraries/Makefile Normal file
View File

@ -0,0 +1,41 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlFirm - libraries
# 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 $(TWLFIRM_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS = \
os \
# syscall \
# init \
# mi \
# nvram \
# gcd \
# aes \
# acsign \
# acsign_ecc \
# devices \
#----------------------------------------------------------------------------
include $(TWLFIRM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,62 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlFirm - libraries_sp - os
# 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:$
#----------------------------------------------------------------------------
SUBDIRS =
#SUBMAKES = Makefile.CALLTRACE \
# Makefile.FUNCTIONCOST
#----------------------------------------------------------------------------
# build ARM & THUMB libraries
FIRM_CODEGEN_ALL ?= TRUE
# Codegen for sub processer
FIRM_PROC = ARM7
SRCDIR = ../common .
SRCS = \
os_init_firm.c \
os_boot.c \
TARGET_LIB = libos_sp$(FIRM_LIBSUFFIX).a
#----------------------------------------------------------------------------
# DEBUG版ビルドの場合、RELEASE版でビルドして
# DEBUG版のライブラリを装います。
ifdef NITRO_DEBUG
NITRO_BUILD_TYPE = RELEASE
endif
include $(TWLFIRM_ROOT)/build/buildtools/commondefs
INSTALL_TARGETS = $(TARGETS)
INSTALL_DIR = $(FIRM_INSTALL_LIBDIR)
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(TWLFIRM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,60 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlFirm - libraries - os
# 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:$
#----------------------------------------------------------------------------
SUBDIRS =
SUBMAKES =
#----------------------------------------------------------------------------
# build ARM & THUMB libraries
FIRM_CODEGEN_ALL ?= TRUE
SRCDIR = ../common .
SRCS = \
os_init_firm.c \
os_boot.c \
os_cache_tag.c \
TARGET_LIB = libos$(FIRM_LIBSUFFIX).a
include $(TWLFIRM_ROOT)/build/buildtools/commondefs
INSTALL_TARGETS = $(TARGETS)
INSTALL_DIR = $(FIRM_INSTALL_LIBDIR)
ifdef NITRO_CALLTRACE
CCFLAGS += -DOS_PROFILE_AVAILABLE -DOS_PROFILE_CALL_TRACE
endif
ifdef NITRO_FUNCTIONCOST
CCFLAGS += -DOS_PROFILE_AVAILABLE -DOS_PROFILE_FUNCTION_COST
endif
ifdef NITRO_TCM_APPLY
CCFLAGS += -DSDK_TCM_APPLY
endif
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(TWLFIRM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,269 @@
/*---------------------------------------------------------------------------*
Project: TwlFirm - OS
File: os_cache_tag.c
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/os/ARM9/os_cache_tag.h>
#include <nitro/code32.h>
//===========================================================================
// DATA CACHE (for specified range)
//===========================================================================
/*---------------------------------------------------------------------------*
Name: DC_ClearTagAll
Description: clear tag in data cache
Arguments: None
Returns: None.
*---------------------------------------------------------------------------*/
void DC_ClearTagAll( void )
{
DC_FillTagAll( 0 );
}
/*---------------------------------------------------------------------------*
Name: DC_FillTagAll
Description: clear tag in data cache
Arguments: data : fill data
Returns: None.
*---------------------------------------------------------------------------*/
asm void DC_FillTagAll( u32 data )
{
mov r12, #0
@1:
mov r2, #0
@2:
orr r3, r2, r12
mcr p15, 3, r3, c15, c0, 0 // set index
mcr p15, 3, r0, c15, c2, 0 // clear tag
add r2, r2, #HW_CACHE_LINE_SIZE
cmp r2, #HW_DCACHE_SIZE/4
blt @2
add r12, r12, #1<<HW_C7_CACHE_SET_NO_SHIFT
cmp r12, #0
bne @1
bx lr
}
/*---------------------------------------------------------------------------*
Name: DC_ClearDataAll
Description: clear data in data cache
Arguments: None
Returns: None.
*---------------------------------------------------------------------------*/
void DC_ClearDataAll( void )
{
DC_FillDataAll( 0 );
}
/*---------------------------------------------------------------------------*
Name: DC_FillDataAll
Description: fill data in data cache
Arguments: data : fill data
Returns: None.
*---------------------------------------------------------------------------*/
asm void DC_FillDataAll( u32 data )
{
mov r12, #0
@1:
mov r2, #0
@2:
orr r3, r2, r12
mcr p15, 3, r3, c15, c0, 0 // set index
mcr p15, 3, r0, c15, c4, 0 // clear data
add r2, r2, #4
cmp r2, #HW_DCACHE_SIZE/4
blt @2
add r12, r12, #1<<HW_C7_CACHE_SET_NO_SHIFT
cmp r12, #0
bne @1
bx lr
}
/*---------------------------------------------------------------------------*
Name: DC_GetTagAndDataAll
Description: get tag and data in data cache
Arguments: tag tag address
data data address
Returns: None.
*---------------------------------------------------------------------------*/
asm void DC_GetTagAndDataAll( void* tag, void* data )
{
mov r12, #0
@1:
mov r2, #0
@2:
orr r3, r2, r12
mcr p15, 3, r3, c15, c0, 0 // set index
tst r2, #HW_CACHE_LINE_SIZE - 1
mrceq p15, 3, r3, c15, c2, 0 // get tag
streq r3, [r0], #4
mrc p15, 3, r3, c15, c4, 0 // get data
str r3, [r1], #4
add r2, r2, #4
cmp r2, #HW_DCACHE_SIZE/4
blt @2
add r12, r12, #1<<HW_C7_CACHE_SET_NO_SHIFT
cmp r12, #0
bne @1
bx lr
}
//===========================================================================
// INSTRUCTION CACHE
//===========================================================================
/*---------------------------------------------------------------------------*
Name: IC_ClearTagAll
Description: clear tag in instruction cache
Arguments: None
Returns: None.
*---------------------------------------------------------------------------*/
void IC_ClearTagAll( void )
{
IC_FillTagAll( 0 );
}
/*---------------------------------------------------------------------------*
Name: IC_FillTagAll
Description: fill tag in instruction cache
Arguments: None
Returns: None.
*---------------------------------------------------------------------------*/
asm void IC_FillTagAll( u32 data )
{
mov r12, #0
@1:
mov r2, #0
@2:
orr r3, r2, r12
mcr p15, 3, r3, c15, c0, 0 // set index
mcr p15, 3, r0, c15, c1, 0 // clear tag
add r2, r2, #HW_CACHE_LINE_SIZE
cmp r2, #HW_ICACHE_SIZE/4
blt @2
add r12, r12, #1<<HW_C7_CACHE_SET_NO_SHIFT
cmp r12, #0
bne @1
bx lr
}
/*---------------------------------------------------------------------------*
Name: IC_ClearInstructionAll
Description: clear instruction in instruction cache
Arguments: None
Returns: None.
*---------------------------------------------------------------------------*/
void IC_ClearInstructionAll( void )
{
IC_FillInstructionAll( 0 );
}
/*---------------------------------------------------------------------------*
Name: IC_FillInstructionAll
Description: fill instruction in instruction cache
Arguments: data : fill data
Returns: None.
*---------------------------------------------------------------------------*/
asm void IC_FillInstructionAll( u32 data )
{
mov r12, #0
@1:
mov r2, #0
@2:
orr r3, r2, r12
mcr p15, 3, r3, c15, c0, 0 // set index
mcr p15, 3, r0, c15, c3, 0 // clear data
add r2, r2, #4
cmp r2, #HW_ICACHE_SIZE/4
blt @2
add r12, r12, #1<<HW_C7_CACHE_SET_NO_SHIFT
cmp r12, #0
bne @1
bx lr
}
/*---------------------------------------------------------------------------*
Name: IC_GetTagAndInstructionAll
Description: get tag and instruction in instruction cache
Arguments: tag tag address
inst instruction address
Returns: None.
*---------------------------------------------------------------------------*/
asm void IC_GetTagAndInstructionAll( void* tag, void* inst )
{
mov r12, #0
@1:
mov r2, #0
@2:
orr r3, r2, r12
mcr p15, 3, r3, c15, c0, 0 // set index
tst r2, #HW_CACHE_LINE_SIZE - 1
mrceq p15, 3, r3, c15, c1, 0 // get tag
streq r3, [r0], #4
mrc p15, 3, r3, c15, c3, 0 // get data
str r3, [r1], #4
add r2, r2, #4
cmp r2, #HW_ICACHE_SIZE/4
blt @2
add r12, r12, #1<<HW_C7_CACHE_SET_NO_SHIFT
cmp r12, #0
bne @1
bx lr
}
#include <nitro/codereset.h>

View File

@ -0,0 +1,32 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlFirm - libraries - os
# 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 $(TWLFIRM_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS = ARM9 \
ARM7 \
#----------------------------------------------------------------------------
include $(TWLFIRM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,57 @@
/*---------------------------------------------------------------------------*
Project: TwlFirm - OS
File: os_boot.c
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 <firm/os.h>
#include <firm/mi.h>
#ifdef SDK_ARM9
#include <twl/os/ARM9/os_cache_tag.h>
#endif
/*---------------------------------------------------------------------------*
Name: OSi_Finalize
Description: finalize
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void OSi_Finalize(void)
{
(void)OS_DisableIrq();
reg_OS_IE = 0;
reg_OS_IF = 0xffffffff;
#ifdef SDK_ARM7
reg_OS_IE2 = 0;
reg_OS_IF2 = 0xffffffff;
#else // SDK_ARM9
(void)OS_DisableInterrupts();
DC_Disable();
DC_FlushAll();
DC_WaitWriteBufferEmpty();
IC_Disable();
IC_InvalidateAll();
// clear cache
IC_ClearTagAll();
IC_ClearInstructionAll();
DC_ClearTagAll();
DC_ClearDataAll();
OS_DisableProtectionUnit();
#endif // SDK_ARM9
}

View File

@ -0,0 +1,146 @@
/*---------------------------------------------------------------------------*
Project: TwlFirm - OS
File: os_init_firm.c
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 <firm.h>
/*---------------------------------------------------------------------------*
Name: OS_InitNOR
Description: initialize sdk os for norfirm
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
#pragma profile off
void OS_InitNOR(void)
{
#ifdef SDK_ARM9
//---- system shared area check
SDK_ASSERT((u32)&(OS_GetSystemWork()->command_area) == HW_CMD_AREA);
//----------------------------------------------------------------
// for ARM9
#ifdef SDK_ENABLE_ARM7_PRINT
// Init PrintServer for ARM7 (if specified)
OS_InitPrintServer();
#endif
//---- Init Arena (arenas except SUBPRIV-WRAM)
OS_InitArena();
//---- Init interProcessor I/F
// Sync with ARM7 to enable OS_GetConsoleType()
// PXI_Init() must be called before OS_InitArenaEx()
PXI_Init();
//---- Init Spinlock
OS_InitLock();
//---- Init Arena (extended main)
OS_InitArenaEx();
//---- Init IRQ Table
OS_InitIrqTable();
//---- Init IRQ Stack checker
OS_SetIrqStackChecker();
//---- Init Exception System
OS_InitException();
//---- Init MI (Wram bank and DMA0 arranged)
MI_Init();
//---- Init VCountAlarm
OS_InitVAlarm();
//---- Init VRAM exclusive System
OSi_InitVramExclusive();
//---- Init Thread System
#ifndef SDK_NO_THREAD
OS_InitThread();
#endif
//---- Init Reset System
#ifndef SDK_SMALL_BUILD
OS_InitReset();
#endif
//---- Init Cartridge
#ifndef SDK_TEG
// CTRDG_Init();
#endif
//---- Init Card
#ifndef SDK_SMALL_BUILD
// CARD_Init();
#endif
//---- Init Power Manager
#ifndef SDK_TEG
// PM_Init();
#endif
//---- adjust VCOUNT
// OSi_WaitVCount0();
#else // SDK_ARM9
//----------------------------------------------------------------
// for ARM7
//---- Init Arena (SUBPRIV-WRAM arena)
OS_InitArena();
//---- Init interProcessor I/F
PXI_Init();
//---- Init Spinlock
OS_InitLock();
//---- Init IRQ Table
OS_InitIrqTable();
#define SDK_EXCEPTION_BUG
#ifndef SDK_EXCEPTION_BUG
//---- Init Exception System
OS_InitException();
#endif
//---- Init Tick
OS_InitTick();
//---- Init Alarm System
OS_InitAlarm();
//---- Init Thread System
OS_InitThread();
//---- Init Reset System
#ifndef SDK_SMALL_BUILD
OS_InitReset();
#endif
//---- Init Cartridge
#ifndef SDK_TEG
// CTRDG_Init();
#endif
#endif // SDK_ARM9
}
#pragma profile reset

View File

@ -0,0 +1,48 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlFirm - tools - norfirm-print
# 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:$
#----------------------------------------------------------------------------
FIRM_PROC = ARM7
FIRM_TARGET = NORFIRM
SUBDIRS =
LINCLUDES = ../include
#----------------------------------------------------------------------------
TARGET_BIN = twl_norfirm7_print.axf
SRCS = \
main.c \
#SRCDIR = # using default
#LCFILE = # using default
include $(TWLFIRM_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(TWLFIRM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,31 @@
/*---------------------------------------------------------------------------*
Project: TwlFirm - tools - norfirm-print
File: main.c
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 <firm.h>
void TwlSpMain( void )
{
OS_TPrintf( "\nNOR Boot time is %d msec.\n", OS_TicksToMilliSecondsBROM32(OS_GetTick()));
OS_InitNOR();
OS_TPrintf( "\nARM7 starts.\n" );
OS_TPrintf( "\nARM7 ends.\n" );
OS_Terminate();
}

View File

@ -0,0 +1,47 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlFirm - tools - norfirm-print
# 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:$
#----------------------------------------------------------------------------
FIRM_TARGET = NORFIRM
SUBDIRS =
LINCLUDES = ../include
#----------------------------------------------------------------------------
TARGET_BIN = twl_norfirm9_print.axf
SRCS = \
main.c \
#SRCDIR = # using default
#LCFILE = # using default
include $(TWLFIRM_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(TWLFIRM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,31 @@
/*---------------------------------------------------------------------------*
Project: TwlFirm - tools - norfirm-print
File: main.c
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 <firm.h>
void TwlMain( void )
{
OS_TPrintf( "\nNOR Boot time is %d msec.\n", OS_TicksToMilliSecondsBROM32(OS_GetTick()));
OS_InitNOR();
OS_TPrintf( "\nARM9 starts.\n" );
OS_TPrintf( "\nARM9 ends.\n" );
OS_Terminate();
}

View File

@ -0,0 +1,51 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlFirm - build
# 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:$
#----------------------------------------------------------------------------
FIRM_TARGET = NORFIRM
include $(TWLFIRM_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS = \
ARM7 \
ARM9 \
wram_regs \
TARGET_BIN = norfirm_print.nor
BINDIR = .
MAKEFIRM_ARM9 = ARM9/bin/ARM9-$(FIRM_PLATFORM)$(CODEGEN_ARCH)/$(FIRM_BUILD_DIR)/twl_norfirm9_print.axf
MAKEFIRM_ARM7 = ARM7/bin/ARM7-$(FIRM_PLATFORM)$(CODEGEN_ARCH)/$(FIRM_BUILD_DIR)/twl_norfirm7_print.axf
MAKEFIRM_RSA_PRVKEY = $(TWL_KEYSDIR)/rsa/private_nor.der
LDEPENDS_BIN += wram_regs/wram_regs.rbin
NITRO_MAKEROM = TRUE
MAKEFIRM_FLAGS += -p
FIRM_SPEC = norfirm-BB.norsf
#----------------------------------------------------------------------------
do-build: $(TARGET_BIN)
include $(TWLFIRM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,25 @@
#NORSF --- Norfirm Spec File
VERSION : GENERATE
BOOT_NAND : TRUE # TRUE or FALSE
RSA_KEY : $(MAKEFIRM_RSA_PRVKEY)
OUT_KEY : rsa_public.sbin
WRAM_RBIN: ./wram_regs/wram_regs.rbin
DECOMP_PROC : ARM9 # ARM9 or ARM7
ARM9_COMP : TRUE # TRUE or FALSE, should be before ARM9_SBIN
ARM9_SBIN : $(MAKEFIRM_ARM9).sbin
ARM9_ELF : $(MAKEFIRM_ARM9).axf
ARM7_COMP : TRUE # TRUE or FALSE, should be before ARM7_SBIN
ARM7_SBIN : $(MAKEFIRM_ARM7).sbin
ARM7_ELF : $(MAKEFIRM_ARM7).axf
NCD_ROMOFS : 0x07fe00
BAUDRATE : 8M # 4M or 8M
ARM9_X2 : TRUE # TRUE or FALSE

View File

@ -0,0 +1,48 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlFirm - tools - norfirm-print
# 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:$
#----------------------------------------------------------------------------
SUBDIRS =
LINCLUDES = ../include
#----------------------------------------------------------------------------
TARGET_BIN = wram_regs.rbin
SRCS = \
wram_regs.c \
#SRCDIR = # using default
#LCFILE = # using default
include $(TWLFIRM_ROOT)/build/buildtools/commondefs
INSTALL_DIR = .
INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN)
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(TWLFIRM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,91 @@
/*---------------------------------------------------------------------------*
Project: TwlFirm - tools - makenorfirm
File: wram_regs.c
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/mi.h>
#include <firm/format/wram_regs.h>
MIHeader_WramRegs wram_regs_init =
{
// ARM9
{
REG_MI_MBK_A0_FIELD( 1, MI_WRAM_A_OFFSET_0KB , MI_WRAM_ARM7 ),
REG_MI_MBK_A1_FIELD( 1, MI_WRAM_A_OFFSET_64KB , MI_WRAM_ARM7 ),
REG_MI_MBK_A2_FIELD( 1, MI_WRAM_A_OFFSET_128KB, MI_WRAM_ARM7 ),
REG_MI_MBK_A3_FIELD( 1, MI_WRAM_A_OFFSET_192KB, MI_WRAM_ARM7 ),
},
{
REG_MI_MBK_B0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ),
REG_MI_MBK_B1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ),
REG_MI_MBK_B2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ),
REG_MI_MBK_B3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ),
REG_MI_MBK_B4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ),
REG_MI_MBK_B5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ),
REG_MI_MBK_B6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ),
REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ),
},
{
REG_MI_MBK_C0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM9 ),
REG_MI_MBK_C1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM9 ),
REG_MI_MBK_C2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM9 ),
REG_MI_MBK_C3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM9 ),
REG_MI_MBK_C4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM9 ),
REG_MI_MBK_C5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM9 ),
REG_MI_MBK_C6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM9 ),
REG_MI_MBK_C7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM9 ),
},
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_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,
0,
},
// WRAM-0/1
3,
// VRAM-C
7,
// VRAM-D
7,
};

View File

@ -19,12 +19,14 @@
#include <twl.h>
#include <firm/memorymap.h>
#include <firm/os.h>
/*
#include <firm/memorymap.h>
#include <firm/mi.h>
#include <firm/nvram.h>
#include <firm/pm.h>
#include <firm/gcd.h>
*/
/* FIRM_H_ */
#endif

View File

@ -0,0 +1,151 @@
/*---------------------------------------------------------------------------*
Project: TwlFirm - OS - include
File: os_cache_tag.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:: $
$Rev:$
$Author:$
*---------------------------------------------------------------------------*/
#ifndef TWL_OS_CACHE_TAG_H_
#define TWL_OS_CACHE_TAG_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <twl/misc.h>
#include <twl/types.h>
//===========================================================================
// DATA CACHE (for specified range)
//===========================================================================
/*---------------------------------------------------------------------------*
Name: DC_ClearTagAll
Description: clear tag in data cache
Arguments: None
Returns: None.
*---------------------------------------------------------------------------*/
void DC_ClearTagAll( void );
/*---------------------------------------------------------------------------*
Name: DC_ClearDataAll
Description: clear data in data cache
Arguments: None
Returns: None.
*---------------------------------------------------------------------------*/
void DC_ClearDataAll( void );
/*---------------------------------------------------------------------------*
Name: DC_FillTagAll
Description: clear tag in data cache
Arguments: data : fill data
Returns: None.
*---------------------------------------------------------------------------*/
void DC_FillTagAll( u32 data );
/*---------------------------------------------------------------------------*
Name: DC_FillDataAll
Description: fill data in data cache
Arguments: data : fill data
Returns: None.
*---------------------------------------------------------------------------*/
void DC_FillDataAll( u32 data );
/*---------------------------------------------------------------------------*
Name: DC_GetTagAndDataAll
Description: get tag and data in data cache
Arguments: tag tag address
data data address
Returns: None.
*---------------------------------------------------------------------------*/
void DC_GetTagAndDataAll( void* tag, void* data );
//===========================================================================
// INSTRUCTION CACHE
//===========================================================================
/*---------------------------------------------------------------------------*
Name: IC_ClearTagAll
Description: clear tag in instruction cache
Arguments: None
Returns: None.
*---------------------------------------------------------------------------*/
void IC_ClearTagAll( void );
/*---------------------------------------------------------------------------*
Name: IC_ClearInstructionAll
Description: clear instruction in instruction cache
Arguments: None
Returns: None.
*---------------------------------------------------------------------------*/
void IC_ClearInstructionAll( void );
/*---------------------------------------------------------------------------*
Name: IC_FillTagAll
Description: fill tag in instruction cache
Arguments: None
Returns: None.
*---------------------------------------------------------------------------*/
void IC_FillTagAll( u32 data );
/*---------------------------------------------------------------------------*
Name: IC_FillInstructionAll
Description: fill instruction in instruction cache
Arguments: data : fill data
Returns: None.
*---------------------------------------------------------------------------*/
void IC_FillInstructionAll( u32 data );
/*---------------------------------------------------------------------------*
Name: IC_GetTagAndInstructionAll
Description: get tag and instruction in instruction cache
Arguments: tag tag address
inst instruction address
Returns: None.
*---------------------------------------------------------------------------*/
void IC_GetTagAndInstructionAll( void* tag, void* inst );
#ifdef __cplusplus
} /* extern "C" */
#endif
/* TWL_OS_CACHE_TAG_H_ */
#endif