OSDN Git Service

(none)
authorryuz <ryuz>
Mon, 24 Sep 2007 08:11:12 +0000 (08:11 +0000)
committerryuz <ryuz>
Mon, 24 Sep 2007 08:11:12 +0000 (08:11 +0000)
24 files changed:
aplfw/build/common/gmake/aplfwsrc.inc
aplfw/driver/serial/at91/at91usartdrv_isr.c
aplfw/sample/arm/utb_arm7at91/armcc/gmake.mak [new file with mode: 0755]
aplfw/sample/arm/utb_arm7at91/armcc/startup.s [new file with mode: 0755]
aplfw/sample/arm/utb_arm7at91/armcc/uish.s [new file with mode: 0755]
aplfw/sample/arm/utb_arm7at91/armcc/vectors.s [new file with mode: 0755]
aplfw/sample/arm/utb_arm7at91/boot_task.c [new file with mode: 0755]
aplfw/sample/arm/utb_arm7at91/boot_task.h [new file with mode: 0755]
aplfw/sample/arm/utb_arm7at91/gcc/crt0.S [new file with mode: 0755]
aplfw/sample/arm/utb_arm7at91/gcc/gmake.mak [new file with mode: 0755]
aplfw/sample/arm/utb_arm7at91/gcc/link.x [new file with mode: 0755]
aplfw/sample/arm/utb_arm7at91/gcc/vectors.S [new file with mode: 0755]
aplfw/sample/arm/utb_arm7at91/main.c [new file with mode: 0755]
aplfw/sample/arm/utb_arm7at91/ostimer.c [new file with mode: 0755]
aplfw/sample/arm/utb_arm7at91/ostimer.h [new file with mode: 0755]
aplfw/sample/arm/utb_arm7at91/system.cfg [new file with mode: 0755]
aplfw/sample/h8/ae-3069-lan/ch38/gmake.mak
aplfw/sample/sh/cq7144a/shc/gmake.mak
aplfw/system/sysapi/sysapi.h
kernel/build/arm/at91/armcc/gmake.mak [new file with mode: 0755]
kernel/build/arm/at91/gcc/gmake.mak [new file with mode: 0755]
kernel/build/common/gmake/makeexe.inc
kernel/source/arch/irc/arm/at91/kexe_irc.c
kernel/source/arch/irc/arm/at91/kini_irc.c

index 02aeaa9..5786955 100755 (executable)
@@ -52,7 +52,8 @@ CSRCS         += $(SYSAPI_DIR)/sysapi_initialize.c                                    \
                  $(SYSAPI_DIR)/sysprc_exit.c                                           \
                  $(SYSAPI_DIR)/sysprc_getcurrenthandle.c                       \
                  $(SYSAPI_DIR)/sysprc_start.c                                          \
-                 $(SYSAPI_DIR)/systim_wait.c
+                 $(SYSAPI_DIR)/systim_wait.c                                           \
+                 $(SYSAPI_DIR)/systim_getsystemtime.c
 
 
 # Handle Object
@@ -76,6 +77,13 @@ CSRCS         += $(PROCESS_DIR)/process.c                                                    \
                  $(PROCESS_DIR)/procobj.c
 
 
+# Time
+TIME_DIR       = $(APLFW_DIR)/system/time
+SRC_DIRS      += $(TIME_DIR)
+CSRCS         += $(TIME_DIR)/time_getsystemtime.c                                      \
+                 $(TIME_DIR)/time_wait.c
+
+
 # File
 FILE_DIR       = $(APLFW_DIR)/system/file
 SRC_DIRS      += $(FILE_DIR)
@@ -216,19 +224,19 @@ CSRCS         += $(PC16550_DIR)/pc16550drv_create.c                                       \
                  $(PC16550_DIR)/pc16550hal_getstatus.c
 
 
-# ARMUART (PL011)
-ARMUART_DIR    = $(APLFW_DIR)/driver/serial/arm
-SRC_DIRS      += $(ARMUART_DIR)
-CSRCS         += $(ARMUART_DIR)/armuartdrv_create.c                                    \
-                 $(ARMUART_DIR)/armuartdrv_delete.c                                    \
-                 $(ARMUART_DIR)/armuartdrv_open.c                                      \
-                 $(ARMUART_DIR)/armuartdrv_close.c                                     \
-                 $(ARMUART_DIR)/armuartdrv_iocontrol.c                         \
-                 $(ARMUART_DIR)/armuartdrv_seek.c                                      \
-                 $(ARMUART_DIR)/armuartdrv_read.c                                      \
-                 $(ARMUART_DIR)/armuartdrv_write.c                                     \
-                 $(ARMUART_DIR)/armuartdrv_flush.c                                     \
-                 $(ARMUART_DIR)/armuartdrv_isr.c                                       \
+# Atmel AT91 USART
+AT91USRAT_DIR  = $(APLFW_DIR)/driver/serial/at91
+SRC_DIRS      += $(AT91USRAT_DIR)
+CSRCS         += $(AT91USRAT_DIR)/at91usartdrv_create.c                                \
+                 $(AT91USRAT_DIR)/at91usartdrv_delete.c                                \
+                 $(AT91USRAT_DIR)/at91usartdrv_open.c                          \
+                 $(AT91USRAT_DIR)/at91usartdrv_close.c                         \
+                 $(AT91USRAT_DIR)/at91usartdrv_iocontrol.c                     \
+                 $(AT91USRAT_DIR)/at91usartdrv_flush.c                         \
+                 $(AT91USRAT_DIR)/at91usartdrv_seek.c                          \
+                 $(AT91USRAT_DIR)/at91usartdrv_read.c                          \
+                 $(AT91USRAT_DIR)/at91usartdrv_write.c                         \
+                 $(AT91USRAT_DIR)/at91usartdrv_isr.c
 
 
 
@@ -264,6 +272,11 @@ MEMTEST_DIR    = $(APLFW_DIR)/application/utility/memtest
 SRC_DIRS      += $(MEMTEST_DIR)
 CSRCS         += $(MEMTEST_DIR)/memtest_main.c
 
+# Time Command
+TIMECMD_DIR    = $(APLFW_DIR)/application/utility/timecmd
+SRC_DIRS      += $(TIMECMD_DIR)
+CSRCS         += $(TIMECMD_DIR)/timecmd_main.c
+
 # Key Test
 KEYTEST_DIR    = $(APLFW_DIR)/application/utility/keytest
 SRC_DIRS      += $(KEYTEST_DIR)
index 2b36a3a..657fbca 100755 (executable)
@@ -18,9 +18,9 @@ void At91UsartDrv_Isr(VPARAM Param)
        C_AT91USARTDRV  *self;
        unsigned long   uwCsr;
        int                             c;
-
+       
        self = (C_AT91USARTDRV *)Param;
-
+       
        uwCsr = AT91USART_REG_READ(self, AT91USART_US_CSR);
        
        /* 受信 */    
