mirror of
https://github.com/rvtr/ctr_firmware.git
synced 2025-10-31 07:51:08 -04:00
VFPデモ追加。i_osSaveContextVFP修正。
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_firmware@158 b871894f-2f95-9b40-918c-086798483c85
This commit is contained in:
parent
6722703730
commit
0485b1ff1e
@ -22,6 +22,7 @@ include $(CTRBROM_ROOT)/build/buildtools/commondefs
|
|||||||
|
|
||||||
SUBDIRS = \
|
SUBDIRS = \
|
||||||
jtag-only \
|
jtag-only \
|
||||||
|
vfp \
|
||||||
thread \
|
thread \
|
||||||
teg-dev \
|
teg-dev \
|
||||||
ctr_bootrom \
|
ctr_bootrom \
|
||||||
|
|||||||
48
trunk/bootrom/build/bootrom/vfp/ARM11/Makefile
Normal file
48
trunk/bootrom/build/bootrom/vfp/ARM11/Makefile
Normal file
@ -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 =====
|
||||||
66
trunk/bootrom/build/bootrom/vfp/ARM11/main.c
Normal file
66
trunk/bootrom/build/bootrom/vfp/ARM11/main.c
Normal file
@ -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 <brom.h>
|
||||||
|
|
||||||
|
#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 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
50
trunk/bootrom/build/bootrom/vfp/ARM9/Makefile
Normal file
50
trunk/bootrom/build/bootrom/vfp/ARM9/Makefile
Normal file
@ -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 =====
|
||||||
24
trunk/bootrom/build/bootrom/vfp/ARM9/main.c
Normal file
24
trunk/bootrom/build/bootrom/vfp/ARM9/main.c
Normal file
@ -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 <brom.h>
|
||||||
|
|
||||||
|
void BromSpMain( void )
|
||||||
|
{
|
||||||
|
osInitException();
|
||||||
|
osInitBROM();
|
||||||
|
}
|
||||||
|
|
||||||
34
trunk/bootrom/build/bootrom/vfp/Makefile
Normal file
34
trunk/bootrom/build/bootrom/vfp/Makefile
Normal file
@ -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 =====
|
||||||
62
trunk/bootrom/build/bootrom/vfp/rom/Makefile
Normal file
62
trunk/bootrom/build/bootrom/vfp/rom/Makefile
Normal file
@ -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 =====
|
||||||
41
trunk/bootrom/build/bootrom/vfp/rom/crt0.c
Normal file
41
trunk/bootrom/build/bootrom/vfp/rom/crt0.c
Normal file
@ -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 <brom/code32.h>
|
||||||
|
#include <brom/types.h>
|
||||||
|
#include <brom/hw/common/mmap_prom.h>
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
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
|
||||||
|
}
|
||||||
@ -76,6 +76,11 @@ asm void osInitContext(
|
|||||||
str r1, [ context, #OS_CONTEXT_R12 ]
|
str r1, [ context, #OS_CONTEXT_R12 ]
|
||||||
str r1, [ context, #OS_CONTEXT_LR ]
|
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
|
bx lr // start here and swicth arm/thumb mode
|
||||||
|
|
||||||
#undef context
|
#undef context
|
||||||
@ -105,7 +110,7 @@ asm BOOL i_osSaveContextVFP( OSContext* context )
|
|||||||
tst r2, #HW_FPEXC_VFP_ENABLE
|
tst r2, #HW_FPEXC_VFP_ENABLE
|
||||||
fmrxne r2, fpscr // VFPコントロールレジスタ保存(VFPイネーブル時)
|
fmrxne r2, fpscr // VFPコントロールレジスタ保存(VFPイネーブル時)
|
||||||
stmiane r1!, {r2}
|
stmiane r1!, {r2}
|
||||||
fstmfdsne r1!, {f0-f31} // VFPレジスタの保存(VFPイネーブル時)
|
fstmiasne r1!, {f0-f31} // VFPレジスタの保存(VFPイネーブル時)
|
||||||
bx lr
|
bx lr
|
||||||
}
|
}
|
||||||
#endif // SDK_CONTEXT_HAS_VFP
|
#endif // SDK_CONTEXT_HAS_VFP
|
||||||
@ -124,9 +129,9 @@ asm BOOL i_osSaveContextVFP( OSContext* context )
|
|||||||
asm BOOL osSaveContext( OSContext* context )
|
asm BOOL osSaveContext( OSContext* context )
|
||||||
{
|
{
|
||||||
#ifdef SDK_CONTEXT_HAS_VFP
|
#ifdef SDK_CONTEXT_HAS_VFP
|
||||||
stmfd sp!, { lr, r0 }
|
stmfd sp!, { r0, lr }
|
||||||
bl i_osSaveContextVFP
|
bl i_osSaveContextVFP
|
||||||
ldmfd sp!, { lr, r0 }
|
ldmfd sp!, { r0, lr }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
add r1, r0, #OS_CONTEXT_CPSR
|
add r1, r0, #OS_CONTEXT_CPSR
|
||||||
@ -176,7 +181,7 @@ asm void i_osLoadContextVFP( OSContext* context )
|
|||||||
ldmia r1!, {r2}
|
ldmia r1!, {r2}
|
||||||
fmxr fpexc, r2
|
fmxr fpexc, r2
|
||||||
tst r2, #HW_FPEXC_VFP_ENABLE
|
tst r2, #HW_FPEXC_VFP_ENABLE
|
||||||
fldmfdsne r1!, {f0-f31}
|
fldmiasne r1!, {f0-f31}
|
||||||
bx lr
|
bx lr
|
||||||
}
|
}
|
||||||
#endif // SDK_CONTEXT_HAS_VFP
|
#endif // SDK_CONTEXT_HAS_VFP
|
||||||
@ -194,9 +199,9 @@ asm void i_osLoadContextVFP( OSContext* context )
|
|||||||
asm void osLoadContext( OSContext* context )
|
asm void osLoadContext( OSContext* context )
|
||||||
{
|
{
|
||||||
#ifdef SDK_CONTEXT_HAS_VFP
|
#ifdef SDK_CONTEXT_HAS_VFP
|
||||||
stmfd sp!, { lr, r0 }
|
stmfd sp!, { r0, lr }
|
||||||
bl i_osLoadContextVFP
|
bl i_osLoadContextVFP
|
||||||
ldmfd sp!, { lr, r0 }
|
ldmfd sp!, { r0, lr }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//---- モードを svc に
|
//---- モードを svc に
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user