OSDN Git Service

add cortex-m3
authorryuz <ryuz@users.sourceforge.jp>
Tue, 1 Mar 2011 14:08:49 +0000 (23:08 +0900)
committerryuz <ryuz@users.sourceforge.jp>
Tue, 1 Mar 2011 14:08:49 +0000 (23:08 +0900)
kernel/build/arm/cortex_m3/gcc/Makefile [new file with mode: 0644]
kernel/include/arch/proc/arm/arm_v7m/proc.h [new file with mode: 0644]
kernel/include/arch/proc/arm/arm_v7m/procatr.h [new file with mode: 0644]
kernel/source/arch/proc/arm/arm_v7m/gcc/kcre_ctx.S [new file with mode: 0644]
kernel/source/arch/proc/arm/arm_v7m/gcc/kdis_int.S [new file with mode: 0644]
kernel/source/arch/proc/arm/arm_v7m/gcc/kena_int.S [new file with mode: 0644]
kernel/source/arch/proc/arm/arm_v7m/gcc/krst_ctx.S [new file with mode: 0644]
kernel/source/arch/proc/arm/arm_v7m/gcc/kswi_ctx.S [new file with mode: 0644]
kernel/source/arch/proc/arm/arm_v7m/gcc/kwai_int.S [new file with mode: 0644]

