Cours:De0NanoSoc : Différence entre versions

De troyesGEII
Aller à : navigation, rechercher
(a trier)
(Contenu remplacé par « =I2C= Media:DE0-Nano-SoC_Schematic.pdf »)
Ligne 1 : Ligne 1 :
=installation Linux=
+
=I2C=
  
*créer la carte SD avec l'image :
+
[[Media:DE0-Nano-SoC_Schematic.pdf]]
https://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&CategoryNo=167&No=941&PartNo=4
 
*modifier la partition racine
 
*installer debian 10
 
https://rcn-ee.com/rootfs/eewiki/minfs/
 
*ajouter la partition racine dans le fichier fstab
 
/dev/mmcblk0p2  /  auto  errors=remount-ro  0  1
 
*démarrer la de0 nano soc
 
**configurer le reseau
 
**bug :
 
ln -s /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@ttyS0.service
 
 
 
==modifier sur la Debian==
 
===apt sources list===
 
 
 
modifier le fichier /etc/apt/sources.list avec :
 
<source lang=bash>
 
deb http://archive.debian.org/debian buster main contrib non-free
 
#deb-src http://archive.debian.org/debian buster main contrib non-free
 
 
 
deb http://archive.debian.org/debian-security buster/updates main contrib non-free
 
#deb-src http://security.debian.org/debian-security buster/updates main contrib non-free
 
 
 
deb http://archive.debian.org/debian buster-updates main contrib non-free
 
#deb-src http://archive.debian.org/debian buster-updates main contrib non-free
 
 
 
#Kernel source (repos.rcn-ee.com) : https://github.com/RobertCNelson/linux-stable-rcn-ee
 
#
 
#git clone https://github.com/RobertCNelson/linux-stable-rcn-ee
 
#cd ./linux-stable-rcn-ee
 
#git checkout `uname -r` -b tmp
 
 
 
deb [arch=armhf signed-by=/usr/share/keyrings/rcn-ee-archive-keyring.gpg] http://repos.rcn-ee.com/debian/ buster main
 
#deb-src [arch=armhf signed-by=/usr/share/keyrings/rcn-ee-archive-keyring.gpg] http://repos.rcn-ee.com/debian/ buster main
 
</source>
 
 
 
===installer===
 
*dpkg-reconfigure locales
 
*apt install build-essential
 
*apt install zlib1g-dev libicu-dev libdouble-conversion-dev libpcre2-dev libzstd-dev libglib2.0-0 libglib2.0-dev libpng-dev libharfbuzz-dev
 
*apt install libssl-dev libkrb5-dev libudev-dev libfontconfig-dev libxkbcommon-dev libinput-dev libdbus-1-dev libdbus-1-3 libcups2-dev libpcre3-dev
 
*libmd4c
 
wget http://ftp.fr.debian.org/debian/pool/main/m/md4c/libmd4c0_0.4.8-1_armhf.deb
 
wget http://ftp.fr.debian.org/debian/pool/main/m/md4c/libmd4c-dev_0.4.8-1_armhf.deb
 
dpkg -i *.deb
 
 
 
 
 
 
 
apt install libc6-dev:armhf libgcc-*-dev:armhf libfreetype6-dev:armhf libfontconfig1-dev:armhf libx11-dev:armhf libxext-dev:armhf libxi-dev:armhf libxrender-dev:armhf libxfixes-dev:armhf libxrandr-dev:armhf libjpeg-dev:armhf libpng-dev:armhf libtiff-dev:armhf libwebp-dev:armhf libegl1-mesa-dev:armhf libgles2-mesa-dev:armhf pkg-config build-essential cmake git python3
 
 
 
apt-get build-dep libqt5core5a
 
 
 
==chroot==
 
 
 
<source lang=bash>
 
rep="monDossier"
 
mount -t proc /proc $rep/chroot/proc/
 
mount --rbind /sys $rep/chroot/sys/
 
mount --rbind /dev $rep/chroot/dev/
 
chroot $rep/chroot/
 
umount -l $rep/chroot/dev/
 
umount -l $rep/chroot/sys/
 
umount -l $rep/chroot/proc/
 
</source>
 
 
 
=cross compilation=
 
 
 
==sysroot==
 
<source lang=bash>
 
rep="monDossier"
 
cd $rep
 
rsync -av chroot/lib sysroot/
 
rsync -av chroot/usr/include sysroot/usr/
 
rsync -av chroot/usr/lib sysroot/usr/
 
rsync -av chroot/usr/arm-linux-gnueabi rsync -av sysroot/usr/
 
 
 
wget https://raw.githubusercontent.com/Kukkimonsuta/rpi-buildqt/master/scripts/utils/sysroot-relativelinks.py
 
