コンパイルしてみる
とりあえず、次のようなソースを書いてみた。
#include "reg3067.h" int main(void) { int a; int b; P4DDR = 0xff; a=0; b=1000; P4DR = 0xc0; while(1) { if(a==0) { P4DR = 0xc0; a = 1; } else { P4DR = 0x00; a = 0; } while(b>0) { b=b-1; } b=100000; } }
このソースは、AKI-H8/3069 LAN対応版用I/OボードのLEDを点滅させるもの。このソースをled.cとする。で、スタートアップルーチンをhttp://mes.sourceforge.jp/h8/h8osv1/crt/index.htmlからダウンロードし、次のようにしてmotファイルを作成する。
$ h8300-hms-gcc -T rom3068.x -nostartfiles -mh -mrelax -mint32 -O2 -W -Wall -o out.coff 30xxcrt0.S led.c $ h8300-hms-objcopy -O srec out.coff out.mot
で、H8へ転送。
$ h8write -3069 -f20 out.mot /dev/cu.(USBtoSerialのパス)
で、実行したら、点滅した。