OSDN Git Service

チケット #25999 「SIOポートのピン割り当ての変更」に対応。TOP
authorsuikan <suikan@users.sourceforge.jp>
Sat, 27 Aug 2011 06:28:28 +0000 (06:28 +0000)
committersuikan <suikan@users.sourceforge.jp>
Sat, 27 Aug 2011 06:28:28 +0000 (06:28 +0000)
64 files changed:
asp/CHANGES.LPC
asp/arch/arm_m_gcc/MANIFEST
asp/arch/arm_m_gcc/Makefile.prc [deleted file]
asp/arch/arm_m_gcc/README.txt [new file with mode: 0644]
asp/arch/arm_m_gcc/common/Makefile.core [new file with mode: 0644]
asp/arch/arm_m_gcc/common/arm_m.h [moved from asp/arch/arm_m_gcc/arm_m.h with 93% similarity]
asp/arch/arm_m_gcc/common/core.tf [moved from asp/arch/arm_m_gcc/prc.tf with 72% similarity]
asp/arch/arm_m_gcc/common/core_cfg1_out.h [new file with mode: 0644]
asp/arch/arm_m_gcc/common/core_check.tf [new file with mode: 0644]
asp/arch/arm_m_gcc/common/core_config.c [moved from asp/arch/arm_m_gcc/prc_config.c with 86% similarity]
asp/arch/arm_m_gcc/common/core_config.h [moved from asp/arch/arm_m_gcc/prc_config.h with 86% similarity]
asp/arch/arm_m_gcc/common/core_def.csv [new file with mode: 0644]
asp/arch/arm_m_gcc/common/core_design.txt [moved from asp/arch/arm_m_gcc/prc_design.txt with 97% similarity]
asp/arch/arm_m_gcc/common/core_insn.h [moved from asp/arch/arm_m_gcc/prc_insn.h with 98% similarity]
asp/arch/arm_m_gcc/common/core_kernel.h [moved from asp/arch/arm_m_gcc/prc_kernel.h with 87% similarity]
asp/arch/arm_m_gcc/common/core_offset.tf [new file with mode: 0644]
asp/arch/arm_m_gcc/common/core_rename.def [new file with mode: 0644]
asp/arch/arm_m_gcc/common/core_rename.h [new file with mode: 0644]
asp/arch/arm_m_gcc/common/core_sil.h [moved from asp/arch/arm_m_gcc/prc_sil.h with 92% similarity]
asp/arch/arm_m_gcc/common/core_stddef.h [moved from asp/arch/arm_m_gcc/prc_stddef.h with 89% similarity]
asp/arch/arm_m_gcc/common/core_support.S [moved from asp/arch/arm_m_gcc/prc_support.S with 78% similarity]
asp/arch/arm_m_gcc/common/core_test.h [moved from asp/arch/arm_m_gcc/prc_test.h with 97% similarity]
asp/arch/arm_m_gcc/common/core_timer.c [moved from asp/arch/arm_m_gcc/prc_timer.c with 95% similarity]
asp/arch/arm_m_gcc/common/core_timer.cfg [moved from asp/arch/arm_m_gcc/prc_timer.cfg with 81% similarity]
asp/arch/arm_m_gcc/common/core_timer.h [moved from asp/arch/arm_m_gcc/prc_timer.h with 94% similarity]
asp/arch/arm_m_gcc/common/core_unrename.h [new file with mode: 0644]
asp/arch/arm_m_gcc/common/core_user.txt [new file with mode: 0644]
asp/arch/arm_m_gcc/common/start.S [moved from asp/arch/arm_m_gcc/start.S with 98% similarity]
asp/arch/arm_m_gcc/makeoffset.c [deleted file]
asp/arch/arm_m_gcc/prc_cfg1_out.h [deleted file]
asp/arch/arm_m_gcc/prc_check.tf [deleted file]
asp/arch/arm_m_gcc/prc_def.csv [deleted file]
asp/arch/arm_m_gcc/prc_rename.def [deleted file]
asp/arch/arm_m_gcc/prc_rename.h [deleted file]
asp/arch/arm_m_gcc/prc_unrename.h [deleted file]
asp/arch/arm_m_gcc/prc_user.txt [deleted file]
asp/arch/arm_m_gcc/prc_user_annex.txt [deleted file]
asp/chip/lpc1700_gcc/MANIFEST
asp/chip/lpc1700_gcc/Makefile.chip
asp/chip/lpc1700_gcc/chip.tf
asp/chip/lpc1700_gcc/chip_cfg1_out.h
asp/chip/lpc1700_gcc/chip_check.tf
asp/chip/lpc1700_gcc/chip_config.c
asp/chip/lpc1700_gcc/chip_config.h
asp/chip/lpc1700_gcc/chip_kernel.h
asp/chip/lpc1700_gcc/chip_rename.def
asp/chip/lpc1700_gcc/chip_rename.h
asp/chip/lpc1700_gcc/chip_sil.h
asp/chip/lpc1700_gcc/chip_stddef.h
asp/chip/lpc1700_gcc/chip_test.h
asp/chip/lpc1700_gcc/chip_timer.cfg
asp/chip/lpc1700_gcc/chip_timer.h
asp/chip/lpc1700_gcc/chip_unrename.h
asp/chip/lpc1700_gcc/lpc1700.h
asp/target/lpc1768_generic_gcc/E_PACKAGE
asp/target/lpc1768_generic_gcc/MANIFEST
asp/target/lpc1768_generic_gcc/Makefile.target
asp/target/lpc1768_generic_gcc/target.tf
asp/target/lpc1768_generic_gcc/target_offset.tf [new file with mode: 0755]
asp/target/lpcxpresso1768_gcc/E_PACKAGE
asp/target/lpcxpresso1768_gcc/MANIFEST
asp/target/lpcxpresso1768_gcc/Makefile.target
asp/target/lpcxpresso1768_gcc/target.tf
asp/target/lpcxpresso1768_gcc/target_offset.tf [new file with mode: 0755]

index 9d71123..f83c127 100644 (file)
@@ -1,3 +1,7 @@
+* Release 1.7.1 2011//
+ - TOPPERS公式CORTEX-M3依存部をマージ (2011/08/27 suikan)
+ - 「チケット #25999 SIOポートのピン割り当ての変更」に対応 (2011/08/27 suikan)
+
 * Release 1.7.0 2011/7/16
  - カーネル 1.7.0をマージ (suikan)
 
index 29c17db..6ea3b6f 100644 (file)
@@ -2,30 +2,31 @@ PACKAGE asp_arch_arm_m_gcc
 VERSION 1.7.0
 
 MANIFEST
-Makefile.prc
-arm_m.h
-makeoffset.c
-prc.tf
-prc_cfg1_out.h
-prc_check.tf
-prc_config.c
-prc_config.h
-prc_def.csv
-prc_design.txt
-prc_insn.h
-prc_kernel.h
-prc_rename.def
-prc_rename.h
-prc_sil.h
-prc_stddef.h
-prc_support.S
-prc_test.h
-prc_timer.c
-prc_timer.cfg
-prc_timer.h
-prc_unrename.h
-prc_user_annex.txt
-prc_user.txt
-start.S
+README.txt
+
+common/arm_m.h
+common/core.tf
+common/core_cfg1_out.h
+common/core_check.tf
+common/core_config.c
+common/core_config.h
+common/core_def.csv
+common/core_design.txt
+common/core_insn.h
+common/core_kernel.h
+common/core_offset.tf
+common/core_rename.def
+common/core_rename.h
+common/core_sil.h
+common/core_stddef.h
+common/core_support.S
+common/core_test.h
+common/core_timer.c
+common/core_timer.cfg
+common/core_timer.h
+common/core_unrename.h
+common/core_user.txt
+common/Makefile.core
+common/start.S
 
 INCLUDE ../../chip/lpc1700_gcc/MANIFEST
diff --git a/asp/arch/arm_m_gcc/Makefile.prc b/asp/arch/arm_m_gcc/Makefile.prc
deleted file mode 100644 (file)
index 551634f..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-#  @(#) $Id: Makefile.prc 1304 2008-08-27 07:28:36Z ertl-honda $
-# 
-
-#
-#              Makefile のプロセッサ依存部(ARM-M用)
-#
-
-#
-#  コンパイルオプション
-#
-COPTS := $(COPTS) -mthumb 
-INCLUDES := $(INCLUDES) -I$(SRCDIR)/arch/$(PRC)_$(TOOL)/
-LDFLAGS := -nostdlib $(LDFLAGS) 
-CDEFS := $(CDEFS) -DTOPPERS_LABEL_ASM
-LIBS := $(LIBS)  -lgcc
-
-#
-#  カーネルに関する定義
-#
-KERNEL_DIR := $(KERNEL_DIR) $(SRCDIR)/arch/$(PRC)_$(TOOL)
-KERNEL_ASMOBJS := $(KERNEL_ASMOBJS) prc_support.o
-KERNEL_COBJS := $(KERNEL_COBJS) prc_config.o
-
-#
-#  コンフィギュレータ関係の変数の定義
-#
-CFG_TABS := $(CFG_TABS) --cfg1-def-table $(SRCDIR)/arch/$(PRC)_$(TOOL)/prc_def.csv
-
-#
-#  依存関係の定義
-#
-cfg1_out.c: $(SRCDIR)/arch/$(PRC)_$(TOOL)/prc_def.csv
-kernel_cfg.timestamp: $(SRCDIR)/arch/$(PRC)_$(TOOL)/prc.tf
diff --git a/asp/arch/arm_m_gcc/README.txt b/asp/arch/arm_m_gcc/README.txt
new file mode 100644 (file)
index 0000000..f8e4ce5
--- /dev/null
@@ -0,0 +1,26 @@
+                      ARM-M依存部 ディレクトリ解説
+
+                                   Last Modified: 2011 Jul 23 17:38:56
+
+
+本ディレクトリ(./arch/arm_m_gcc)は,armv7mアーキテクチャのコア及び,
+armv7mアーキテクチャのコアを用いたチップに依存した記述を置くためのディ
+レクトリである.
+
+ターゲットディレクトリ(./target)との切り分けは,本ディレクトリは,特
+定のボードに依存しない再利用可能な記述を置こととし,ターゲットディレク
+トリは再利用の可能性が低いボードに依存した記述を置くこととする.
+
+再利用可能な範囲としては,armv7mアーキテクチャのコアを用いたチップをま
+でを想定している.そのため,本ディレクトリに置く依存部をチップ依存部と
+呼ぶ.各チップ依存部はチップ名でディレクトリを作成し,その下に関連する
+ファイルを置く.
+
+一方,armv7mアーキテクチャのコアに依存した記述は,コア依存部と呼び,
+commonディレクトリ以下に置く.各チップ依存部は必要に応じてコア依存部の
+ファイルを使用する.コア依存部に関しては,common/core_user.txt を参照
+のこと.
+
+チップによっては,コア依存部と同等の機能を持たない場合もある.その場合
+は,チップ依存部を作成せず,ターゲット依存部とコア依存部のファイルを組
+み合わせればよい.
diff --git a/asp/arch/arm_m_gcc/common/Makefile.core b/asp/arch/arm_m_gcc/common/Makefile.core
new file mode 100644 (file)
index 0000000..be24d23
--- /dev/null
@@ -0,0 +1,39 @@
+#
+#  @(#) $Id: Makefile.core 2189 2011-07-24 13:16:06Z ertl-honda $
+# 
+
+#
+#              Makefile のプロセッサ依存部(ARM-M用)
+#
+
+# 
+#  コア依存部ディレクトリ名の定義 
+# 
+COREDIR = $(SRCDIR)/arch/$(PRC)_$(TOOL)/common
+
+#
+#  コンパイルオプション
+#
+COPTS := $(COPTS) -mthumb 
+INCLUDES := $(INCLUDES) -I$(COREDIR)
+LDFLAGS := -nostdlib $(LDFLAGS) 
+CDEFS := $(CDEFS) -DTOPPERS_LABEL_ASM
+LIBS := $(LIBS)  -lgcc
+
+#
+#  カーネルに関する定義
+#
+KERNEL_DIR := $(KERNEL_DIR) $(COREDIR)
+KERNEL_ASMOBJS := $(KERNEL_ASMOBJS) core_support.o
+KERNEL_COBJS := $(KERNEL_COBJS) core_config.o
+
+#
+#  依存関係の定義
+#
+cfg1_out.c: $(COREDIR)/core_def.csv
+kernel_cfg.timestamp: $(COREDIR)/core.tf
+
+#
+#  コンフィギュレータ関係の変数の定義
+#
+CFG_TABS := $(CFG_TABS) --cfg1-def-table $(COREDIR)/core_def.csv
similarity index 93%
rename from asp/arch/arm_m_gcc/arm_m.h
rename to asp/arch/arm_m_gcc/common/arm_m.h
index cddf114..a516c34 100644 (file)
@@ -3,7 +3,7 @@
  *      Toyohashi Open Platform for Embedded Real-Time Systems/
  *      Advanced Standard Profile Kernel
  * 
- *  Copyright (C) 2008 by Embedded and Real-Time Systems Laboratory
+ *  Copyright (C) 2008-2011 by Embedded and Real-Time Systems Laboratory
  *              Graduate School of Information Science, Nagoya Univ., JAPAN
  * 
  *  上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
@@ -35,7 +35,7 @@
  *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
  *  の責任を負わない.
  * 