chmod +x sysroot-relativelinks.py
 
python3 sysroot-relativelinks.py sysroot
 
 
 
cd $rep/sysroot/usr/lib/arm-linux-gnueabihf
 
ln -s $rep/sysroot/lib/arm-linux-gnueabihf/libpcre.so.3 ./
 
 
 
</source>
 
 
 
==compilateur arm 8==
 
 
 
*ajouter au fichier /etc/apt/sources.list
 
deb http://archive.ubuntu.com/ubuntu focal main universe
 
 
 
 
 
<source lang=bash>
 
mkdir -p /apps/gcc/arm-8/
 
cp /apps/gcc/arm-8/
 
ln -s /usr/bin/arm-linux-gnueabihf-cpp-8 arm-linux-gnueabihf-cpp
 
ln -s /usr/bin/arm-linux-gnueabihf-g++-8 arm-linux-gnueabihf-g++
 
ln -s /usr/bin/arm-linux-gnueabihf-gcc-8 arm-linux-gnueabihf-gcc
 
ln -s /usr/bin/arm-linux-gnueabihf-gcc-ar-8 arm-linux-gnueabihf-ar
 
ln -s /usr/bin/arm-linux-gnueabihf-gcc-nm-8 arm-linux-gnueabihf-nm
 
ln -s /usr/bin/arm-linux-gnueabihf-gcc-ranlib-8 arm-linux-gnueabihf-ranlib
 
ln -s /usr/bin/arm-linux-gnueabihf-gcov-8 arm-linux-gnueabihf-gcov
 
ln -s /usr/bin/arm-linux-gnueabihf-gcov-dump-8 arm-linux-gnueabihf-gcov-dump
 
ln -s /usr/bin/arm-linux-gnueabihf-gcov-tool-8 arm-linux-gnueabihf-gcov-tool
 
ln -s /usr/bin/arm-linux-gnueabihf-lto-dump-8 arm-linux-gnueabihf-dump
 
</source>
 
 
 
 
 
PATH=/apps/gcc/arm-8:$PATH
 
 
 
==compiler Qt==
 
 
 
 
 
===get qtSource===
 
<source lang=bash>
 
rep="monDossier"
 
PATH=/apps/gcc/arm-12:$PATH
 
arm-linux-gnueabihf-gcc --version
 
!! doit être 8 !!
 
 
 
cd $rep
 
mkdir qt5Source
 
cd qt5Source
 
git clone https://code.qt.io/qt/qt5.git -b 5.15
 
cd qt5
 
./init-repository --module-subset=essential
 
git submodule foreach --recursive "git clean -dfx"
 
</source>
 
 
 
===créer les fichier "devices"===
 
 
 
<source lang=bash>
 
mkdir linux-cyclonev-g++
 
cd linux-cyclonev-g++
 
nano qmake.conf
 
//contenu
 
 
 
#include(../common/linux_device_pre.conf)
 
 
 
#DISTRO_OPTS                  += arm
 
#COMPILER_FLAGS              += -march=armv7-a+fp -mfloat-abi=hard
 
 
 
#DISTRO_OPTS += hard-float
 
 
 
#CONFIG += incremental cross_compile qpa
 
#QT_QPA_DEFAULT_PLATFORM = linuxfb
 
 
 
 
 
#include(../common/linux_arm_device_post.conf)
 
 
 
 
 
#-------------------------------------------------
 
# Qt mkspec for DE0-Nano-SoC (Cyclone V, ARMv7-A, hard-float)
 
# Cross-compilation using Linaro or Intel SoC EDS toolchain
 
#-------------------------------------------------
 
 
 
MAKEFILE_GENERATOR = UNIX
 
CONFIG += incremental global_init_link_order
 
CONFIG += cross_compile qpa
 
 
 
# QPA platforms
 
QMAKE_QPA_PLATFORM = linuxfb eglfs
 
 
 
#-------------------------------------------------
 
# Toolchain
 
#-------------------------------------------------
 
QMAKE_CC        = $$CROSS_COMPILEgcc-12
 
QMAKE_CXX      = $$CROSS_COMPILEg++-12
 
QMAKE_LINK      = $$CROSS_COMPILEg++-12
 
QMAKE_LINK_SHLIB= $$CROSS_COMPILEg++-12
 
QMAKE_AR        = $$CROSS_COMPILEar cqs
 
QMAKE_OBJCOPY  = $$CROSS_COMPILEobjcopy
 
QMAKE_STRIP    = $$CROSS_COMPILEstrip
 
 
 
#-------------------------------------------------
 
# CPU architecture flags (Cyclone V = ARMv7-A + NEON)
 
#-------------------------------------------------
 
