・2022/08/10
32bitマイコン Zylin CPUの ZPU用の GCC toolchainを WSL環境でビルドする方法
(How to build Zylin ZPU's GCC toolchain with Windows WSL)
Tags: [FPGA], [電子工作], [Xilinx XC6SLX9], [FPGA 2022]
●【世界最小】FPGAに 32bitマイコン Zylin CPUの ZPUを実装して gccで開発する方法【gcc】
Zylin ZPU、Worlds Smallest 32 bit CPU with GCC toolchain
これも Papilio FPGA用の GitHubの内容を ALINX AX309で動く様に変更します。
Zylin AS - open source
The ZPU project is now hosted at github https://github.com/zylin/zpu
https://github.com/zylin/zpu
The Zylin ZPU . The worlds smallest 32 bit CPU with GCC toolchain .
https://github.com/zylin/zpugcc
zpugcc ZPU toolchain source code
Papilio-ZPUino-SOC
ZPUを使用した Arduinoスケッチが動く環境 ZPUino Soft Processor
● Zylin CPU ZPUの zpugcc toolchainのビルド手順(公式)
# ZPU build instructions to build unstable on linux (same for CygWin32)
git clone https://github.com/zylin/zpugcc.git
cd toolchain/toolchain
sh fixperm.sh
. env.sh
# toolchain/build.sh
sh build.sh
tar -cjvf zpugcclinux_unstable.tar.bz2 install
● Zylin CPU ZPUの zpugcc toolchainのビルド手順(FREE WING修正版)
zpugcc FREE WING修正版
ビルド環境
・Windows 10 WSL Windows Subsystem for Linux
・Raspberry Pi OS Lite Release date: April 4th 2022 32-bit
● Windows 10 WSL Windows Subsystem for Linux
Linux環境としてラズパイも便利だけど WSLも便利だわさ!
Microsoft Windows 10 Pro 21H2 Version 10.0.19044
ver
rem Microsoft Windows [Version 10.0.19044]
wsl --status
# Linux 用 Windows サブシステムの最終更新日: 2022/04/24
# カーネル バージョン: 5.10.102.1
wsl --unregister Debian
wsl --install -d Debian
● Windows WSLで sshd(SSH接続のサービス)を有効にして SFTPで接続できるようにする
Windows側のクライアントアプリは WinSCPが簡単でオススメ。
WinSCPとは
sudo apt install -y openssh-server
sudo service ssh restart
# [ ok ] Restarting OpenBSD Secure Shell server: sshd.
● x86系 Windows WSL Debian環境用
# WSL Debian Build ZPU GCC
uname -a
# Linux WIN10 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 GNU/Linux
sudo apt-get update
sudo apt-get install -y git zip nano
sudo apt-get install -y build-essential
sudo apt-get install -y flex bison
gcc -v
# gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)
# Clone zpugcc with patched by FREEWING
cd
git clone https://github.com/FREEWING-JP/zpugcc --depth 1 -b feature/build_toolchain_2022
cd
cd zpugcc
cd toolchain
sh fixperm.sh
. env.sh
# https://github.com/zylin/zpugcc/blob/master/toolchain/build.sh
# build.sh
# ====
# Build binutils
rm -rf build
mkdir build
cd build
export CFLAGS=-D_FORTIFY_SOURCE=0
../binutils/configure --target=zpu-elf --prefix=`pwd`/../install \
--disable-nls
make
echo $?
make install
echo $?
cd ..
ls -l install
ls -l ./install/bin
./install/bin/zpu-elf-ar -V
# GNU ar 2.15
# ====
# Build GCC
export PATH=`pwd`/install/bin:$PATH
export | grep PATH
rm -rf gccbuild
mkdir gccbuild
cd gccbuild
../gcc/configure --target=zpu-elf --prefix=`pwd`/../install --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib --disable-shared --enable-newlib -v --enable-checking=misc,tree,rtl,rtlflag,gc,gcac,fold --disable-multilib --disable-threads --enable-sjlj-exceptions --enable-libstdcxx-allocator=malloc \
--disable-nls
make
echo $?
make install
echo $?
cd ..
ls -l ./install/bin
./install/bin/zpu-elf-gcc -v
# gcc version 3.4.2
zip -u zpugcclinux_unstable -r install
# WSL Debian Build ZPU GCC
ls -l zpugcclinux_unstable.zip
# -rw-r--r-- 1 user user 15818617 Aug 20 11:54 zpugcclinux_unstable.zip
● x86系 Windows環境用
引数 | 指定する内容 | 引数の意味 | 対応 OS環境 |
--build | x86_64-unknown-linux-gnu | ビルド(プログラムをコンパイル)する環境 | WSL Debian Linux |
--host | i686-w64-mingw32 | makeして作ったプログラムの実行環境 | Windows |
--target | zpu-elf | クロス開発におけるターゲット環境 | ZPU |
# WSL Debian Cross Compile Build GCC for Windows
uname -a
# Linux WIN10 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 GNU/Linux
sudo apt-get update
sudo apt-get install -y git zip nano
sudo apt-get install -y build-essential
sudo apt-get install -y flex bison
# Cross Compile for Windows
sudo apt-get install -y gcc-mingw-w64
# sudo apt-get install mingw-w64 mingw-w64-tools
sudo apt-get install -y libc6-dev-i386
i686-w64-mingw32-gcc -v
# Thread model: win32
# gcc version 6.3.0 20170516 (GCC)
# Clone zpugcc with patched by FREEWING
cd
git clone https://github.com/FREEWING-JP/zpugcc --depth 1 -b feature/build_toolchain_2022
cd
cd zpugcc
cd toolchain
sh fixperm.sh
. env.sh
# https://github.com/zylin/zpugcc/blob/master/toolchain/build.sh
# build.sh
# ====
# Build binutils
rm -rf build_exe
mkdir build_exe
cd build_exe
export CFLAGS=-D_FORTIFY_SOURCE=0
../binutils/configure --target=zpu-elf --prefix=`pwd`/../install_exe \
--build=x86_64-unknown-linux-gnu \
--host=i686-w64-mingw32 \
--disable-nls
# # error "sysctl system call is unsupported in x32 kernel"
sed -i -e "s/^# include <sys\/sysctl.h>/\/\/# include <sys\/sysctl.h>/g" ../binutils/libiberty/physmem.c
grep sysctl.h ../binutils/libiberty/physmem.c
# //# include <sys/sysctl.h>
make
echo $?
# make[2]: makeinfo: Command not found
# Disable makeinfo
cat Makefile | grep '^MAKEINFO='
sed -i -e 's|^MAKEINFO=.*|MAKEINFO=true|g' Makefile
rm -rf ../install_exe
make install
echo $?
cd ..
ls -l install_exe
ls -l ./install_exe/bin
./install_exe/bin/zpu-elf-ar.exe -V
# GNU ar 2.15
# Copyright 2004 Free Software Foundation, Inc.
# ====
# Build GCC
# /bin/sh: 1: zpu-elf-gcc: not found
export PATH=`pwd`/install/bin:$PATH
export PATH=`pwd`/install_exe/bin:$PATH
export | grep PATH
rm -rf gccbuild_exe
mkdir gccbuild_exe
cd gccbuild_exe
../gcc/configure --target=zpu-elf --prefix=`pwd`/../install_exe --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib --disable-shared --enable-newlib -v --enable-checking=misc,tree,rtl,rtlflag,gc,gcac,fold --disable-multilib --disable-threads --enable-sjlj-exceptions --enable-libstdcxx-allocator=malloc \
--build=x86_64-unknown-linux-gnu \
--host=i686-w64-mingw32 \
--disable-nls
# # error "sysctl system call is unsupported in x32 kernel"
sed -i -e "s/^# include <sys\/sysctl.h>/\/\/# include <sys\/sysctl.h>/g" ../gcc/libiberty/physmem.c
grep sysctl.h ../gcc/libiberty/physmem.c
# //# include <sys/sysctl.h>
make
echo $?
make install
echo $?
cd ..
ls -l ./install_exe/bin
./install_exe/bin/zpu-elf-gcc.exe -v
# gcc version 3.4.2
zip -u zpugccwindows_unstable -r install_exe
ls -l zpugccwindows_unstable.zip
# -rw-r--r-- 1 user user 16457326 Aug 20 13:19 zpugccwindows_unstable.zip
$ apt search gcc-mingw
Sorting... Done
Full Text Search... Done
gcc-mingw-w64/oldoldstable 6.3.0-14+19.3 all
GNU C compiler for MinGW-w64
gcc-mingw-w64-base/oldoldstable 6.3.0-18+19.3+b3 amd64
GNU Compiler Collection for MinGW-w64 (base package)
gcc-mingw-w64-i686/oldoldstable 6.3.0-18+19.3+b3 amd64
GNU C compiler for MinGW-w64 targeting Win32
gcc-mingw-w64-x86-64/oldoldstable 6.3.0-18+19.3+b3 amd64
GNU C compiler for MinGW-w64 targeting Win64
● Raspberry Pi OS Lite Release date: April 4th 2022 32-bit
uname -a
# Linux raspberrypi 5.15.32-v7l+ #1538 SMP Thu Mar 31 19:39:41 BST 2022 armv7l GNU/Linux
sudo apt-get update
sudo apt-get install -y git zip nano
sudo apt-get install -y build-essential
sudo apt-get install -y flex bison
gcc -v
# gcc version 10.2.1 20210110 (Raspbian 10.2.1-6+rpi1)
# Clone zpugcc with patched by FREEWING
cd
git clone https://github.com/FREEWING-JP/zpugcc --depth 1 -b feature/build_toolchain_2022
cd
cd zpugcc
cd toolchain
sh fixperm.sh
. env.sh
# https://github.com/zylin/zpugcc/blob/master/toolchain/build.sh
# build.sh
# ====
# Build binutils
rm -rf build
mkdir build
cd build
export CFLAGS=-D_FORTIFY_SOURCE=0
../binutils/configure --target=zpu-elf --prefix=`pwd`/../install \
--disable-nls
make
echo $?
make install
echo $?
cd ..
./install/bin/zpu-elf-ar -V
# GNU ar 2.15
# Copyright 2004 Free Software Foundation, Inc.
ls -l ./install/bin
# ====
# Build GCC
export PATH=`pwd`/install/bin:$PATH
export | grep PATH
rm -rf gccbuild
mkdir gccbuild
cd gccbuild
../gcc/configure --target=zpu-elf --prefix=`pwd`/../install --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib --disable-shared --enable-newlib -v --enable-checking=misc,tree,rtl,rtlflag,gc,gcac,fold --disable-multilib --disable-threads --enable-sjlj-exceptions --enable-libstdcxx-allocator=malloc \
--disable-nls
make
echo $?
make install
echo $?
cd ..
ls -l install/bin
zpu-elf-gcc -v
# gcc version 3.4.2
zip -u zpugcclinux_unstable -r install
ls -l zpugcclinux_unstable.zip
# -rw-r--r-- 1 user user 15577521 Aug 20 00:30 zpugcclinux_unstable.zip
● x86系 Windows環境用
ラズパイ環境では Windows環境用の ZPU GCCをビルドできませんでした。
引数 | 指定する内容 | 引数の意味 | 対応 OS環境 |
--build | armv7l-unknown-linux-gnu | ビルド(プログラムをコンパイル)する環境 | Raspberrypi OS |
--host | i686-w64-mingw32 | makeして作ったプログラムの実行環境 | Windows |
--target | zpu-elf | クロス開発におけるターゲット環境 | ZPU |
sudo apt-get install -y gcc-mingw-w64
# sudo apt-get install mingw-w64 mingw-w64-tools
sudo apt-get install -y libc6-dev-i386
# E: Unable to locate package libc6-dev-i386
apt search libc6-dev-i386
sudo apt-get install -y libc6-dev-i386-cross
i686-w64-mingw32-gcc -v
# gcc version 10-win32 20210110 (GCC)
cd
cd zpugcc
cd toolchain
rm -rf build_exe
mkdir build_exe
cd build_exe
export CFLAGS=-D_FORTIFY_SOURCE=0
../binutils/configure --target=zpu-elf --prefix=`pwd`/../install_exe \
--build=armv7l-unknown-linux-gnu \
--host=i686-w64-mingw32 \
--disable-nls
make
checking for gcc... i686-w64-mingw32-gcc
checking whether the C compiler (i686-w64-mingw32-gcc -D_FORTIFY_SOURCE=0 ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.
make: *** [Makefile:18166: configure-bfd] Error 1
Can't Build Windows Compiler in Raspberrypi OS
● Zylin CPU ZPU zpugcc toolchain Build Message
----------------------------------------------------------------------
Libraries have been installed in:
/home/pi/zpugcc/toolchain/gccbuild/../install/zpu-elf/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
● Zylin CPU ZPU zpugcc toolchain Build Error Problem solver
・ configure: flex: not found、configure: lex: not found
checking for bison... no
checking for byacc... no
checking for flex... no
checking for lex... no
./zpugcc/toolchain/binutils/ld/configure: 4407: ./zpugcc/toolchain/binutils/ld/configure: flex: not found
checking for flex... lex
checking for yywrap in -ll... no
checking lex output file root... ./zpugcc/toolchain/binutils/ld/configure: 4495: ./zpugcc/toolchain/binutils/ld/configure: lex: not found
configure: error: cannot find output from lex; giving up
●Solution
sudo apt-get install -y flex bison
・ makeinfo: Command not found
echo '@set VERSION 2.15' > config.texi
makeinfo --split-size=5000000 -I ../../../binutils/bfd/doc ../../../binutils/bfd/doc/bfd.texinfo
make[2]: makeinfo: Command not found
Makefile:227: recipe for target 'bfd.info' failed
make[2]: *** [bfd.info] Error 127
●Solution
1) Disable makeinfo
2) Install texinfo module
・ 2) Install texinfo module
sudo apt-get install -y texinfo
・ Makefile:227: recipe for target 'bfd.info' failed
makeinfo --split-size=5000000 -I ../../../binutils/bfd/doc ../../../binutils/bfd/doc/bfd.texinfo
./elf.texi:1: warning: @section missing argument
./bfdt.texi:325: raising the section level of @subsubsection which is too low
./init.texi:5: raising the section level of @subsubsection which is too low
./archive.texi:54: raising the section level of @subsubsection which is too low
./format.texi:27: raising the section level of @subsubsection which is too low
./reloc.texi:495: raising the section level of @subsubsection which is too low
./core.texi:8: raising the section level of @subsubsection which is too low
./opncls.texi:5: raising the section level of @subsubsection which is too low
./libbfd.texi:10: raising the section level of @subsubsection which is too low
./cache.texi:14: raising the section level of @subsubsection which is too low
./elf.texi:13: raising the section level of @subsubsection which is too low
Makefile:227: recipe for target 'bfd.info' failed
make[2]: *** [bfd.info] Error 1
make[2]: Leaving directory '/home/user/zpugcc/toolchain/build_exe/bfd/doc'
Makefile:427: recipe for target 'install-recursive' failed
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory '/home/user/zpugcc/toolchain/build_exe/bfd'
Makefile:18225: recipe for target 'install-bfd' failed
etc.
creating po/Makefile.in
file=../../../binutils/bfd/po/`echo ro | sed 's,.*/,,'`.gmo \
&& rm -f $file && PATH=../src:$PATH no -o $file ../../../binutils/bfd/po/ro.po
/bin/sh: 2: no: not found
Makefile:402: recipe for target 'ro.gmo' failed
make[3]: *** [ro.gmo] Error 127
make[3]: Leaving directory '/home/user/zpugcc/toolchain/build/bfd/po'
Makefile:427: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
●Solution
1) Disable makeinfo
2) Install module
・ 1) Disable makeinfo
How to disable Automake docs ?
cat Makefile | grep '^MAKEINFO='
sed -i -e 's|^MAKEINFO=.*|MAKEINFO=true|g' Makefile
・ 2) Install module
sudo apt-get install ???
適当に apt-get installでモジュールを入れまくったら出なくなった。
・ make[3]: *** [Makefile:402: da.gmo] Error 127
creating po/Makefile.in
file=../../../binutils/bfd/po/`echo da | sed 's,.*/,,'`.gmo \
&& rm -f $file && PATH=../src:$PATH no -o $file ../../../binutils/bfd/po/da.po
/bin/sh: 2: no: not found
make[3]: *** [Makefile:402: da.gmo] Error 127
make[3]: Leaving directory '/home/pi/zpugcc/toolchain/build/bfd/po'
make[2]: *** [Makefile:427: all-recursive] Error 1
make[2]: Leaving directory '/home/pi/zpugcc/toolchain/build/bfd'
make[1]: *** [Makefile:573: all-recursive-am] Error 2
make[1]: Leaving directory '/home/pi/zpugcc/toolchain/build/bfd'
make: *** [Makefile:18199: all-bfd] Error 2
etc.
make[3]: Entering directory '/home/pi/zpugcc/toolchain/build/bfd/po'
file=../../../binutils/bfd/po/`echo zh_CN | sed 's,.*/,,'`.gmo \
&& rm -f $file && PATH=../src:$PATH no -o $file ../../../binutils/bfd/po/zh_CN.po
/bin/sh: 2: no: not found
make[3]: *** [Makefile:402: zh_CN.gmo] Error 127
●Solution
1) configureに --disable-nlsを追加する。
2) build.sh fails #18の内容で Makefileを修正する
・ 1) configureに --disable-nlsを追加する。
# --disable-nls
# Disables NLS Do not use Native Language Support
../xxx/configure xxxxx \
--disable-nls
・ 2) build.sh fails #18の内容で Makefileを修正する
build.sh fails #18
・ # error "sysctl system call is unsupported in x32 kernel"
gcc -c -DHAVE_CONFIG_H -D_FORTIFY_SOURCE=0 -mx32 -I. -I../../../../binutils/libiberty/../include -W -Wall -Wtraditional -pedantic ../../../../binutils/libiberty/physmem.c -o physmem.o
In file included from /usr/include/sys/sysctl.h:63:0,
from ../../../../binutils/libiberty/physmem.c:52:
/usr/include/bits/sysctl.h:19:3: error: #error "sysctl system call is unsupported in x32 kernel"
# error "sysctl system call is unsupported in x32 kernel"
^~~~~
Makefile:795: recipe for target 'physmem.o' failed
make[3]: *** [physmem.o] Error 1
gcc -c -DHAVE_CONFIG_H -D_FORTIFY_SOURCE=0 -mx32 -I. -I../../../../gcc/libiberty/../include -W -Wall -Wtraditional -pedantic ../../../../gcc/libiberty/physmem.c -o physmem.o
In file included from /usr/include/sys/sysctl.h:63:0,
from ../../../../gcc/libiberty/physmem.c:52:
/usr/include/bits/sysctl.h:19:3: error: #error "sysctl system call is unsupported in x32 kernel"
# error "sysctl system call is unsupported in x32 kernel"
^~~~~
Makefile:124: recipe for target 'physmem.o' failed
make[3]: *** [physmem.o] Error 1
●Solution
Comment out "#include <sys/sysctl.h>"
build failed on Linux with x32 ABI
649746 /usr/include/bits/sysctl.h:19:3: error: #error "sysctl system call is unsupported in x32 kernel"
sed -i -e "s/^# include <sys\/sysctl.h>/\/\/# include <sys\/sysctl.h>/g" ../binutils/libiberty/physmem.c
grep sysctl.h ../binutils/libiberty/physmem.c
sed -i -e "s/^# include <sys\/sysctl.h>/\/\/# include <sys\/sysctl.h>/g" ../gcc/libiberty/physmem.c
grep sysctl.h ../gcc/libiberty/physmem.c
nano ../binutils/libiberty/physmem.c
nano ../gcc/libiberty/physmem.c
#if HAVE_SYS_SYSCTL_H
// # include <sys/sysctl.h>
#endif
・ recipe for target 'collect2.exe' failed
i686-w64-mingw32-gcc -D_FORTIFY_SOURCE=0 -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -fno-common -DHAVE_CONFIG_H -o Tcollect2.exe \
collect2.o tlink.o intl.o version.o ../libiberty/libiberty.a ../intl/libintl.a
collect2.o:collect2.c:(.text+0x326): undefined reference to `kill'
collect2.o:collect2.c:(.text+0x352b): undefined reference to `pipe'
collect2.o:collect2.c:(.text+0x35e2): undefined reference to `fork'
collect2: error: ld returned 1 exit status
Makefile:1358: recipe for target 'collect2.exe' failed
make[1]: *** [collect2.exe] Error 1
make[1]: Leaving directory '/home/user/zpugcc/toolchain/gccbuild_exe/gcc'
Makefile:23346: recipe for target 'all-gcc' failed
make: *** [all-gcc] Error 2
●Solution
1) Skip collect2 build on windows
2) modify collect2.c
・ 1) Skip collect2 build on windows
既存で下記の設定が有りますが、WSL環境でのクロスビルドでは機能しませんでした。
(i386と i686の違いで i386/t-mingw32定義を読み込まないっぽい)
zpugcc/toolchain/gcc/gcc/config/i386/t-mingw32
# zpugcc/toolchain/gcc/gcc/config/i386/t-mingw32
#
# collect2 doesn't work for i386-mingw32* yet.
#
USE_COLLECT2=
# We hide calls to w32api needed for w32 thread support here:
LIB2FUNCS_EXTRA = $(srcdir)/config/i386/gthr-win32.c
・ 2) modify collect2.c
Re: error in crosscompiling with -mno-cygwin
Bug 14316 - collect2 doesnt build on windows hosts
「Comment 3」の内容で collect2.cにパッチを当てます。
nano ../gcc/gcc/collect2.c
Comment 3
Dave Murphy 2004-03-16 14:07:12 UTC
here's the patch I'm currently using for mingw compiler crosses, as I've applied to the current 3.4 snapshot.
--- collect2.c.orig Fri Jan 23 23:35:54 2004
+++ collect2.c Wed Feb 25 03:01:44 2004
@@ -144,6 +144,63 @@
#define SCAN_LIBRARIES
#endif
...
・ undefined reference to `libc_name_p'
gcc -D_FORTIFY_SOURCE=0 -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -fno-common -DHAVE_CONFIG_H -o cc1plus \
cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parser.o cp/ptree.o cp/rtti.o cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o cp/optimize.o cp/mangle.o cp/cp-lang.o cp/name-lookup.o cp/cxx-pretty-print.o attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o c-dump.o c-pretty-print.o c-opts.o c-pch.o c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o main.o libbackend.a libcpp.a ../libiberty/libiberty.a
cp/except.o: In function `nothrow_libfn_p':
except.c:(.text+0x230d): undefined reference to `libc_name_p'
collect2: error: ld returned 1 exit status
../../gcc/gcc/cp/Make-lang.in:90: recipe for target 'cc1plus' failed
make[1]: *** [cc1plus] Error 1
make[1]: Leaving directory '/home/user/zpugcc/toolchain/gccbuild/gcc'
●Solution
1) cfns.hファイルの libc_name_pの __inline修飾子を修正する。
2) export CC="gcc -fgnu89-inline"を追加する。
3) zpugccの Pull requestを適用する。
・ 1) cfns.hファイルの libc_name_pの __inline修飾子を修正する。
How to handle error compiling GCC 4.7.0 using GCC 6.2.1
AR# 67940: 2016.3 SDK - インライン関数に対して「undefined reference to FUNCTION_NAME」というエラー メッセージが表示される
sed -i -e \
"109 s/^__inline/#ifdef __GNUC_STDC_INLINE__\n__attribute__ ((__gnu_inline__))\n#else\n__inline\n#endif/g" \
../gcc/gcc/cp/cfns.h
grep -A6 -B1 __GNUC_STDC_INLINE__ ../gcc/gcc/cp/cfns.h
nano ../gcc/gcc/cp/cfns.h
#ifdef __GNUC__
#ifdef __GNUC_STDC_INLINE__
__attribute__ ((__gnu_inline__))
#else
__inline
#endif
#endif
const char * libc_name_p (const char *, unsigned int);
・ 2) export CC="gcc -fgnu89-inline"を追加する。
Fails to build with GCC 5.4 #10
export PATH=`pwd`/install/bin:$PATH
export CC="gcc -fgnu89-inline"
rm -rf gccbuild
・ 3) zpugccの Pull requestを適用する。
Fixes build problems from issue #6 #9
Fixed inline issue with libc_name_p #11
・ /bin/sh: 1: -f: not found
Makefile:172: warning: overriding recipe for target '.c.o'
Makefile:95: warning: ignoring old recipe for target '.c.o'
if [ -f ./../../../binutils/objdump ] ; then \
objdump="./../../../binutils/objdump"; \
else \
t='s,^,zpu-elf-,;'; \
objdump=`echo objdump | sed -e $t`; \
fi ; \
name=`$objdump -f crt0.o | sed '/^$/d'`;
name=`$objdump -f crt_io.o | sed '/^$/d'`;
/bin/sh: 1: -f: not found
/usr/bin/install -c crt0.o /home/pi/zpugcc/toolchain/gccbuild/../install/zpu-elf/lib/crt0.o
/usr/bin/install -c crt_io.o /home/pi/zpugcc/toolchain/gccbuild/../install/zpu-elf/lib/crt_io.o
make[2]: Leaving directory '/home/pi/zpugcc/toolchain/gccbuild/zpu-elf/libgloss/zpu'
●Solution
toolchain/gcc/libgloss/zpu/Makefile.inの name=`$$objdump -f $(CRT0) | sed '/^$$/d'`;の末尾に \を追加する。
fix Makefile.in
nano ../gcc/libgloss/zpu/Makefile.in
name=`$$objdump -f $(CRT0) | sed '/^$$/d'`; \
・ /bin/sh: 1: zpu-elf-gcc: not found at i686 mingw32 Cross Compile
i686-w64-mingw32-gcc -D_FORTIFY_SOURCE=0 -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -fno-common -DHAVE_CONFIG_H -o cpp.exe gcc.o cppspec.o intl.o \
prefix.o version.o ../libiberty/libiberty.a ../intl/libintl.a
zpu-elf-gcc -dumpspecs > tmp-specs
/bin/sh: 1: zpu-elf-gcc: not found
Makefile:1134: recipe for target 'specs' failed
make[1]: *** [specs] Error 127
make[1]: Leaving directory '/home/user/zpugcc/toolchain/gccbuild_exe/gcc'
Makefile:23346: recipe for target 'all-gcc' failed
make: *** [all-gcc] Error 2
●Solution
Linux版の実行ファイルのパスを PATHに追加する
export PATH=`pwd`/install/bin:$PATH
・ configure: error: installation or configuration problem: C compiler cannot create executables.
checking for working aclocal-1.4... missing
checking for working autoconf... missing
checking for working automake-1.4... missing
checking for working autoheader... missing
checking for working makeinfo... missing
checking for i686-w64-mingw32-ar... i686-w64-mingw32-ar
checking for i686-w64-mingw32-ranlib... i686-w64-mingw32-ranlib
checking for gcc... i686-w64-mingw32-gcc
checking whether the C compiler (i686-w64-mingw32-gcc -D_FORTIFY_SOURCE=0 ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.
make: *** [Makefile:18166: configure-bfd] Error 1
●Solution
???
解決方法が不明
●その他、Linux環境での裏技
・ bashスクリプトには set -euを設定すると良い
理由:
-e 途中でエラーが発生した場合に中断してくれる設定
-u 変数が未設定の状態だとエラーにしてくれる
#!/bin/bash
# set --help
# set -eu
# -e Exit immediately if a command exits with a non-zero status.
# -u Treat unset variables as an error when substituting.
・ configureが失敗する時の緊急避難の設定方法
configureに --disable-werror を追加する。
make -kで -kオプションを付ける。
Installing GCC: Configuration
理由:
--disable-werror warningをエラー扱いしない
-k, --keep-going 途中でエラーが有っても無視して続行する
configure --disable-werror
Do not Make all warnings into errors
make -k
-k, --keep-going Keep going when some targets can't be made.
Tags: [FPGA], [電子工作], [Xilinx XC6SLX9], [FPGA 2022]
●関連するコンテンツ(この記事を読んだ人は、次の記事も読んでいます)
AMD Xilinxの FPGA Spartan-6 XC6SLX16のボードを買ってアーケード ゲームを動かす
ALINX AX309 XC6SLX9の中華クローンの XC6SLX16版を購入しました
AMD Xilinxの FPGAの開発アプリ ISE WebPackをダウンロードして Windows 10で動かす方法
Spartan-6の FPGAの開発用に Xilinx ISE WebPack開発ソフトウェアを Windows 10で動かす方法
Xilinxの FPGA Spartan-6の Block RAM RAMB8BWERに初期値を入れて ROMとして使う方法
Xilinxの FPGA Spartan-6の Block RAM RAMB8BWERに初期値を入れて ROMとして使う方法
FPGA Spartan-6 XC6SLX16でファミコンを動かす!
Xilinx FPGA Spartan-6 XC6SLX16 NES clone in ALINX AX309
Xilinxの FPGA Spartan-6で PicoBlaze KCPSM 8 ビット マイクロコントローラーを動かす!
PicoBlaze KCPSM6 in Spartan-6 with ISE WebPack
Xilinxの FPGA Spartan-6で MicroBlazeを ISE WebPack 14.7で無料ライセンスで動かす方法
How to MicroBlaze in Spartan-6 with ISE WebPack 14.7 only Free License to Blink LED !
USB HOST機能を FPGAに実装する方法、FPGAの GPIOに USB HIDデバイスを接続したい!!
FPGAに USB HOST機能を実装して Low Speedの USB HIDデバイスを接続するのら
USBの通信プロトコルを勉強する
今まで漠然としていた USBデバイスの通信方法を理解します
USB HOST機能が欲しいのでワンチップマイコンの GPIOで USB HOST機能を実現する
FPGAに USBデバイスを接続したいのですが、USB HOSTの通信を実装できないので困っています
OLIMEX LPC-H40(Philips LPC2106)
MOTHER BOARD for LPC-H40(LPC-H2106) and ASM Sample Program.
線形帰還シフトレジスタ LFSRのまとめ、FPGAの Verilog HDLでの実装例
LFSR Linear Feedback Shift Registerについて調べた
【2022年版】最近流行の RISC-Vプロセッサの環境を WSL Ubuntu上に構築する方法
RISC-Vプロセッサの Rocket Chipの開発環境を Windows上に構築して Verilogする方法
XILINX FPGAのBlock RAMをROMとして使う方法
FPGAに内蔵のBLOCK-RAMにROMとして初期値を与える方法
スパルタン2で"ギャラクシアン基板"を作る!
Verilog言語で記述してあります
スパルタン2で"MIDWAY 8080(TAITO インベーダ基板)"を動かす!
ハードウェアで本物を作ります
スパルタン2で"パックマン"を動かす!
FPGAでパックマンが動きます
スパルタン2で"ド*キーコ*グ"を動かす!
これもFPGAで動いちゃいます
スパルタン3でアーケードゲームを動かす!
XAPP694の使用例、INVADER/GALAXIAN/PACMAN/D*NKEY-K*NG/TIME PILOT
[HOME]
|
[BACK]
リンクフリー(連絡不要、ただしトップページ以外は Web構成の変更で移動する場合があります)
Copyright (c)
2022 FREE WING,Y.Sakamoto
Powered by 猫屋敷工房 & HTML Generator
http://www.neko.ne.jp/~freewing/fpga/zpu_soft_core_build_zpu_gcc_toolchain/