2015年6月30日

1.簡単なOSを作成する~ソース管理編~

Cygwin でGitを入れていたので、さっそくGitHubでアカウント及びリポジトリを作成した。

$ git init 
$ git add
$ git commit -m "test"
$ git remote add origin https://github.com/satoshishimizu/mae_h8_3069f.git
$ git push -u origin master

username? password ? を入力。


Counting objects: 156, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (151/151), done.
Writing objects: 100% (156/156), 136.37 KiB | 0 bytes/s, done.
Total 156 (delta 74), reused 0 (delta 0)
To https://github.com/satoshishimizu/mae_h8_3069f.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.


今後の開発にかかわるソースは上記リポジトリで実施予定。
また、かなり遅くなってしまったが分散バージョン管理についても勉強していきたい。


<参考URL>
http://blog.urouro.net/entry/2012/12/22/164157
http://tweeeety.hateblo.jp/entry/2014/11/19/235517
http://qiita.com/hshimo/items/99811144bf4a081319e5


その他の人は下記コマンドでソースをクローンしてください。
mw@mw1-PC ~
$ git clone https://github.com/satoshishimizu/mae_h8_3069f.git
Cloning into 'mae_h8_3069f'...
remote: Counting objects: 156, done.
remote: Compressing objects: 100% (77/77), done.
remote: Total 156 (delta 74), reused 156 (delta 74), pack-reused 0
Receiving objects: 100% (156/156), 136.37 KiB | 0 bytes/s, done.
Resolving deltas: 100% (74/74), done.
Checking connectivity... done.


2015年6月27日

1.簡単なOSを作成する~開発環境の整備編~

まず、H8-3069Fを開封すると、「I/O BOARD」資料の部品表をみて、
可変抵抗、LED、カーボン抵抗、ジャンーピンなどを実装していく。
付属のCD-ROM内の3068net.pdfにも記載があるので、実装していこう。

こういったものが必要になるよ。






出来上がるとこんな感じ。
















実装が完了したら動作確認をするために、PC側の開発環境を整えていこう!!

付属 CD-ROM install.pdf参照


まずは、Windows環境なのでCygwinをインストする。
同封されているCygwin versionは古いので、Cygwin HPから setupファイルをDLする。


binutils、gccコンパイラを下記をみてinstallする。(viはお好みで。)

ここでDL中にエディタはサクラエディタをDLしておく。
また、お好みで背景色を変更する
サクラエディタを黒背景の配色(Monokai風)にカスタマイズする - C/C++強調キーワードセット付き



Cygwin で C 言語コンパイル環境を整える

gccコンパイル完了。


 


次に下記をURLを参考に後々使う可能性があるためgitも入れておく。

Cygwin(64bit)とgitのインストール

DLはミラーサイトからなので結構かかる。。。地道に待つ。


git install 完了。何度かDLが失敗したが、くじけずtry。









h8用のクロスコンパイラ環境構築


・binutils-2.25.tar.gz(<---- a="">

gcc-5.1.0.tar.gz(<------ p="">※5.1.0ではmakefileが生成されなかったため、3.4.6にした。


詳細な手順はここに記載されています。



次に構築したクロスコンパイラ環境が妥当かどうか確認する。 
http://kozos.jp/kozos/osbook_03.html よりソースアーカイブしたものをDLする。







gcc は64bit 環境だと、Makefileが64bit環境に対応していないので、指定してやる必要がある。

$./configure --target=h8300-elf --build=x86_64-unknown-cygwin --disable-nls --disable-threads --disable-shared --enable-languages=c












sto@sto-PC ~/gcc-3.4.6
$ ./configure --build=x86_64-unknown-cygwin --target=h8300-elf --disable-nls --disauages=ceads --disable-shared --enable-lang
loading cache ./config.cache
checking host system type... ./config.guess: unable to guess system type

This script, last modified 2004-02-16, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from

    ftp://ftp.gnu.org/pub/gnu/config/

If the version you run (./config.guess) is already up to date, please
send the following data and any information you think might be
pertinent to in order to provide the needed
information to handle your system.

config.guess timestamp = 2004-02-16

uname -m = x86_64
uname -r = 2.0.4(0.287/5/3)
uname -s = CYGWIN_NT-6.1
uname -v = 2015-06-09 12:22

/usr/bin/uname -p = unknown
/bin/uname -X     =

hostinfo               =
/bin/universe          =
/usr/bin/arch -k       =
/bin/arch              = x86_64
/usr/bin/oslevel       =
/usr/convex/getsysinfo =

UNAME_MACHINE = x86_64
UNAME_RELEASE = 2.0.4(0.287/5/3)
UNAME_SYSTEM  = CYGWIN_NT-6.1
UNAME_VERSION = 2015-06-09 12:22
configure: error: can not guess host type; you must specify one


ダメだと言われた。

$ wget -O config.guess 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'
$ wget -O config.sub 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD'

configureをupdateしても結果同じだった。


時間はかかったが、Cygwin64bit版ではなく、Cygein32bit版であれば
binutils-2.25とgcc--3.4.6のmake installまで完了できた。


そのあとは、手順通りにソースをコンパイルして下記の通り、OS転送まで完了できたので、
クロスコンパイラ環境の動作確認に問題ないことを確認し完了。



ついでにCashrcを編集。

sto@sto-PC ~
$ vi .bashrc


# Aliases
#
# Some people use a different file for aliases
# if [ -f "${HOME}/.bash_aliases" ]; then
#   source "${HOME}/.bash_aliases"
# fi
#
# Some example alias instructions
# If these are enabled they will be used instead of any instructions
# they may mask.  For example, alias rm='rm -i' will mask the rm
# application.  To override the alias instruction use a \ before, ie
# \rm will call the real rm not the alias.
#
# Interactive operation...
 alias rm='rm -i'
 alias cp='cp -i'
 alias mv='mv -i'
#
# Default to human readable figures
 alias df='df -h'
 alias du='du -h'
#
# Misc :)
 alias less='less -r'                          # raw control characters
 alias whence='type -a'                        # where, of a sort
 alias grep='grep --color'                     # show differences in colour
 alias egrep='egrep --color=auto'              # show differences in colour
 alias fgrep='fgrep --color=auto'              # show differences in colour
#
# Some shortcuts for different directory listings
 alias ls='ls -hF --color=tty'                 # classify files in colour
 alias dir='ls --color=auto --format=vertical'
 alias vdir='ls --color=auto --format=long'
 alias ll='ls -l'                              # long list
 alias la='ls -A'                              # all but . and ..
 alias l='ls -CF'                              #