QMAKE_CFLAGS  += -march=armv7-a -mfloat-abi=hard -mfpu=neon
 
QMAKE_CXXFLAGS += -march=armv7-a -mfloat-abi=hard -mfpu=neon
 
 
 
#-------------------------------------------------
 
# Sysroot
 
#-------------------------------------------------
 
 
 
QMAKE_INCDIR += \
 
    $$[QT_SYSROOT]/usr/include \
 
    $$[QT_SYSROOT]/usr/include/arm-linux-gnueabihf \
 
    $$[QT_SYSROOT]/usr/arm-linux-gnueabi/include
 
 
 
QMAKE_LIBDIR += \
 
    $$[QT_SYSROOT]/lib \
 
    $$[QT_SYSROOT]/lib/arm-linux-gnueabihf \
 
    $$[QT_SYSROOT]/usr/lib \
 
    $$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf
 
 
 
 
 
QMAKE_LIBS += -ldl
 
QMAKE_LIBS_PRIVATE += -ldl
 
 
 
# Avoid RPATH for embedded targets
 
QMAKE_LFLAGS_RPATH =
 
 
 
# Default QPA platform
 
QT_QPA_DEFAULT_PLATFORM = linuxfb
 
 
 
# EGLFS backend (requires SGX drivers)
 
EGLFS_DEVICE_INTEGRATION = eglfs
 
 
 
#-------------------------------------------------
 
# Common includes for embedded Linux
 
#-------------------------------------------------
 
DISTRO_OPTS += hard-float
 
 
 
QT_CPU_FEATURES.arm = neon
 
 
 
load(device_config)
 
include(../common/linux_device_pre.conf)
 
include(../common/linux_arm_device_post.conf)
 
load(qt_config)
 
 
 
 
 
nano qplatformdefs.h
 
 
 
//contenu
 
/dev/mmcblk0p2  /  auto  errors=remount-ro  0  1
 
 
 
</source>
 
 
 
===configurer les sources qt puis compiler===
 
<source lang=bash>
 
cd $rep/qt5Source/qt5
 
cp -R $rep/linux-cyclonev-g++ qtbase/mkspecs/devices/
 
 
 
export CFLAGS="-std=gnu11"
 
export CXXFLAGS="-std=gnu++11"
 
 
 
./configure -release -device linux-cyclonev-g++ -no-eglfs \
 
-device-option CROSS_COMPILE=arm-linux-gnueabihf- \
 
-sysroot $rep/sysroot -opensource -confirm-license -make libs \
 
-prefix /usr/local/qt5pi -extprefix $rep/qt5_de0 -hostprefix $rep/qt5 \
 
-R $rep/sysroot/usr/lib/arm-linux-gnueabihf -no-gbm -no-use-gold-linker -v -no-opengl -release -shared \
 
-R $rep/usr/arm-linux-gnueabi/include \
 
-R $rep/usr/arm-linux-gnueabi/include/gnu \
 
  -nomake tests -nomake examples -system-sqlite\
 
  -skip qtwebengine -no-feature-imageformat_xpm -no-xcb -no-feature-kms -no-feature-bearermanagement -skip qtmultimedia -no-sql-psql \
 
  -no-feature-vulkan -no-cups \
 
  -no-egl -no-freetype -no-gif -no-glib -no-icu -no-ico -no-iconv -no-kms -no-libjpeg -no-libproxy -no-openvg -no-sctp -no-sql-db2 -no-sql-ibase -no-sql-oci -no-sql-tds -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-system-proxies -no-use-gold-linker -nomake examples -nomake tests -no-feature-bearermanagement -no-feature-colordialog -no-feature-concurrent -no-feature-dial -no-feature-ftp -no-feature-http -no-feature-image_heuristic_mask -no-feature-keysequenceedit -no-feature-lcdnumber -no-feature-networkdiskcache -no-feature-networkproxy -no-feature-pdf -no-feature-printdialog -no-feature-printer -no-feature-printpreviewdialog -no-feature-printpreviewwidget -no-feature-sessionmanager -no-feature-socks5  -no-feature-statemachine -no-feature-syntaxhighlighter -no-feature-textodfwriter -no-feature-topleveldomain -no-feature-udpsocket -no-feature-undocommand -no-feature-undogroup -no-feature-undostack -no-feature-undoview -no-feature-vnc -no-gtk -no-opengles3 -no-angle -no-sqlite -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdeclarative -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmacextras -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtquickcontrols -skip qtquickcontrols2 -skip qtscript -skip qtscxml -skip qtsensors -skip qtspeech -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtx11extras -skip qtxmlpatterns
 
 
 
 
 
# eventuellement modifier qtbase/src/plugins/printsupport/printsupport.pro pour le desactiver
 