@@ -39,9 +39,11 @@ void At91UsartDrv_Isr(VPARAM Param)
        /* 送信チェック */        
        if ( uwCsr & 0x00000002 )
        {
-               AT91USART_REG_WRITE(self, AT91USART_US_IDR, 0x00000002);        /* 送信割り込み禁止 */          
+               AT91USART_REG_WRITE(self, AT91USART_US_IDR, 0x00000002);        /* 送信割り込み禁止 */
                SysEvt_Set(self->hEvtSend);
        }
+       
+       SysInt_Clear(self->iIntNum);
 }
 
 
diff --git a/aplfw/sample/arm/utb_arm7at91/armcc/gmake.mak b/aplfw/sample/arm/utb_arm7at91/armcc/gmake.mak
new file mode 100755 (executable)
index 0000000..dba2bae
--- /dev/null
@@ -0,0 +1,122 @@
+# ----------------------------------------------------------------------------
+# Hyper Operating System V4 Advance
+#  
+# 
+# Copyright (C) 1998-2007 by Project HOS
+# http://sourceforge.jp/projects/hos/
+# ----------------------------------------------------------------------------
+
+
+# %jp{ターゲット名}
+TARGET ?= sample
+
+# %jp{ディレクトリ}
+OS_DIR            = ../../../../..
+KERNEL_DIR        = $(OS_DIR)/kernel
+KERNEL_CFGRTR_DIR = $(OS_DIR)/cfgrtr/build/gcc
+KERNEL_MAKINC_DIR = $(KERNEL_DIR)/build/common/gmake
+KERNEL_BUILD_DIR  = $(KERNEL_DIR)/build/arm/at91/armcc
+APLFW_DIR         = $(OS_DIR)/aplfw
+APLFW_INC_DIR     = $(APLFW_DIR)
+APLFW_BUILD_DIR   = $(APLFW_DIR)/build/arm/arm_v4t/armcc
+OBJS_DIR          = objs_$(TARGET)
+
+
+# %jp{共通定義読込み}
+include $(KERNEL_MAKINC_DIR)/common.inc
+
+
+# %jp{コンフィギュレータ定義}
+KERNEL_CFGRTR = $(KERNEL_CFGRTR_DIR)/h4acfg-at91
+
+
+# %jp{ライブラリ定義}
+APLFW_LIB = $(APLFW_BUILD_DIR)/hosaplfw.a
+
+
+# %jp{デバッグ版の定義変更}
+ifeq ($(DEBUG),Yes)
+TARGET := $(TARGET)dbg
+APLFW_LIB = $(APLFW_BUILD_DIR)/hosaplfwdbg.a
+endif
+
+
+# %jp{フラグ設定}
+CFLAGS  += --cpu=ARM7TDMI --apcs=inter --thumb
+AFLAGS  += --cpu=ARM7TDMI --apcs=inter --thumb
+LNFLAGS += --ro_base=0x20000000 --first=vectors.o\(Init\) --entry=0x20000000
+
+
+# %jp{出力ファイル名}
+TARGET_EXE = $(TARGET).axf
+TARGET_MOT = $(TARGET).mot
+TARGET_HEX = $(TARGET).hex
+
+
+# %jp{armcc用の設定読込み}
+include $(KERNEL_MAKINC_DIR)/armcc_d.inc
+
+
+# %jp{インクルードディレクトリ}
+INC_DIRS += $(APLFW_INC_DIR)
+
+# %jp{ソースディレクトリ}
+SRC_DIRS += . ..
+
+
+# %jp{アセンブラファイルの追加}
+ASRCS += ./vectors.s           \
+         ./startup.s           \
+         ./uish.s
+
+
+# %jp{C言語ファイルの追加}
+CSRCS += ../kernel_cfg.c       \
+         ../main.c                     \
+         ../boot_task.c                \
+         ../ostimer.c
+
+# %jp{ライブラリファイルの追加}
+LIBS += $(APLFW_LIB)
+
+
+
+# --------------------------------------
+#  %jp{ルール}
+# --------------------------------------
+
+.PHONY : all
+all: make_aplfw makeexe_all $(TARGET_EXE) $(TARGET_MOT) $(TARGET_HEX)
+
+
+.PHONY : make_aplfw
+make_aplfw:
+       make -C $(APLFW_BUILD_DIR) -f gmake.mak
+
+
+clean: makeexe_clean
+       rm -f $(TARGET_EXE) $(TARGET_EXE) $(OBJS) ../kernel_cfg.c ../kernel_id.h
+
+
+../kernel_cfg.c ../kernel_id.h: ../system.cfg
+       cpp -E ../system.cfg ../system.i
+       $(KERNEL_CFGRTR) ../system.i -c ../kernel_cfg.c -i ../kernel_id.h
+
+
+
+# %jp{ライブラリ生成用設定読込み}
+include $(KERNEL_MAKINC_DIR)/makeexe.inc
+
+# %jp{armcc用のルール定義読込み}
+include $(KERNEL_MAKINC_DIR)/armcc_r.inc
+
+
+
+# --------------------------------------
+#  %jp{依存関係}
+# --------------------------------------
+
+$(OBJS_DIR)/sample.obj: ../sample.c ../kernel_id.h
+
+
+# end of file
diff --git a/aplfw/sample/arm/utb_arm7at91/armcc/startup.s b/aplfw/sample/arm/utb_arm7at91/armcc/startup.s
new file mode 100755 (executable)
index 0000000..727bb02
--- /dev/null
@@ -0,0 +1,76 @@
+
+                               EXPORT  Reset_Handler
+                               EXPORT  Undefined_Handler
+                               EXPORT  Swi_Handler
+                               EXPORT  Prefetch_Handler
+                               EXPORT  Abort_Handler
+                               IMPORT  _kernel_int_isp
+
+
+
+; %jp{プロセッサモード定義}
+Mode_USR               EQU     0x10            ; USR モード
+Mode_FIQ               EQU             0x11            ; FIQ モード
+Mode_IRQ               EQU     0x12            ; IRQ モード
+Mode_SVC               EQU             0x13            ; SVC モード
+Mode_ABT               EQU             0x17            ; ABT モード
+Mode_UND               EQU             0x1b            ; UND モード
+Mode_SYS               EQU     0x1f            ; SYS モード
+Mode_MASK              EQU     0x1f            ; モードビットマスク
+
+; %jp{フラグ定義}
+T_Bit                  EQU             0x20            ; T ビット
+F_Bit                  EQU     0x40            ; F ビット
+I_Bit                  EQU     0x80            ; I ビット
+
+
+
+                               CODE32
+
+                               PRESERVE8
+                               AREA    Init, CODE, READONLY
+
+
+; リセットハンドラ
+Reset_Handler
+               ; --- SYSモード移行
+                               msr             cpsr_c, #Mode_SYS:OR:F_Bit:OR:I_Bit
+
+               ; --- スタック仮設定
+                               ldr             r0, =_kernel_int_isp
+                               ldr     sp, [r0]
+                               
+               ; --- C言語コードにジャンプ
+                               IMPORT  __main
+                               bl              __main
+end_loop
+                               b               end_loop
+
+
+
+
+;  SWIハンドラ
+Swi_Handler
+                               movs    pc, lr
+
+
+;  Undefined ハンドラ
+Undefined_Handler
+                               b               Undefined_Handler
+
+
+;  Prefetch ハンドラ
+Prefetch_Handler
+                               b               Prefetch_Handler
+
+
+;  Abort ハンドラ
+Abort_Handler
+                               b               Abort_Handler
+
+
+
+                               END
+
+
+; end of file                                            
diff --git a/aplfw/sample/arm/utb_arm7at91/armcc/uish.s b/aplfw/sample/arm/utb_arm7at91/armcc/uish.s
new file mode 100755 (executable)
index 0000000..9309dcb
--- /dev/null
@@ -0,0 +1,38 @@
+
+HEAP_SIZE              EQU             256
+
+
+                               EXPORT  __user_initial_stackheap
+                               IMPORT  __use_two_region_memory
+                               
+                               IMPORT  _kernel_int_stkblk
+                               IMPORT  _kernel_int_isp
+
+
+                               PRESERVE8
+                               AREA    UISH, CODE, READONLY
+                               CODE32
+
+__user_initial_stackheap       FUNCTION
+                               
+                               ldr             r0, =User_Heap                          ; Heap Base
+                               ldr             r2, =HEAP_SIZE
+                               add             r2, r2, r0                                      ; Heap Limit
+                               
+                               ldr             r1, =_kernel_int_isp
+                               ldr             r1, [r1]                                        ; Stack Base
+                               ldr             r3, =_kernel_int_stkblk         ; Stack Limit
+
+                               bx              lr
+
+                               ENDFUNC
+
+
+
+                               AREA    ||.bss||, NOINIT, ALIGN=2
+User_Heap
+                               %       HEAP_SIZE
+
+
+
+                               END
diff --git a/aplfw/sample/arm/utb_arm7at91/armcc/vectors.s b/aplfw/sample/arm/utb_arm7at91/armcc/vectors.s
new file mode 100755 (executable)
index 0000000..ab02596
--- /dev/null
@@ -0,0 +1,67 @@
+
+
+                               IMPORT  Reset_Handler
+                               IMPORT  Undefined_Handler
+                               IMPORT  Swi_Handler
+                               IMPORT  Prefetch_Handler
+                               IMPORT  Abort_Handler
+                               IMPORT  _kernel_irq_hdr
+                               IMPORT  _kernel_fiq_hdr
+
+
+                               CODE32
+
+                               PRESERVE8
+                               AREA    Init, CODE, READONLY
+
+                               ENTRY
+
+               IF :DEF: ROM_AT_ADDRESS_ZERO
+
+                               ldr     pc, Reset_Addr
+                               ldr     pc, Undefined_Addr
+                               ldr     pc, Swi_Addr
+                               ldr     pc, Prefetch_Addr
+                               ldr     pc, Abort_Addr
+                               nop
+                               ldr     pc, Irq_Addr
+                               ldr     pc, Fiq_Addr
+
+               ELSE
+
+                               mov     r8, #0
+                               adr     r9, Vector_Init_Block
+                               ldmia   r9!, {r0-r7}
+                               stmia   r8!, {r0-r7}
+                               ldmia   r9!, {r0-r7}
+                               stmia   r8!, {r0-r7}
+
+Vector_Init_Block
+                               ldr     pc, Reset_Addr
+                               ldr     pc, Undefined_Addr
+                               ldr     pc, Swi_Addr
+                               ldr     pc, Prefetch_Addr
+                               ldr     pc, Abort_Addr
+                               nop
+                               ldr     pc, Irq_Addr
+                               ldr     pc, Fiq_Addr
+
+               ENDIF
+
+
+
+Reset_Addr             dcd             Reset_Handler
+Undefined_Addr dcd             Undefined_Handler
+Swi_Addr               dcd             Swi_Handler
+Prefetch_Addr  dcd             Prefetch_Handler
+Abort_Addr             dcd             Abort_Handler
+Irq_Addr               dcd             _kernel_irq_hdr
+Fiq_Addr               dcd             _kernel_fiq_hdr
+
+
+
+                               END
+
+
+
+; end of file
diff --git a/aplfw/sample/arm/utb_arm7at91/boot_task.c b/aplfw/sample/arm/utb_arm7at91/boot_task.c
new file mode 100755 (executable)
index 0000000..e02573b
--- /dev/null
@@ -0,0 +1,113 @@
+/**
+ * Hyper Operating System  Application Framework Library
+ *   μTeaboard/ARM7-AT91 用サンプルプログラム
+ *
+ * @file  boot_task.c
+ * @brief %jp{サンプルプログラム}%en{Sample program}
+ *
+ * Copyright (C) 1998-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "kernel.h"
+#include "kernel_id.h"
+#include "boot_task.h"
+#include "system/system/system.h"
+#include "system/sysapi/sysapi.h"
+#include "system/file/console.h"
+#include "system/process/process.h"
+#include "system/command/command.h"
+#include "system/shell/shell.h"
+#include "driver/ether/lan9000/lan9000drv.h"
+#include "driver/tcpip/ipether/ipether.h"
+#include "driver/tcpip/tcpip/tcpip.h"
+#include "driver/serial/at91/at91usartdrv.h"
+#include "driver/console/vt100/vt100drv.h"
+#include "application/example/hello/hello.h"
+#include "application/utility/memdump/memdump.h"
+#include "application/utility/memwrite/memwrite.h"
+#include "application/utility/memtest/memtest.h"
+#include "application/utility/keytest/keytest.h"
+#include "application/utility/timecmd/timecmd.h"
+#include "application/netcmd/ethersnoop/ethersnoop.h"
+
+
+long                   g_SystemHeap[32 * 1024 / sizeof(long)];
+
+C_AT91USARTDRV g_At91UsartDrv[3];
+C_VT100DRV             g_Vt100Drv[1];
+
+
+
+void Boot_Task(VP_INT exinf)
+{
+       HANDLE                  hTty;
+       HANDLE                  hCon;
+       
+       /*************************/
+       /*    固有初期設定       */
+       /*************************/
+       
+       
+       
+       /*************************/
+       /*       初期化          */
+       /*************************/
+       
+       /* システム初期化 */
+       System_Initialize(g_SystemHeap, sizeof(g_SystemHeap));
+       
+       
+       /*************************/
+       /*   デバイスドライバ    */
+       /*************************/
+       
+       /* At91UartDrvデバドラ生成 (/dev/com0 に登録) */
+       At91UsartDrv_Create(&g_At91UsartDrv[0], (void *)0xfffc0000, 2, 32000000, 64);
+       File_AddDevice("com0", (C_DRVOBJ *)&g_At91UsartDrv[0]);
+
+       /* At91UartDrvデバドラ生成 (/dev/com1 に登録) */
+       At91UsartDrv_Create(&g_At91UsartDrv[1], (void *)0xfffc4000, 3, 32000000, 64);
+       File_AddDevice("com1", (C_DRVOBJ *)&g_At91UsartDrv[0]);
+
+       /* At91UartDrvデバドラ生成 (/dev/com2 に登録) */
+       At91UsartDrv_Create(&g_At91UsartDrv[2], (void *)0xfffc8000, 4, 32000000, 64);
+       File_AddDevice("com2", (C_DRVOBJ *)&g_At91UsartDrv[0]);
+       
+       
+       /* シリアルを開く */
+       hTty = File_Open("/dev/com0", FILE_OPEN_READ | FILE_OPEN_WRITE);
+       
+       /* シリアル上にコンソールを生成(/dev/con0 に登録) */
+       Vt100Drv_Create(&g_Vt100Drv[0], hTty);
+       File_AddDevice("con0", (C_DRVOBJ *)&g_Vt100Drv[0]);
+       
+       /* コンソールを開く */
+       hCon = File_Open("/dev/con0", FILE_OPEN_READ | FILE_OPEN_WRITE);
+       
+       
+       /*************************/
+       /*     コマンド登録      */
+       /*************************/
+       Command_AddCommand("hsh",      Shell_Main);
+       Command_AddCommand("hello",    Hello_Main);
+       Command_AddCommand("memdump",  MemDump_Main);
+       Command_AddCommand("memwrite", MemWrite_Main);
+       Command_AddCommand("memtest",  MemTest_Main);
+       Command_AddCommand("keytest",  KeyTest_Main);
+       Command_AddCommand("time",     TimeCmd_Main);
+       Command_AddCommand("ethsnoop", EtherSnoop_Main);
+       
+       /*************************/
+       /*  システムプロセス起動 */
+       /*************************/
+       System_Boot(hTty, hCon, "hsh", 4096);
+}
+
+
+
+/* end of file */
diff --git a/aplfw/sample/arm/utb_arm7at91/boot_task.h b/aplfw/sample/arm/utb_arm7at91/boot_task.h
new file mode 100755 (executable)
index 0000000..eb864ac
--- /dev/null
@@ -0,0 +1,31 @@
+/** 
+ *  Sample program for Hyper Operating System V4 Advance
+ *
+ * @file  sample.c
+ * @brief %jp{サンプルプログラム}%en{Sample program}
+ *
+ * Copyright (C) 1998-2006 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+
+#ifndef __boot_task_h__
+#define __boot_task_h__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void Boot_Task(VP_INT exinf);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __boot_task_h__ */
+
+
+/* end of file */
diff --git a/aplfw/sample/arm/utb_arm7at91/gcc/crt0.S b/aplfw/sample/arm/utb_arm7at91/gcc/crt0.S
new file mode 100755 (executable)
index 0000000..e270d74
--- /dev/null
@@ -0,0 +1,82 @@
+/* ------------------------------------------------------------------------ */
+/*  Hyper Operating System V4 Advance                                       */
+/*    Sample program for ADuC7000 series                                    */
+/*                                                                          */
+/*                                  Copyright (C) 1998-2007 by Project HOS  */
+/*                                  http://sourceforge.jp/projects/hos/     */
+/* ------------------------------------------------------------------------ */
+
+
+                               .extern         __kernel_int_isp
+                               .extern         ___data
+                               .extern         ___data_end
+                               .extern         ___bss
+                               .extern         ___bss_end
+                               .extern         main
+
+                               .global         _reset_handler
+                               .global         __main
+
+
+                               .text
+
+#define Mode_USR               0x10
+#define Mode_IRQ               0x12
+#define Mode_FIQ               0x11
+#define Mode_SVC               0x13
+#define Mode_UND               0x1b
+#define Mode_SYS               0x1f
+#define I_Bit                  0x80
+#define F_Bit                  0x40
+#define T_Bit                  0x20
+
+
+/************************************************
+  リセットハンドラ
+************************************************/
+                               .align          4
+_reset_handler:        
+                               /* モード設定 */
+                               msr             cpsr_c, #(Mode_SYS | F_Bit | I_Bit)
+                               
+                               /* スタック仮設定 */
+                               ldr             r0, =_kernel_int_isp
+                               ldr     sp, [r0]
+                               
+                               
+                               /* DATA領域のコピー */
+                               ldr             r0, =___data_rom
+                               ldr             r1, =___data
+                               ldr             r2, =___data_end
+data_loop:             
+                               cmp             r1, r2
+                               ldrcc   r3, [r0], #4
+                               strcc   r3, [r1], #4
+                               bcc             data_loop
+                               
+                               
+                               /* BSS領域の初期化 */
+                               ldr             r0, =___bss
+                               ldr             r1, =___bss_end
+                               mov             r2, #0
+bss_loop:              
+                               cmp             r0, r1
+                               strcc   r2, [r0], #4
+                               bcc             bss_loop
+                               
+                               
+                               /* main関数の呼び出し */
+                               bl              main
+end_loop:
+                               b               end_loop
+
+
+__main:
+                               bx              lr
+
+
+
+                               .end
+
+
+/* end of file */
diff --git a/aplfw/sample/arm/utb_arm7at91/gcc/gmake.mak b/aplfw/sample/arm/utb_arm7at91/gcc/gmake.mak
new file mode 100755 (executable)
index 0000000..dcbfc6f
--- /dev/null
@@ -0,0 +1,150 @@
+# ----------------------------------------------------------------------------
+# Hyper Operating System V4 Advance
+#
+# Copyright (C) 1998-2007 by Project HOS
+# http://sourceforge.jp/projects/hos/
+# ----------------------------------------------------------------------------
+
+
+# %jp{ターゲット名}
+TARGET ?= sample
+
+# %jp{ツール定義}
+GCC_SYS    ?= arm-elf-
+CMD_CC     ?= $(GCC_SYS)gcc
+CMD_ASM    ?= $(GCC_SYS)gcc
+CMD_LINK   ?= $(GCC_SYS)gcc
+CMD_OBJCNV ?= $(GCC_SYS)objcopy
+
+# %jp{ディレクトリ}
+OS_DIR            = ../../../../..
+KERNEL_DIR        = $(OS_DIR)/kernel
+KERNEL_CFGRTR_DIR = $(OS_DIR)/cfgrtr/build/gcc
+KERNEL_MAKINC_DIR = $(KERNEL_DIR)/build/common/gmake
+KERNEL_BUILD_DIR  = $(KERNEL_DIR)/build/arm/at91/gcc
+APLFW_DIR         = $(OS_DIR)/aplfw
+APLFW_INC_DIR     = $(APLFW_DIR)
+APLFW_BUILD_DIR   = $(APLFW_DIR)/build/arm/arm_v4t/gcc
+OBJS_DIR          = objs_$(TARGET)
+
+
+# %jp{共通定義読込み}
+include $(KERNEL_MAKINC_DIR)/common.inc
+
+
+# %jp{コンフィギュレータ定義}
+KERNEL_CFGRTR = $(KERNEL_CFGRTR_DIR)/h4acfg-at91
+
+
+# %jp{ライブラリ定義}
+APLFW_LIB = $(APLFW_BUILD_DIR)/hosaplfw.a
+
+
+# %jp{デバッグ版の定義変更}
+ifeq ($(DEBUG),Yes)
+TARGET := $(TARGET)dbg
+APLFW_LIB = $(APLFW_BUILD_DIR)/hosaplfwdbg.a
+endif
+
+
+# %jp{メモリマップ}
+ifeq ($(MEMMAP),ext)
+# %jp{外部メモリ}
+TARGET       := $(TARGET)ext
+LINK_SCRIPT = linkext.x
+else
+ifeq ($(MEMMAP),ram)
+# %jp{内蔵RAM}
+TARGET       := $(TARGET)ram
+LINK_SCRIPT = linkram.x
+else
+# %jp{内蔵ROM}
+LINK_SCRIPT = link.x
+endif
+endif
+
+
+# %jp{フラグ設定}
+CFLAGS  = -mcpu=arm7tdmi -mthumb-interwork
+AFLAGS  = -mcpu=arm7tdmi -mthumb-interwork
+LNFLAGS = -mcpu=arm7tdmi -mthumb-interwork -nostartfiles -Wl,-Map,$(TARGET).map,-T$(LINK_SCRIPT)
+
+
+# %jp{出力ファイル名}
+TARGET_EXE = $(TARGET).elf
+TARGET_MOT = $(TARGET).mot
+TARGET_HEX = $(TARGET).hex
+
+
+# %jp{gcc用の設定読込み}
+include $(KERNEL_MAKINC_DIR)/gcc_d.inc
+
+
+# %jp{インクルードディレクトリ}
+INC_DIRS += $(APLFW_INC_DIR)
+
+# %jp{ソースディレクトリ}
+SRC_DIRS += . ..
+
+
+# %jp{アセンブラファイルの追加}
+ASRCS += ./vectors.S           \
+         ./crt0.S
+
+
+# %jp{C言語ファイルの追加}
+CSRCS += ../kernel_cfg.c       \
+         ../main.c                     \
+         ../boot_task.c                \
+         ../ostimer.c
+
+# %jp{ライブラリファイルの追加}
+LIBS += $(APLFW_LIB)
+
+
+
+# --------------------------------------
+#  %jp{ルール}
+# --------------------------------------
+
+.PHONY : all
+all: aplfw_make makeexe_all $(TARGET_EXE) $(TARGET_MOT) $(TARGET_HEX)
+
+
+.PHONY : aplfw_make
+aplfw_make:
+       make -C $(APLFW_BUILD_DIR) -f gmake.mak
+
+.PHONY : aplfw_clean
+aplfw_clean:
+       make -C $(APLFW_BUILD_DIR) -f gmake.mak clean
+
+.PHONY : clean
+clean: makeexe_clean
+       rm -f $(TARGET_EXE) $(TARGET_EXE) $(OBJS) ../kernel_cfg.c ../kernel_id.h
+
+.PHONY : mostlyclean
+mostlyclean: clean kernel_clean aplfw_clean
+
+../kernel_cfg.c ../kernel_id.h: ../system.cfg
+       cpp -E ../system.cfg ../system.i
+       $(KERNEL_CFGRTR) ../system.i -c ../kernel_cfg.c -i ../kernel_id.h
+
+
+
+# %jp{ライブラリ生成用設定読込み}
+include $(KERNEL_MAKINC_DIR)/makeexe.inc
+
+# %jp{gcc用のルール定義読込み}
+include $(KERNEL_MAKINC_DIR)/gcc_r.inc
+
+
+
+# --------------------------------------
+#  %jp{依存関係}
+# --------------------------------------
+
+$(OBJS_DIR)/sample.obj: ../sample.c ../kernel_id.h
+
+
+# end of file
diff --git a/aplfw/sample/arm/utb_arm7at91/gcc/link.x b/aplfw/sample/arm/utb_arm7at91/gcc/link.x
new file mode 100755 (executable)
index 0000000..5a7f072
--- /dev/null
@@ -0,0 +1,54 @@
+OUTPUT_ARCH(arm)
+ENTRY(_reset_handler)
+
+MEMORY
+{
+       vector : o = 0x20000000, l = 0x00000040
+       rom    : o = 0x20000040, l = 0x000fffc0
+       ram    : o = 0x20100000, l = 0x00100000
+}
+
+SECTIONS
+{
+       .vector :
+       {
+               ___vector = . ; 
+               */vectors.o(.text)
+               FILL(0xff)
+               ___vector_end = . ; 
+       } > vector
+       .text :
+       {
+                ___text = . ; 
+               *(.text)
+               *(.strings)
+               *(.rodata*)
+               *(.glue*)
+                ___text_end = . ; 
+       }  > rom
+       .tors :
+       {
+               . = ALIGN(4);
+               ___ctors = . ;
+               *(.ctors)
+               ___ctors_end = . ;
+               ___dtors = . ;
+               *(.dtors)
+               ___dtors_end = . ;
+       } > rom
+       data : AT (ADDR(.tors) + SIZEOF(.tors))
+       {
+           ___data_rom = ADDR(.tors) + SIZEOF(.tors);
+               ___data = . ;
+               *(.data)
+               ___data_end = . ;
+       } > ram
+       .bss :
+       {
+               ___bss = . ;
+               *(.bss)
+               *(COMMON)
+               ___bss_end = . ;  
+       }  >ram
+}
+
diff --git a/aplfw/sample/arm/utb_arm7at91/gcc/vectors.S b/aplfw/sample/arm/utb_arm7at91/gcc/vectors.S
new file mode 100755 (executable)
index 0000000..c0f5a86
--- /dev/null
@@ -0,0 +1,55 @@
+/* ------------------------------------------------------------------------ */
+/*  Hyper Operating System V4  サンプルプログラム                           */
+/*    ベクタテーブル                                                        */
+/*                                                                          */
+/*                                  Copyright (C) 1998-2007 by Project HOS  */
+/*                                  http://sourceforge.jp/projects/hos/     */
+/* ------------------------------------------------------------------------ */
+
+
+               /* --- 外部定数宣言 */
+                               .global _reset_handler
+                               .global _kernel_und_hdr
+                               .global _kernel_swi_hdr
+                               .global _kernel_pre_hdr
+                               .global _kernel_abt_hdr
+                               .global _kernel_irq_hdr
+                               .global _kernel_fiq_hdr
+
+
+                               .text
+                               .align  2
+
+/* --------------------------------------- */
+/*            ベクタ定義                   */
+/* --------------------------------------- */
+                               ldr             pc, adr_rst_hdr
+                               ldr             pc, adr_und_hdr
+                               ldr             pc, adr_swi_hdr
+                               ldr             pc, adr_pre_hdr
+                               ldr             pc, adr_abt_hdr
+                               nop
+                               ldr             pc, adr_irq_hdr
+                               ldr             pc, adr_fiq_hdr
+
+
+adr_rst_hdr:   
+                               .long   _reset_handler
+adr_und_hdr:           
+                               .long   _kernel_und_hdr
+adr_swi_hdr:   
+                               .long   _kernel_swi_hdr
+adr_pre_hdr:           
+                               .long   _kernel_pre_hdr
+adr_abt_hdr:
+                               .long   _kernel_abt_hdr
+adr_irq_hdr:
+                               .long   _kernel_irq_hdr
+adr_fiq_hdr:
+                               .long   _kernel_fiq_hdr
+
+
+                               .end
+
+
+/* end of file */
diff --git a/aplfw/sample/arm/utb_arm7at91/main.c b/aplfw/sample/arm/utb_arm7at91/main.c
new file mode 100755 (executable)
index 0000000..651ed5d
--- /dev/null
@@ -0,0 +1,26 @@
+/** 
+ *  Sample program for Hyper Operating System V4 Advance
+ *
+ * @file  main.c
+ * @brief %jp{メイン関数}%en{main}
+ *
+ * Copyright (C) 1998-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "kernel.h"
+
+
+/** %jp{メイン関数} */
+int main()
+{
+       /* %jp{カーネルの動作開始} */
+       vsta_knl();
+       
+       return 0;
+}
+
+
+
+/* end of file */
diff --git a/aplfw/sample/arm/utb_arm7at91/ostimer.c b/aplfw/sample/arm/utb_arm7at91/ostimer.c
new file mode 100755 (executable)
index 0000000..a95045a
--- /dev/null
@@ -0,0 +1,77 @@
+/** 
+ *  Sample program for Hyper Operating System V4 Advance
+ *
+ * @file  ostimer.c
+ * @brief %jp{OSタイマ}%en{OS timer}
+ *
+ * Copyright (C) 1998-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "kernel.h"
+#include "system/sysapi/sysapi.h"
+#include "ostimer.h"
+
+
+#define TC1_CCR                ((volatile UW *)0xfffd0000)             /* Channel Control Register */
+#define TC1_CMR                ((volatile UW *)0xfffd0004)             /* Channel Mode Register */
+#define TC1_CV         ((volatile UW *)0xfffd0010)             /* Counter Value */
+#define TC1_RA         ((volatile UW *)0xfffd0014)             /* Register A */
+#define TC1_RB         ((volatile UW *)0xfffd0018)             /* Register B */
+#define TC1_RC         ((volatile UW *)0xfffd001c)             /* Register C */
+#define TC1_SR         ((volatile UW *)0xfffd0020)             /* Status Register */
+#define TC1_IER                ((volatile UW *)0xfffd0024)             /* Interrupt Enable Register */
+#define TC1_IDR                ((volatile UW *)0xfffd0028)             /* Interrupt Disable Register */
+#define TC1_IMR                ((volatile UW *)0xfffd002c)             /* Interrupt Mask Register */
+#define TC_BCR         ((volatile UW *)0xfffd00c0)             /* TC Block Control Register */
+#define TC_BMR         ((volatile UW *)0xfffd00c4)             /* TC Block Mode Register */
+
+
+static void OsTimer_Isr(VP_INT exinf); /**< %jp{タイマ割込みサービスルーチン} */
+
+
+/** %jp{OS用タイマ初期化ルーチン} */
+void OsTimer_Initialize(VP_INT exinf)
+{
+       T_CISR cisr;
+
+       *(volatile UW *)0xfffff018 = 0x0025;
+
+       *TC_BMR  = 0x00000000; 
+       
+       *TC1_CCR = 0x00000002;
+       *TC1_IDR = 0x000000ff;
+       
+       *TC1_RC  = 9999;
+       *TC1_CMR = 0x00004002;
+       *TC1_IER = 0x00000010;
+       
+       *TC1_CCR = 0x00000001;
+       *TC1_CCR = 0x00000004;
+       
+       
+       /* %jp{割り込みサービスルーチン生成} */
+       cisr.isratr = TA_HLNG;
+       cisr.exinf  = 0;
+       cisr.intno  = 6;
+       cisr.isr    = (FP)OsTimer_Isr;
+       acre_isr(&cisr);
+       ena_int(6);
+}
+
+
+/** %jp{タイマ割り込みハンドラ} */
+void OsTimer_Isr(VP_INT exinf)
+{
+       SysInt_Clear(6);
+       
+       if ( *TC1_SR & 0x00000010 )
+       {
+               /* %jp{タイムティック供給} */
+               isig_tim();
+       }
+}
+
+
+/* end of file */
diff --git a/aplfw/sample/arm/utb_arm7at91/ostimer.h b/aplfw/sample/arm/utb_arm7at91/ostimer.h
new file mode 100755 (executable)
index 0000000..e741bb1
--- /dev/null
@@ -0,0 +1,31 @@
+/** 
+ *  Sample program for Hyper Operating System V4 Advance
+ *
+ * @file  ostimer.c
+ * @brief %jp{OSタイマ}%en{OS timer}
+ *
+ * Copyright (C) 1998-2006 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#ifndef __ostimer_h__
+#define __ostimer_h__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** %jp{OS用タイマ初期化ルーチン} */
+void OsTimer_Initialize(VP_INT exinf);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __ostimer_h__ */
+
+
+/* end of file */
diff --git a/aplfw/sample/arm/utb_arm7at91/system.cfg b/aplfw/sample/arm/utb_arm7at91/system.cfg
new file mode 100755 (executable)
index 0000000..4e19600
--- /dev/null
@@ -0,0 +1,32 @@
+/** 
+ *  Sample program for Hyper Operating System V4 Advance
+ *
+ * @file  system.cfg
+ * @brief %jp{サンプルのコンフィギュレーション}
+ *
+ * Copyright (C) 1998-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+/* %jp{カーネル独自の設定}%en{kernel} */
+KERNEL_HEP_MEM(65536, NULL);
+KERNEL_INT_STK(512, NULL);
+KERNEL_MAX_TSKID(32);
+KERNEL_MAX_SEMID(32);
+KERNEL_MAX_FLGID(32);
+KERNEL_MAX_MBXID(32);
+KERNEL_MAX_MPFID(32);
+KERNEL_MAX_ISRID(32);
+
+
+/* %jp{OSタイマの設定}%en{OS timer} */
+INCLUDE("\"ostimer.h\"");
+ATT_INI({TA_HLNG, 0, OsTimer_Initialize});
+
+/* %jp{ブートタスク}%en{Boot task} */
+INCLUDE("\"boot_task.h\"");
+CRE_TSK(TSKID_SAMPLE, {TA_HLNG | TA_ACT, 0, Boot_Task, 2, 2048, NULL});
+
+
+/* end of file */
index 7d062e8..32f720e 100755 (executable)
@@ -60,7 +60,7 @@ STD_LIBS = stdlib.lib
 VPATH = .:..:$(SRC_DIR)/driver/renesas
 
 