diff --git a/kernel/build/arm/cortex_m3/gcc/Makefile b/kernel/build/arm/cortex_m3/gcc/Makefile
new file mode 100644 (file)
index 0000000..47c230a
--- /dev/null
@@ -0,0 +1,158 @@
+# ----------------------------------------------------------------------------
+# Hyper Operating System V4 Advance
+#  makefile for Cortex-M3
+#
+# Copyright (C) 1998-2011 by Project HOS
+# http://sourceforge.jp/projects/hos/
+# ----------------------------------------------------------------------------
+
+
+
+# --------------------------------------
+#  %jp{各種設定}%en{setting}
+# --------------------------------------
+
+# %jp{ターゲットライブラリ名}%en{target library name}
+TARGET ?= libhosv4a
+
+
+# %jp{ツール定義}%jp{tools}
+GCC_ARCH ?= arm-none-eabi-
+CMD_CC   ?= $(GCC_ARCH)gcc
+CMD_ASM  ?= $(GCC_ARCH)gcc
+CMD_LIBR ?= $(GCC_ARCH)ar
+
+
+# %jp{アーキテクチャ定義}%en{architecture}
+ARCH_NAME ?= cortex_m3
+ARCH_PROC ?= arm/arm_v7m
+ARCH_IRC  ?= none
+ARCH_CC   ?= gcc
+
+
+# %jp{ディレクトリ定義}%en{directories}
+TOP_DIR           = ../../../../..
+KERNEL_DIR        = $(TOP_DIR)/kernel
+KERNEL_MAKINC_DIR = $(KERNEL_DIR)/build/common/gmake
+INC_PROC_DIR      = $(KERNEL_DIR)/include/arch/proc/$(ARCH_PROC)
+INC_IRC_DIR       = $(KERNEL_DIR)/include/arch/irc/$(ARCH_IRC)
+SRC_PROC_DIR      = $(KERNEL_DIR)/source/arch/proc/$(ARCH_PROC)
+SRC_PROC_CC_DIR   = $(KERNEL_DIR)/source/arch/proc/$(ARCH_PROC)/$(ARCH_CC)
+SRC_IRC_DIR       = $(KERNEL_DIR)/source/arch/irc/$(ARCH_IRC)
+SRC_IRC_CC_DIR    = $(KERNEL_DIR)/source/arch/irc/$(ARCH_IRC)/$(ARCH_CC)
+CFGRTR_DIR        = $(TOP_DIR)/cfgrtr/build/gcc
+
+
+# %jp{コンフィギュレータ定義}%en{kernel configurator}
+CFGRTR = h4acfg-$(ARCH_NAME)
+
+
+# %jp{カーネル指定}%en{kernel flag}
+KERNEL = Yes
+
+
+# %jp{共通定義読込み}%en{common setting}
+include $(KERNEL_MAKINC_DIR)/common.inc
+
+
+# %jp{パス設定}%en{add source directories}
+INC_DIRS += $(INC_PROC_DIR) $(INC_IRC_DIR)
+SRC_DIRS += $(SRC_PROC_DIR) $(SRC_PROC_DIR) $(SRC_PROC_CC_DIR) $(SRC_IRC_DIR) $(SRC_IRC_CC_DIR)
+
+
+# %jp{オプションフラグ}%en{option flags}
+AFLAGS  = -mcpu=cortex-m3 -mthumb
+CFLAGS  = -mcpu=cortex-m3 -mthumb
+ARFLAGS = 
+
+
+# %jp{コンパイラ依存の設定読込み}%en{compiler dependent definitions}
+include $(KERNEL_MAKINC_DIR)/$(ARCH_CC)_d.inc
+
+# %jp{ライブラリ生成用設定読込み}%en{definitions for library}
+include $(KERNEL_MAKINC_DIR)/maklib_d.inc
+
+
+
+
+# --------------------------------------
+#  %jp{ソースファイル}%en{source files}
+# --------------------------------------
+
+# %jp{アセンブラファイルの追加}%en{assembry sources}
+ASRCS += $(SRC_PROC_CC_DIR)/kdis_int.S
+ASRCS += $(SRC_PROC_CC_DIR)/kena_int.S
+ASRCS += $(SRC_PROC_CC_DIR)/kcre_ctx.S
+ASRCS += $(SRC_PROC_CC_DIR)/krst_ctx.S
+ASRCS += $(SRC_PROC_CC_DIR)/kswi_ctx.S
+ASRCS += $(SRC_PROC_CC_DIR)/kwai_int.S
+
+
+
+
+# %jp{C言語ファイルの追加}%en{C sources}
+#CSRCS += $(SRC_PROC_DIR)/val_int.c
+#CSRCS += $(SRC_IRC_DIR)/kini_irc.c
+#CSRCS += $(SRC_IRC_DIR)/kexe_irc.c
+#CSRCS += $(SRC_IRC_DIR)/ena_int.c
+#CSRCS += $(SRC_IRC_DIR)/dis_int.c
+#CSRCS += $(SRC_IRC_DIR)/vclr_int.c
+
+
+# %jp{カーネル共通ソースの追加}%en{kernel common sources}
+include $(KERNEL_MAKINC_DIR)/knlsrc.inc
+
+
+
+
+# --------------------------------------
+#  %jp{ルール定義}%en{rules}
+# --------------------------------------
+
+# %jp{ALL}%en{all}
+.PHONY : all
+all: makelib_all
+       $(MAKE) -C $(CFGRTR_DIR) TARGET=$(CFGRTR) ARCH_PROC=$(ARCH_PROC) ARCH_IRC=$(ARCH_IRC)
+
+# %jp{クリーン}%en{clean}
+.PHONY : clean
+clean: makelib_clean
+       $(MAKE) -C $(CFGRTR_DIR) TARGET=$(CFGRTR) ARCH_PROC=$(ARCH_PROC) ARCH_IRC=$(ARCH_IRC) clean
+       $(RM) -f *.lst
+
+# %jp{依存関係更新}%en{make depend}
+.PHONY : depend
+depend: makelib_depend
+
+# %jp{ソース一括コピー}%en{source files copy}
+.PHONY : srccpy
+srccpy: makelib_srccpy
+
+
+# %jp{ライブラリ生成用設定読込み}%en{rules for library}
+include $(KERNEL_MAKINC_DIR)/maklib_r.inc
+
+# %jp{コンパイラ依存のルール定義読込み}%en{rules for compiler}
+include $(KERNEL_MAKINC_DIR)/$(ARCH_CC)_r.inc
+
+
+
+
+# --------------------------------------
+#  %jp{依存関係}%en{dependency}
+# --------------------------------------
+
+# %jp{カーネル依存関係読込み}{dependency list of kernel sources}
+include $(KERNEL_MAKINC_DIR)/knldep.inc
+
+
+$(OBJS_DIR)/val_int.$(EXT_OBJ) :       $(COMMON_HEADERS)
+$(OBJS_DIR)/kini_irc.$(EXT_OBJ)        :       $(COMMON_HEADERS)
+$(OBJS_DIR)/kexe_irc.$(EXT_OBJ)        :       $(COMMON_HEADERS)
+$(OBJS_DIR)/ena_int.$(EXT_OBJ) :       $(COMMON_HEADERS)
+$(OBJS_DIR)/dis_int.$(EXT_OBJ) :       $(COMMON_HEADERS)
+$(OBJS_DIR)/vclr_int.$(EXT_OBJ)        :       $(COMMON_HEADERS)
+
+
+
+# end of file
diff --git a/kernel/include/arch/proc/arm/arm_v7m/proc.h b/kernel/include/arch/proc/arm/arm_v7m/proc.h
new file mode 100644 (file)
index 0000000..065548f
--- /dev/null
@@ -0,0 +1,85 @@
+/** 
+ *  Hyper Operating System V4 Advance
+ *
+ * @file  proc.h
+ * @brief %jp{ARM v7-M}%en{ARM v7-M}
+ *
+ * Copyright (C) 1998-2011 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#ifndef _KERNEL__arch__proc__arm__arm_v7m__proc_h__
+#define _KERNEL__arch__proc__arm__arm_v7m__proc_h__
+
+
+
+#define _KERNEL_IMSK_F         0x40            /**< %jp{FIQ割込みマスクビット} */
+#define _KERNEL_IMSK_I         0x80            /**< %jp{IRQ割込みマスクビット} */
+
+#define _KERNEL_IMSK_LV0       0xc0            /**< %jp{割込みマスクレベル0(すべてマスク)} */
+#define _KERNEL_IMSK_LV1       0x80            /**< %jp{割込みマスクレベル1(FIQのみ許可)} */
+#define _KERNEL_IMSK_LV2       0x00            /**< %jp{割込みマスクレベル2(すべて許可)} */
+
+
+
+/** %jp{コンテキスト制御ブロック} */
+typedef struct _kernel_t_ctxcb
+{
+       VP      sp;
+} _KERNEL_T_CTXCB;
+
+/** %jp{割込みコンテキスト制御ブロック} */
+typedef struct _kernel_t_ictxcb
+{
+       UB  imsk;
+       UB      intcnt;
+       VP      isp;
+} _KERNEL_T_ICTXCB;
+
+
+extern _KERNEL_T_ICTXCB _kernel_ictxcb;                /**< %jp{割込みコンテキスト制御ブロック} */
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void    _kernel_ena_int(void);                                                                                                                                         /**< %jp{割込み許可} */
+void    _kernel_dis_int(void);                                                                                                                                         /**< %jp{割込み禁止} */
+void    _kernel_wai_int(void);                                                                                                                                         /**< %jp{割込み待ち(アイドル時の処理)} */
+
+void    _kernel_cre_ctx(_KERNEL_T_CTXCB *pk_ctxcb, VP isp, FP entry, VP_INT par1, VP_INT par2);                /**< %jp{実行コンテキストの作成} */
+void    _kernel_rst_ctx(VP_INT par1, VP_INT par2, FP entry, VP isp);                                                           /**< %jp{実行コンテキストのリスタート} */
+void    _kernel_sta_ctx(_KERNEL_T_CTXCB *pk_ctxcb);                                                                                                    /**< %jp{実行コンテキストの開始} */
+void    _kernel_swi_ctx(_KERNEL_T_CTXCB *pk_ctxinf_nxt, _KERNEL_T_CTXCB *pk_ctxcb_now);                                /**< %jp{実行コンテキストの切替} */
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#define _KERNEL_INI_PRC()                      do {} while (0)                                                                                                 /**< %jp{プロセッサ固有の初期化} */
+
+#define _KERNEL_INI_INT(stksz, stk)    do { _kernel_ictxcb.isp = (VB *)(stk) + (stksz); } while (0)    /**< %jp{割込み初期化} */
+#define _KERNEL_ENA_INT()                      _kernel_ena_int()                                                                                               /**< %jp{割込み許可} */
+#define _KERNEL_DIS_INT()                      _kernel_dis_int()                                                                                               /**< %jp{割込み禁止} */
+#define _KERNEL_WAI_INT()                      _kernel_wai_int()                                                                                               /**< %jp{割込み待ち(アイドル時の処理)} */
+
+#define _KERNEL_CRE_CTX(pk_ctxcb, stksz, stk, isp, entry, exinf1, exinf2)              \
+                                                                       _kernel_cre_ctx((pk_ctxcb), (isp), (entry), (exinf1), (exinf2)) /**< %jp{実行コンテキストの作成} */  
+#define _KERNEL_DEL_CTX(pk_ctxcb)      do {} while (0)                                                                                                 /**< %jp{実行コンテキストの削除} */
+#define _KERNEL_RST_CTX(pk_ctxcb, stksz, stk, isp, entry, exinf1, exinf2)              \
+                                                                       _kernel_rst_ctx((exinf1), (exinf2), (entry), (isp))                             /**< %jp{実行コンテキストのリスタート} */
+#define _KERNEL_STA_CTX(pk_ctxcb)      _kernel_sta_ctx(pk_ctxcb)
+#define _KERNEL_SWI_CTX(pk_ctxcb_now, pk_ctxinf_nxt)                                                   \
+                                                                       _kernel_swi_ctx((pk_ctxinf_nxt), (pk_ctxcb_now))                                /**< %jp{実行コンテキストの切替} */
+
+
+#endif /* _KERNEL__arch__proc__arm__arm_v7m__proc_h__ */
+
+
+
+/* end of file */
diff --git a/kernel/include/arch/proc/arm/arm_v7m/procatr.h b/kernel/include/arch/proc/arm/arm_v7m/procatr.h
new file mode 100644 (file)
index 0000000..d95d7a1
--- /dev/null
@@ -0,0 +1,66 @@
+/** 
+ *  Hyper Operating System V4 Advance
+ *
+ * @file  procatr.h
+ * @brief %jp{ARM v7-M}%en{ARM v7-M}
+ *
+ * Copyright (C) 1998-2011 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#ifndef _KERNEL__arch__proc__arm__arm_v7m__procatr_h__
+#define _KERNEL__arch__proc__arm__arm_v7m__procatr_h__
+
+
+
+/* %jp{プロセッサアーキテクチャ定義のあるインクルードパス} */
+#define _KERNEL_PROCATR_INC_PATH                       "arm/arm_v7m"
+
+
+/* %jp{プロセッサアーキテクチャに依存した属性} */
+#define _KERNEL_PROCATR_CTX_STK                                FALSE           /**< %jp{コンテキスト生成にスタック領域の指定が必要か?} */
+#define _KERNEL_PROCATR_CTX_STKSZ                      FALSE           /**< %jp{コンテキスト生成にスタックサイズの指定が必要か?} */
+#define _KERNEL_PROCATR_CTX_ISP                                TRUE            /**< %jp{コンテキスト生成に初期スタックポインタ値が必要か?} */
+#define _KERNEL_PROCATR_CTX_DEL                                FALSE           /**< %jp{別コンテキストからのコンテキスト削除が必要か?} */
+#define _KERNEL_PROCATR_CTX_RST                                TRUE            /**< %jp{自コンテキストのリスタートが可能か?} */
+
+#define _KERNEL_PROCATR_TMIN_STKSZ                     (4*16)          /**< %jp{最低限必要なスタックサイズ(byte単位)} */
+#define _KERNEL_PROCATR_DEF_SYSSTKSZ           64
+#define _KERNEL_PROCATR_DEF_INTSTKSZ           256
+
+#define _KERNEL_PROCATR_SPT_SMP                                FALSE           /**< %jp{SMPに対応しているか?} */
+#define _KERNEL_PROCATR_SPT_MULTINT                    TRUE            /**< %jp{多重割込みに対応しているか?} */
+
+#define _KERNEL_PROCATR_TMIN_INHNO                     0                       /**< %jp{割込みハンドラ番号の最小値} */
+#define _KERNEL_PROCATR_TMAX_INHNO                     1                       /**< %jp{割込みハンドラ番号の最大値} */
+
+#define _KERNEL_PROCATR_TMIN_EXCNO                     0                       /**< %jp{CPU例外ハンドラ番号の最小値} */
+#define _KERNEL_PROCATR_TMAX_EXCNO                     4                       /**< %jp{CPU例外ハンドラ番号の最大値} */
+
+#define _KERNEL_PROCATR_SYSSTK_NUM                     2                       /**< %jp{システムスタックは何本必要か?} */
+
+#define _KERNEL_PROCATR_SIGNED_INT                     0                       /**< %jp{符号付整数と符号無し整数のどちらが得意か?(符号付き:1, 符号無し:-1, 同じ:0)} */
+#define _KERNEL_PROCATR_TBIT_INT                       32                      /**< %jp{プロセッサに最適な整数型のビット数} */
+#define _KERNEL_PROCATR_TBIT_PTR                       32                      /**< %jp{ポインタのビット数} */
+#define _KERNEL_PROCATR_MEM_ALIGN                      32                      /**< %jp{適切なメモリのアライメント(byte単位)} */
+#define _KERNEL_PROCATR_STK_ALIGN                      8                       /**< %jp{適切なスタックのアライメント(byte単位)} */
+#define _KERNEL_PROCATR_ALLOW_UNALIGN          FALSE           /**< %jp{アンアラインアクセスは可能か?} */
+
+
+/* %jp{ARM固有の定数} */
+#define _KERNEL_ARM_INHNO_IRQ                          0                       /**< %jp{IRQ割込みの割込みハンドラ番号} */
+#define _KERNEL_ARM_INHNO_FIQ                          1                       /**< %jp{FIQ割込みの割込みハンドラ番号} */
+
+#define _KERNEL_ARM_EXCNO_RST                          0                       /**< %jp{リセットのCPU例外ハンドラ番号} */
+#define _KERNEL_ARM_EXCNO_UND                          1                       /**< %jp{無効命令例外のCPU例外ハンドラ番号} */
+#define _KERNEL_ARM_EXCNO_SWI                          2                       /**< %jp{ソフトウェア割込みのCPU例外ハンドラ番号} */
+#define _KERNEL_ARM_EXCNO_PRE                          3                       /**< %jp{プリフェッチアボートのCPU例外ハンドラ番号} */
+#define _KERNEL_ARM_EXCNO_ABT                          4                       /**< %jp{データアボートのCPU例外ハンドラ番号} */
+
+
+
+#endif /* _KERNEL__arch__proc__arm__arm_v7m__procatr_h__ */
+
+
+/* end of file */
diff --git a/kernel/source/arch/proc/arm/arm_v7m/gcc/kcre_ctx.S b/kernel/source/arch/proc/arm/arm_v7m/gcc/kcre_ctx.S
new file mode 100644 (file)
index 0000000..cd41ea7
--- /dev/null
@@ -0,0 +1,53 @@
+/** 
+ *  Hyper Operating System V4 Advance
+ *
+ * Copyright (C) 1998-2011 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+                               .text
+                               .align  2
+
+
+/************************************************
+  実行コンテキストの作成
+  void _kernel_cre_ctx(
+                       _KERNEL_T_CTXCB *pk_ctxcb,      r0   :作成するコンテキスト
+                       VP             isp,                     r1   :スタックポインタ
+                       FP             entry,           r2   :実行アドレス
+                       VP_INT         par1,            r3   :実行時パラメータ
+                       VP_INT         par2)            sp[0]:実行時パラメータ
+ ************************************************/
+                               .global _kernel_cre_ctx
+                               .thumb
+                               .thumb_func
+                               .type   _kernel_cre_ctx, %function
+_kernel_cre_ctx:
+                               sub             r1, #36                                         /* スタックを確保 */
+                               str             r2, [r1, #0]                            /* r4 部分にentryを設定 */
+                               str             r3, [r1, #4]                            /* r5 部分にpar1を設定 */
+                               ldr             r2, [sp, #0]                            /* par2を取り出し */
+                               str             r2, [r1, #8]                            /* r6 部分にpar2を設定 */
+                               movw    r2, #:lower16:ctx_entry
+                               movt    r2, #:upper16:ctx_entry
+                               str             r2, [r1, #32]                           /* lr 部分にエントリーアドレスを設定 */
+                               str             r1, [r0]                                        /* ctxcb に新 sp を保存 */
+                               bx              lr                                                      /* リターン */
+
+/************************************************
+  実行コンテキストエントリーアドレス
+ ************************************************/
+ctx_entry:
+                               mov             r0, r5                                          /* par1を設定 */
+                               mov             r1, r6                                          /* par2を設定 */
+                               bx              r4                                                      /* entry を実行 */
+
+
+                               .size   _kernel_cre_ctx, .-_kernel_cre_ctx
+
+
+                               .end
+
+
+/* end of file */
diff --git a/kernel/source/arch/proc/arm/arm_v7m/gcc/kdis_int.S b/kernel/source/arch/proc/arm/arm_v7m/gcc/kdis_int.S
new file mode 100644 (file)
index 0000000..c276ed5
--- /dev/null
@@ -0,0 +1,29 @@
+/** 
+ *  Hyper Operating System V4 Advance
+ *
+ * Copyright (C) 1998-2011 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+
+                               .text
+                               .align  2
+
+/************************************************
+   割り込み禁止
+   void _kernel_dis_int(void)
+ ************************************************/
+                               .global _kernel_dis_int
+                               .thumb
+                               .thumb_func
+                               .type   _kernel_dis_int, %function
+_kernel_dis_int:
+                               cpsid   i                       /* 割り込み禁止 */
+                               bx              lr                      /* リターン */
+                               .size   _kernel_dis_int, .-_kernel_dis_int
+
+                               .end
+
+
+/* end of file */
diff --git a/kernel/source/arch/proc/arm/arm_v7m/gcc/kena_int.S b/kernel/source/arch/proc/arm/arm_v7m/gcc/kena_int.S
new file mode 100644 (file)
index 0000000..d17a64a
--- /dev/null
@@ -0,0 +1,29 @@
+/** 
+ *  Hyper Operating System V4 Advance
+ *
+ * Copyright (C) 1998-2011 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+                               .text
+                               .align  2
+
+/************************************************
+  割り込み許可
+  void _kernel_ena_int(void)
+ ************************************************/
+                               .global _kernel_ena_int
+                               .thumb
+                               .thumb_func
+                               .type   _kernel_ena_int, %function
+_kernel_ena_int:
+                               cpsie   i                       /* 割り込み許可 */
+                               bx              lr                      /* リターン */
+                               .size   _kernel_ena_int, .-_kernel_ena_int
+
+
+                               .end
+
+
+/* end of file */
diff --git a/kernel/source/arch/proc/arm/arm_v7m/gcc/krst_ctx.S b/kernel/source/arch/proc/arm/arm_v7m/gcc/krst_ctx.S
new file mode 100644 (file)
index 0000000..8c76c25
--- /dev/null
@@ -0,0 +1,32 @@
+/** 
+ *  Hyper Operating System V4 Advance
+ *
+ * Copyright (C) 1998-2011 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+                               .text
+                               .align  2
+
+/************************************************
+  実行コンテキストのリスタート
+  void _kernel_rst_ctx(
+                       VP_INT         par1,    r0 : 実行時パラメータ
+                       VP_INT         par2,    r1 : 実行時パラメータ
+                       FP             entry,   r2 : 実行アドレス
+                       VP             isp)             r3 : スタックポインタ
+ ************************************************/
+                               .global _kernel_rst_ctx
+                               .thumb
+                               .thumb_func
+                               .type   _kernel_rst_ctx, %function
+_kernel_rst_ctx:
+                               mov             sp, r3          /* スタックを初期値にリセット */
+                               bx              r2                      /* エントリーアドレスから再開始 */
+                               .size   _kernel_rst_ctx, .-_kernel_rst_ctx
+
+                               .end
+
+
+/* end of file */
diff --git a/kernel/source/arch/proc/arm/arm_v7m/gcc/kswi_ctx.S b/kernel/source/arch/proc/arm/arm_v7m/gcc/kswi_ctx.S
new file mode 100644 (file)
index 0000000..21923ba
--- /dev/null
@@ -0,0 +1,53 @@
+/** 
+ *  Hyper Operating System V4 Advance
+ *
+ * Copyright (C) 1998-2011 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+
+                               .text
+                               .align  2
+
+/************************************************
+  実行コンテキストの切替
+  void _kernel_swi_ctx(
+                       _KERNEL_T_CTXCB *pk_ctxinf_nxt, r0 : 現在のコンテキストの保存先
+                       _KERNEL_T_CTXCB *pk_ctxinf_now) r1 : 切り替えるコンテキスト
+ ************************************************/
+                               .global _kernel_swi_ctx
+                               .thumb
+                               .thumb_func
+                               .type   _kernel_swi_ctx, %function
+_kernel_swi_ctx:
+                               push    {r4-r7, lr}                     /* レジスタ保存 */
+                               mov             r4, sp
+                               str             r4, [r1]
+               /* --- そのまま _kernel_sta_ctx に続ける */
+
+
+/************************************************
+  実行コンテキストの開始
+  void _kernel_sta_ctx(
+                       _KERNEL_T_CTXCB *pk_ctxcb)              r0: 実行を開始するコンテキスト
+ ************************************************/
+                               .global _kernel_sta_ctx
+                               .thumb
+                               .thumb_func
+                               .type   _kernel_sta_ctx, %function
+_kernel_sta_ctx:
+                               ldr             r4, [r0]                        /* スタックポインタ復帰 */
+                               mov             sp, r4
+                               pop             {r4-r7, pc}                     /* レジスタ復帰 */
+
+                               .size   _kernel_swi_ctx, .-_kernel_swi_ctx
+                               .size   _kernel_sta_ctx, .-_kernel_sta_ctx
+
+
+
+                               .end
+
+
+; end of file
+
diff --git a/kernel/source/arch/proc/arm/arm_v7m/gcc/kwai_int.S b/kernel/source/arch/proc/arm/arm_v7m/gcc/kwai_int.S
new file mode 100644 (file)
index 0000000..4fcbf39
--- /dev/null
@@ -0,0 +1,30 @@
+/** 
+ *  Hyper Operating System V4 Advance
+ *
+ * Copyright (C) 1998-2011 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+
+                               .text
+                               .align  2
+
+/************************************************
+  割り込み待ち(CPUのアイドル処理)
+  void         _kernel_wai_int(void);
+ ************************************************/
+                               .global _kernel_wai_int
+                               .thumb
+                               .thumb_func
+                               .type   _kernel_wai_int, %function
+_kernel_wai_int:
+               /*              mcr             p15, 0, r0, c7, c0, 4   */      /* WaitForInterrupt */
+                               b               _kernel_wai_int
+                               .size   _kernel_wai_int, .-_kernel_wai_int
+
+
+                               .end
+
+
+/* end of file */