# export LDFLAGS="--sysroot=$SYSROOT -Wl,-rpath-link,$SYSROOT/lib -Wl,-rpath-link,$SYSROOT/usr/lib/arm-linux-gnueabihf -fuse-ld=bfd"
 
 
 
make -j12
 
 
 
rm -R $rep/qt5_de0
 
make install -j12
 
 
 
</source>
 
 
 
={{Rouge|Projet Quartus}}=
 
Device :
 
*Altera Cyclone®  V
 
*SE  Mainstream
 
*5CSEMA4U23C6 N
 
 
 
={{Rouge|positions}}=
 
 
 
{| class="wikitable"
 
|-
 
| Nom || Led7 || Led6 || Led5 || Led4 || Led3 || Led2 || Led1 || Led0
 
|-
 
| Broche || AA23 || Y16 || AE26 || AF26 || V15 || V16 || AA24 || W15
 
|}
 
 
 
{| class="wikitable"
 
|-
 
| Nom || SW3 || SW2 || SW1 || SW0
 
|-
 
| Broche || H5 || H6 || L9 || L10
 
|}
 
 
 
={{Rouge|Ressources}}=
 
 
 
*[https://eewiki.net/display/linuxonarm/DE0-Nano-SoC+Kit préparation de la carte SD avec debian]
 
*configuration du noyau
 
**device/fpga_config_support  .... altera
 
**device/gpio ... altera
 
 
 
 
 
=Créer toolchain debian=
 
 
 
<source lang=bash>
 
mkdir -p /opt/gcc-8-debian
 
cd /opt/gcc-8-debian
 
apt download \
 
  gcc-8-arm-linux-gnueabihf \
 
  g++-8-arm-linux-gnueabihf \
 
  binutils-arm-linux-gnueabihf=2.31* \
 
  libbinutils=2.31* \
 
  binutils-common=2.31* \
 
  libgcc-8-dev \
 
  libc6-dev-armhf-cross=2.28* \
 
  libc6-armhf-cross=2.28* \
 
  libgcc-8-dev-armhf-cross \
 
  libstdc++-8-dev-armhf-cross \
 
  linux-libc-dev-armhf-cross=4* \
 
  libgcc1-armhf-cross=1* \
 
  cpp-8-arm-linux-gnueabihf
 
for deb in *.deb; do
 
  dpkg-deb -x "$deb" .
 
done
 
</source>
 
 
 
 
 
=utilisation du pont f2h pour ecrire dans la DDR=
 
 
 
*dans u-boot : autoriser l'accès à la ddr
 
**mw 0xFFC25080 0x1F0
 
**mw 0xFFC2505C 0xA
 
 
 
 
 
=compilation=
 
 
 
After the first compilation, when the fitter fails, you must run the following TCL scripts:
 
 
 
hps_sdram_p0_parameters.tcl
 
 
 
hps_sdram_p0_pin_assignments.tcl
 
 
 
=a trier=
 
 
 
<source lang=bash>
 
 
 
#!/bin/bash# https://support.criticallink.com/redmine/projects/mityarm-5cs/wiki/Important_Note_about_FPGAHPS_SDRAM_Bridge# start by disabling all fpga-hps bridges
 
echo =
 
cat /sys/class/fpga-bridge/*/enable
 
echo 0 > /sys/class/fpga-bridge/fpga2hps/enable
 
echo 0 > /sys/class/fpga-bridge/hps2fpga/enable
 
echo 0 > /sys/class/fpga-bridge/lwhps2fpga/enable
 
echo =
 
cat /sys/class/fpga-bridge/*/enable
 
echo =
 
memtool -32 0xFFC25080=0x0
 
echo =
 
cat /sys/class/fpga/fpga0/status
 
dd if=P10.rbf of=/dev/fpga0 bs=1M
 
cat /sys/class/fpga/fpga0/status# at this point, if fpga status is not user mode - program the fpga manually with the programmer
 
read -p "Should I continue? y/n: " -n 1 -r
 
echo
 
if $ ]]
 
then
 
    cat /sys/class/fpga/fpga0/status
 
    sleep 1
 
    echo =
 
    memtool -32 0xFFC2505C=0x8
 
    echo =
 
    memtool -32 0xFFC25080=0x111
 
   
 
    echo
 
    echo 1 > /sys/class/fpga-bridge/fpga2hps/enable
 
    echo 1 > /sys/class/fpga-bridge/hps2fpga/enable
 
    echo 1 > /sys/class/fpga-bridge/lwhps2fpga/enable
 
        cat /sys/class/fpga-bridge/*/enable
 
    echo
 
    memtool -32 0xFFC25080 1
 
fi
 
</source>
 

Version du 28 janvier 2026 à 16:22