*.lzh
*.tgz
*.tar.gz
+
+# eclipse
+.settings
+.project
fprintf(fp, "#include \"kernel.h\"\n");
fprintf(fp, "#include \"arch/proc/%s/procatr.h\"\n", _KERNEL_PROCATR_INC_PATH);
fprintf(fp, "#include \"arch/proc/%s/proc.h\"\n", _KERNEL_PROCATR_INC_PATH);
+ fprintf(fp, "#include \"arch/irc/%s/ircatr.h\"\n", _KERNEL_IRCATR_INC_PATH);
+ fprintf(fp, "#include \"arch/irc/%s/irc.h\"\n", _KERNEL_IRCATR_INC_PATH);
+ fprintf(fp, "#include \"config/cfgknl.h\"\n");
+ fprintf(fp, "#include \"parser/parsknl.h\"\n");
+ fprintf(fp, "#include \"core/objid.h\"\n");
+ fprintf(fp, "#include \"core/objhdl.h\"\n");
+ fprintf(fp, "#include \"object/tskobj.h\"\n");
+ fprintf(fp, "#include \"object/semobj.h\"\n");
+ fprintf(fp, "#include \"object/flgobj.h\"\n");
+ fprintf(fp, "#include \"object/dtqobj.h\"\n");
+ fprintf(fp, "#include \"object/mbxobj.h\"\n");
+ fprintf(fp, "#include \"object/mtxobj.h\"\n");
+ fprintf(fp, "#include \"object/mpfobj.h\"\n");
+ fprintf(fp, "#include \"object/inhobj.h\"\n");
+ fprintf(fp, "#include \"object/isrobj.h\"\n");
+ fprintf(fp, "#include \"object/cycobj.h\"\n");
fprintf(fp, "#include \"kernel_id.h\"\n");
g_ApiInclude.WriteCfgDef(fp);
# --------------------------------------
# %jp{アセンブラファイルの追加}%en{assembry sources}
+ASRCS += $(SRC_PROC_CC_DIR)/krst_hdr.S
+ASRCS += $(SRC_PROC_CC_DIR)/knmi_hdr.S
+ASRCS += $(SRC_PROC_CC_DIR)/khwf_hdr.S
ASRCS += $(SRC_PROC_CC_DIR)/kdis_int.S
ASRCS += $(SRC_PROC_CC_DIR)/kena_int.S
ASRCS += $(SRC_PROC_CC_DIR)/kcre_ctx.S
#define _KERNEL_IMSK_LV2 0x00 /**< %jp{割込みマスクレベル2(すべて許可)} */
-
/** %jp{コンテキスト制御ブロック} */
typedef struct _kernel_t_ctxcb
{
VP sp;
} _KERNEL_T_CTXCB;
+#if 0
/** %jp{割込みコンテキスト制御ブロック} */
typedef struct _kernel_t_ictxcb
{
extern _KERNEL_T_ICTXCB _kernel_ictxcb; /**< %jp{割込みコンテキスト制御ブロック} */
-
+#endif
#ifdef __cplusplus
#define _KERNEL_INI_PRC() do {} while (0) /**< %jp{プロセッサ固有の初期化} */
-#define _KERNEL_INI_INT(stksz, stk) do { _kernel_ictxcb.isp = (VB *)(stk) + (stksz); } while (0) /**< %jp{割込み初期化} */
+#define _KERNEL_INI_INT(stksz, stk) do {} while (0) /**< %jp{割込み初期化} */
#define _KERNEL_ENA_INT() _kernel_ena_int() /**< %jp{割込み許可} */
#define _KERNEL_DIS_INT() _kernel_dis_int() /**< %jp{割込み禁止} */
#define _KERNEL_WAI_INT() _kernel_wai_int() /**< %jp{割込み待ち(アイドル時の処理)} */
--- /dev/null
+/**
+ * Hyper Operating System V4 Advance
+ *
+ * Copyright (C) 1998-2011 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+
+ .text
+ .align 2
+
+
+/************************************************
+ リセットハンドラ
+ ************************************************/
+ .global _kernel_hw_fault_handler
+ .thumb
+ .thumb_func
+ .type _kernel_hw_fault_handler, %function
+_kernel_hw_fault_handler:
+ b _kernel_hw_fault_handler
+
+ .size _kernel_hw_fault_handler, .-_kernel_hw_fault_handler
+
+
+ .end
+
+
+; end of file
+
--- /dev/null
+/**
+ * Hyper Operating System V4 Advance
+ *
+ * Copyright (C) 1998-2011 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+
+ .text
+ .align 2
+
+ .global main
+
+/************************************************
+ リセットハンドラ
+ ************************************************/
+ .global _kernel_nmi_handler
+ .thumb
+ .thumb_func
+ .type _kernel_nmi_handler, %function
+_kernel_nmi_handler:
+ b _kernel_nmi_handler
+
+ .size _kernel_nmi_handler, .-_kernel_nmi_handler
+
+
+ .end
+
+
+; end of file
+
--- /dev/null
+/**
+ * Hyper Operating System V4 Advance
+ *
+ * Copyright (C) 1998-2011 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+
+ .text
+ .align 2
+
+ .global main
+
+/************************************************
+ リセットハンドラ
+ ************************************************/
+ .global _kernel_reset_handler
+ .thumb
+ .thumb_func
+ .type _kernel_reset_handler, %function
+_kernel_reset_handler:
+ blx main
+
+ .size _kernel_reset_handler, .-_kernel_reset_handler
+
+
+ .end
+
+
+; end of file
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?>
+
+<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="cdt.managedbuild.toolchain.gnu.cygwin.base.1570928895">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.cygwin.base.1570928895" moduleId="org.eclipse.cdt.core.settings" name="デフォルト">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration buildProperties="" id="cdt.managedbuild.toolchain.gnu.cygwin.base.1570928895" name="デフォルト" parent="org.eclipse.cdt.build.core.emptycfg">
+ <folderInfo id="cdt.managedbuild.toolchain.gnu.cygwin.base.1570928895.535793802" name="/" resourcePath="">
+ <toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.base.1357496047" name="cdt.managedbuild.toolchain.gnu.cygwin.base" superClass="cdt.managedbuild.toolchain.gnu.cygwin.base">
+ <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.Cygwin_PE" id="cdt.managedbuild.target.gnu.platform.cygwin.base.1298702746" name="デバッグ・プラットフォーム" osList="win32" superClass="cdt.managedbuild.target.gnu.platform.cygwin.base"/>
+ <builder id="cdt.managedbuild.target.gnu.builder.cygwin.base.1747100279" managedBuildOn="false" name="Gnu Make ビルダー.デフォルト" superClass="cdt.managedbuild.target.gnu.builder.cygwin.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.assembler.cygwin.base.931406315" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.cygwin.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.archiver.cygwin.base.74847627" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.cygwin.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.base.1097478345" name="Cygwin C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.115305879" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.c.linker.cygwin.base.1286825455" name="Cygwin C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base.274938788" name="Cygwin C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base"/>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+ <buildOutputProvider>
+ <openAction enabled="true" filePath=""/>
+ <parser enabled="true"/>
+ </buildOutputProvider>
+ <scannerInfoProvider id="specsFile">
+ <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+ <parser enabled="true"/>
+ </scannerInfoProvider>
+ </profile>
+ <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+ <buildOutputProvider>
+ <openAction enabled="true" filePath=""/>
+ <parser enabled="true"/>
+ </buildOutputProvider>
+ <scannerInfoProvider id="makefileGenerator">
+ <runAction arguments="-E -P -v -dD" command="" useDefault="true"/>
+ <parser enabled="true"/>
+ </scannerInfoProvider>
+ </profile>
+ <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+ <buildOutputProvider>
+ <openAction enabled="true" filePath=""/>
+ <parser enabled="true"/>
+ </buildOutputProvider>
+ <scannerInfoProvider id="specsFile">
+ <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+ <parser enabled="true"/>
+ </scannerInfoProvider>
+ </profile>
+ <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+ <buildOutputProvider>
+ <openAction enabled="true" filePath=""/>
+ <parser enabled="true"/>
+ </buildOutputProvider>
+ <scannerInfoProvider id="specsFile">
+ <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+ <parser enabled="true"/>
+ </scannerInfoProvider>
+ </profile>
+ <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+ <buildOutputProvider>
+ <openAction enabled="true" filePath=""/>
+ <parser enabled="true"/>
+ </buildOutputProvider>
+ <scannerInfoProvider id="specsFile">
+ <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+ <parser enabled="true"/>
+ </scannerInfoProvider>
+ </profile>
+ <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+ <buildOutputProvider>
+ <openAction enabled="true" filePath=""/>
+ <parser enabled="true"/>
+ </buildOutputProvider>
+ <scannerInfoProvider id="specsFile">
+ <runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
+ <parser enabled="true"/>
+ </scannerInfoProvider>
+ </profile>
+ <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
+ <buildOutputProvider>
+ <openAction enabled="true" filePath=""/>
+ <parser enabled="true"/>
+ </buildOutputProvider>
+ <scannerInfoProvider id="specsFile">
+ <runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
+ <parser enabled="true"/>
+ </scannerInfoProvider>
+ </profile>
+ <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
+ <buildOutputProvider>
+ <openAction enabled="true" filePath=""/>
+ <parser enabled="true"/>
+ </buildOutputProvider>
+ <scannerInfoProvider id="specsFile">
+ <runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
+ <parser enabled="true"/>
+ </scannerInfoProvider>
+ </profile>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="sample_stm32f103.null.1001591681" name="sample_stm32f103"/>
+ </storageModule>
+</cproject>
--- /dev/null
+# ----------------------------------------------------------------------------
+# Hyper Operating System V4 Advance
+#
+# Copyright (C) 1998-2011 by Project HOS
+# http://sourceforge.jp/projects/hos/
+# ----------------------------------------------------------------------------
+
+
+
+# --------------------------------------
+# %jp{各種設定}{setting}
+# --------------------------------------
+
+# %jp{ターゲット名}%en{target name}
+TARGET ?= sample
+
+
+# %jp{ツール定義}%en{tools}
+GCC_ARCH ?= arm-none-eabi-
+CMD_CC ?= $(GCC_ARCH)gcc
+CMD_ASM ?= $(GCC_ARCH)gcc
+CMD_LINK ?= $(GCC_ARCH)gcc
+CMD_OBJCNV ?= $(GCC_ARCH)objcopy
+
+
+# %jp{アーキテクチャ定義}%en{architecture}
+ARCH_NAME ?= cortex_m3
+ARCH_CC ?= gcc
+
+
+# %jp{ディレクトリ定義}%en{directories}
+TOP_DIR = ../../../..
+KERNEL_DIR = $(TOP_DIR)/kernel
+KERNEL_CFGRTR_DIR = $(TOP_DIR)/cfgrtr/build/gcc
+KERNEL_MAKINC_DIR = $(KERNEL_DIR)/build/common/gmake
+KERNEL_BUILD_DIR = $(KERNEL_DIR)/build/arm/cortex_m3/gcc
+
+
+# %jp{コンフィギュレータ定義}
+KERNEL_CFGRTR = $(KERNEL_CFGRTR_DIR)/h4acfg-$(ARCH_NAME)
+
+
+# %jp{共通定義読込み}%jp{common setting}
+include $(KERNEL_MAKINC_DIR)/common.inc
+
+
+# %jp{リンカスクリプト}%en{linker script}
+LINK_SCRIPT = link.lds
+
+# %jp{外部メモリ}%en{external memory}
+ifeq ($(MEMMAP),ext)
+LINK_SCRIPT = linkext.lds
+endif
+
+# %jp{内蔵RAM}%en{internal RAM}
+ifeq ($(MEMMAP),ram)
+LINK_SCRIPT = linkram.lds
+endif
+
+
+# %jp{パス設定}%en{add source directories}
+INC_DIRS += . ..
+SRC_DIRS += . ..
+
+
+# %jp{オプションフラグ}%en{option flags}
+AFLAGS = -mcpu=cortex-m3 -mthumb
+CFLAGS = -mcpu=cortex-m3 -mthumb
+LNFLAGS = -mcpu=cortex-m3 -mthumb -nostartfiles -Wl,-Map,$(TARGET).map,-T$(LINK_SCRIPT)
+
+
+# %jp{コンパイラ依存の設定読込み}%en{compiler dependent definitions}
+include $(KERNEL_MAKINC_DIR)/$(ARCH_CC)_d.inc
+
+# %jp{実行ファイル生成用設定読込み}%en{definitions for exection file}
+include $(KERNEL_MAKINC_DIR)/makexe_d.inc
+
+
+# %jp{出力ファイル名}%en{output files}
+TARGET_EXE = $(TARGET).$(EXT_EXE)
+TARGET_MOT = $(TARGET).$(EXT_MOT)
+TARGET_HEX = $(TARGET).$(EXT_HEX)
+
+
+
+
+# --------------------------------------
+# %jp{ソースファイル}%en{source files}
+# --------------------------------------
+
+# %jp{アセンブラファイルの追加}%en{assembry sources}
+#ASRCS += ./vectors.S
+#ASRCS += ./crt0.S
+
+
+# %jp{C言語ファイルの追加}%en{C sources}
+CSRCS += ./kernel_vct.c
+CSRCS += ../kernel_cfg.c
+CSRCS += ../main.c
+CSRCS += ../sample.c
+CSRCS += ../ostimer.c
+CSRCS += ../uart.c
+
+
+
+
+# --------------------------------------
+# %jp{ルール定義}%en{rules}
+# --------------------------------------
+
+# %jp{ALL}%en{all}
+.PHONY : all
+all: kernel_make makeexe_all $(TARGET_EXE) $(TARGET_MOT) $(TARGET_HEX)
+
+# %jp{クリーン}%en{clean}
+.PHONY : clean
+clean: makeexe_clean
+ rm -f $(TARGET_EXE) $(TARGET_EXE) $(OBJS) ../kernel_cfg.c ../kernel_id.h
+
+# %jp{依存関係更新}%en{depend}
+.PHONY : depend
+depend: makeexe_depend
+
+# %jp{ソース一括コピー}%en{source files copy}
+.PHONY : srccpy
+srccpy: makeexe_srccpy
+
+# %jp{カーネルごとクリーン}%en{mostlyclean}
+.PHONY : mostlyclean
+mostlyclean: clean kernel_clean
+
+
+# %jp{コンフィギュレータ実行}%en{configurator}
+../kernel_cfg.c ../kernel_id.h: ../system.cfg $(KERNEL_CFGRTR)
+ cpp -E ../system.cfg ../system.i
+ $(KERNEL_CFGRTR) ../system.i -c ../kernel_cfg.c -i ../kernel_id.h
+
+
+# %jp{実行ファイル生成用設定読込み}%en{rules for exection file}
+include $(KERNEL_MAKINC_DIR)/makexe_r.inc
+
+# %jp{コンパイラ依存のルール定義読込み}%en{rules for compiler}
+include $(KERNEL_MAKINC_DIR)/$(ARCH_CC)_r.inc
+
+
+
+
+# --------------------------------------
+# %jp{依存関係}%en{dependency}
+# --------------------------------------
+
+$(OBJS_DIR)/sample.$(EXT_OBJ) : ../kernel_id.h
+
+
+
+# end of file
+
--- /dev/null
+/* ------------------------------------------------------------------------ */
+/* 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 */
--- /dev/null
+/* ------------------------------------------------------------------------ */
+/* HOS-V4a kernel configuration */
+/* */
+/* ------------------------------------------------------------------------ */
+
+
+#include "kernel.h"
+#include "arch/proc/arm/cortex_m3/procatr.h"
+#include "arch/proc/arm/cortex_m3/proc.h"
+#include "arch/irc/none/ircatr.h"
+#include "arch/irc/none/irc.h"
+#include "config/cfgknl.h"
+#include "parser/parsknl.h"
+#include "core/objid.h"
+#include "core/objhdl.h"
+#include "object/tskobj.h"
+#include "object/semobj.h"
+#include "object/flgobj.h"
+#include "object/dtqobj.h"
+#include "object/mbxobj.h"
+#include "object/mtxobj.h"
+#include "object/mpfobj.h"
+#include "object/inhobj.h"
+#include "object/isrobj.h"
+#include "object/cycobj.h"
+#include "kernel_id.h"
+
+#include "ostimer.h"
+#include "sample.h"
+
+
+
+/* ------------------------------------------ */
+/* define interrupt handler */
+/* ------------------------------------------ */
+
+extern VP _kernel_int_stkblk[((512) + sizeof(VP) - 1) / sizeof(VP)];
+
+
+_KERNEL_T_INHINF _kernel_inh_tbl[65] =
+ {
+ {(FP)(_kernel_reset_handler)}, /* reset handler */
+ {(FP)(&_kernel_int_stkblk[((512) + sizeof(VP) - 1) / sizeof(VP)])}, /* stack pointer */
+ {(FP)(_kernel_nmi_handler)}, /* non maskable intterupt handler */
+ {(FP)(_kernel_hw_fault_handler)}, /* hard fault handler */
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ {(FP)NULL},
+ };
+
+
+
+/* ------------------------------------------------------------------------ */
+/* End of file */
+/* ------------------------------------------------------------------------ */
--- /dev/null
+OUTPUT_ARCH(arm)
+ENTRY(_kernel_reset_handler)
+
+MEMORY
+{
+ vector : o = 0x00000000, l = 0x00001000
+ rom : o = 0x00001000, l = 0x000ff000
+ ram : o = 0x40000000, l = 0x00004000
+}
+
+SECTIONS
+{
+ .vector :
+ {
+ ___vector = . ;
+ */kernel_vct.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
+}
+
--- /dev/null
+/* ------------------------------------------------------------------------ */
+/* 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 */
--- /dev/null
+/**
+ * Sample program for Hyper Operating System V4 Advance
+ *
+ * @file main.c
+ * @brief %jp{メイン関数}%en{main}
+ *
+ * Copyright (C) 1998-2006 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "kernel.h"
+
+
+/** %jp{メイン関数} */
+int main()
+{
+
+ /* %jp{カーネルの動作開始} */
+ vsta_knl();
+
+ return 0;
+}
+
+void _sbrk(void)
+{
+}
+
+/* end of file */
--- /dev/null
+/**
+ * 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/
+ */
+
+
+#include "kernel.h"
+#include "ostimer.h"
+
+
+#define INTNO_TIMER0 4
+
+
+static void OsTimer_Isr(VP_INT exinf); /**< %jp{タイマ割込みサービスルーチン} */
+
+
+/** %jp{OS用タイマ初期化ルーチン} */
+void OsTimer_Initialize(VP_INT exinf)
+{
+ T_CISR cisr;
+
+ /* %jp{割込みサービスルーチン生成} */
+/*
+ cisr.isratr = TA_HLNG;
+ cisr.exinf = 0;
+ cisr.intno = INTNO_TIMER0;
+ cisr.isr = (FP)OsTimer_Isr;
+ acre_isr(&cisr);
+*/
+
+/* ena_int(INTNO_TIMER0); */
+
+ /* %jp{タイマ動作開始} */
+}
+
+
+/** %jp{タイマ割込みハンドラ} */
+void OsTimer_Isr(VP_INT exinf)
+{
+ /* %jp{割込み要因クリア} */
+
+ /* %jp{タイムティック供給} */
+ isig_tim();
+}
+
+
+/* end of file */
--- /dev/null
+/**
+ * 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 */
--- /dev/null
+/**
+ * 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/
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "kernel.h"
+#include "kernel_id.h"
+#include "uart.h"
+
+
+#define LEFT(num) ((num) <= 1 ? 5 : (num) - 1)
+#define RIGHT(num) ((num) >= 5 ? 1 : (num) + 1)
+
+
+ID mbxid;
+ID mpfid;
+
+
+/** %jp{メッセージ構造体} */
+typedef struct t_print_msg
+{
+ T_MSG msg;
+ char text[32];
+} T_PRINT_MSG;
+
+
+/** %jp{初期化ハンドラ} */
+void Sample_Initialize(VP_INT exinf)
+{
+ T_CMPF cmpf;
+ T_CMBX cmbx;
+
+ /* %jp{UART初期化} */
+ Uart_Initialize();
+
+ /* %jp{固定長メモリプール生成} */
+ cmpf.mpfatr = TA_TFIFO;
+ cmpf.blkcnt = 3;
+ cmpf.blksz = sizeof(T_PRINT_MSG);
+ cmpf.mpf = NULL;
+ mpfid = acre_mpf(&cmpf);
+
+ /* %jp{メールボックス生成} */
+ cmbx.mbxatr = TA_TFIFO | TA_TFIFO;
+ cmbx.maxmpri = 1;
+ cmbx.mprihd = NULL;
+ mbxid = acre_mbx(&cmbx);
+
+ /* %jp{タスク起動} */
+ act_tsk(TSKID_PRINT);
+ act_tsk(TSKID_SAMPLE1);
+ act_tsk(TSKID_SAMPLE2);
+ act_tsk(TSKID_SAMPLE3);
+ act_tsk(TSKID_SAMPLE4);
+ act_tsk(TSKID_SAMPLE5);
+}
+
+
+/** %jp{適当な時間待つ} */
+void rand_wait(void)
+{
+ int r;
+
+ wai_sem(SEMID_RAND);
+ r = rand();
+ sig_sem(SEMID_RAND);
+
+ dly_tsk((r % 100) + 10);
+}
+
+
+/** %jp{状態表示} */
+void print_state(int num, char *text)
+{
+ T_PRINT_MSG *msg;
+ VP mem;
+
+ /* %jp{メモリ取得} */
+ get_mpf(mpfid, &mem);
+ msg = (T_PRINT_MSG *)mem;
+
+ /* %jp{文字列生成} */
+ msg->text[0] = '0' + num;
+ msg->text[1] = ' ';
+ msg->text[2] = ':';
+ msg->text[3] = ' ';
+ strcpy(&msg->text[4], text);
+ strcat(msg->text, "\n");
+
+ /* %jp{表示タスクに送信} */
+ snd_mbx(mbxid, (T_MSG *)msg);
+}
+
+
+/** %jp{サンプルタスク} */
+void Sample_Task(VP_INT exinf)
+{
+ int num;
+
+ num = (int)exinf;
+
+ /* %jp{いわゆる哲学者の食事の問題} */
+ for ( ; ; )
+ {
+ /* %jp{適当な時間考える} */
+ print_state(num, "thinking");
+ rand_wait();
+
+ /* %jp{左右のフォークを取るまでループ} */
+ for ( ; ; )
+ {
+ /* %jp{左から順に取る} */
+ wai_sem(LEFT(num));
+ if ( pol_sem(RIGHT(num)) == E_OK )
+ {
+ break; /* %jp{両方取れた} */
+ }
+ sig_sem(LEFT(num)); /* %jp{取れなければ離す} */
+
+ /* %jp{適当な時間待つ} */
+ print_state(num, "hungry");
+ rand_wait();
+
+ /* %jp{右から順に取る} */
+ wai_sem(RIGHT(num));
+ if ( pol_sem(LEFT(num)) == E_OK )
+ {
+ break; /* %jp{両方取れた} */
+ }
+ sig_sem(RIGHT(num)); /* %jp{取れなければ離す} */
+
+ /* %jp{適当な時間待つ} */
+ print_state(num, "hungry");
+ rand_wait();
+ }
+
+ /* %jp{適当な時間、食べる} */
+ print_state(num, "eating");
+ rand_wait();
+
+ /* %jp{フォークを置く} */
+ sig_sem(LEFT(num));
+ sig_sem(RIGHT(num));
+ }
+}
+
+
+/** %jp{表示タスク} */
+void Sample_Print(VP_INT exinf)
+{
+ T_PRINT_MSG *msg;
+
+ for ( ; ; )
+ {
+ rcv_mbx(mbxid, (T_MSG **)&msg);
+ Uart_PutString(msg->text);
+ rel_mpf(mpfid, msg);
+ }
+}
+
+
+
+/* end of file */
--- /dev/null
+/**
+ * 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 __sample_h__
+#define __sample_h__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void Sample_Initialize(VP_INT exinf);
+void Sample_Task(VP_INT exinf);
+void Sample_Print(VP_INT exinf);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __sample_h__ */
+
+
+/* end of file */
--- /dev/null
+/**
+ * Sample program for Hyper Operating System V4 Advance
+ *
+ * @file system.cfg
+ * @brief %jp{サンプルのコンフィギュレーション}
+ *
+ * Copyright (C) 1998-2006 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+/* %jp{カーネル独自の設定}%en{kernel} */
+KERNEL_HEP_MEM(256, NULL);
+KERNEL_SYS_STK(256, NULL);
+KERNEL_INT_STK(512, NULL);
+KERNEL_MAX_TSKID(5);
+KERNEL_MAX_SEMID(6);
+KERNEL_MAX_FLGID(2);
+KERNEL_MAX_MBXID(2);
+KERNEL_MAX_MPFID(2);
+KERNEL_MAX_ISRID(4);
+
+
+/* %jp{OSタイマの設定}%en{OS timer} */
+INCLUDE("\"ostimer.h\"");
+ATT_INI({TA_HLNG, 0, OsTimer_Initialize});
+
+/* %jp{サンプル}%en{Sample program} */
+INCLUDE("\"sample.h\"");
+ATT_INI({TA_HLNG, 0, Sample_Initialize});
+CRE_TSK(TSKID_PRINT, {TA_HLNG, 1, Sample_Print, 1, 512, NULL});
+CRE_TSK(TSKID_SAMPLE1, {TA_HLNG, 1, Sample_Task, 2, 512, NULL});
+CRE_TSK(TSKID_SAMPLE2, {TA_HLNG, 2, Sample_Task, 2, 512, NULL});
+CRE_TSK(TSKID_SAMPLE3, {TA_HLNG, 3, Sample_Task, 2, 512, NULL});
+CRE_TSK(TSKID_SAMPLE4, {TA_HLNG, 4, Sample_Task, 2, 512, NULL});
+CRE_TSK(TSKID_SAMPLE5, {TA_HLNG, 5, Sample_Task, 2, 512, NULL});
+CRE_SEM(1, {TA_TFIFO, 1, 1});
+CRE_SEM(2, {TA_TFIFO, 1, 1});
+CRE_SEM(3, {TA_TFIFO, 1, 1});
+CRE_SEM(4, {TA_TFIFO, 1, 1});
+CRE_SEM(5, {TA_TFIFO, 1, 1});
+CRE_SEM(SEMID_RAND, {TA_TFIFO, 1, 1});
+
+
+/* end of file */
--- /dev/null
+/**
+ * Sample program for Hyper Operating System V4 Advance
+ *
+ * @file uart.c
+ * @brief %jp{UARTへの出力}%en{UART device driver}
+ *
+ * Copyright (C) 1998-2006 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "kernel.h"
+
+#define PINSEL0 ((volatile UW *)0xe002c000)
+
+#define U0RBR ((volatile UB *)0xe000c000)
+#define U0THR ((volatile UB *)0xe000c000)
+#define U0LCR ((volatile UB *)0xe000c00c)
+#define U0LSR ((volatile UB *)0xe000c014)
+#define U0DLL ((volatile UB *)0xe000c000)
+#define U0DLM ((volatile UB *)0xe000c004)
+
+
+#define VPB_CLK (14700000/4)
+#define UART_BPS 38400
+
+
+/* %jp{UARTの初期化} */
+void Uart_Initialize(void)
+{
+ *PINSEL0 = (*PINSEL0 & 0xfffffff0) | 0x05;
+
+ *U0LCR = 0x80;
+ *U0DLL = (VPB_CLK / 16.0) / UART_BPS + 0.5;
+ *U0DLM = 0x00;
+ *U0LCR = 0x03;
+}
+
+
+/* %jp{1文字出力} */
+void Uart_PutChar(int c)
+{
+ while ( !(*U0LSR & 0x20) )
+ ;
+
+ *U0THR = c;
+}
+
+
+/* %jp{文字列出力} */
+void Uart_PutString(const char *text)
+{
+ while ( *text != '\0' )
+ {
+ if ( *text == '\n' )
+ {
+ Uart_PutChar('\r');
+ Uart_PutChar('\n');
+ }
+ else
+ {
+ Uart_PutChar(*text);
+ }
+
+ text++;
+ }
+}
+
+
+char Uart_hex2asc(int a)
+{
+ if ( a < 10 )
+ {
+ return '0' + a;
+ }
+ return 'a' + a - 10;
+}
+
+
+void Uart_PutHexByte(char c)
+{
+ Uart_PutChar(Uart_hex2asc((c >> 4) & 0xf));
+ Uart_PutChar(Uart_hex2asc((c >> 0) & 0xf));
+}
+
+void Uart_PutHexWord(int i)
+{
+ Uart_PutHexByte((i >> 8) & 0xff);
+ Uart_PutHexByte((i >> 0) & 0xff);
+}
+
+
+
+/* end of file */
--- /dev/null
+/**
+ * Sample program for Hyper Operating System V4 Advance
+ *
+ * @file uart.h
+ * @brief %jp{UARTへの出力}%en{UART device driver}
+ *
+ * Copyright (C) 1998-2006 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#ifndef __ostimer_h__
+#define __ostimer_h__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void Uart_Initialize(void); /* %jp{UART の初期化} */
+void Uart_PutChar(int c); /* %jp{1文字出力} */
+void Uart_PutString(const char *text); /* %jp{文字列出力} */
+
+void Uart_PutHexByte(char c);
+void Uart_PutHexWord(int i);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __ostimer_h__ */
+
+
+/* end of file */