diff --git a/trunk/bootrom/build/bootrom/Makefile b/trunk/bootrom/build/bootrom/Makefile index 9c76056..8697bc7 100644 --- a/trunk/bootrom/build/bootrom/Makefile +++ b/trunk/bootrom/build/bootrom/Makefile @@ -22,6 +22,7 @@ include $(CTRBROM_ROOT)/build/buildtools/commondefs SUBDIRS = \ jtag-only \ + vfp \ thread \ teg-dev \ ctr_bootrom \ diff --git a/trunk/bootrom/build/bootrom/vfp/ARM11/Makefile b/trunk/bootrom/build/bootrom/vfp/ARM11/Makefile new file mode 100644 index 0000000..f840a06 --- /dev/null +++ b/trunk/bootrom/build/bootrom/vfp/ARM11/Makefile @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: CtrBrom - bootrom - vfp +# 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$ +#---------------------------------------------------------------------------- + + +BROM_DEF_LINK_SCATLD = TRUE + +SUBDIRS = + + +#---------------------------------------------------------------------------- + +TARGET_BIN = vfp11.padbin + +SRCS = \ + main.c \ + +#SRCDIR = # using default +#LCFILE = # using default + +include $(CTRBROM_ROOT)/build/buildtools/commondefs + +INSTALL_DIR = .. +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN_BASENAME).axf + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(CTRBROM_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/trunk/bootrom/build/bootrom/vfp/ARM11/main.c b/trunk/bootrom/build/bootrom/vfp/ARM11/main.c new file mode 100644 index 0000000..141e0ee --- /dev/null +++ b/trunk/bootrom/build/bootrom/vfp/ARM11/main.c @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------------* + Project: TwlBrom - vfp + 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 + +#define THREAD1_PRIO 10 +#define STACK_SIZE 1024 + +OSThread thread1; +u64 stack1[STACK_SIZE / sizeof(u64)]; +void proc1(void *arg); + +float f0 = 1; +float f1 = 1; + +void BromMain( void ) +{ + s32 n; + + osInitException(); + osInitBROM(); + + osPrintf( "ARM11: start\n" ); + + osInitThread(); + osCreateThread( &thread1, proc1, (void *)0x111, stack1 + STACK_SIZE / sizeof(u64), STACK_SIZE, THREAD1_PRIO ); + + for (n = 0; n < 5; n++) + { + osPrintf( "BromMain\n" ); + osWakeupThreadDirect( &thread1 ); + } +} + +//-------------------------------------------------------------------------------- +// proc1 +// +void proc1(void *arg) +{ +#ifdef SDK_FINALROM +#pragma unused( arg ) +#endif + while (1) + { + osPrintf( "Thread1: (%x)\n", (u32)arg ); + // 1回目のみVFP例外発生 + f0+=f1; + // osVSNPrintf は %f 非サポート + osPrintf( "Thread1: %f\n", f0 ); + osSleepThread( NULL ); + } +} + diff --git a/trunk/bootrom/build/bootrom/vfp/ARM9/Makefile b/trunk/bootrom/build/bootrom/vfp/ARM9/Makefile new file mode 100644 index 0000000..b39eb38 --- /dev/null +++ b/trunk/bootrom/build/bootrom/vfp/ARM9/Makefile @@ -0,0 +1,50 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: CtrBrom - bootrom - vfp +# 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$ +#---------------------------------------------------------------------------- + + +#BROM_DEF_LINK_SCATLD = TRUE + +BROM_PROC = ARM9 + +SUBDIRS = + + +#---------------------------------------------------------------------------- + +TARGET_BIN = vfp9.padbin + +SRCS = \ + main.c \ + +#SRCDIR = # using default +#LCFILE = # using default + +include $(CTRBROM_ROOT)/build/buildtools/commondefs + +INSTALL_DIR = .. +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN_BASENAME).axf + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(CTRBROM_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/trunk/bootrom/build/bootrom/vfp/ARM9/main.c b/trunk/bootrom/build/bootrom/vfp/ARM9/main.c new file mode 100644 index 0000000..0937a31 --- /dev/null +++ b/trunk/bootrom/build/bootrom/vfp/ARM9/main.c @@ -0,0 +1,24 @@ +/*---------------------------------------------------------------------------* + Project: TwlBrom - vfp + 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 + +void BromSpMain( void ) +{ + osInitException(); + osInitBROM(); +} + diff --git a/trunk/bootrom/build/bootrom/vfp/Makefile b/trunk/bootrom/build/bootrom/vfp/Makefile new file mode 100644 index 0000000..75a0861 --- /dev/null +++ b/trunk/bootrom/build/bootrom/vfp/Makefile @@ -0,0 +1,34 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: CtrBrom - build +# 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$ +#---------------------------------------------------------------------------- + +include $(CTRBROM_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + ARM11 \ + ARM9 \ + rom \ + +#---------------------------------------------------------------------------- + +include $(CTRBROM_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/trunk/bootrom/build/bootrom/vfp/rom/Makefile b/trunk/bootrom/build/bootrom/vfp/rom/Makefile new file mode 100644 index 0000000..5bd4e84 --- /dev/null +++ b/trunk/bootrom/build/bootrom/vfp/rom/Makefile @@ -0,0 +1,62 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: CtrBrom - bootrom - vfp +# 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$ +#---------------------------------------------------------------------------- + +BROM_PROMGEN = TRUE + +SUBDIRS = + +LINCLUDES = ../include + +#---------------------------------------------------------------------------- + +TARGET_BIN = twl_bootrom.exo + +CRT0_O = + +SRCS = \ + crt0.c \ + +#SRCDIR = # using default +#LCFILE = # using default + +BROM_PADBIN_ARM11 = ../ARM11/bin/$(BROM_BUILDTYPE_ARM11)/vfp11.padbin +BROM_PADBIN_ARM9 = ../ARM9/bin/$(BROM_BUILDTYPE_ARM9)/vfp9.padbin +BROM_DEPENDS = $(BROM_PADBIN_ARM11) $(BROM_PADBIN_ARM9) + +MACRO_FLAGS += -DBROM_PADBIN_ARM11=$(BROM_PADBIN_ARM11) \ + -DBROM_PADBIN_ARM9=$(BROM_PADBIN_ARM9) \ + + +include $(CTRBROM_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(BROM_INSTALL_PROMDIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(CTRBROM_ROOT)/build/buildtools/modulerules + + +crt0.c : $(BROM_DEPENDS) + touch crt0.c + + +#===== End of Makefile ===== diff --git a/trunk/bootrom/build/bootrom/vfp/rom/crt0.c b/trunk/bootrom/build/bootrom/vfp/rom/crt0.c new file mode 100644 index 0000000..6fc177c --- /dev/null +++ b/trunk/bootrom/build/bootrom/vfp/rom/crt0.c @@ -0,0 +1,41 @@ +/*---------------------------------------------------------------------------* + Project: CtrBrom - bootrom - init + File: crt0.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 + +/*---------------------------------------------------------------------------* + Name: _start + + Description: Start up + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +asm void _start( void ) +{ + PRESERVE8 + + EXPORT CTR_BROM_ARM11 + EXPORT CTR_BROM_ARM9 + +CTR_BROM_ARM11 + INCBIN BROM_PADBIN_ARM11 +CTR_BROM_ARM9 + INCBIN BROM_PADBIN_ARM9 +} diff --git a/trunk/bootrom/build/libraries/os/common/os_context.c b/trunk/bootrom/build/libraries/os/common/os_context.c index f368671..8df225e 100644 --- a/trunk/bootrom/build/libraries/os/common/os_context.c +++ b/trunk/bootrom/build/libraries/os/common/os_context.c @@ -76,6 +76,11 @@ asm void osInitContext( str r1, [ context, #OS_CONTEXT_R12 ] str r1, [ context, #OS_CONTEXT_LR ] + // ---- VFPレジスタを初期化 +#ifdef SDK_CONTEXT_HAS_VFP + str r1, [ context, #__cpp(offsetof(OSContext,fpexc)) ] +#endif + bx lr // start here and swicth arm/thumb mode #undef context @@ -105,7 +110,7 @@ asm BOOL i_osSaveContextVFP( OSContext* context ) tst r2, #HW_FPEXC_VFP_ENABLE fmrxne r2, fpscr // VFPコントロールレジスタ保存(VFPイネーブル時) stmiane r1!, {r2} - fstmfdsne r1!, {f0-f31} // VFPレジスタの保存(VFPイネーブル時) + fstmiasne r1!, {f0-f31} // VFPレジスタの保存(VFPイネーブル時) bx lr } #endif // SDK_CONTEXT_HAS_VFP @@ -124,9 +129,9 @@ asm BOOL i_osSaveContextVFP( OSContext* context ) asm BOOL osSaveContext( OSContext* context ) { #ifdef SDK_CONTEXT_HAS_VFP - stmfd sp!, { lr, r0 } + stmfd sp!, { r0, lr } bl i_osSaveContextVFP - ldmfd sp!, { lr, r0 } + ldmfd sp!, { r0, lr } #endif add r1, r0, #OS_CONTEXT_CPSR @@ -176,7 +181,7 @@ asm void i_osLoadContextVFP( OSContext* context ) ldmia r1!, {r2} fmxr fpexc, r2 tst r2, #HW_FPEXC_VFP_ENABLE - fldmfdsne r1!, {f0-f31} + fldmiasne r1!, {f0-f31} bx lr } #endif // SDK_CONTEXT_HAS_VFP @@ -194,9 +199,9 @@ asm void i_osLoadContextVFP( OSContext* context ) asm void osLoadContext( OSContext* context ) { #ifdef SDK_CONTEXT_HAS_VFP - stmfd sp!, { lr, r0 } + stmfd sp!, { r0, lr } bl i_osLoadContextVFP - ldmfd sp!, { lr, r0 } + ldmfd sp!, { r0, lr } #endif //---- モードを svc に