SVX日記
2009-02-04(Wed) Fedora9、電子工作チューン
というのも、本格的な電子工作は約1年前にロータリエンコーダをゴソゴソやって以来だ。ちなみにソレは放置状態。まぁ、念願が叶ってWindowsを捨て、PC環境をFedoraに移し、7やらVistaやらXPやらのゴタゴタから完全に解放され、すこぶる気分よく毎日を過ごしているが、電子工作まわりの環境だけは、ほとんどイチから構築しなければならない……つーか、そもそも構築できるモンなんやろか?
つーわけで、まずは、オイラが回路デザインをする時に必須な、回路図エディタ……というか、実体配線図エディタをどうにかしなければならんのだが、Windows時代に愛用していたBschは、どうやらLinuxでも動くらしい。早速、コンパイルを試みる。
/home/mitsu/develop # mkdir bsch
/home/mitsu/develop # cd bsch
/home/mitsu/develop/bsch # wget http://www.suigyodo.com/online/e/qbsv047.tgz
/home/mitsu/develop/bsch # wget http://www.suigyodo.com/online/e/qlcv043.tgz
/home/mitsu/develop/bsch # wget http://www.suigyodo.com/online/qnl047a.tgz
/home/mitsu/develop/bsch # wget http://www.suigyodo.com/online/qnu043a.tgz
/home/mitsu/develop/bsch # wget http://www.suigyodo.com/online/c2t3c003.tgz
/home/mitsu/develop/bsch # tar xvfz qbsv047.tgz
/home/mitsu/develop/bsch # cd qbsv047
/home/mitsu/develop/bsch/qbsv047 # cat readme-j.txt | toutf8
/home/mitsu/develop/bsch/qbsv047 # cd qtbsch3v
/home/mitsu/develop/bsch/qbsv047/qtbsch3v # qmake
-bash: qmake: command not found
/home/mitsu/develop/bsch/qbsv047/qtbsch3v # yum search qt
/home/mitsu/develop/bsch/qbsv047/qtbsch3v # yum install qt-devel
/home/mitsu/develop/bsch/qbsv047/qtbsch3v # qmake-qt4
/home/mitsu/develop/bsch/qbsv047/qtbsch3v # make
g++ -c -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_QT3SUPPORT_LIB -DQT3_SUPPORT -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtGui -I/usr/include/Qt3Support -I/usr/include/Qt3Support -I/usr/include -I. -I. -I. -o complib.o complib.cpp
In file included from complib.h:30,
from complib.cpp:33:
sptnobjtext.h:40: 警告: unused parameter ‘grip’
complib.cpp: In member function ‘bool SPtn::readCe3(SReadCE3&)’:
complib.cpp:244: error: ‘atoi’ was not declared in this scope
complib.cpp:248: error: ‘atoi’ was not declared in this scope
complib.cpp:192: 警告: unused variable ‘vBuffCount’
complib.cpp:193: 警告: unused variable ‘n’
complib.cpp:193: 警告: unused variable ‘i’
complib.cpp: In member function ‘bool SPin::readCe3(SReadCE3&, int)’:
complib.cpp:424: error: ‘atoi’ was not declared in this scope
complib.cpp: In member function ‘bool SCompInfo::readCe3(SReadCE3&, std::string&, std::string&)’:
complib.cpp:738: error: ‘atoi’ was not declared in this scope
complib.cpp:741: error: ‘atoi’ was not declared in this scope
complib.cpp:745: error: ‘atoi’ was not declared in this scope
complib.cpp: In member function ‘std::string SCompLib::uniqueName(const std::string&)’:
complib.cpp:1221: error: ‘atoi’ was not declared in this scope
complib.cpp: In member function ‘bool SCompLib::ReadLb3(SReadCE3&, bool)’:
complib.cpp:1347: 警告: deprecated conversion from string constant to ‘char*’
complib.cpp: In member function ‘bool SCompLib::readLibraryFile(const char*)’:
complib.cpp:1511: 警告: deprecated conversion from string constant to ‘char*’
complib.cpp:1519: 警告: unused variable ‘len’
make: *** [complib.o] エラー 1
/home/mitsu/develop/bsch/qbsv047/qtbsch3v # emacs stdafx.h
+ #include <stdlib.h>
/home/mitsu/develop/bsch/qbsv047/qtbsch3v # make
g++ -c -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_QT3SUPPORT_LIB -DQT3_SUPPORT -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtGui -I/usr/include/Qt3Support -I/usr/include/Qt3Support -I/usr/include -I. -I. -I. -o sptnobjpolygon.o sptnobjpolygon.cpp
sptnobjpolygon.cpp: In member function ‘virtual SRect SPtnObjPolygon::area()’:
sptnobjpolygon.cpp:76: error: ‘INT_MAX’ was not declared in this scope
sptnobjpolygon.cpp: In member function ‘virtual bool SPtnObjPolygon::readCe3(SReadCE3&)’:
sptnobjpolygon.cpp:289: error: ‘INT_MIN’ was not declared in this scope
sptnobjpolygon.cpp:366: 警告: deprecated conversion from string constant to ‘char*’
make: *** [sptnobjpolygon.o] エラー 1
/home/mitsu/develop/bsch/qbsv047/qtbsch3v # emacs stdafx.h
+ #define INT_MAX (2^31) - 1
+ #define INT_MIN -(2^31)
/home/mitsu/develop/bsch/qbsv047/qtbsch3v # make
g++ -c -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_QT3SUPPORT_LIB -DQT3_SUPPORT -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtGui -I/usr/include/Qt3Support -I/usr/include/Qt3Support -I/usr/include -I. -I. -I. -o xbschdoc.o xbschdoc.cpp
In file included from complib.h:30,
from xbschcomponent.h:28,
from xbschdoc.h:32,
from xbschdoc.cpp:45:
sptnobjtext.h:40: 警告: unused parameter ‘grip’
xbschdoc.cpp:734: 警告: unused parameter ‘wce3’
xbschdoc.cpp:734: 警告: unused parameter ‘pList’
xbschdoc.cpp:734: 警告: unused parameter ‘bOwnOnly’
xbschdoc.cpp: In member function ‘void SXBSchDoc::selectForDragPinConnection(int, const SRect&, bool)’:
xbschdoc.cpp:1399: 警告: unused variable ‘tempSize’
xbschdoc.cpp: In member function ‘virtual bool SXBSchDoc::findStringCompare(const char*, const char*, bool)’:
xbschdoc.cpp:1734: error: ‘strcmp’ was not declared in this scope
xbschdoc.cpp:1736: error: ‘strstr’ was not declared in this scope
make: *** [xbschdoc.o] エラー 1
/home/mitsu/develop/bsch/qbsv047/qtbsch3v # emacs stdafx.h
+ #include <string.h>
/home/mitsu/develop/bsch/qbsv047/qtbsch3v # make
g++ -o qtbsch3v application.o ce3io.o cfgdata.o complib.o componentview.o coord.o drawcomponent.o drawcomponentbase.o drawobject.o editcommentdlg.o editcomponent.o editcomponentimpl.o editlabel.o editlabelimpl.o edittag.o edittagimpl.o main.o printOptionDlg.o selcomp.o selcompimpl.o setlib.o setlibimpl.o setSheetSize.o setlayerdlg.o sptnobj.o sptnobjarc.o sptnobjcircle.o sptnobjline.o sptnobjpolygon.o sptnobjtext.o xbschcomment.o xbschcomponent.o xbschdoc.o xbschdocsch.o xbschdrawobject.o xbschentry.o xbschfont.o xbschglobal.o xbschjunc.o xbschlabel.o xbschline.o xbschobj.o xbschpattern.o xbschsheetinfo.o xbschtag.o xbschview.o moc_application.o moc_componentview.o moc_editcommentdlg.o moc_editcomponent.o moc_editcomponentimpl.o moc_editlabel.o moc_editlabelimpl.o moc_edittag.o moc_edittagimpl.o moc_printOptionDlg.o moc_selcomp.o moc_selcompimpl.o moc_setlib.o moc_setlibimpl.o moc_setSheetSize.o moc_setlayerdlg.o moc_xbschview.o -lQt3Support -lQtGui -lQtCore -lpthread
/home/mitsu/develop/bsch/qbsv047/qtbsch3v # ./qtbsch3v
/home/mitsu/develop/bsch/qbsv047/qtbsch3v # cp qtbsch3v /usr/local/bin
/home/mitsu/develop/bsch/qbsv047/qtbsch3v # cd ..
/home/mitsu/develop/bsch/qbsv047 # mkdir /usr/share/qtbsch3v
/home/mitsu/develop/bsch/qbsv047 # cp -r LIBV /usr/share/qtbsch3v
/home/mitsu/develop/bsch/qbsv047 # qtbsch3v
/home/mitsu/develop/bsch # tar xvfz c2t3c003.tgz
/home/mitsu/develop/bsch # cd c2t3c003
/home/mitsu/develop/bsch/c2t3c003 # cat ce2to3.txt | toutf8
/home/mitsu/develop/bsch/c2t3c003 # cd ce2to3
/home/mitsu/develop/bsch/c2t3c003/ce2to3 # g++ *.cpp
/home/mitsu/develop/bsch/c2t3c003/ce2to3 # emacs ce3io.h
+ #include <stdlib.h>
+ #define INT_MAX (2^31) - 1
+ #define INT_MIN -(2^31)
/home/mitsu/develop/bsch/c2t3c003/ce2to3 # g++ *.cpp
In file included from xbschcomponent.h:10,
from ce2to3.cpp:16:
complib.h:173: error: extra qualification ‘SCompIndex::’ on member ‘pin’
ce2to3.cpp: In function ‘SXBSchSheetInfo* readCE2SheetInfo(FILE*)’:
ce2to3.cpp:65: 警告: deprecated conversion from string constant to ‘char*’
In file included from complib.cpp:14:
complib.h:173: error: extra qualification ‘SCompIndex::’ on member ‘pin’
In file included from xbschcomponent.h:10,
from xbschcomponent.cpp:13:
complib.h:173: error: extra qualification ‘SCompIndex::’ on member ‘pin’
In file included from xbschcomponent.h:10,
from xbschdoc.cpp:20:
complib.h:173: error: extra qualification ‘SCompIndex::’ on member ‘pin’
In file included from xbschglobal.cpp:16:
complib.h:173: error: extra qualification ‘SCompIndex::’ on member ‘pin’
xbschline.cpp:10 から include されたファイル中:
ce3io.h:12:1: 警告: "INT_MAX" が再定義されました
xbschline.cpp:7 から include されたファイル中:
/usr/lib/gcc/i386-redhat-linux/4.3.0/include/limits.h:74:1: 警告: ここが以前の宣言がある位置です
xbschline.cpp:10 から include されたファイル中:
ce3io.h:13:1: 警告: "INT_MIN" が再定義されました
xbschline.cpp:7 から include されたファイル中:
/usr/lib/gcc/i386-redhat-linux/4.3.0/include/limits.h:72:1: 警告: ここが以前の宣言がある位置です
/home/mitsu/develop/bsch/c2t3c003/ce2to3 # emacs complib.h
- SPin* SCompIndex::pin(int index,int dir,int& nLtrb,SPoint& ptEnd) const;
+ SPin* pin(int index,int dir,int& nLtrb,SPoint& ptEnd) const;
/home/mitsu/develop/bsch/c2t3c003/ce2to3 # g++ *.cpp
/home/mitsu/develop/bsch/c2t3c003/ce2to3 # cp a.out /usr/local/bin/ce2to3
/home/mitsu/develop/picNewDisp $ ce2to3 picNDisp.CE2
/home/mitsu/develop/picNewDisp $ qtbsch3v picNDisp.ce3
部品がトンでしまっているので、ワケがわからんが、これは約2年前のLCDパネルの実体配線図だ。近々、XPortを使って、コレのLANポート版を作りたいと思っているのだが。
/home/mitsu/develop/bsch # yum search gpasm
/home/mitsu/develop/bsch # yum install ktechlab
/home/mitsu/develop/picNewDisp $ ../pic80ppc/pic80ppc picNDisp.s
/home/mitsu/develop/picNewDisp $ gpasm -l
/home/mitsu/develop/picNewDisp $ gpasm -p p16f648a picNDisp.asm
/home/mitsu/develop/picNewDisp $ emacs test.asm
include "p16f648a.inc"
org 00h
goto start
org 04h
goto start
start
goto start
END
/home/mitsu/develop/picNewDisp $ gpasm -p p16f648a test.asm
/home/mitsu/develop/picNewDisp $ cat test.hex
:020000040000FA
:020000000528D1
:04000800052805289A
:00000001FF
なんだか、それっぽい出力は得られた。こっち方面もオッケーっぽいな……っと思ったところで、どーも、最近の開発トレンドはPICですらCらしい。オイラは、Z80っぽいニーモックを、PICのソレに変換するようなプリプロセッサを書いたくらいの(Z80)アセンブラ好きだが、そんなにラクができるんならば、Cもカジらせてもらおうかしらん。
/home/mitsu/develop/bsch # yum search sdcc
/home/mitsu/develop/bsch # yum install sdcc
/home/mitsu/develop/sdcc # cat test.c
#include <pic16f84a.h>
int main() {
while (1) {
}
}
/home/mitsu/develop/sdcc # sdcc test.c
-bash: sdcc: command not found
/home/mitsu/develop/sdcc # rpm -ql sdcc
/home/mitsu/develop/sdcc # cat /usr/share/doc/sdcc-2.8.0/README.fedora
Many of the executables in SDCC have very generic names. Therefore the binaries
are installed into $PREFIX/libexec/sdcc/, and symlinks with prefix sdcc- are
created in $PREFIX/bin. If this is a problem for you, you can add
$PREFIX/libexec/sdcc/ to you path.
/home/mitsu/develop/sdcc # sdcc-sdcc -mpic14 -p16f648a test.c
libsdcc.lib: No such file or directory
/home/mitsu/develop/sdcc # sdcc-sdcc -V -mpic14 -p16f648a test.c
+ "/usr/libexec/sdcc/sdcpp" -nostdinc -Wall -std=c99 -obj-ext=.o -DSDCC_MODEL_SMALL -DSDCC=260 -DSDCC_pic14 -D__pic14 -DSDCC_PROCESSOR="16f648a" -I"/usr/libexec/sdcc/../share/sdcc/include/pic14" -I"/usr/share/sdcc/include/pic14" -I"/usr/libexec/sdcc/../share/sdcc/include" -I"/usr/share/sdcc/include" -I"/usr/libexec/sdcc/../share/sdcc/include/pic" -I"/usr/share/sdcc/include/pic" "test.c"
+ "gpasm" -c "test.asm"
+ "gplink" -I"/usr/libexec/sdcc/../share/sdcc/lib" -I"/usr/share/sdcc/lib" -I"/usr/libexec/sdcc/../share/sdcc/lib/pic" -I"/usr/share/sdcc/lib/pic" -o test test.o libsdcc.lib pic16f648a.lib
libsdcc.lib: No such file or directory
でも、なんかダメっすぜ。つーか、コレにはハマった。原因はコレ。なッ、なんだこのマヌケなやりとりはッ!!
/home/mitsu/develop/sdcc # ls /usr/share/sdcc/lib/pic
-rw-r--r-- 1 root root 8 2008-11-15 06:30 pic.lib
/home/mitsu/develop/sdcc # ls /usr/share/sdcc/lib/pic16
-rw-r--r-- 1 root root 10 2008-11-15 06:30 pic16.lib
/home/mitsu/develop/sdcc # wget http://mirrors.nl.eu.kernel.org/fedora/updates/9/SRPMS.newkey/sdcc-2.8.0-3.fc9.src.rpm
/home/mitsu/develop/sdcc # rpm -ivh sdcc-2.8.0-3.fc9.src.rpm
/home/mitsu/develop/sdcc # cd /usr/src/redhat/SPECS
/usr/src/redhat/SPECS # rpmbuild -bp sdcc.spec
/usr/src/redhat/SPECS # yum install lyx latex2html gc-devel
/usr/src/redhat/SPECS # rpmbuild -bp sdcc.spec
/usr/src/redhat/SPECS # rpmbuild -ba sdcc.spec
/usr/src/redhat/BUILD # cp /usr/src/redhat/BUILD/sdcc/device/lib/pic/bin/* /usr/share/sdcc/lib/pic/
/usr/src/redhat/BUILD # cp /usr/src/redhat/BUILD/sdcc/device/lib/pic16/bin/* /usr/share/sdcc/lib/pic16
/home/mitsu/develop/sdcc # sdcc-sdcc -V -mpic14 -p16f648a test.c
+ "/usr/libexec/sdcc/sdcpp" -nostdinc -Wall -std=c99 -obj-ext=.o -DSDCC_MODEL_SMALL -DSDCC=280 -DSDCC_REVISION=5117 -DSDCC_pic14 -D__pic14 -DSDCC_PROCESSOR="16f648a" -I"/usr/libexec/sdcc/../share/sdcc/include/pic14" -I"/usr/share/sdcc/include/pic14" -I"/usr/libexec/sdcc/../share/sdcc/include" -I"/usr/share/sdcc/include" -I"/usr/libexec/sdcc/../share/sdcc/include/pic" -I"/usr/share/sdcc/include/pic" "test.c"
+ "gpasm" -c "test.asm"
+ "gplink" -I"/usr/libexec/sdcc/../share/sdcc/lib" -I"/usr/share/sdcc/lib" -I"/usr/libexec/sdcc/../share/sdcc/lib/pic" -I"/usr/share/sdcc/lib/pic" -w -r -o test test.o libsdcc.lib pic16f648a.lib
message: using default linker script "/usr/share/gputils/lkr/16f648a.lkr"
/home/mitsu/develop/akipic # wget http://members.jcom.home.ne.jp/pnms/src/akipic-0.1.8.tar.gz
/home/mitsu/develop/akipic # tar xvfz akipic-0.1.8.tar.gz
/home/mitsu/develop/akipic # cd akipic-0.1.8
/home/mitsu/develop/akipic/akipic-0.1.8 # make