-all: mkdir_objs mk_kernel mk_aplfw $(TARGET).abs
+all: mkdir_objs kernel_make aplfw_make $(TARGET).abs
 
 
 $(TARGET).abs: $(OBJS) $(KERNEL_LIB) $(APLFW_LIB) $(STD_LIBS)
@@ -81,10 +81,10 @@ $(TARGET).abs: $(OBJS) $(KERNEL_LIB) $(APLFW_LIB) $(STD_LIBS)
 $(STD_LIBS):
        lbg38 -OUTPut=$(STD_LIBS) $(CFLAGS) -REent 
 
-mk_kernel:
+kernel_make:
        make -C $(KERNEL_BUILD_DIR) -f gmake.mak
 
-mk_aplfw:
+aplfw_make:
        make -C $(APLFW_BUILD_DIR) -f gmake.mak
 
 mkdir_objs:
index 22f993d..493739f 100755 (executable)
@@ -113,7 +113,7 @@ clean: makeexe_clean
        rm -f $(TARGET_EXE) $(TARGET_EXE) $(OBJS) ../kernel_cfg.c ../kernel_id.h
 
 .PHONY : mostlyclean
-mostlyclean: clean clean_kernel
+mostlyclean: clean kernel_clean
        make -C $(APLFW_BUILD_DIR) -f gmake.mak clean
 
 .PHONY : mostlydepend