- *  @(#) $Id: arm_m.h 1304 2008-08-27 07:28:36Z ertl-honda $
+ *  @(#) $Id: arm_m.h 2202 2011-07-26 13:27:11Z ertl-honda $
  */
 
 /*
@@ -45,7 +45,6 @@
 #ifndef ARM_M_H
 #define ARM_M_H
 
-
 /*
  *  EPSRのTビット
  */
 #define NVIC_CLRENA0        0xE000E180  // IRQ 0 to 31 Set Disable Register
 
 /*
+ *  割込みセットペンディングレジスタ
+ */
+#define NVIC_ISER0          0xE000E200  // IRQ 0 to 31 Set-Pending Register
+
+/*
+ *  割込みクリアペンディングレジスタ
+ */
+#define NVIC_ICER0          0xE000E280  // IRQ 0 to 31 Clear-Pending Register
+
+/*
  *  ベクタテーブルオフセットレジスタ
  */
 #define NVIC_VECTTBL        0xE000ED08
similarity index 72%
rename from asp/arch/arm_m_gcc/prc.tf
rename to asp/arch/arm_m_gcc/common/core.tf
index 17a7b4d..47720ad 100644 (file)
@@ -26,20 +26,11 @@ $INHNO_DEFINH_VALID = INHNO_VALID$
 $EXCNO_DEFEXC_VALID = EXCNO_VALID$
 
 $ 
-$  チェック方法の指定
-$ 
-$CHECK_STKSZ_ALIGN = 8$
-
-$ 
 $  CFG_INTで使用できる割込み番号と割込み優先度
-$ 
+$  最大優先度はBASEPRIレジスタでマスクできない優先度(内部優先度'0')
+$  そのため,カーネル管理外の割込みでのみ指定可能.
 $INTNO_CFGINT_VALID = INTNO_VALID$
 $INTPRI_CFGINT_VALID = RANGE(-(1 << TBITW_IPRI),-1)$
-
-$ 
-$  割込み属性中のターゲット依存に用いるビット
-$ 
-$ TARGET_INTATR = $
            
 $ 
 $  標準テンプレートファイルのインクルード
@@ -66,16 +57,16 @@ $FOREACH excno {2,3,...,14}$
        $IF excno == 11$
                $TAB$(FP)(_kernel_svc_handler),      // 11 SVCall handler
        $ELSE$
-               $TAB$(FP)(_kernel_exc_entry_point),
+               $TAB$(FP)(_kernel_core_exc_entry),
        $END$
        $SPC$$FORMAT("/* %d */", +excno)$$NL$
 $END$
 
 $FOREACH inhno INTNO_VALID$ 
-       $IF LENGTH(INH.INHNO[inhno]) && (INT.INTPRI[inhno] < TIPM_LOCK)$
+       $IF LENGTH(INH.INHNO[inhno]) && ((INH.INHATR[inhno] & TA_NONKERNEL) != 0)$
                $TAB$(FP)($INH.INTHDR[inhno]$),
        $ELSE$
-               $TAB$(FP)(_kernel_int_entry_point),
+               $TAB$(FP)(_kernel_core_int_entry),
        $END$
        $SPC$$FORMAT("/* %d */", +inhno)$$NL$
 $END$
@@ -127,6 +118,8 @@ $END$
        $bitpat_cfgint_num$
 ] = {$NL$
 $FOREACH num RANGE(0,(bitpat_cfgint_num-1))$
+$   //boost のバージョンによって挙動が変わるための対策
+$   //http://www.toppers.jp/TOPPERS-USERS/201004/msg00034.html
        $bitpat_cfgint = 1-1$
        $FOREACH inhno RANGE(num*32, (num*32)+31)$
                $IF LENGTH(INH.INHNO[inhno])$
@@ -138,3 +131,25 @@ $END$
 
 $NL$};$NL$
 $NL$
+
+
+$ 
+$  割込み優先度テーブル(内部表現)
+$ 
+const uint32_t _kernel_int_iipm_tbl[] = {$NL$
+$FOREACH excno {0,1,...,14}$
+       $TAB$$FORMAT("UINT32_C(0x%08x), /* 0x%03x */", 0, +excno)$$NL$
+$END$
+
+$FOREACH intno INTNO_VALID$
+       $IF LENGTH(INT.INTNO[intno])$
+               $intpri = (((1 << TBITW_IPRI) + INT.INTPRI[intno]) << (8 - TBITW_IPRI))$
+       $ELSE$
+$              // LSBを1にしているのは,割込み属性が設定されていないことを判
+$              // 別するためである.
+               $intpri = 0 $
+       $END$
+       $TAB$$FORMAT("UINT32_C(0x%08x), /* 0x%03x */", intpri, +intno)$$NL$
+$END$
+$NL$};$NL$
+$NL$
diff --git a/asp/arch/arm_m_gcc/common/core_cfg1_out.h b/asp/arch/arm_m_gcc/common/core_cfg1_out.h
new file mode 100644 (file)
index 0000000..445ea36
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ *  @(#) $Id: core_cfg1_out.h 2189 2011-07-24 13:16:06Z ertl-honda $
+ */
+
+/*
+ *             cfg1_out.cをリンクするために必要なスタブの定義
+ */
+
+void sta_ker(void){}
+
+/* 
+ *  オフセットファイルを生成するための定義 
+ */ 
+const uint8_t   MAGIC_1 = 0x12; 
+const uint16_t  MAGIC_2 = 0x1234; 
+const uint32_t  MAGIC_4 = 0x12345678;
+
+const TCB      TCB_enatex = {
+       { NULL, NULL },                 /* task_queue */
+       NULL,                                   /* p_tinib */
+       0U,                                             /* tstat */
+#ifdef TOPPERS_SUPPORT_MUTEX
+       0U,                                             /* bpriority */
+#endif /* TOPPERS_SUPPORT_MUTEX */
+       0U,                                             /* priority */
+       false,                                  /* acqeue */
+       false,                                  /* wupque */
+       true,                                   /* enatex */
+       0U,                                             /* texprn */
+       NULL,                                   /* p_winifo */
+#ifdef TOPPERS_SUPPORT_MUTEX
+       { NULL, NULL },                 /* mutex_queue */
+#endif /* TOPPERS_SUPPORT_MUTEX */
+       { NULL, NULL }                  /* tskctxb */
+};
diff --git a/asp/arch/arm_m_gcc/common/core_check.tf b/asp/arch/arm_m_gcc/common/core_check.tf
new file mode 100644 (file)
index 0000000..756aa18
--- /dev/null
@@ -0,0 +1,8 @@
+$ 
+$              パス3のプロセッサ依存テンプレート(ARM-M用)
+$ 
+
+$ 
+$  標準テンプレートファイルのインクルード
+$ 
+$INCLUDE "kernel/kernel_check.tf"$
similarity index 86%
rename from asp/arch/arm_m_gcc/prc_config.c
rename to asp/arch/arm_m_gcc/common/core_config.c
index 0fbba06..586cc31 100644 (file)
@@ -3,7 +3,7 @@
  *      Toyohashi Open Platform for Embedded Real-Time Systems/
  *      Advanced Standard Profile Kernel
  * 
- *  Copyright (C) 2008 by Embedded and Real-Time Systems Laboratory
+ *  Copyright (C) 2008-2011 by Embedded and Real-Time Systems Laboratory
  *              Graduate School of Information Science, Nagoya Univ., JAPAN
  * 
  *  上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
  *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
  *  の責任を負わない.
  * 
- *  @(#) $Id: prc_config.c 1304 2008-08-27 07:28:36Z ertl-honda $
+ *  @(#) $Id: core_config.c 2193 2011-07-25 04:34:11Z ertl-honda $
  */
 
 /*
- *             ã\83\97ã\83­ã\82»ã\83\83ã\82µ依存モジュール(ARM-M用)
+ *             ã\82³ã\82¢依存モジュール(ARM-M用)
  */
 
 #include "kernel_impl.h"
@@ -74,7 +74,7 @@ static const unsigned int nvic_sys_pri_reg[] = {
  *  excnoはARM-Mで定められている Exception Number を指定.
  */
 void
-set_exc_int_priority(uint32_t excno, uint8_t pri){
+set_exc_int_priority(uint32_t excno, uint32_t iipm){
        uint32_t tmp, reg;
 
        /*
@@ -100,14 +100,14 @@ set_exc_int_priority(uint32_t excno, uint8_t pri){
        
        tmp = sil_rew_mem((void *)reg);
        tmp &= ~(0xFF << (8 * (excno & 0x03)));
-       tmp |= (pri << (8 - TBITW_IPRI)) << (8 * (excno & 0x03));
+       tmp |= iipm << (8 * (excno & 0x03));
        sil_wrw_mem((void *)reg, tmp);
 }
 
 /*
  *  例外の許可
  *
- *  Memory Management, Bus Fault, Usage Fault は禁止・許可が買おう
+ *  Memory Management, Bus Fault, Usage Fault は禁止・許可が可能
  */
 void
 enable_exc(EXCNO excno)
@@ -162,10 +162,10 @@ disable_exc(EXCNO excno)
 
 
 /*
- *  ã\83\97ã\83­ã\82»ã\83\83ã\82µ依存の初期化
+ *  ã\82³ã\82¢依存の初期化
  */
 void
-prc_initialize(void)
+core_initialize(void)
 {
        /*
         *  CPUロックフラグ実現のための変数の初期化
@@ -179,23 +179,41 @@ prc_initialize(void)
        sil_wrw_mem((void*)NVIC_VECTTBL, (uint32_t)vector_table);
 
        /*
-        *  SVCハンドラの優先度を設定
+        *  各例外の優先度を設定
+        *  CPUロック状態でも発生するように,BASEPRIレジスタでマスクでき
+        *  ない'0'とする.
         */
+       set_exc_int_priority(EXCNO_HARD, 0);
+       set_exc_int_priority(EXCNO_MPU, 0);
+       set_exc_int_priority(EXCNO_BUS, 0);
+       set_exc_int_priority(EXCNO_USAGE, 0);
        set_exc_int_priority(EXCNO_SVCALL, 0);
+       set_exc_int_priority(EXCNO_DEBUG, 0);
+       set_exc_int_priority(EXCNO_PENDSV, 0);
 
        /*
         *  SVCハンドラを有効に
         */
-       x_enable_int(EXCNO_SVCALL);     
+       x_enable_int(EXCNO_SVCALL);
 }
 
 /*
- *  ã\83\97ã\83­ã\82»ã\83\83ã\82µ依存の終了処理
+ *  ã\82³ã\82¢依存の終了処理
  */
 void
-prc_terminate(void)
+core_terminate(void)
 {
+       extern void    software_term_hook(void);
+       void (*volatile fp)(void) = software_term_hook;
 
+       /*
+        *  software_term_hookへのポインタを,一旦volatile指定のあるfpに代
+        *  入してから使うのは,0との比較が最適化で削除されないようにするた
+        *  めである.
+        */
+       if (fp != 0) {
+               (*fp)();
+       }
 }
 
 /*
@@ -215,11 +233,10 @@ x_config_int(INTNO intno, ATR intatr, PRI intpri)
        /*
         *  割込み優先度をセット
         */
-       set_exc_int_priority(intno, intpri);
+       set_exc_int_priority(intno, INT_IPM(intpri));
 
        /*
         *  割込み要求マスク解除(必要な場合)
-        *  同時に割込み優先度もセットされる
         */
        if ((intatr & TA_ENAINT) != 0U) {
                (void) x_enable_int(intno);
similarity index 86%
rename from asp/arch/arm_m_gcc/prc_config.h
rename to asp/arch/arm_m_gcc/common/core_config.h
index 2f2e5b9..6c5e8fa 100644 (file)
@@ -3,7 +3,7 @@
  *      Toyohashi Open Platform for Embedded Real-Time Systems/
  *      Advanced Standard Profile Kernel
  * 
- *  Copyright (C) 2008 by Embedded and Real-Time Systems Laboratory
+ *  Copyright (C) 2008-2011 by Embedded and Real-Time Systems Laboratory
  *              Graduate School of Information Science, Nagoya Univ., JAPAN
  * 
  *  上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
@@ -35,7 +35,7 @@
  *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
  *  の責任を負わない.
  * 
- *  @(#) $Id: prc_config.h 1304 2008-08-27 07:28:36Z ertl-honda $
+ *  @(#) $Id: core_config.h 2198 2011-07-25 16:57:14Z ertl-honda $
  */
 
 /*
  *  直接インクルードしてはならない.
  */
 
-#ifndef TOPPERS_PRC_CONFIG_H
-#define TOPPERS_PRC_CONFIG_H
+#ifndef TOPPERS_CORE_CONFIG_H
+#define TOPPERS_CORE_CONFIG_H
 
 #ifndef TOPPERS_MACRO_ONLY
 
 /*
  *  プロセッサの特殊命令のインライン関数定義
  */
-#include "prc_insn.h"
+#include "core_insn.h"
+
+/*
+ *  ターゲット依存のオブジェクト属性
+ */
+#define TARGET_INHATR  TA_NONKERNEL /* ターゲット定義の割込みハンドラ属性 */
+
+/*
+ *  エラーチェック方法の指定
+ */
+#define CHECK_STKSZ_ALIGN      8       /* スタックサイズのアライン単位 */
+#define CHECK_FUNC_ALIGN       1       /* 関数のアライン単位 */
+#define CHECK_FUNC_NONNULL             /* 関数の非NULLチェック */
+#define CHECK_STACK_ALIGN      8       /* スタック領域のアライン単位 */
+#define CHECK_STACK_NONNULL            /* スタック領域の非NULLチェック */
+#define CHECK_MPF_ALIGN                4       /* 固定長メモリプール領域のアライン単位 */
+#define CHECK_MPF_NONNULL              /* 固定長メモリプール領域の非NULLチェック */
+#define CHECK_MB_ALIGN         4       /* 管理領域のアライン単位 */
 
 /*
  *  非タスクコンテキスト用のスタック初期値
  */
-#define TOPPERS_ISTKPT(istk, istksz) ((STK_T *)((istk) + (istksz)/(sizeof(STK_T))))
+#define TOPPERS_ISTKPT(istk, istksz) ((STK_T *)((char_t *)(istk) + (istksz)))
 
 /*
  *  タスクコンテキストブロックの定義
@@ -178,12 +195,16 @@ x_lock_cpu(void)
        uint32_t iipm;
 
        /*
-        *  current_iipm()の返り値を直接saved_iipmに保存せず,一時変数iipm
-        *  を用いているのは,current_iipm()を呼んだ直後に割込みが発生し,
+        *  get_basepri()の返り値を直接saved_iipmに保存せず,一時変数iipm
+        *  を用いているのは,get_baespri()を呼んだ直後に割込みが発生し,
         *  起動された割込み処理でsaved_iipmが変更される可能性があるためで
         *  ある.
         */
        iipm = get_basepri();
+       /*
+        *  BASEPRIレジスタは値が小さいほど優先度が高いが,IIPM_ENAALL が
+        *  '0'であるため,単純に優先度比較だけでは不十分である.
+        */
        if ((IIPM_LOCK < iipm) || (IIPM_ENAALL == iipm)) {
                set_basepri(IIPM_LOCK);
        }
@@ -299,7 +320,7 @@ x_get_ipm(void)
 #define i_get_ipm()    x_get_ipm()
 
 /*
- *  SVCハンドラ(prc_support.S)
+ *  SVCハンドラ(core_support.S)
  */
 extern void svc_handler(void);
 
@@ -309,7 +330,7 @@ extern void svc_handler(void);
 extern void _start(void);
 
 /*
- *  最高優先順位タスクへのディスパッチ(prc_support.S)
+ *  最高優先順位タスクへのディスパッチ(core_support.S)
  *
  *  dispatchは,タスクコンテキストから呼び出されたサービスコール処理か
  *  ら呼び出すべきもので,タスクコンテキスト・CPUロック状態・ディスパッ
@@ -319,7 +340,7 @@ extern void _start(void);
 extern void dispatch(void);
 
 /*
- *  ディスパッチャの動作開始(prc_support.S)
+ *  ディスパッチャの動作開始(core_support.S)
  *
  *  start_dispatchは,カーネル起動時に呼び出すべきもので,すべての割込
  *  みを禁止した状態(割込みロック状態と同等の状態)で呼び出さなければ
@@ -328,7 +349,7 @@ extern void dispatch(void);
 extern void start_dispatch(void) NoReturn;
 
 /*
- *  現在のコンテキストを捨ててディスパッチ(prc_support.S)
+ *  現在のコンテキストを捨ててディスパッチ(core_support.S)
  *
  *  exit_and_dispatchは,ext_tskから呼び出すべきもので,タスクコンテキ
  *  スト・CPUロック状態・ディスパッチ許可状態・(モデル上の)割込み優先
@@ -337,7 +358,7 @@ extern void start_dispatch(void) NoReturn;
 extern void exit_and_dispatch(void) NoReturn;
 
 /*
- *  カーネルの終了処理の呼出し(prc_support.S)
+ *  カーネルの終了処理の呼出し(core_support.S)
  *
  *  call_exit_kernelは,カーネルの終了時に呼び出すべきもので,非タスク
  *  コンテキストに切り換えて,カーネルの終了処理(exit_kernel)を呼び出
@@ -434,7 +455,8 @@ x_disable_int(INTNO intno)
                sil_wrw_mem((void *)SYSTIC_CONTROL_STATUS, tmp);
        }else {
                tmp = intno - 16;
-               sil_wrw_mem((void *)NVIC_CLRENA0 + (tmp >> 5), (1 << (tmp & 0x1f)));
+               sil_wrw_mem((void *)((uint32_t *)NVIC_CLRENA0 + (tmp >> 5)),
+                                       (1 << (tmp & 0x1f)));
        }
 
        return(true);
@@ -589,67 +611,24 @@ exc_sense_intmask(void *p_excinf)
 }
 
 /*
- *  CPU例外の発生した時のコンテキストと割込み/CPUロック状態の参照
- *
- *  CPU例外の発生した時のシステム状態が,カーネル実行中でなく,タスクコ
- *  ンテキストであり,割込みロック状態でなく,CPUロック状態でない時に
- *  true,そうでない時にfalseを返す(CPU例外がカーネル管理外の割込み処
- *  理中で発生した場合にもfalseを返す).
- *
- *  CPU例外の発生した時のBASEPRI(ハードウェアの割込み優先度マ
- *  スク)がTIPM_LOCKより低いことをチェックすることで,カーネル実行中で
- *  ないこと,割込みロック状態でないこと,CPUロック状態でないことの3つ
- *  の条件をチェックしている(CPU例外が発生した時のlock_flagは参照して
- *  いない).これにより,(モデル上の)割込み優先度マスクをTIPM_LOCK以
- *  上に設定してタスクを実行している時にもfalseが返ってしまうが,判断を
- *  正確にするためのオーバヘッドが大きいことから,許容することにする.
+ *  CPU例外エントリ(core_support.S)
  */
-Inline bool_t
-exc_sense_unlock(void *p_excinf)
-{
-       return(!exc_sense_context(p_excinf)
-                  && ((exc_get_iipm(p_excinf) > IIPM_LOCK)
-                          || exc_get_iipm(p_excinf) == IIPM_ENAALL));
-}
-
-/*
- *  CPU例外エントリ(prc_support.S)
- */
-extern void exc_entry_point(void);
+extern void core_exc_entry(void);
 
 /*
- *  割込みエントリ(prc_support.S)
+ *  割込みエントリ(core_support.S)
  */
-extern void int_entry_point(void);
+extern void core_int_entry(void);
 
 /*
  *  プロセッサ依存の初期化
  */
-extern void prc_initialize(void);
+extern void core_initialize(void);
 
 /*
  *  プロセッサ依存の終了時処理
  */
-extern void prc_terminate(void);
-
-/*
- *  atexitの処理とデストラクタの実行
- */
-Inline void
-call_atexit(void)
-{
-       extern void    software_term_hook(void);
-       void (*volatile fp)(void) = software_term_hook;
-
-       /*
-        *  software_term_hookへのポインタを,一旦volatile指定のあるfpに代
-        *  入してから使うのは,0との比較が最適化で削除されないようにするた
-        *  めである.
-        */
-       if (fp != 0) {
-               (*fp)();
-       }
-}
+extern void core_terminate(void);
 
 /*
  * 登録されていない例外が発生すると呼び出される
@@ -662,4 +641,4 @@ extern void default_exc_handler(void *p_excinf);
 extern void default_int_handler(void *p_excinf);
 
 #endif /* TOPPERS_MACRO_ONLY */
-#endif /* TOPPERS_PRC_CONFIG_H */
+#endif /* TOPPERS_CORE_CONFIG_H */
diff --git a/asp/arch/arm_m_gcc/common/core_def.csv b/asp/arch/arm_m_gcc/common/core_def.csv
new file mode 100644 (file)
index 0000000..9818a3b
--- /dev/null
@@ -0,0 +1,8 @@
+TMAX_INTNO,TMAX_INTNO
+TIPM_LOCK,TIPM_LOCK 
+TBITW_IPRI,TBITW_IPRI
+sizeof_TCB,sizeof(TCB)
+offsetof_TCB_p_tinib,"offsetof(TCB,p_tinib)"
+offsetof_TCB_texptn,"offsetof(TCB,texptn)"
+offsetof_TCB_sp,"offsetof(TCB,tskctxb.sp)"
+offsetof_TCB_pc,"offsetof(TCB,tskctxb.pc)"
similarity index 97%
rename from asp/arch/arm_m_gcc/prc_design.txt
rename to asp/arch/arm_m_gcc/common/core_design.txt
index cd53625..29b7a63 100644 (file)
@@ -1,6 +1,6 @@
 =====================================================================
                          ARM-Mプロセッサ依存部設計メモ
-                                  Last Modified: 23 Aug 2008 21:54:54
+                                  Last Modified: 2011 Jul 26 22:22:34
 =====================================================================
 
 ○このドキュメントの位置づけ
@@ -39,7 +39,11 @@ Vector Table Offset Register(メモリマップドレジスタ) を操作す
 
 ●優先度
 
-値が小さい方が高優先度となる.
+値が小さい方が高優先度となり,0が最高優先度となる.一方,後述するプロ
+セッサの割込み優先度を設定するBASEPRIレジスタは'0'をセットすると,全て
+の割込みを許可するため,最高優先度は,有効なビットのLSBを'1'とした値で
+ある(3bitの場合は0x20).また,割込みの優先度に'0'を設定すると,
+BASEPRIレジスタでマスクできない割込みとなる.
 
 優先度は最大8bitであり,SoC毎に実装されているビット幅が異なる.実装さ
 れるビットが8bit以下の場合は,LSBから無効になる.例えば,実装されてい
@@ -53,6 +57,7 @@ Vector Table Offset Register(メモリマップドレジスタ) を操作す
 Reset,NMI,Hard Fault 以外の例外は割込みと同様に優先度が設定可能であり,
 割込みマスク機能により,発生を禁止することが可能である.
 
+
 ●CPUモード
 
 プロセッサは,ThreadモードもしくはHandlerモードのいずれかのモードとな
@@ -167,6 +172,8 @@ PRIMASKを'1'に設定すると,NMI と Hardware Fault 以外の例外/割込
 ・NVIC割込み優先度マスクを受付けた例外/割込みの優先度に設定する.
 ・lrにEXC_RETURNの値が設定される.
 ・ベクタテーブルを読み込みハンドラを実行する.
+・スタックフレームは,Configureation and Control Register(CCR)の
+  STKALIGNが'1'の場合は,8byte境界にアラインされる.
 
 ●例外/割込みからのリターン
 
@@ -506,7 +513,7 @@ SVCハンドラはCPUロック状態のBASEPRIに設定する優先度マスク
 可能な最高優先度)として指定可能な優先度マスクの設定範囲は以下の値の範
 囲となる.
 
-    -(2^(TBIW_IPRI)) + (2^TBITW_SUBIPRI)) 〜 -1
+    -(2^(TBIW_IPRI) - 1) + (2^TBITW_SUBIPRI) 〜 -1
 
 
 14. 未解決課題
@@ -517,5 +524,4 @@ SVCハンドラはCPUロック状態のBASEPRIに設定する優先度マスク
   ->あきらめてマニュアル記載に逃げるか.
   メモリプロテクションの例外もマスク可能であるため要件等.
 
-
 以上.
similarity index 98%
rename from asp/arch/arm_m_gcc/prc_insn.h
rename to asp/arch/arm_m_gcc/common/core_insn.h
index e144d5c..9755770 100644 (file)
@@ -35,7 +35,7 @@
  *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
  *  の責任を負わない.
  * 
- *  @(#) $Id: prc_insn.h 1304 2008-08-27 07:28:36Z ertl-honda $
+ *  @(#) $Id: core_insn.h 2178 2011-07-23 09:58:56Z ertl-honda $
  */
 
 
similarity index 87%
rename from asp/arch/arm_m_gcc/prc_kernel.h
rename to asp/arch/arm_m_gcc/common/core_kernel.h
index a81860e..423f833 100644 (file)
@@ -3,7 +3,7 @@
  *      Toyohashi Open Platform for Embedded Real-Time Systems/
  *      Advanced Standard Profile Kernel
  * 
- *  Copyright (C) 2008 by Embedded and Real-Time Systems Laboratory
+ *  Copyright (C) 2008-2011 by Embedded and Real-Time Systems Laboratory
  *              Graduate School of Information Science, Nagoya Univ., JAPAN
  * 
  *  上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
  *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
  *  の責任を負わない.
  * 
- *  @(#) $Id: prc_kernel.h 1304 2008-08-27 07:28:36Z ertl-honda $
+ *  @(#) $Id: core_kernel.h 2189 2011-07-24 13:16:06Z ertl-honda $
  */
 
 /*
- *             kernel.hã\81®ã\83\97ã\83­ã\82»ã\83\83ã\82µ依存部(ARM-M用)
+ *             kernel.hã\81®ã\82³ã\82¢依存部(ARM-M用)
  *
  *  このインクルードファイルは,target_kernel.h(または,そこからインク
  *  ルードされるファイル)のみからインクルードされる.他のファイルから
  *  直接インクルードしてはならない.
  */
 
-#ifndef TOPPERS_PRC_KERNEL_H
-#define TOPPERS_PRC_KERNEL_H
+#ifndef TOPPERS_CORE_KERNEL_H
+#define TOPPERS_CORE_KERNEL_H
 
 /*
  *  サポートする機能の定義
  */
-#define TOPPERS_SUPPORT_DIS_INT            /* dis_intをサポートする */
-#define TOPPERS_SUPPORT_ENA_INT            /* ena_intをサポートする */
+#define TOPPERS_TARGET_SUPPORT_DIS_INT      /* dis_intをサポートする */
+#define TOPPERS_TARGET_SUPPORT_ENA_INT      /* ena_intをサポートする */
 
 #define TMAX_INTPRI            (-1)            /* 割込み優先度の最大値(最低値)*/
 
@@ -61,4 +61,4 @@
 
 #endif /* TOPPERS_MACRO_ONLY */
 
-#endif /* TOPPERS_PRC_KERNEL_H */
+#endif /* TOPPERS_CORE_KERNEL_H */
diff --git a/asp/arch/arm_m_gcc/common/core_offset.tf b/asp/arch/arm_m_gcc/common/core_offset.tf
new file mode 100644 (file)
index 0000000..f049344
--- /dev/null
@@ -0,0 +1,19 @@
+$
+$       オフセットファイル生成用テンプレートファイル(ARM-M用)
+$
+
+$
+$  オフセット値のマクロ定義の生成
+$
+$DEFINE("TCB_p_tinib", offsetof_TCB_p_tinib)$
+$DEFINE("TCB_texptn", offsetof_TCB_texptn)$
+$DEFINE("TCB_sp", offsetof_TCB_sp)$
+$DEFINE("TCB_pc", offsetof_TCB_pc)$
+
+$DEFINE("TINIB_exinf", offsetof_TINIB_exinf)$
+$DEFINE("TINIB_task", offsetof_TINIB_task)$
+
+$
+$  ビットオフセット値等のマクロ定義の生成
+$
+$DEFINE_BIT("TCB_enatex", sizeof_TCB, "B")$
diff --git a/asp/arch/arm_m_gcc/common/core_rename.def b/asp/arch/arm_m_gcc/common/core_rename.def
new file mode 100644 (file)
index 0000000..5107537
--- /dev/null
@@ -0,0 +1,26 @@
+# core_config.c
+exc_tbl
+vector_table
+lock_flag
+saved_iipm
+default_exc_handler
+default_int_handler
+x_config_int
+core_initialize
+core_terminate
+bitpat_cfgint
+set_exc_int_priority
+enable_exc
+disable_exc
+
+# core_support.S
+core_int_entry
+core_exc_entry
+ret_int
+ret_exc
+svc_handler
+start_r
+dispatch
+start_dispatch
+exit_and_dispatch
+call_exit_kernel
diff --git a/asp/arch/arm_m_gcc/common/core_rename.h b/asp/arch/arm_m_gcc/common/core_rename.h
new file mode 100644 (file)
index 0000000..8103c46
--- /dev/null
@@ -0,0 +1,73 @@
+/* This file is generated from core_rename.def by genrename. */
+
+#ifndef TOPPERS_CORE_RENAME_H
+#define TOPPERS_CORE_RENAME_H
+
+/*
+ *  core_config.c
+ */
+#define exc_tbl                                                _kernel_exc_tbl
+#define vector_table                           _kernel_vector_table
+#define lock_flag                                      _kernel_lock_flag
+#define saved_iipm                                     _kernel_saved_iipm
+#define default_exc_handler                    _kernel_default_exc_handler
+#define default_int_handler                    _kernel_default_int_handler
+#define x_config_int                           _kernel_x_config_int
+#define core_initialize                                _kernel_core_initialize
+#define core_terminate                         _kernel_core_terminate
+#define bitpat_cfgint                          _kernel_bitpat_cfgint
+#define set_exc_int_priority           _kernel_set_exc_int_priority
+#define enable_exc                                     _kernel_enable_exc
+#define disable_exc                                    _kernel_disable_exc
+
+/*
+ *  core_support.S
+ */
+#define core_int_entry                         _kernel_core_int_entry
+#define core_exc_entry                         _kernel_core_exc_entry
+#define ret_int                                                _kernel_ret_int
+#define ret_exc                                                _kernel_ret_exc
+#define svc_handler                                    _kernel_svc_handler
+#define start_r                                                _kernel_start_r
+#define dispatch                                       _kernel_dispatch
+#define start_dispatch                         _kernel_start_dispatch
+#define exit_and_dispatch                      _kernel_exit_and_dispatch
+#define call_exit_kernel                       _kernel_call_exit_kernel
+
+#ifdef TOPPERS_LABEL_ASM
+
+/*
+ *  core_config.c
+ */
+#define _exc_tbl                                       __kernel_exc_tbl
+#define _vector_table                          __kernel_vector_table
+#define _lock_flag                                     __kernel_lock_flag
+#define _saved_iipm                                    __kernel_saved_iipm
+#define _default_exc_handler           __kernel_default_exc_handler
+#define _default_int_handler           __kernel_default_int_handler
+#define _x_config_int                          __kernel_x_config_int
+#define _core_initialize                       __kernel_core_initialize
+#define _core_terminate                                __kernel_core_terminate
+#define _bitpat_cfgint                         __kernel_bitpat_cfgint
+#define _set_exc_int_priority          __kernel_set_exc_int_priority
+#define _enable_exc                                    __kernel_enable_exc
+#define _disable_exc                           __kernel_disable_exc
+
+/*
+ *  core_support.S
+ */
+#define _core_int_entry                                __kernel_core_int_entry
+#define _core_exc_entry                                __kernel_core_exc_entry
+#define _ret_int                                       __kernel_ret_int
+#define _ret_exc                                       __kernel_ret_exc
+#define _svc_handler                           __kernel_svc_handler
+#define _start_r                                       __kernel_start_r
+#define _dispatch                                      __kernel_dispatch
+#define _start_dispatch                                __kernel_start_dispatch
+#define _exit_and_dispatch                     __kernel_exit_and_dispatch
+#define _call_exit_kernel                      __kernel_call_exit_kernel
+
+#endif /* TOPPERS_LABEL_ASM */
+
+
+#endif /* TOPPERS_CORE_RENAME_H */
similarity index 92%
rename from asp/arch/arm_m_gcc/prc_sil.h
rename to asp/arch/arm_m_gcc/common/core_sil.h
index 93aaeaf..9c6dc11 100644 (file)
@@ -2,7 +2,7 @@
  *  TOPPERS Software
  *      Toyohashi Open Platform for Embedded Real-Time Systems
  * 
- *  Copyright (C) 2008 by Embedded and Real-Time Systems Laboratory
+ *  Copyright (C) 2008-2011 by Embedded and Real-Time Systems Laboratory
  *              Graduate School of Information Science, Nagoya Univ., JAPAN
  * 
  *  上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
  *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
  *  の責任を負わない.
  * 
- *  @(#) $Id: prc_sil.h 1304 2008-08-27 07:28:36Z ertl-honda $
+ *  @(#) $Id: core_sil.h 2183 2011-07-23 10:29:36Z ertl-honda $
  */
 
 /*
- *   sil.hã\81®ã\83\97ã\83­ã\82»ã\83\83ã\82µ依存部(ARM-M用)
+ *   sil.hã\81®ã\82³ã\82¢依存部(ARM-M用)
  */
 
-#ifndef TOPPERS_PRC_SIL_H
-#define TOPPERS_PRC_SIL_H
+#ifndef TOPPERS_CORE_SIL_H
+#define TOPPERS_CORE_SIL_H
 
 #ifndef TOPPERS_MACRO_ONLY
 
@@ -82,4 +82,4 @@ TOPPERS_enaint(bool_t locked)
 
 #endif /* TOPPERS_MACRO_ONLY */
 
-#endif /* TOPPERS_PRC_SIL_H */
+#endif /* TOPPERS_CORE_SIL_H */
similarity index 89%
rename from asp/arch/arm_m_gcc/prc_stddef.h
rename to asp/arch/arm_m_gcc/common/core_stddef.h
index e0bdc79..99fd723 100644 (file)
@@ -2,7 +2,7 @@
  *  TOPPERS Software
  *      Toyohashi Open Platform for Embedded Real-Time Systems
  * 
- *  Copyright (C) 2008 by Embedded and Real-Time Systems Laboratory
+ *  Copyright (C) 2008-2011 by Embedded and Real-Time Systems Laboratory
  *              Graduate School of Information Science, Nagoya Univ., JAPAN
  * 
  *  上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
  *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
  *  の責任を負わない.
  * 
- *  @(#) $Id: prc_stddef.h 1304 2008-08-27 07:28:36Z ertl-honda $
+ *  @(#) $Id: core_stddef.h 2183 2011-07-23 10:29:36Z ertl-honda $
  */
 
 /*
- *  t_stddef.hã\81®ã\83\97ã\83­ã\82»ã\83\83ã\82µ依存部(ARM-M用)
+ *  t_stddef.hã\81®ã\82³ã\82¢依存部(ARM-M用)
  *
  *  このインクルードファイルは,target_stddef.h(または,そこからインク
  *  ルードされるファイル)のみからインクルードされる.他のファイルから
  *  直接インクルードしてはならない.
  */
 
-#ifndef TOPPERS_PRC_STDDEF_H
-#define TOPPERS_PRC_STDDEF_H
+#ifndef TOPPERS_CORE_STDDEF_H
+#define TOPPERS_CORE_STDDEF_H
 
 /*
  *  ターゲットを識別するためのマクロの定義
  */
-#define TOPPERS_ARM_M           /* ã\83\97ã\83­ã\82»ã\83\83ã\82µ略称 */
+#define TOPPERS_ARM_M           /* ã\82³ã\82¢略称 */
 
 /*
  *  スタックの型
@@ -59,4 +59,4 @@
  */
 #define TOPPERS_STK_T  long long
 
-#endif /* TOPPERS_PRC_STDDEF_H */
+#endif /* TOPPERS_CORE_STDDEF_H */
similarity index 78%
rename from asp/arch/arm_m_gcc/prc_support.S
rename to asp/arch/arm_m_gcc/common/core_support.S
index 7c7cf24..dc380bd 100644 (file)
@@ -3,7 +3,7 @@
  *      Toyohashi Open Platform for Embedded Real-Time Systems/
  *      Advanced Standard Profile Kernel
  * 
- *  Copyright (C) 2008 by Embedded and Real-Time Systems Laboratory
+ *  Copyright (C) 2008-2011 by Embedded and Real-Time Systems Laboratory
  *              Graduate School of Information Science, Nagoya Univ., JAPAN
  * 
  *  上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
@@ -35,7 +35,7 @@
  *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
  *  の責任を負わない.
  * 
- *  @(#) $Id: prc_support.S 1365 2008-09-28 07:23:15Z futl-takaki $
+ *  @(#) $Id: core_support.S 2202 2011-07-26 13:27:11Z ertl-honda $
  */
 
 /*
@@ -87,8 +87,12 @@ dispatch_r:
        ldrb  r0,[r1,#TCB_enatex]
        tst   r0,#TCB_enatex_mask
        beq   dispatch_r_1            /* enatex が false ならリターン */
-       ldr   r0,[r1,#TCB_texptn]     /* texptn が0でなければ         */
-       tst   r0,r0                 
+       ldr   r0,[r1,#TCB_texptn]     /* texptn が 0 ならリターン     */
+       tst   r0,r0
+       beq   dispatch_r_1            
+       ldr   r1, =ipmflg             /* ipmflgが false ならリターン  */
+       ldr   r0, [r1]
+       tst   r0,r0
        bne   call_texrtn             /* タスク例外ルーチンの呼び出し */
 dispatch_r_1:                     /* タスクへのcall_textnから戻る */
        mov   pc,lr
@@ -103,9 +107,9 @@ dispatch_r_1:                     /* タスクへのcall_textnから戻る */
        .align 2
        .syntax unified
        .code 16
-       .global exc_entry_point
-       .type exc_entry_point, function
-exc_entry_point:
+       .global core_exc_entry
+       .type core_exc_entry, function
+core_exc_entry:
        /*
         *  例外/割込みが発生すると,発生時にアクティブなスタックにスクラ
         *  ッチレジスタ等が保存される.
@@ -143,19 +147,32 @@ exc_entry_point:
        mrs   r2, basepri             /* baepriの値を取得 */
 
        /*
-        * 多重割込みかチェック
+        *  カーネル管理外の例外かチェック
+        *  カーネル内のクリティカルセクションの実行中,全割込みロック状態,
+        *  CPUロック状態,カーネル管理外の割込みハンドラ実行中のいずれかで
+        *  発生したCPU例外を,カーネル管理外のCPU例外と呼ぶ
+        *  CPUロック状態はbasepriがIIPM_LOCKで判断する.
+        *  全割込みロック状態はFAULTMASKが'1'の場合
+        */
+       cmp   r2, #IIPM_LOCK              /* CPUロック状態ならカーネル管理外例外処理へ */
+       beq   core_nonkernel_exc_entry
+       mrs   r2, FAULTMASK               /* 全割込みロック状態ならカーネル管理外例外処理へ */
+       cbnz  r2, core_nonkernel_exc_entry
+
+       /*
+        * スタックを変更する必要があるかチェック
         * EXC_RETURN(割込み時にLRに設定される値)をチェックして,例外発生時に
         * アクティブなスタックを特定することで多重割込みか判定する.
         */
        tst   lr, #EXC_RETURN_PSP    /* 割込み元がMSPなら多重割込み */
-       beq   exc_entry_1            /* 多重割込みならexc_entry_1へ */
+       beq   core_exc_entry_1       /* 多重割込みならcore_exc_entry_1へ */
        mrs   r0, psp                /* 一段目の割込みの場合はPSP上に */
        stmfd r0!,{r2}               /* 割込み発生時の割込み優先度マスクを積む */
        stmfd r0!,{lr}               /* EXC_RETURN を積む             */
        msr   psp, r0                /* CPU例外ハンドラへの引数となる */
        push  {lr}                   /* MSP上にもEXC_RETURN を積む    */ 
-       b     exc_entry_2
-exc_entry_1:                     /* 多重割込みの場合 */
+       b     core_exc_entry_2
+core_exc_entry_1:                /* 多重割込みの場合 */
        push  {r2}                   /* 割込み発生時の割込み優先度マスクを積む */
        push  {lr}                   /* EXC_RETURN を積む             */ 
        mov   r0, sp                 /* CPU例外ハンドラへの引数となる */
@@ -163,7 +180,7 @@ exc_entry_1:                     /* 多重割込みの場合 */
        /*
         *  共通処理
         */
-exc_entry_2:                     
+core_exc_entry_2:                     
        mrs   r3, ipsr               /* ハンドラアドレスを取得 */
        ldr   r1, =_kernel_exc_tbl
        ldr   r2, [r1, r3, lsl #2]
@@ -188,6 +205,65 @@ exc_entry_2:
 
        b     ret_exc
 
+/*
+ *  カーネル管理外のCPU例外の出入口処理
+ */
+core_nonkernel_exc_entry:
+       tst   lr, #EXC_RETURN_PSP    /* 割込み元がMSPなら多重割込み */
+       beq   core_nonkernel_exc_entry_1  /* 多重割込みなら */
+       mrs   r0, psp                /* 一段目の割込みの場合はPSP上に */
+       stmfd r0!,{r2}               /* 割込み発生時の割込み優先度マスクを積む */
+       stmfd r0!,{lr}               /* EXC_RETURN を積む             */
+       msr   psp, r0                /* CPU例外ハンドラへの引数となる */
+       push  {lr}                   /* MSP上にもEXC_RETURN を積む    */ 
+       b     core_nonkernel_exc_entry_2
+core_nonkernel_exc_entry_1:      /* 多重割込みの場合 */
+       push  {r2}                   /* 割込み発生時の割込み優先度マスクを積む */
+       push  {lr}                   /* EXC_RETURN を積む             */ 
+       mov   r0, sp                 /* CPU例外ハンドラへの引数となる */
+
+core_nonkernel_exc_entry_2:
+       mrs   r3, ipsr               /* CPU例外ハンドラのアドレスを取得 */
+       ldr   r1, =_kernel_exc_tbl
+       ldr   r2, [r1, r3, lsl #2]
+
+       /*
+        *  CPU例外ハンドラの呼び出し
+        */
+       blx   r2
+
+       /*
+        *  割込みロック状態とする.
+        */
+       cpsid f
+
+       /*
+        *  戻り先のコンテキストの判定
+        * 
+        *  割込みハンドラ実行にLRにセットされるEXC_RETURNをチェックして,戻り
+        *  先でMSPが使われていれば,割込み先が非タスクコンテキストと判定する.
+        */
+       pop   {r3}                     /* lrをスタックから取得         */
+       tst   r3, #EXC_RETURN_PSP      /* 戻り先がPSPなら              */
+       bne   core_nonkernel_ret_exc_1
+       pop   {r1}                     /* 元の割込み優先度マスク(basepri) */
+       b     core_nonkernel_ret_exc_2 /* の値をMSPから取得 */
+
+core_nonkernel_ret_exc_1:
+       /*
+        *  PSP上からEXC_RETURNを削除
+        */
+       mrs   r2, psp
+       add   r2, r2, #4
+       /*
+        *  元の割込み優先度マスク(basepri)の値をPSPから取得
+        */
+       ldmfd r2!, {r1} 
+       msr   psp, r2
+
+core_nonkernel_ret_exc_2:
+       msr   basepri, r1             /* 割込み優先度マスクを割込み前に状態へ */
+       bx    r3                      /* リターン */
 
 /*
  *  割込みエントリ
@@ -195,9 +271,9 @@ exc_entry_2:
        .align 2
        .syntax unified
        .code 16
-       .global int_entry_point
-       .type int_entry_point, function
-int_entry_point:
+       .global core_int_entry
+       .type core_int_entry, function
+core_int_entry:
        /*
         *  割込み発生時の割込み優先度マスクをスタックに保存するため取得
         */
@@ -209,14 +285,14 @@ int_entry_point:
         * アクティブなスタックを特定することで多重割込みか判定する.
         */
        tst   lr, #EXC_RETURN_PSP    /* 割込み元がMSPなら多重割込み */
-       beq   int_entry_1            /* 多重割込みならint_entry_1へ    */
+       beq   core_int_entry_1       /* 多重割込みならcore_int_entry_1へ */
        mrs   r0, psp                /* 一段目の割込みの場合はPSP上に */
        stmfd r0!,{r2}               /* 割込み発生時の割込み優先度マスクを積む */
        stmfd r0!,{lr}               /* EXC_RETURN を積む             */
        msr   psp, r0                /* CPU例外ハンドラへの引数となる */
        push  {lr}                   /* MSP上にもEXC_RETURN を積む    */ 
-       b     int_entry_2
-int_entry_1:                     /* 多重割込みの場合 */
+       b     core_int_entry_2
+core_int_entry_1:                /* 多重割込みの場合 */
        push  {r2}                   /* 割込み発生時の割込み優先度マスクを積む */
        push  {lr}                   /* EXC_RETURN を積む             */ 
        mov   r0, sp                 /* 未定義の割込みが発生した場合の情報とする */
@@ -224,12 +300,21 @@ int_entry_1:                     /* 多重割込みの場合 */
        /*
         *  共通処理
         */
-int_entry_2:                     
+core_int_entry_2:                     
        mrs   r3, ipsr               /* ハンドラアドレスを取得 */
        ldr   r1, =_kernel_exc_tbl
        ldr   r2, [r1, r3, lsl #2]
 
-#ifdef LOG_EXC_ENTER
+       /*
+        *  basepriの設定
+        *  NVIC優先度マスクが自動的に設定されるため優先度マスクの点では必要な
+        *  いが,x_get_ipm()がbasepriを参照するため,basepriも更新する.
+        */
+       ldr   r1, =_kernel_int_iipm_tbl
+       ldr   lr, [r1, r3, lsl #2]
+       msr   basepri, lr
+
+#ifdef LOG_INH_ENTER
        push  {r0,r2,r3}
        mov   r0, r3                 /* 例外番号をパラメータに  */
        bl    log_inh_enter          /* log_exc_enterを呼び出す */
@@ -242,10 +327,10 @@ int_entry_2:
         */
        blx   r2
 
-#ifdef LOG_EXC_ENTER
+#ifdef LOG_INH_LEAVE
        pop   {r0}                   /* 例外番号を引数に        */
        bl    log_exc_leave          /* log_exc_leaveを呼び出す */
-#endif /* LOG_EXC_ENTER */
+#endif /* LOG_INH_LEAVE */
 
 
 
@@ -269,7 +354,7 @@ ret_int:
         *  一方,FAULTMASKは,割込みからのリターン処理によって,'0'にクリ
         *  アされる.
         */
-       cpsid f                        
+       cpsid f
 
        /*
         *  戻り先のコンテキストの判定
@@ -288,11 +373,12 @@ ret_int:
         */
 ret_int_1:
        /*
-        *  PSP上からEXC_RETURNを削除
+        *  PSP上から,EXC_RETURN(r0)と元の割込み優先度マスク(basepri)(r1)
+        *  を取得
         */
-       mrs   r2, psp                 
-       add   r2, r2, #4
-       msr   psp, r2                 
+       mrs   r2, psp
+       ldmfd r2!, {r0,r1} 
+       msr   psp, r2
 
        /*
         *  reqflgをチェックする
@@ -305,11 +391,8 @@ ret_int_1:
         *  である.
         */
        ldr   r0, =reqflg             /* reqflgがfalseならそのまま戻る */
-       ldr   r1, [r0]
-       cbnz  r1, ret_int_3           /* trueならret_int_3へ           */
-       mrs   r2, psp                 /* 元の割込み優先度マスク(basepri) */
-       ldmfd r2!, {r1}               /* の値をPSPから取得 */
-       msr   psp, r2                 
+       ldr   r2, [r0]
+       cbnz  r2, ret_int_3           /* trueならret_int_3へ           */
 
 ret_int_2:
        /*
@@ -320,7 +403,6 @@ ret_int_2:
        msr   basepri, r1             /* 割込み優先度マスクを割込み前に状態へ */
        bx    r3                      /* リターン */
 
-
 ret_int_3:
        /*
         *  ここでは,戻り先がタスクであり,PSP上にスクラッチレジスタと割
@@ -329,6 +411,22 @@ ret_int_3:
         *  また,r0には,reqflgのアドレス,r3には割込み受付時のlrの値が保
         *  持されている.
         */
+       /*
+        *  タスク例外ハンドラやディスパッチをする際にThreadモードへ遷移する
+        *  ダミーのスタックフレームを作成して,bx命令でHandlerモードからリ
+        *  ターンする.また,遅延ディスパッチする場合も,再び割り込んだタス
+        *  クに戻る際には,svc命令で,svc_handlerを呼び出す.
+        *  スタックフレームは,Configureation and Control Register(CCR)の
+        *  STKALIGNが'1'の場合は,8byte境界にアラインされる.
+        *  参考 : DDI0403B_arm_architecture_v7m_reference_manual(P.220)
+        *  そのため,この時点のスタックは割込みや例外発生時に作成された
+        *  スタックフレームから,8byte境界のサイズにしておくと,svc_handler
+        *  等でスタックフレームのアライメントの有無の確認を省略できる.
+        *  ただし,システム起動後は,動的にCCRのSTKALIGNの設定を変更するのは
+        *  禁止とする.
+        *  この時点は標準のスタックフレームは,割込み・例外発生時と同等であ
+        *  るため,タスクスタック(PSP)は8byte境界になっている.
+        */
        mov   r1, #0                   /* reqflgをfalseに */
        str   r1, [r0]
 
@@ -341,18 +439,22 @@ ret_int_3:
         *  この時点でCPUロック状態とするのは,dispatcherへ分岐する時と,
         *  call_texrtnを呼び出す時に,CPUロック状態になっている必要がある
         *  ためである.
-     *  なお,この処理の後,Threadモードへの移行処理を行なうため,割込み
-     *  ロック状態(FAULTMASKを"1")は保持する.
+        *  なお,この処理の後,Threadモードへの移行処理を行なうため,割込み
+        *  ロック状態(FAULTMASKを"1")は保持する.
         */
        ldr   r1, =IIPM_LOCK          /* CPUロック状態 */ 
        msr   basepri, r1          
        mov   r1, #0x01               /* lock_flag を trueに */
        ldr   r0, =lock_flag          
-       str   r1, [r0]             
-       mrs   r2, psp                 /* 割込み前の割込み優先度マスクを */
-       ldr   r1, [r2]                /* タスクスタックから取得         */
-       ldr   r0, =saved_iipm         /* saved_iipmに保存 */
-       str   r1, [r0]             
+       str   r1, [r0]
+
+       /*
+        *  割込み優先度マスクを,全解除状態(TIPM_ENAALL)に設定する
+        *  すでにCPUロック状態なので,saved_iipmをIIPM_ENAALLとする.
+        */
+       ldr   r1, =IIPM_ENAALL
+       ldr   r0, =saved_iipm
+       str   r1, [r0]
 
        /*
         *  Threadモードへ移行する.
@@ -365,6 +467,7 @@ ret_int_3:
         */
        ldr   r0, =ret_int_4          /* PC   */
        ldr   r1, =EPSR_T             /* xPSR(Tビットが'1'である必要がある) */
+       mrs   r2, psp
        stmfd r2!, {r0-r1}            /* ダミーフレームをスタック上に積む   */
        sub   r2, #(EXC_FRAME_SIZE - (4*2)) /* r0-r3,r12,lrの内容は設定する必要がない */
        msr   psp,r2                  
@@ -417,8 +520,11 @@ ret_int_r_1:
        ldrb  r0, [r1,#TCB_enatex]
        tst   r0, #TCB_enatex_mask
        beq   ret_int_r_2           /* enatex が false なら ret_int_r_2へ */
-       ldr   r0, [r1,#TCB_texptn]  /* texptnをロード                     */
-       cbz   r0, ret_int_r_2       /* '0'ならリターン */
+       ldr   r0, [r1,#TCB_texptn]  /* texptn が 0 ならリターン     */
+       cbz   r0, ret_int_r_2
+       ldr   r1, =ipmflg             /* ipmflgが false ならリターン  */
+       ldr   r0, [r1]
+       cbz   r0, ret_int_r_2
        bl    call_texrtn           /* タスク例外ルーチンの呼び出し */
 ret_int_r_2:
        svc   0                     /* SVCの呼び出し */
@@ -444,10 +550,8 @@ svc_handler:
        mov   r0, #0
        ldr   r1, =lock_flag          /* CPUロック解除状態へ */
        str   r0, [r1]
-       mrs   r0, psp                 /* 割込み優先度マスクをタスクスタック */
-       ldmfd r0!, {r1}               /* から取得                           */
-       msr   psp, r0
-       msr   basepri, r1             /* 割込み優先度マスクを設定           */
+       ldr   r1, =IIPM_ENAALL        /* 割込み優先度マスクを全解除状態に設定 */
+       msr   basepri, r1             
        bx    lr                      /* リターン     */
 
 /*
@@ -463,7 +567,7 @@ start_dispatch:
         * (割込みロック状態と同等)で呼び出される.また,割込みモード(非
         *  タスクコンテキストと同等)で呼び出されることを想定している.
         *
-        *  prc_initializeで,lock_flagをtrueに,saved_iipmをIIPM_ENAALLに
+        *  core_initializeで,lock_flagをtrueに,saved_iipmをIIPM_ENAALLに
         *  初期化しているため,カーネル管理外の割込みを許可することで,
         *  CPUロック状態・(モデル上の)割込み優先度マスク全解除状態になる.
         *  また,task_initializeでdisdspをfalseに初期化しているため,ディ
@@ -513,8 +617,7 @@ dispatcher_0:
        ldr   r1, [r0]
        ldr   r2, =p_runtsk   
        str   r1, [r2]        
-       cmp   r1, #0            /* p_runtskがNULLならdispatcher_1へ */
-       beq   dispatcher_1             
+       cbz   r1, dispatcher_1  /* p_runtskがNULLならdispatcher_1へ */           
        ldr   sp, [r1,#TCB_sp]  /* タスクスタックを復帰 */
 #ifdef LOG_DSP_LEAVE
        mov   r0, r1            /* p_runtskをパラメータに */
@@ -558,7 +661,7 @@ dispatcher_2:
         *  した際の動作が仕様に合致しなくなる.
         *
         */
-#ifdef TOPPERS_CUSTOM_IDEL
+#ifdef TOPPERS_CUSTOM_IDLE
        toppers_asm_custom_idle
 #else
        cpsid i               /* PRIMASK をセット */
similarity index 97%
rename from asp/arch/arm_m_gcc/prc_test.h
rename to asp/arch/arm_m_gcc/common/core_test.h
index e129634..0133c9c 100644 (file)
@@ -35,7 +35,7 @@
  *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
  *  の責任を負わない.
  * 
- *  @(#) $Id: prc_test.h 1304 2008-08-27 07:28:36Z ertl-honda $
+ *  @(#) $Id: core_test.h 2178 2011-07-23 09:58:56Z ertl-honda $
  */
 
 /*
similarity index 95%
rename from asp/arch/arm_m_gcc/prc_timer.c
rename to asp/arch/arm_m_gcc/common/core_timer.c
index 33a45cb..3a46f0c 100644 (file)
@@ -3,7 +3,7 @@
  *      Toyohashi Open Platform for Embedded Real-Time Systems/
  *      Advanced Standard Profile Kernel
  * 
- *  Copyright (C) 2007 by Embedded and Real-Time Systems Laboratory
+ *  Copyright (C) 2008-2011 by Embedded and Real-Time Systems Laboratory
  *              Graduate School of Information Science, Nagoya Univ., JAPAN
  * 
  *  上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
@@ -35,7 +35,7 @@
  *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
  *  の責任を負わない.
  * 
- *  @(#) $Id: prc_timer.c 1304 2008-08-27 07:28:36Z ertl-honda $
+ *  @(#) $Id: core_timer.c 2202 2011-07-26 13:27:11Z ertl-honda $
  */
 
 /*
@@ -102,7 +102,7 @@ target_timer_handler(void)
        unsigned int tmp;
 
        /* probe_int のため,COUNTFLAGをクリア */
-       tmp = sil_rew_mem((void *)SYSTIC_CONTROL_STATUS);
+       tmp = sil_rew_mem((void *)SYSTIC_CURRENT_VALUE);
 
        i_begin_int(INTNO_TIMER);
        signal_time();                    /* タイムティックの供給 */
similarity index 81%
rename from asp/arch/arm_m_gcc/prc_timer.cfg
rename to asp/arch/arm_m_gcc/common/core_timer.cfg
index 2029d82..e31e356 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  @(#) $Id: prc_timer.cfg 1304 2008-08-27 07:28:36Z ertl-honda $
+ *  @(#) $Id: core_timer.cfg 2178 2011-07-23 09:58:56Z ertl-honda $
  */
 
 /*
similarity index 94%
rename from asp/arch/arm_m_gcc/prc_timer.h
rename to asp/arch/arm_m_gcc/common/core_timer.h
index e6c609a..d35b297 100644 (file)
@@ -3,7 +3,7 @@
  *      Toyohashi Open Platform for Embedded Real-Time Systems/
  *      Advanced Standard Profile Kernel
  * 
- *  Copyright (C) 2008 by Embedded and Real-Time Systems Laboratory
+ *  Copyright (C) 2008-2011 by Embedded and Real-Time Systems Laboratory
  *              Graduate School of Information Science, Nagoya Univ., JAPAN
  * 
  *  上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
  *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
  *  の責任を負わない.
  * 
- *  @(#) $Id: prc_timer.h 1304 2008-08-27 07:28:36Z ertl-honda $
+ *  @(#) $Id: core_timer.h 2183 2011-07-23 10:29:36Z ertl-honda $
  */
 
 /*
  *  タイマドライバ(SYSTIC用)
  */
 
-#ifndef TOPPERS_PRC_TIMER_H
-#define TOPPERS_PRC_TIMER_H
+#ifndef TOPPERS_CORE_TIMER_H
+#define TOPPERS_CORE_TIMER_H
 
 #include <sil.h>
 
@@ -110,4 +110,4 @@ target_timer_probe_int(void)
 extern void target_timer_handler(void);
 
 #endif /* TOPPERS_MACRO_ONLY */
-#endif /* TOPPERS_PRC_TIMER_H */
+#endif /* TOPPERS_CORE_TIMER_H */
diff --git a/asp/arch/arm_m_gcc/common/core_unrename.h b/asp/arch/arm_m_gcc/common/core_unrename.h
new file mode 100644 (file)
index 0000000..1a9f400
--- /dev/null
@@ -0,0 +1,74 @@
+/* This file is generated from core_rename.def by genrename. */
+
+/* This file is included only when core_rename.h has been included. */
+#ifdef TOPPERS_CORE_RENAME_H
+#undef TOPPERS_CORE_RENAME_H
+
+/*
+ *  core_config.c
+ */
+#undef exc_tbl
+#undef vector_table
+#undef lock_flag
+#undef saved_iipm
+#undef default_exc_handler
+#undef default_int_handler
+#undef x_config_int
+#undef core_initialize
+#undef core_terminate
+#undef bitpat_cfgint
+#undef set_exc_int_priority
+#undef enable_exc
+#undef disable_exc
+
+/*
+ *  core_support.S
+ */
+#undef core_int_entry
+#undef core_exc_entry
+#undef ret_int
+#undef ret_exc
+#undef svc_handler
+#undef start_r
+#undef dispatch
+#undef start_dispatch
+#undef exit_and_dispatch
+#undef call_exit_kernel
+
+#ifdef TOPPERS_LABEL_ASM
+
+/*
+ *  core_config.c
+ */
+#undef _exc_tbl
+#undef _vector_table
+#undef _lock_flag
+#undef _saved_iipm
+#undef _default_exc_handler
+#undef _default_int_handler
+#undef _x_config_int
+#undef _core_initialize
+#undef _core_terminate
+#undef _bitpat_cfgint
+#undef _set_exc_int_priority
+#undef _enable_exc
+#undef _disable_exc
+
+/*
+ *  core_support.S
+ */
+#undef _core_int_entry
+#undef _core_exc_entry
+#undef _ret_int
+#undef _ret_exc
+#undef _svc_handler
+#undef _start_r
+#undef _dispatch
+#undef _start_dispatch
+#undef _exit_and_dispatch
+#undef _call_exit_kernel
+
+#endif /* TOPPERS_LABEL_ASM */
+
+
+#endif /* TOPPERS_CORE_RENAME_H */
diff --git a/asp/arch/arm_m_gcc/common/core_user.txt b/asp/arch/arm_m_gcc/common/core_user.txt
new file mode 100644 (file)
index 0000000..ce0a5d2
--- /dev/null
@@ -0,0 +1,330 @@
+=====================================================================
+                         ARM-Mプロセッサ依存部
+                                  Last Modified: 2011 Jul 26 22:24:51
+=====================================================================
+
+
+(1) 対応しているターゲットシステムの種類・構成
+
+ARM-M依存部は,ARMVx-Mアーキテクチャをターゲットとしている.ARMVx-Mは,
+ARMとは異なり,ARM命令を実行できないため,ARM依存部と分けている.
+
+
+(2) 使用する開発環境と動作検証した条件(バージョン,オプション等)
+
+カーネルはGCCを用いてコンパイルする.動作確認したバージョンは各ターゲ
+ット依存部のドキュメントに記載する.
+
+
+(3) ターゲット定義事項の規定
+
+(3-1) データ型に関する規定
+
+データ型は arch/gcc/tool_stddef.h で定義されている内容で,float型と
+double型は,それぞれIEEE754準拠の単精度浮動小数点数と倍精度浮動小数点
+数である.
+
+(3-2) 割込み処理に関する規定
+
+○割込みハンドラ番号と割込み番号の割当て,両者の対応
+
+割込みハンドラ番号と割込み番号は,例外発生時にIPSRにセットされる例外番
+号を用いる.SYSTICKは15番で,外部割込みは16番からの番号が割り付けられ
+ている.
+
+○割込み優先度の段階数とTMIN_INTPRIの値
+
+割込み優先度の段階数は,SoC毎にハードウェア的にサポートする割込み優先
+度ビット幅が異なるので,ターゲット依存部毎に異なる.ターゲット依存部で
+は,割込み優先度のビット幅(TBITW_IPRI)とその割込み優先度中のサブ優先
+度のビット幅(TBITW_SUBPRI)を定義する.
+
+各ビット幅の値とCFG_INTで使用可能な割込み優先度の範囲は次の通りである.
+
+   -(2^(TBIW_IPRI)) + (2^TBITW_SUBIPRI) 〜 -1
+
+例えば優先度のビット幅(TBITW_IPRI)が8bit,サブ優先度のビット幅
+(TBITW_SUBIPRI) が1bitの場合は,-254 〜 -1 の範囲である.
+
+優先度のビット幅(TBITW_IPRI)が3bit,サブ優先度のビット幅(TBITW_SUBIPRI) 
+が0bitの場合は,-8 〜 -1 の範囲である.
+
+最大優先度(3bitの例では-8)は,内部優先度としては"0x00"となる.この優先
+度はCPUロックで用いるBASEPRIレジスタではマスクできないため,カーネル管
+理内の割込みの最高優先度(TMIN_INTPRI)は,最大値より1つ優先度が低い値
+以下の値を指定する.
+
+この範囲で,カーネル管理内の割込みの最高優先度(TMIN_INTPRI)をターゲ
+ット依存部で設定する.
+
+○dis_intとena_intのサポートの有無,その制限事項
+
+dis_intとena_intをサポートする.制限事項は特にない.
+
+○CFG_INTの制限事項と拡張(ターゲット定義で使用できる割込み属性)
+
+CFG_INTの制限事項はなく,ターゲット定義で使用可能な割込み属性は特にな
+い.
+
+○カーネル管理外の割込み
+
+カーネル管理外の割込みをサポートする.指定方法は,割込み優先度の段階数
+で指定した,サポートする割込み優先度の最高値(最小値)より,
+TMIN_INTPRIの値を大きく(優先度を低く)設定すると,TMIN_INTPRIより値が
+小い(高優先度)な割込み優先度を設定した割込みを割込み優先度として扱う.
+
+カーネル管理外の割込みはOS実行中も禁止になることはなく(厳密には割込み
+の出口でごく短い区間禁止される),割込み発生時は,カーネルのコードを経
+由せずに呼び出される.
+
+カーネル管理外の割込みに対する,DEF_INH,CFG_INTはサポートする.
+
+(3-3) CPU例外処理に関する規定
+
+○CPU例外ハンドラ番号
+
+CPU例外ハンドラ番号としては,例外発生時にIPSRにセットされる,例外番号
+を用いる.各例外の例外番号は以下の通りである.
+
+        例外              例外番号
+  Reset                      1
+  Non-makable Interrupt      2
+  Hard Fault                 3
+  Memory Management          4
+  Bus Fault                  5
+  Usage Fault                6
+  SVCall                    11
+  Debug Monitor             12
+  PendSV                    14
+
+なお,Resetと,SVCallについては,カーネルが使用するため,ユーザーは使
+用することができない.
+
+ARM-MアーキテクチャではCPU例外に優先度を設定することが可能である.
+ARM-M依存部では,全てのCPU例外の優先度をCPUロックではマスクできないマ
+スク出来ない値(内部優先度0)に初期化している.
+
+(3-4) CPUロック・割込みロック
+
+CPUロックは,basepriをTMIN_INTPRIの優先度の割込みを禁止する値に設定す
+る.割込みロックは,FAULTMASKを'1'に設定することで実現している.
+
+(3-5) 性能評価用システム時刻の参照に関する規定
+
+get_utmをサポートする.精度に関しては,ターゲット毎に異なる.
+
+(3-6) スタートアップルーチンでの初期化内容
+
+スタートアップルーチンは,Threadモードで呼び出されることを前提としてい
+る.実行後,割込みロック状態(FAULTMASKをセット)とする.割込みロック
+状態は,カーネルの初期化終了時に許可する.スタートアップルーチンで,
+MSPをアクティブなスタックとし,MSPの内容を初期化するためには,INIT_MSP
+をターゲット依存部で定義する.
+
+(3-7) ベクタテーブルオフセットの初期化
+
+プロセッサ依存の初期化処理で,Vector Table Offset Register をターゲッ
+ト依存部の初期化ルーチンで設定する.なお,ベクターテーブルは,.vector
+のセクション属性が付加されているため,リンカスクリプトでこのセクション
+を指定して配置する.
+
+
+(4) タイマドライバ関連の情報
+
+カーネルのタイムティックとして,SYSTICを使用する場合は,core_config.c 
+をコンパイル対象とし,コンフィギュレーションファイルに core_config.cfg 
+を指定すること.
+
+周期の基本は1msecとする.周期をCALIBRATIONレジスタの設定内容を元に計算
+する場合は,SYSTIC_USE_CALIBRATION を定義する.CALIBRATIONレジスタを用
+いない場合は,1msec周期分のカウント値を TIMER_CLOCK に設定する.クロッ
+クソースとして,外部クロックを用いる場合は,SYSTIC_USE_STCLK を用いる.
+
+
+(5) ターゲット依存部での設定項目
+
+ターゲット依存部では以下のマクロを定義する必要がある.
+
+   ・TMAX_INTNO     : 割込み番号の最大値(通常の割込み番号 + 15)
+   ・TBITW_IPRI     : 割込み優先度のビット幅
+   ・TBITW_SUBIPRI  : 割込み優先度のビット幅中のサブ優先度のビット幅
+   ・TMIN_INTPRI    : 割込み優先度の最小値(最高値)
+   ・TIC_NUME       : タイムティックの周期の分子
+   ・TIC_DENO       : タイムティックの周期の分母
+   ・TIMER_CLOCK    : タイマ値の内部表現とミリ秒単位との変換
+   ・INTPRI_TIMER   : タイマ割込み割込み優先度
+   ・INTATR_TIMER   : タイマ割込みの割込み属性
+   ・INIT_MSP       : スタートアップルーチンでMSPを初期化する場合は定義
+   ・DEFAULT_ISTKSZ : スタックサイズ(8byte単位で指定)
+   ・SIL_DLY_TIM1   : 微少時間待ちのための定義
+   ・SIL_DLY_TIM2   : 微少時間待ちのための定義
+
+
+(6) その他
+
+(6-1) Configureation and Control Register(CCR)のSTKALIGNの制限
+
+システム起動後(正確にはOSの初期化終了後)はCCRのSTKALIGNの設定は,変
+更しないこと.
+
+
+(7) ディレクトリ構成・ファイル構成
+  ./arch/arm_m_gcc/common
+    ./Makefile.core
+    ./arm_m.h
+    ./makeoffset.c
+    ./core.tf
+    ./core_cfg1_out.h
+    ./core_check.tf
+    ./core_config.c
+    ./core_config.h
+    ./core_def.csv
+    ./core_insn.h
+    ./core_kernel.h
+    ./core_rename.def
+    ./core_rename.h
+    ./core_sil.h
+    ./core_stddef.h
+    ./core_support.S
+    ./core_test.h
+    ./core_timer.c
+    ./core_timer.cfg
+    ./core_timer.h
+    ./core_unrename.h
+    ./core_user.txt
+    ./start.S
+
+
+(8) バージョン履歴
+2011/07/26
+・CCRのSTKALIGNが'1'の場合への対応
+  割込み・例外の出入口処理では,スタックは常に8byte境界となるように変
+  更.
+  
+2011/07/25
+・CPU例外の優先度の初期化
+  CPUロックでマスクできない優先度(内部優先度0)に初期化する処理を追加.
+  
+・CFG_INTで使用できる割込み優先度の最大値の修正(core.tf)
+  ・最大値が1つ大きな値となっていた.
+  
+・カーネル管理外の割込みの扱いの変更
+  ・共通部での扱いの変更に伴う変更.
+  
+・タイマ割込みハンドラでのCOUNTFLAGのクリア処理の修正
+  SYSTIC_CONTROL_STATUSレジスタのCOUNTFLAGをクリアするには,
+  SYSTIC_CURRENT_VALUEレジスタを読み込む必要があるが,誤って
+  SYSTIC_CONTROL_STATUSレジスタを読み込んでいた.
+
+・core_int_entryにおけるbasepriの設定
+  NVIC優先度マスクが自動的に設定されるため優先度マスクの点では必要な
+  いが,x_get_ipm()がbasepriを参照するため,basepriも更新するよう変更.
+  
+
+2011/07/24
+・_ret_int_2/svc_handler の変更
+  割込み優先度マスクが全解除状態でしかタスク例外を呼び出さないように
+  仕様が変更されたため,_ret_int_2では,割込み優先度マスクを,全解除
+  状態(TIPM_ENAALL)に設定するよう変更.
+  svc_handlerはタスクにリターンする時にbasepriをIIPM_ENAALLにするよう
+  に変更.
+  
+・x_config_int()/set_exc_int_priority()の修正  
+  x_config_int()から,set_exc_int_priority()に対して外部優先度を引数に
+  して呼び出しいたため,内部優先度を引数で呼び出すよう修正.
+  set_exc_int_priority()も受け取った引数を内部優先度として優先度を設定
+  するように修正.
+
+2011/07/23
+・共通部を1.4.0にupdate.
+
+・arm依存部と同様にチップ依存部を置けるようにディレクトリ構造を変更
+
+・arm依存部と同様にファイル名のプリフィックスをcoreに変更.
+
+・call_atexitの削除
+  software_term_hook の呼び出しは,core_terminate()に移動.
+  
+・共通部を1.7.0にupdate.  
+
+・タスクコンテキストブロックの型名の変更
+  CTXB型をTSKCTXB型に名称変更.
+
+・ターゲット依存部でサポートする機能を示すマクロの変更
+  TOPPERS_SUPPORT_DIS_INTをTOPPERS_TARGET_SUPPORT_DIS_INTに,
+  TOPPERS_SUPPORT_ENA_INTをTOPPERS_TARGET_SUPPORT_ENA_INTに,
+  変更.
+  
+・exc_sense_unlockの定義を削除.  
+  
+・オフセットファイルをコンフィギュレータで生成する方法への対応
+
+・CHECK_FUNC_ALIGN,CHECK_FUNC_NONNULL,CHECK_STACK_ALIGN,
+  CHECK_STACK_NONNULL,CHECK_MPF_ALIGN,CHECK_MPF_NONNULLの定義を,タ
+  ーゲット依存部のテンプレートファイル(パス3)からヘッダファイルに移
+  動.
+
+・割込みと例外の入り口処理の名前を変更
+  int_entryをcore_int_entryへexc_entryをcore_exc_entryに変更.
+  オフセットの取得方法が変更となったため,元の名前のままだとcfg1_out.c
+  がコンパイルエラーとなるために変更.
+  
+・ターゲット依存部で定義する名称のリネームの追加
+
+・call_texrtnを呼び出す条件に「ipmflgがtrue」を追加
+・カーネル管理外のCPU例外の扱いの変更
+
+
+2011/07/22
+・x_disable_int() : prc_config.h の修正   
+ 割込み禁止レジスタのアドレスを取得する際に,ベースの値をuint32_tの
+ ポインタにキャストしていなったため,正しいアドレスが生成できていな
+ かった問題を修正.
+・非タスクコンテキスト用のスタックの初期値マクロ(TOPPERS_ISTKPT)の修正 
+  : prc_config.h
+ バイト単位で取得するように,(char_t *) にキャストして掲載するように修
+ 正.
+  
+・LOG_INH_ENTRYとLOG_INH_LEAVEの誤記 : prc_support.S
+  LOG_INH_ENTRYとLOG_INH_LEAVEであるべき箇所が LOG_EXC_ENTRYと
+  LOG_EXC_ENTRYになっている問題を修正.
+
+・TOPPERS_CUSTOM_IDLE のtypoの修正 : prc_support.S
+
+・svn_hanlderの修正 :  prc_support.S
+  一律EXC_FRAME_SIZE分のスタックを捨てていたが,Configureation and 
+  Control Register(CCR)のSTKALIGNが'1'の場  合は,8byte境界にアライン
+  されるため,捨てるサイズが異なる.アラインされたかは,xPSRの9ビッ
+  トをチェックすることにより判定する.
+  
+・prc.tfの修正
+  boostのバージョンによって変わる挙動を吸収.
+  http://www.toppers.jp/TOPPERS-USERS/201004/msg00034.html
+  
+・_kernel_istkpt の削除 : prc_cfg1_out.h
+  _kernel_istkpt が必要ないターゲットが存在するため,必要なら,ターゲ
+  ット依存部で定義するように変更.
+
+2008/08/22
+・prc_user.txt/prc_design.txt
+  ・2008/8/21の技術検討会での議論結果を反映.
+  
+・prc_support.S/prc_config.c/prc_config.h/arm_m.h
+  ・コンテキスト判定をexc_ncntからアクティブなスタックに変更
+  
+・prc_config.c
+  ・set_exc_int_priority() でサポート可能なIRQの上限を239に拡張.
+  
+・start.S 
+  ・起動時はThreadモードを前提としていることを明記.
+  ・ブートローダー等から起動される場合を想定し,MSPを有効にするように
+    変更.
+    
+・prc_timer.c
+  ・コメントを修正
+  ・デバッグ用コードを削除
+
+2008/07/11
+・最初のリリース
similarity index 98%
rename from asp/arch/arm_m_gcc/start.S
rename to asp/arch/arm_m_gcc/common/start.S
index 38f8921..733508d 100644 (file)
@@ -34,7 +34,7 @@
  *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
  *  の責任を負わない.
  * 
- *  @(#) $Id: start.S 1304 2008-08-27 07:28:36Z ertl-honda $
+ *  @(#) $Id: start.S 2177 2011-07-23 08:31:35Z ertl-honda $
  */
                 
 /*
diff --git a/asp/arch/arm_m_gcc/makeoffset.c b/asp/arch/arm_m_gcc/makeoffset.c
deleted file mode 100644 (file)
index f27f92a..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *  TOPPERS Software
- *      Toyohashi Open Platform for Embedded Real-Time Systems
- * 
- *  Copyright (C) 2008 by Embedded and Real-Time Systems Laboratory
- *              Graduate School of Information Science, Nagoya Univ., JAPAN
- * 
- *  上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
- *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
- *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
- *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
- *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
- *      スコード中に含まれていること.
- *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
- *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
- *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
- *      の無保証規定を掲載すること.
- *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
- *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
- *      と.
- *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
- *        作権表示,この利用条件および下記の無保証規定を掲載すること.
- *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
- *        報告すること.
- *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
- *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
- *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
- *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
- *      免責すること.
- * 
- *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
- *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
- *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
- *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
- *  の責任を負わない.
- * 
- *  @(#) $Id: makeoffset.c 1304 2008-08-27 07:28:36Z ertl-honda $
- */
-
-#include "kernel_impl.h"
-#include "task.h"
-
-#define OFFSET_DEF(TYPE, FIELD)                            \
-    Asm("OFFSET_DEF " #TYPE "_" #FIELD " = %0"            \
-      : /* no output */                                    \
-      : "g"(offsetof(TYPE, FIELD)))
-
-#define OFFSET_DEF2(TYPE, FIELD, FIELDNAME)                \
-    Asm("OFFSET_DEF " #TYPE "_" #FIELDNAME " = %0"        \
-      : /* no output */                                    \
-      : "g"(offsetof(TYPE, FIELD)))
-
-void
-makeoffset(void)
-{
-    OFFSET_DEF(TCB, p_tinib);
-    OFFSET_DEF(TCB, texptn);
-    OFFSET_DEF2(TCB, tskctxb.sp, sp);
-    OFFSET_DEF2(TCB, tskctxb.pc, pc);
-
-    OFFSET_DEF(TINIB, exinf);
-    OFFSET_DEF(TINIB, task);
-}
-
-uint32_t    BIT_REF_4 = 0x12345678;
-uint16_t    BIT_REF_2 = 0x1234;
-uint8_t     BIT_REF_1 = 0x12;
-
-TCB    BIT_BB_TCB_enatex = {
-       { NULL, NULL },                 /* task_queue */
-       NULL,                                   /* p_tinib */
-       0U,                                             /* tstat */
-#ifdef TOPPERS_SUPPORT_MUTEX
-       0U,                                             /* bpriority */
-#endif /* TOPPERS_SUPPORT_MUTEX */
-       0U,                                             /* priority */
-       false,                                  /* acqeue */
-       false,                                  /* wupque */
-       true,                                   /* enatex */
-       0U,                                             /* texprn */
-       NULL,                                   /* p_winifo */
-#ifdef TOPPERS_SUPPORT_MUTEX
-       { NULL, NULL },                 /* mutex_queue */
-#endif /* TOPPERS_SUPPORT_MUTEX */
-       { NULL, NULL }                  /* tskctxb */
-};
diff --git a/asp/arch/arm_m_gcc/prc_cfg1_out.h b/asp/arch/arm_m_gcc/prc_cfg1_out.h
deleted file mode 100644 (file)
index 6760afd..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- *  @(#) $Id: prc_cfg1_out.h 1304 2008-08-27 07:28:36Z ertl-honda $
- */
-
-/*
- *             cfg1_out.cをリンクするために必要なスタブの定義
- */
-
-void sta_ker(void){}
-#ifdef TOPPERS_CHIP_LPC17XX
-/* TOPPERS_CHIP_LPC17XXが宣言されているときには、何もここでは宣言しない */
-#else
-STK_T *const   _kernel_istkpt = 0x00;
-#endif
diff --git a/asp/arch/arm_m_gcc/prc_check.tf b/asp/arch/arm_m_gcc/prc_check.tf
deleted file mode 100644 (file)
index 10a4103..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-$ 
-$              パス3のプロセッサ依存テンプレート(ARM-M用)
-$ 
-
-$ 
-$  チェック方法の指定
-$ 
-$CHECK_FUNC_ALIGN = 1$
-$CHECK_FUNC_NONNULL = 1$
-$CHECK_STACK_ALIGN = 8$
-$CHECK_STACK_NONNULL = 1$
-$CHECK_MPF_ALIGN = 4$
-$CHECK_MPF_NONNULL = 1$
-
-$ 
-$  標準テンプレートファイルのインクルード
-$ 
-$INCLUDE "kernel/kernel_check.tf"$
diff --git a/asp/arch/arm_m_gcc/prc_def.csv b/asp/arch/arm_m_gcc/prc_def.csv
deleted file mode 100644 (file)
index 42b69d1..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-TMAX_INTNO,TMAX_INTNO
-TIPM_LOCK,TIPM_LOCK 
-TBITW_IPRI,TBITW_IPRI
diff --git a/asp/arch/arm_m_gcc/prc_rename.def b/asp/arch/arm_m_gcc/prc_rename.def
deleted file mode 100644 (file)
index 206257d..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# prc_config.c
-exc_tbl
-vector_table
-lock_flag
-saved_iipm
-default_exc_handler
-default_int_handler
-x_config_int
-prc_initialize
-prc_terminate
-bitpat_cfgint
-
-# prc_support.S
-int_entry_point
-exc_entry_point
-ret_int
-ret_exc
-svc_handler
-start_r
diff --git a/asp/arch/arm_m_gcc/prc_rename.h b/asp/arch/arm_m_gcc/prc_rename.h
deleted file mode 100644 (file)
index 35a3e23..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/* This file is generated from prc_rename.def by genrename. */
-
-#ifndef TOPPERS_PRC_RENAME_H
-#define TOPPERS_PRC_RENAME_H
-
-/*
- *  prc_config.c
- */
-#define exc_tbl                                                _kernel_exc_tbl
-#define vector_table                           _kernel_vector_table
-#define lock_flag                                      _kernel_lock_flag
-#define saved_iipm                                     _kernel_saved_iipm
-#define default_exc_handler                    _kernel_default_exc_handler
-#define default_int_handler                    _kernel_default_int_handler
-#define x_config_int                           _kernel_x_config_int
-#define prc_initialize                         _kernel_prc_initialize
-#define prc_terminate                          _kernel_prc_terminate
-#define bitpat_cfgint                          _kernel_bitpat_cfgint
-
-/*
- *  prc_support.S
- */
-#define int_entry_point                                _kernel_int_entry_point
-#define exc_entry_point                                _kernel_exc_entry_point
-#define ret_int                                                _kernel_ret_int
-#define ret_exc                                                _kernel_ret_exc
-#define svc_handler                                    _kernel_svc_handler
-#define start_r                                                _kernel_start_r
-
-#ifdef TOPPERS_LABEL_ASM
-
-/*
- *  prc_config.c
- */
-#define _exc_tbl                                       __kernel_exc_tbl
-#define _vector_table                          __kernel_vector_table
-#define _lock_flag                                     __kernel_lock_flag
-#define _saved_iipm                                    __kernel_saved_iipm
-#define _default_exc_handler           __kernel_default_exc_handler
-#define _default_int_handler           __kernel_default_int_handler
-#define _x_config_int                          __kernel_x_config_int
-#define _prc_initialize                                __kernel_prc_initialize
-#define _prc_terminate                         __kernel_prc_terminate
-#define _bitpat_cfgint                         __kernel_bitpat_cfgint
-
-/*
- *  prc_support.S
- */
-#define _int_entry_point                       __kernel_int_entry_point
-#define _exc_entry_point                       __kernel_exc_entry_point
-#define _ret_int                                       __kernel_ret_int
-#define _ret_exc                                       __kernel_ret_exc
-#define _svc_handler                           __kernel_svc_handler
-#define _start_r                                       __kernel_start_r
-
-#endif /* TOPPERS_LABEL_ASM */
-
-
-#endif /* TOPPERS_PRC_RENAME_H */
diff --git a/asp/arch/arm_m_gcc/prc_unrename.h b/asp/arch/arm_m_gcc/prc_unrename.h
deleted file mode 100644 (file)
index 69d9cf0..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/* This file is generated from prc_rename.def by genrename. */
-
-/* This file is included only when prc_rename.h has been included. */
-#ifdef TOPPERS_PRC_RENAME_H
-#undef TOPPERS_PRC_RENAME_H
-
-/*
- *  prc_config.c
- */
-#undef exc_tbl
-#undef vector_table
-#undef lock_flag
-#undef saved_iipm
-#undef default_exc_handler
-#undef default_int_handler
-#undef x_config_int
-#undef prc_initialize
-#undef prc_terminate
-#undef bitpat_cfgint
-
-/*
- *  prc_support.S
- */
-#undef int_entry_point
-#undef exc_entry_point
-#undef ret_int
-#undef ret_exc
-#undef svc_handler
-#undef start_r
-
-#ifdef TOPPERS_LABEL_ASM
-
-/*
- *  prc_config.c
- */
-#undef _exc_tbl
-#undef _vector_table
-#undef _lock_flag
-#undef _saved_iipm
-#undef _default_exc_handler
-#undef _default_int_handler
-#undef _x_config_int
-#undef _prc_initialize
-#undef _prc_terminate
-#undef _bitpat_cfgint
-
-/*
- *  prc_support.S
- */
-#undef _int_entry_point
-#undef _exc_entry_point
-#undef _ret_int
-#undef _ret_exc
-#undef _svc_handler
-#undef _start_r
-
-#endif /* TOPPERS_LABEL_ASM */
-
-
-#endif /* TOPPERS_PRC_RENAME_H */
diff --git a/asp/arch/arm_m_gcc/prc_user.txt b/asp/arch/arm_m_gcc/prc_user.txt
deleted file mode 100644 (file)
index ea8879d..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-=====================================================================
-                         ARM-Mプロセッサ依存部
-                                  Last Modified: 23 Aug 2008 22:04:49
-=====================================================================
-
-Ver 1.6.0以降の変更に関しては、prc_user_annex.txtを参照。
-
-(1) 対応しているターゲットシステムの種類・構成
-
-ARM-M依存部は,ARMVx-Mアーキテクチャをターゲットとしている.ARMVx-Mは,
-ARMとは異なり,ARM命令を実行できないため,ARM依存部と分けている.
-
-
-(2) 使用する開発環境と動作検証した条件(バージョン,オプション等)
-
-カーネルはGCCを用いてコンパイルする.動作確認したバージョンは各ターゲ
-ット依存部のドキュメントに記載する.
-
-
-(3) ターゲット定義事項の規定
-
-(3-1) データ型に関する規定
-
-データ型は arch/gcc/tool_stddef.h で定義されている内容で,float型と
-double型は,それぞれIEEE754準拠の単精度浮動小数点数と倍精度浮動小数点
-数である.
-
-(3-2) 割込み処理に関する規定
-
-○割込みハンドラ番号と割込み番号の割当て,両者の対応
-
-割込みハンドラ番号と割込み番号は,例外発生時にIPSRにセットされる例外番
-号を用いる.SYSTICKは15番で,外部割込みは16番からの番号が割り付けられ
-ている.
-
-○割込み優先度の段階数(TMIN_INTPRIの値),その設定方法
-
-割込み優先度の段階数は,SoC毎にハードウェア的にサポートする割込み優先
-度ビット幅が異なるので,ターゲット依存部毎に異なる.ターゲット依存部で
-は,割込み優先度のビット幅(TBITW_IPRI)とその割込み優先度中のサブ優先
-度のビット幅(TBITW_SUBPRI)を定義する.各ビット幅の値と設定可能な優先
-度の範囲は次の通りである.
-
-   -(2^(TBIW_IPRI)) + (2^TBITW_SUBIPRI)) 〜 -1
-
-例えば優先度のビット幅(TBITW_IPRI)が8bit,サブ優先度のビット幅
-(TBITW_SUBIPRI) が1bitの場合は,-254 〜 -1 の範囲である.
-
-この範囲で,カーネル管理内の割込みの最高優先度(TMIN_INTPRI)をターゲ
-ット依存部で設定する.
-
-各割込みの割込み優先度は,CFG_INTでTMIN_INTPRI以上の値を指定する.
-
-○dis_intとena_intのサポートの有無,その制限事項
-
-dis_intとena_intをサポートする.制限事項は特にない.
-
-○CFG_INTの制限事項と拡張(ターゲット定義で使用できる割込み属性)
-
-CFG_INTの制限事項はなく,ターゲット定義で使用可能な割込み属性は特にな
-い.
-
-○カーネル管理外の割込み
-
-カーネル管理外の割込みをサポートする.指定方法は,割込み優先度の段階数
-で指定した,サポートする割込み優先度の最高値(最小値)より,
-TMIN_INTPRIを大きく設定すると,TMIN_INTPRIより値が小い(高優先度)な割
-込み優先度を設定した割込みを割込み優先度として扱う.
-
-カーネル管理外の割込みはOS実行中も禁止になることはなく(厳密には割込み
-の出口でごく短い区間禁止される),割込み発生時は,カーネルのコードを経
-由せずに呼び出される.
-
-カーネル管理外の割込みに対する,DEF_INH,CFG_INTはサポートする.
-
-(3-3) CPU例外処理に関する規定
-
-○CPU例外ハンドラ番号
-
-CPU例外ハンドラ番号としては,例外発生時にIPSRにセットされる,例外番号
-を用いる.各例外の例外番号は以下の通りである.
-
-        例外              例外番号
-  Reset                      1
-  Non-makable Interrupt      2
-  Hard Fault                 3
-  Memory Management          4
-  Bus Fault                  5
-  Usage Fault                6
-  SVCall                    11
-  Debug Monitor             12
-  PendSV                    14
-
-なお,Resetと,SVCallについては,カーネルが使用するため,ユーザーは使
-用することができない.
-
-(3-4) CPUロック・割込みロック
-
-CPUロックは,basepriをTMIN_INTPRIの優先度の割込みを禁止する値に設定す
-る.割込みロックは,FAULTMASKを'1'に設定することで実現している.
-
-(3-5) 性能評価用システム時刻の参照に関する規定
-
-get_utmをサポートする.精度に関しては,ターゲット毎に異なる.
-
-(3-6) スタートアップルーチンでの初期化内容
-
-スタートアップルーチンは,Threadモードで呼び出されることを前提としてい
-る.実行後,割込みロック状態(FAULTMASKをセット)とする.割込みロック
-状態は,カーネルの初期化終了時に許可する.スタートアップルーチンで,
-MSPをアクティブなスタックとし,MSPの内容を初期化するためには,INIT_MSP
-をターゲット依存部で定義する.
-
-(3-7) ベクタテーブルオフセットの初期化
-
-プロセッサ依存の初期化処理で,Vector Table Offset Register をターゲッ
-ト依存部の初期化ルーチンで設定する.なお,ベクターテーブルは,.vector
-のセクション属性が付加されているため,リンカスクリプトでこのセクション
-を指定して配置する.
-
-
-(4) タイマドライバ関連の情報
-
-カーネルのタイムティックとして,SYSTICを使用する場合は,prc_config.c 
-をコンパイル対象とし,コンフィギュレーションファイルに prc_config.cfg 
-を指定すること.
-
-周期の基本は1msecとする.周期をCALIBRATIONレジスタの設定内容を元に計算
-する場合は,SYSTIC_USE_CALIBRATION を定義する.CALIBRATIONレジスタを用
-いない場合は,1msec周期分のカウント値を TIMER_CLOCK に設定する.クロッ
-クソースとして,外部クロックを用いる場合は,SYSTIC_USE_STCLK を用いる.
-
-
-(5) ターゲット依存部での設定項目
-
-ターゲット依存部では以下のマクロを定義する必要がある.
-
-   ・TMAX_INTNO     : 割込み番号の最大値(通常の割込み番号 + 15)
-   ・TBITW_IPRI     : 割込み優先度のビット幅
-   ・TBITW_SUBIPRI  : 割込み優先度のビット幅中のサブ優先度のビット幅
-   ・TMIN_INTPRI    : 割込み優先度の最小値(最高値)
-   ・TIC_NUME       : タイムティックの周期の分子
-   ・TIC_DENO       : タイムティックの周期の分母
-   ・TIMER_CLOCK    : タイマ値の内部表現とミリ秒単位との変換
-   ・INTPRI_TIMER   : タイマ割込み割込み優先度
-   ・INTATR_TIMER   : タイマ割込みの割込み属性
-   ・INIT_MSP       : スタートアップルーチンでMSPを初期化する場合は定義
-   ・DEFAULT_ISTKSZ : スタックサイズ(8byte単位で指定)
-   ・SIL_DLY_TIM1   : 微少時間待ちのための定義
-   ・SIL_DLY_TIM2   : 微少時間待ちのための定義
-
-
-(6) ディレクトリ構成・ファイル構成
-  ./arch/arm_m_gcc/
-    ./Makefile.prc
-    ./arm_m.h
-    ./makeoffset.c
-    ./prc.tf
-    ./prc_cfg1_out.h
-    ./prc_check.tf
-    ./prc_config.c
-    ./prc_config.h
-    ./prc_def.csv
-    ./prc_insn.h
-    ./prc_kernel.h
-    ./prc_rename.def
-    ./prc_rename.h
-    ./prc_sil.h
-    ./prc_stddef.h
-    ./prc_support.S
-    ./prc_test.h
-    ./prc_timer.c
-    ./prc_timer.cfg
-    ./prc_timer.h
-    ./prc_unrename.h
-    ./prc_user_annex.txt
-    ./prc_user.txt
-    ./start.S
-
-(12) バージョン履歴
-
-2010/10/23
- ・1.6.0対応にしたがい、数点の変更を行った。詳しくは prc_user_annex.txtを参照。
-
-2008/08/22
- ・prc_user.txt/prc_design.txt
-   ・2008/8/21の技術検討会での議論結果を反映.
- ・prc_support.S/prc_config.c/prc_config.h/arm_m.h
-   ・コンテキスト判定をexc_ncntからアクティブなスタックに変更
- ・prc_config.c
-   ・set_exc_int_priority() でサポート可能なIRQの上限を239に拡張.
- ・start.S 
-   ・起動時はThreadモードを前提としていることを明記.
-   ・ブートローダー等から起動される場合を想定し,MSPを有効にするように
-     変更.
- ・prc_timer.c
-   ・コメントを修正
-   ・デバッグ用コードを削除
-
-2008/07/11
- ・最初のリリース
diff --git a/asp/arch/arm_m_gcc/prc_user_annex.txt b/asp/arch/arm_m_gcc/prc_user_annex.txt
deleted file mode 100644 (file)
index 51ff897..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-=====================================================================
-                         ARM-Mプロセッサ依存部 ASP 1.7.0対応版
-                                  Last Modified: 2011/Jul/16
-=====================================================================
-
-
-(1) CPU依存部の概要
-
-このARM-M依存部は、TOPPERSプロジェクトが配布しているTOPPERS/ASP
-1.3.2対応版CORTEX-M3依存部を元に修正したものである。
-
-(2) 変更点
-以下の点を元にしたASP 1.3.2.対応版から変更した
-
-(2-1) prc_cfg1_out.h
-_kernel_istkptの定義を、LPC17xx向けコンパイル時に外すようにした。
-これによって、メモリリマップのないLPC17xxでもGDBでSRAMにロードした
-プログラムが正しいMSP値を取得できるようになる。
-
-(2-2) prc_config.h
-ターゲット非依存部の要請に従い、CTXBをTSKCTXBに改名した。
-
-TOPPERS_ISTKPTにある、割り込みスタックのサイズの計算のバグを修正した。
-
-(2-3) prc.tf
-以下の議論に従い、$bitpat_cfgintへの代入方法を修正した。
-http://www.toppers.jp/TOPPERS-USERS/201004/msg00034.html
-> prc.tfの130行目に
-> $bitpat_cfgint = 0$
-> という行がありますが、これを
-> $bitpat_cfgint = 1-1$
-> に書き換えるとうまくいくようです。
-
-(2-4) prc_user_annex.h
-当ドキュメントを追加した。
-
-(2-5) MANIFEST
-バージョン番号を1.6.0に変更し、新設したチップ依存部、ターゲット依存部の
-マニフェストのINCLUDEを追加した。
-
-(2-6) 割り込みエントリprc_support.S の int_entry および exp_entry 
-が 1.7.0カーネルの内部名と衝突したため、それぞれ int_entry_pointおよび
-exp_entry_pointに改名し、関連する prc_rename.defを変更した。
-
-当ドキュメントの名前を追加した。
-
-(3) 変更履歴
-2011/Jul/16
-    - 1.7.0 対応
-
-2010/Oct/23
-       - 初版
-       
-以上
index 13596e5..51270f0 100644 (file)
@@ -23,4 +23,8 @@ chip_user.txt
 lpc1700.h
 chip_rename.def
 chip_rename.h
-chip_unrename.h
\ No newline at end of file
+chip_unrename.h
+
+INCLUDE ../../target/lpc1768_generic_gcc/MANIFEST
+INCLUDE ../../target/lpcxpresso1768_gcc/MANIFEST
+INCLUDE ../../pdic/uart/MANIFEST
index c2159b8..e18fd9e 100644 (file)
@@ -24,7 +24,7 @@ COPTS := $(COPTS) -mcpu=cortex-m3
 #
 KERNEL_DIR := $(KERNEL_DIR) $(CHIPDIR)
 KERNEL_ASMOBJS := $(KERNEL_ASMOBJS)
-KERNEL_COBJS := $(KERNEL_COBJS)  chip_config.o prc_timer.o
+KERNEL_COBJS := $(KERNEL_COBJS)  chip_config.o core_timer.o
 KERNEL_CFLAGS := $(KERNEL_CFLAGS) -fno-strict-aliasing -mcpu=cortex-m3
 
 #
@@ -76,4 +76,4 @@ $(OBJFILE): $(CHIPDIR)/chip_check.tf
 #
 #  プロセッサ依存部のインクルード
 #
-include $(SRCDIR)/arch/$(PRC)_$(TOOL)/Makefile.prc
+include $(SRCDIR)/arch/$(PRC)_$(TOOL)/common/Makefile.core
index 9c0cb40..6f779d0 100644 (file)
@@ -5,4 +5,4 @@ $
 $ 
 $  プロセッサ依存のテンプレートファイルのインクルード
 $ 
-$INCLUDE"arm_m_gcc/prc.tf"$
+$INCLUDE"arm_m_gcc/common/core.tf"$
index 34f184b..7ec0bd5 100644 (file)
@@ -11,7 +11,7 @@
 /*
  *  コア依存のスタブの定義を読み込む
  */
-#include "arm_m_gcc/prc_cfg1_out.h"
+#include "arm_m_gcc/common/core_cfg1_out.h"
 
 /**
  * \}
index 28eb34d..7917a93 100644 (file)
@@ -5,4 +5,4 @@ $
 $ 
 $  パス3のプロセッサ依存のテンプレートのインクルード
 $ 
-$INCLUDE"arm_m_gcc/prc_check.tf"$
+$INCLUDE"arm_m_gcc/common/core_check.tf"$
index 09e46e6..2f716bd 100644 (file)
@@ -62,7 +62,7 @@ void chip_initialize(void)
        /*
         *  プロセッサ依存部の初期化
         */
-       prc_initialize();
+       core_initialize();
 
 }
 
@@ -112,7 +112,7 @@ extern void initPLL0(
 void chip_exit(void)
 {
        /* チップ依存部の終了処理 */
-       prc_terminate();
+       core_terminate();
 }
 
 
index eefcc79..3100650 100644 (file)
@@ -158,7 +158,7 @@ extern void chip_fput_log(char_t c);
 /*
  *  プロセッサ依存モジュール(ARM-M用)
  */
-#include "arm_m_gcc/prc_config.h"
+#include "arm_m_gcc/common/core_config.h"
 
 #endif /* TOPPERS_CHIP_CONFIG_H */
 
index 2159cc0..ee7934f 100644 (file)
 /*
  *  プロセッサで共通な定義
  */
-#include "arm_m_gcc/prc_kernel.h"
+#include "arm_m_gcc/common/core_kernel.h"
 
 #endif /* TOPPERS_CHIP_KERNEL_H */
 
index 39077b9..41f9cae 100644 (file)
@@ -1,4 +1,4 @@
-INCLUDE        "arm_m_gcc/prc"
+INCLUDE        "arm_m_gcc/common/core"
 
 chip_initialize
 initPLL0
index 78fe266..d073469 100644 (file)
@@ -19,6 +19,6 @@
 
 #endif /* TOPPERS_LABEL_ASM */
 
-#include "arm_m_gcc/prc_rename.h"
+#include "arm_m_gcc/common/core_rename.h"
 
 #endif /* TOPPERS_CHIP_RENAME_H */
index 4f40e18..9ff066d 100644 (file)
@@ -79,7 +79,7 @@
 /*
  *  プロセッサで共通な定義 
  */
-#include "arm_m_gcc/prc_sil.h"
+#include "arm_m_gcc/common/core_sil.h"
 
 
 #endif /* TOPPERS_CHIP_SIL_H */
index 2720327..65c8f7b 100644 (file)
@@ -85,7 +85,7 @@
 /*
  *  プロセッサで共通な定義
  */
-#include "arm_m_gcc/prc_stddef.h"
+#include "arm_m_gcc/common/core_stddef.h"
 
 #endif /* TOPPERS_CHIP_STDDEF_H */
 
index 50ac506..e3af8a8 100644 (file)
@@ -56,7 +56,7 @@
 /*
  *  プロセッサ依存モジュール(ARM-M用)
  */
-#include "arm_m_gcc/prc_test.h"
+#include "arm_m_gcc/common/core_test.h"
 
 #endif /* TOPPERS_CHIP_TEST_H */
 
index 6101f40..15bc1fd 100644 (file)
@@ -1,3 +1,3 @@
 #include "target_timer.h"
 
-INCLUDE("arm_m_gcc/prc_timer.cfg");
+INCLUDE("arm_m_gcc/common/core_timer.cfg");
index cbd3873..fb08088 100644 (file)
@@ -78,7 +78,7 @@
 /*
  *  プロセッサ依存部で定義する
  */
-#include "arm_m_gcc/prc_timer.h"
+#include "arm_m_gcc/common/core_timer.h"
 
 #endif /* TOPPERS_CHIP_TIMER_H */
 
index 4f82b8e..34310a2 100644 (file)
@@ -20,6 +20,6 @@
 
 #endif /* TOPPERS_LABEL_ASM */
 
-#include "arm_m_gcc/prc_unrename.h"
+#include "arm_m_gcc/common/core_unrename.h"
 
 #endif /* TOPPERS_CHIP_RENAME_H */
index 43faef2..467ad5d 100644 (file)
@@ -55,7 +55,7 @@
 /*
  * CORTEX-M3 CPUの依存部のインクルード
  */
-#include "arm_m_gcc/arm_m.h"
+#include "arm_m_gcc/common/arm_m.h"
 #ifndef TOPPERS_MACRO_ONLY
 #include "LPC17xx.h"
 #endif
index 6d5f264..a3c5c47 100644 (file)
@@ -4,5 +4,3 @@ VERSION %date
 INCLUDE ../../MANIFEST
 INCLUDE ../../cfg/MANIFEST
 INCLUDE ../../arch/arm_m_gcc/MANIFEST
-INCLUDE ../../pdic/uart/MANIFEST
-INCLUDE ./MANIFEST
index bc9dadb..42ee3d5 100644 (file)
@@ -15,6 +15,7 @@ target_config.c
 target_config.h
 target_def.csv
 target_kernel.h
+target_offset.tf
 target_rename.def
 target_rename.h
 target_serial.cfg
@@ -27,5 +28,3 @@ target_timer.cfg
 target_timer.h
 target_unrename.h
 target_user.txt
-
-
index 63cdcf2..04d1dc9 100644 (file)
@@ -63,6 +63,11 @@ all: $(OBJNAME).hex
 sram: all
 
 
+# 
+#  オフセットファイル生成のための定義 
+# 
+OFFSET_TF := $(TARGETDIR)/target_offset.tf
+
 #
 #  プロセッサ依存部のインクルード
 #
index edbb88e..3daef6f 100644 (file)
@@ -5,4 +5,4 @@ $
 $ 
 $  プロセッサ依存のテンプレートファイルのインクルード
 $ 
-$INCLUDE"arm_m_gcc/prc.tf"$
+$INCLUDE"chip.tf"$
diff --git a/asp/target/lpc1768_generic_gcc/target_offset.tf b/asp/target/lpc1768_generic_gcc/target_offset.tf
new file mode 100755 (executable)
index 0000000..443c8b7
--- /dev/null
@@ -0,0 +1,13 @@
+$
+$       オフセットファイル生成用テンプレートファイル(LPC1768用)
+$
+
+$
+$  標準テンプレートファイルのインクルード
+$
+$INCLUDE "kernel/genoffset.tf"$
+
+$ 
+$  コア依存テンプレートのインクルード(ARM-M用)
+$ 
+$INCLUDE"../../arch/arm_m_gcc/common/core_offset.tf"$
index a2b3c73..96e9a3d 100644 (file)
@@ -4,5 +4,3 @@ VERSION %date
 INCLUDE ../../MANIFEST
 INCLUDE ../../cfg/MANIFEST
 INCLUDE ../../arch/arm_m_gcc/MANIFEST
-INCLUDE ../../pdic/uart/MANIFEST
-INCLUDE ./MANIFEST
index abb8ecc..c712c1a 100644 (file)
@@ -14,6 +14,7 @@ target_config.c
 target_config.h
 target_def.csv
 target_kernel.h
+target_offset.tf
 target_rename.def
 target_rename.h
 target_serial.cfg
@@ -26,5 +27,3 @@ target_timer.cfg
 target_timer.h
 target_unrename.h
 target_user.txt
-
-
index 55683b7..4c92903 100644 (file)
@@ -59,6 +59,11 @@ all: $(OBJNAME).hex
 sram: all
 
 
+# 
+#  オフセットファイル生成のための定義 
+# 
+OFFSET_TF := $(TARGETDIR)/target_offset.tf
+
 #
 #  プロセッサ依存部のインクルード
 #
index edbb88e..3daef6f 100644 (file)
@@ -5,4 +5,4 @@ $
 $ 
 $  プロセッサ依存のテンプレートファイルのインクルード
 $ 
-$INCLUDE"arm_m_gcc/prc.tf"$
+$INCLUDE"chip.tf"$
diff --git a/asp/target/lpcxpresso1768_gcc/target_offset.tf b/asp/target/lpcxpresso1768_gcc/target_offset.tf
new file mode 100755 (executable)
index 0000000..443c8b7
--- /dev/null
@@ -0,0 +1,13 @@
+$
+$       オフセットファイル生成用テンプレートファイル(LPC1768用)
+$
+
+$
+$  標準テンプレートファイルのインクルード
+$
+$INCLUDE "kernel/genoffset.tf"$
+
+$ 
+$  コア依存テンプレートのインクルード(ARM-M用)
+$ 
+$INCLUDE"../../arch/arm_m_gcc/common/core_offset.tf"$