index 6fa2559..e2f3221 100755 (executable)
@@ -12,7 +12,7 @@
 /* ITRONをマイクロカーネルとして、依存性はこのモジュールで極力隠蔽する */
 /* いわゆるシステムモード(デバドラとか)のみに許すAPIを定義する */
 /* ユーザーモード用APIは別途作成予定 */
-/* 本ファイルのAPIはデバイスドライバなどいわゆるスーパバイザーモード相当の
+/* 本ファイルのAPIはデバイスドライバなどいわゆるスーパバイザーモード相当の */
 /* プログラムのみが呼び出すものとする */
 
 
diff --git a/kernel/build/arm/at91/armcc/gmake.mak b/kernel/build/arm/at91/armcc/gmake.mak
new file mode 100755 (executable)
index 0000000..dab0f95
--- /dev/null
@@ -0,0 +1,105 @@
+# ----------------------------------------------------------------------------
+# Hyper Operating System V4 Advance
+#  makefile for ATMEL AT91 series
+#
+# Copyright (C) 1998-2007 by Project HOS
+# http://sourceforge.jp/projects/hos/
+# ----------------------------------------------------------------------------
+
+
+# ターゲット名
+TARGET    ?= libhosv4a
+
+
+# ディレクトリ定義
+HOSV4A_DIR        = ../../../../..
+KERNEL_DIR        = $(HOSV4A_DIR)/kernel
+KERNEL_MAKINC_DIR = $(KERNEL_DIR)/build/common/gmake
+OBJS_DIR          = objs_$(TARGET)
+
+
+# %jp{共通定義読込み}
+include $(KERNEL_MAKINC_DIR)/common.inc
+
+
+# %jp{アーキテクチャ定義}
+ARCH_PROC ?= arm/arm_v4t
+ARCH_IRC  ?= arm/at91
+ARCH_CC   ?= armcc
+
+# %jp{アーキテクチャパス}
+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)
+
+# %jp{パス設定}
+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{オプションフラグ}
+AFLAGS  += --cpu=ARM7TDMI --apcs=inter --thumb
+CFLAGS  += --cpu=ARM7TDMI --apcs=inter --thumb
+ARFLAGS += 
+
+# %jp{コンフィギュレータ定義}
+CFGRTR_DIR = $(HOSV4A_DIR)/cfgrtr/build/gcc
+CFGRTR     = h4acfg-at91
+
+
+# %jp{コンパイラ依存の設定読込み}
+include $(KERNEL_MAKINC_DIR)/$(ARCH_CC)_d.inc
+
+
+
+# C言語ファイルの追加
+CSRCS += $(SRC_PROC_DIR)/val_int.c                     \
+         $(SRC_IRC_DIR)/kini_irc.c                     \
+         $(SRC_IRC_DIR)/kexe_irc.c                     \
+         $(SRC_IRC_DIR)/ena_int.c                      \
+         $(SRC_IRC_DIR)/dis_int.c                      \
+         $(SRC_IRC_DIR)/vclr_int.c
+
+
+# アセンブラファイルの追加
+ASRCS += $(SRC_PROC_CC_DIR)/kcre_ctx.s         \
+         $(SRC_PROC_CC_DIR)/kdis_int.s         \
+         $(SRC_PROC_CC_DIR)/kena_int.s         \
+         $(SRC_PROC_CC_DIR)/kirq_hdr.s         \
+         $(SRC_PROC_CC_DIR)/kfiq_hdr.s         \
+         $(SRC_PROC_CC_DIR)/krst_ctx.s         \
+         $(SRC_PROC_CC_DIR)/kswi_ctx.s         \
+         $(SRC_PROC_CC_DIR)/kwai_int.s
+
+
+
+# カーネル共通ソースの追加
+include $(KERNEL_MAKINC_DIR)/knlsrc.inc
+
+
+
+# %jp{ALL}
+.PHONY : all
+all: makelib_all
+       make -C $(CFGRTR_DIR) -f gmake.mak TARGET=$(CFGRTR) ARCH_PROC=$(ARCH_PROC) ARCH_IRC=$(ARCH_IRC)
+
+# %jp{クリーン}
+.PHONY : clean
+clean: makelib_clean
+       make -C $(CFGRTR_DIR) -f gmake.mak TARGET=$(CFGRTR) ARCH_PROC=$(ARCH_PROC) ARCH_IRC=$(ARCH_IRC) clean
+       $(RM) -f *.lst
+
+
+# %jp{ライブラリ生成用設定読込み}
+include $(KERNEL_MAKINC_DIR)/makelib.inc
+
+# %jp{コンパイラ依存ルール定義読込み}
+include $(KERNEL_MAKINC_DIR)/$(ARCH_CC)_r.inc
+
+# %jp{カーネル依存関係読込み}
+include $(KERNEL_MAKINC_DIR)/knldep.inc
+
+
+# end of file
diff --git a/kernel/build/arm/at91/gcc/gmake.mak b/kernel/build/arm/at91/gcc/gmake.mak
new file mode 100755 (executable)
index 0000000..82dbf22
--- /dev/null
@@ -0,0 +1,113 @@
+# ----------------------------------------------------------------------------
+# Hyper Operating System V4 Advance
+#  makefile for ATMEL AT91 series
+#
+# Copyright (C) 1998-2007 by Project HOS
+# http://sourceforge.jp/projects/hos/
+# ----------------------------------------------------------------------------
+
+
+# %jp{ターゲット名}
+TARGET ?= libhosv4a
+
+# %jp{アーキテクチャパス}
+ARCH_PROC ?= arm/arm_v4t
+ARCH_IRC  ?= arm/at91
+ARCH_CC   ?= gcc
+
+# %jp{ツール定義}
+GCC_SYS  ?= elf
+CMD_CC   ?= arm-$(GCC_SYS)-gcc
+CMD_ASM  ?= arm-$(GCC_SYS)-gcc
+CMD_LIBR ?= arm-$(GCC_SYS)-ar
+
+
+# %jp{ディレクトリ定義}
+TOP_DIR           = ../../../../..
+KERNEL_DIR        = $(TOP_DIR)/kernel
+KERNEL_MAKINC_DIR = $(KERNEL_DIR)/build/common/gmake
+OBJS_DIR          = objs_$(TARGET)
+
+
+# %jp{共通定義読込み}
+include $(KERNEL_MAKINC_DIR)/common.inc
+
+
+# %jp{アーキテクチャパス定義}
+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)
+
+# %jp{パス設定}
+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{オプションフラグ}
+AFLAGS  += -mcpu=arm7tdmi -mthumb-interwork
+CFLAGS  += -mcpu=arm7tdmi -mthumb-interwork
+ARFLAGS += 
+
+# %jp{コンフィギュレータ定義}
+CFGRTR_DIR = $(TOP_DIR)/cfgrtr/build/gcc
+CFGRTR     = h4acfg-aduc7000
+
+
+# C言語ファイルの追加
+CSRCS += $(SRC_PROC_DIR)/val_int.c                     \
+         $(SRC_IRC_DIR)/kini_irc.c                     \
+         $(SRC_IRC_DIR)/kexe_irc.c                     \
+         $(SRC_IRC_DIR)/ena_int.c                      \
+         $(SRC_IRC_DIR)/dis_int.c                      \
+         $(SRC_IRC_DIR)/vclr_int.c
+
+
+# アセンブラファイルの追加
+ASRCS += $(SRC_PROC_CC_DIR)/kdis_int.S         \
+         $(SRC_PROC_CC_DIR)/kena_int.S         \
+         $(SRC_PROC_CC_DIR)/kcre_ctx.S         \
+         $(SRC_PROC_CC_DIR)/krst_ctx.S         \
+         $(SRC_PROC_CC_DIR)/kswi_ctx.S         \
+         $(SRC_PROC_CC_DIR)/kwai_int.S         \
+         $(SRC_PROC_CC_DIR)/kund_hdr.S         \
+         $(SRC_PROC_CC_DIR)/kswi_hdr.S         \
+         $(SRC_PROC_CC_DIR)/kpre_hdr.S         \
+         $(SRC_PROC_CC_DIR)/kabt_hdr.S         \
+         $(SRC_PROC_CC_DIR)/kirq_hdr.S         \
+         $(SRC_PROC_CC_DIR)/kfiq_hdr.S
+
+
+
+# カーネル共通ソースの追加
+include $(KERNEL_MAKINC_DIR)/knlsrc.inc
+
+
+# %jp{ALL}
+.PHONY : all
+all: makelib_all
+       make -C $(CFGRTR_DIR) -f gmake.mak TARGET=$(CFGRTR) ARCH_PROC=$(ARCH_PROC) ARCH_IRC=$(ARCH_IRC)
+
+# %jp{クリーン}
+.PHONY : clean
+clean: makelib_clean
+       make -C $(CFGRTR_DIR) -f gmake.mak TARGET=$(CFGRTR) ARCH_PROC=$(ARCH_PROC) ARCH_IRC=$(ARCH_IRC) clean
+       $(RM) -f *.lst
+
+
+
+# %jp{コンパイラ依存の設定読込み}
+include $(KERNEL_MAKINC_DIR)/$(ARCH_CC)_d.inc
+
+# %jp{ライブラリ生成用設定読込み}
+include $(KERNEL_MAKINC_DIR)/makelib.inc
+
+# %jp{コンパイラ依存ルール定義読込み}
+include $(KERNEL_MAKINC_DIR)/$(ARCH_CC)_r.inc
+
+# %jp{カーネル依存関係読込み}
+include $(KERNEL_MAKINC_DIR)/knldep.inc
+
+
+# end of file
index 4f75c98..1950738 100755 (executable)
@@ -101,7 +101,7 @@ OBJS = $(addprefix $(OBJS_DIR)/, $(addsuffix .$(EXT_OBJ), $(basename $(notdir $(
 
 # %jp{ライブラリ生成}
 .PHONY : makeexe_all
-makeexe_all: mk_kernel mkdir_objs $(CSRCS) $(ASRCS)
+makeexe_all: kernel_make mkdir_objs $(CSRCS) $(ASRCS)
 
 
 # %jp{オブジェクト出力ディレクトリ作成}
@@ -134,14 +134,14 @@ endif
 
 
 # %jp{カーネル生成}
-.PHONY : mk_kernel
-mk_kernel:
+.PHONY : kernel_make
+kernel_make:
        make -C $(KERNEL_BUILD_DIR) -f gmake.mak DEBUG=$(KERNEL_DEBUG) ERRLEVEL=$(KERNEL_ERRLEVEL)
 
 
 # %jp{カーネル生成}
-.PHONY : clean_kernel
-clean_kernel:
+.PHONY : kernel_clean
+kernel_clean:
        make -C $(KERNEL_BUILD_DIR) -f gmake.mak DEBUG=$(KERNEL_DEBUG) ERRLEVEL=$(KERNEL_ERRLEVEL) clean
 
 
index a4c7087..0d325a5 100755 (executable)
@@ -20,7 +20,7 @@ void _kernel_exe_irc(INHNO inhno)
        INTNO intno;
        
        /* %jp{割り込み番号取得} */
-       inhno = (*_KERNEL_IRC_AIC_ISR & 0x0000001f);
+       intno = *_KERNEL_IRC_AIC_IVR;
        
        /* %jp{割込みサービスルーチン呼び出し} */
        _kernel_exe_isr(intno);
index 9142923..73252eb 100755 (executable)
@@ -25,8 +25,13 @@ void _kernel_ini_irc(void)
        for ( i = 0; i < 32; i++ )
        {
                *_KERNEL_IRC_AIC_SMR(i) = 0x00000007;
-               *_KERNEL_IRC_AIC_SVR(i) = (UW)_kernel_irq_hdr;
+               *_KERNEL_IRC_AIC_SVR(i) = (UW)i;
        }
+       
+       for ( i = 0; i < 32; i++ )
+       {
+               *_KERNEL_IRC_AIC_EOICR = i;
+       }       
 }