diff --git a/README.md b/README.md index aeca41090a491e1200d1f30784576c982a52ae57..213c80be2c4673598c05bffb0beae2bd1e97946f 100644 --- a/README.md +++ b/README.md @@ -82,10 +82,10 @@ and File -> Export -> Export Hardware -> include bitstream $ cd <SCALP_PROJECT_FOLDER> $ git clone https://gitedu.hesge.ch/soma/scalp_petalinux.git $ cd scalp_petalinux -$ git checkout SCALP-SAFE-v0.4.1 +$ git checkout SCALP-SAFE-v0.4.2 ``` -**Use version 0.4.1 only for the GIT scalp_petalinux repository and not for the GIT scalp_firmware repository. The version difference is not an error.** +**Use version 0.4.2 only for the GIT scalp_petalinux repository and not for the GIT scalp_firmware repository. The version difference is not an error.** ### Create new Petalinux project from a BSP @@ -97,7 +97,7 @@ $ petalinux-create --type project -s <path-to-bsp> --name <PROJECT NAME> $ cd <PROJECT NAME> ``` -In my case **\<path-to-bsp\>** corresponds to /home/jo/Documents/Projets/Hepia/scalp_project/scalp_petalinux/bsp/SCALP-SAFE-FIRMWARE-BSP-V0.4.1.bsp +In my case **\<path-to-bsp\>** corresponds to /home/jo/Documents/Projets/Hepia/scalp_project/scalp_petalinux/bsp/SCALP-SAFE-FIRMWARE-BSP-V0.4.2.bsp ### Importing hardware configuration @@ -523,6 +523,8 @@ We start by packaging the BOOT.BIN firmware. $ petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/system.bit --u-boot --add images/linux/ubi-image.ubi --offset 0x500000 --force ``` +**With the UBI embedded flash memory volume manager, it must be ensured that the entire flash memory has been erased before use.** + Zeros are added at the end of the BOOT.BIN file up to the size of the SPI NOR memory. ``` diff --git a/bsp/SCALP-SAFE-FIRMWARE-BSP-V0.4.2.bsp b/bsp/SCALP-SAFE-FIRMWARE-BSP-V0.4.2.bsp new file mode 100644 index 0000000000000000000000000000000000000000..6d487b7dd04cd226621e88780a763f337eadcf51 Binary files /dev/null and b/bsp/SCALP-SAFE-FIRMWARE-BSP-V0.4.2.bsp differ diff --git a/scalp_safe_petalinux/.petalinux/metadata b/scalp_safe_petalinux/.petalinux/metadata index b6b8f719f8d36f34565506d383d27bd7e5f494e9..6315c867da65724a084bbf5b17875729fde3ef80 100644 --- a/scalp_safe_petalinux/.petalinux/metadata +++ b/scalp_safe_petalinux/.petalinux/metadata @@ -3,4 +3,4 @@ VALIDATE_HW_CHKSUM=1 HARDWARE_PATH=/home/jo/Documents/Projets/Hepia/scalp_project/scalp_firmware/designs/vivado/scalp_safe_firmware/2020.2/lin64/scalp_safe_firmware/scalp_safe_firmware.xsa HARDWARE_CHECKSUM=c0e54849f94ffc5aaa53e1cad4e1235f YOCTO_SDK=5ff8fc5f85d1566b314bb73eaa378212 -RFSCONFIG_CHKSUM=098862acb0a15bbc6a0d0999eb493baa +RFSCONFIG_CHKSUM=cbbefadac8312a93a2731682ecb50ade diff --git a/scalp_safe_petalinux/SCALP-SAFE-FIRMWARE-BSP-V0.4.2.bsp b/scalp_safe_petalinux/SCALP-SAFE-FIRMWARE-BSP-V0.4.2.bsp new file mode 100644 index 0000000000000000000000000000000000000000..6d487b7dd04cd226621e88780a763f337eadcf51 Binary files /dev/null and b/scalp_safe_petalinux/SCALP-SAFE-FIRMWARE-BSP-V0.4.2.bsp differ diff --git a/scalp_safe_petalinux/project-spec/configs/rootfs_config b/scalp_safe_petalinux/project-spec/configs/rootfs_config index b745e0dfec1eeb9b458b8c87a60904ed866d2f23..26dbf1e876fe91e40ae49212caedcc5a8ae431fd 100644 --- a/scalp_safe_petalinux/project-spec/configs/rootfs_config +++ b/scalp_safe_petalinux/project-spec/configs/rootfs_config @@ -4022,6 +4022,8 @@ CONFIG_imagefeature-debug-tweaks=y # # apps # +CONFIG_bitstream-conf=y +CONFIG_bitstream-init=y # CONFIG_gpio-demo is not set # CONFIG_peekpoke is not set CONFIG_sja1105-conf=y diff --git a/scalp_safe_petalinux/project-spec/meta-user/conf/user-rootfsconfig b/scalp_safe_petalinux/project-spec/meta-user/conf/user-rootfsconfig index 3e2e33e7e773616f4938bab4c81df882b7da5f2c..a31c7cda48ce9c38e14fe43553117c0ce9590b37 100644 --- a/scalp_safe_petalinux/project-spec/meta-user/conf/user-rootfsconfig +++ b/scalp_safe_petalinux/project-spec/meta-user/conf/user-rootfsconfig @@ -5,3 +5,5 @@ CONFIG_gpio-demo CONFIG_peekpoke CONFIG_sja1105-init CONFIG_sja1105-conf +CONFIG_bitstream-init +CONFIG_bitstream-conf diff --git a/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-conf/.gdbinit b/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-conf/.gdbinit new file mode 100644 index 0000000000000000000000000000000000000000..760896a756bada91c6625fe928d9dfbb17efd8bf --- /dev/null +++ b/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-conf/.gdbinit @@ -0,0 +1,3 @@ +# Load the PetaLinux SDK main gdbinit script +source plnx_gdbinit + diff --git a/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-conf/README b/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-conf/README new file mode 100644 index 0000000000000000000000000000000000000000..f0dc610b882a7b7ea2582ed248030386ac0b2e2d --- /dev/null +++ b/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-conf/README @@ -0,0 +1,30 @@ +PetaLinux User Application Template +=================================== + +This directory contains a PetaLinux user application created from a template. + +You can easily import any already built application or script by copying +it into this directory, and editing the automatically generated Makefile +as described below. + +Modify the "install:" target in Makefile to use $(TARGETINST) to install your +prebuilt application or script to the host copy of the target file system +referring to the comments of the "install:" target. + +Before building the application, you will need to enable the application +from PetaLinux menuconfig by running: + "petalinux-config -c rootfs" +You will see your application in the "apps --->" submenu. + +To install your prebuilt application or script to the target file system +copy on the host, simply run the command. + "petalinux-build -c rootfs/bitstream-conf" + +You will also need to rebuild PetaLinux bootable images so that the images +is updated with the updated target filesystem copy, run this command: + "petalinux-build -c rootfs" + +You can also run one PetaLinux command to install the application to the +target filesystem host copy and update the bootable images as follows: + "petalinux-build" + diff --git a/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-conf/bitstream-conf.bb b/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-conf/bitstream-conf.bb new file mode 100644 index 0000000000000000000000000000000000000000..4e72203239a5632d22151595ced61cdfff25ec9d --- /dev/null +++ b/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-conf/bitstream-conf.bb @@ -0,0 +1,18 @@ +# +# This file is the bitstream-conf recipe. +# + +SUMMARY = "Simple bitstream-conf application" +SECTION = "PETALINUX/apps" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +SRC_URI = "file://bitstream-conf \ + " + +S = "${WORKDIR}" + +do_install() { + install -d ${D}/${bindir} + install -m 0755 ${S}/bitstream-conf ${D}/${bindir} +} diff --git a/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-conf/files/bitstream-conf b/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-conf/files/bitstream-conf new file mode 100644 index 0000000000000000000000000000000000000000..ff5414211067b726a895121928c86727c9d0931e --- /dev/null +++ b/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-conf/files/bitstream-conf @@ -0,0 +1,23 @@ +#!/bin/sh + +export FIRMWARE_FOLDER_PATH="/lib/firmware/" +export FIRMWARE_BASE_FOLDER_PATH=${FIRMWARE_FOLDER_PATH}"base/" +export BITSTREAM_FILE_NAME="scalp_safe_firmware.bit.bin" +export BITSTREAM_PATH=${FIRMWARE_FOLDER_PATH}${BITSTREAM_FILE_NAME} +export BITSTREAM_BASE_PATH=${FIRMWARE_BASE_FOLDER_PATH}${BITSTREAM_FILE_NAME} + +bitstream_copy() +{ + echo "[INFO] bitstream-conf : Copy the bitstream configuration file to the /lib/firmware/ folder." + cp ${BITSTREAM_BASE_PATH} ${BITSTREAM_PATH} +} + +bitstream_conf() +{ + echo "[INFO] bitstream-conf : Configuration of the PL part from the bitstream configuration file." + echo 0 > /sys/class/fpga_manager/fpga0/flags + echo ${BITSTREAM_FILE_NAME} > /sys/class/fpga_manager/fpga0/firmware +} + +bitstream_copy +bitstream_conf diff --git a/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-init/.gdbinit b/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-init/.gdbinit new file mode 100644 index 0000000000000000000000000000000000000000..760896a756bada91c6625fe928d9dfbb17efd8bf --- /dev/null +++ b/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-init/.gdbinit @@ -0,0 +1,3 @@ +# Load the PetaLinux SDK main gdbinit script +source plnx_gdbinit + diff --git a/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-init/README b/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-init/README new file mode 100644 index 0000000000000000000000000000000000000000..5ecd3b6170f29c528ba76fc21179a37c23d55bab --- /dev/null +++ b/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-init/README @@ -0,0 +1,30 @@ +PetaLinux User Application Template +=================================== + +This directory contains a PetaLinux user application created from a template. + +You can easily import any already built application or script by copying +it into this directory, and editing the automatically generated Makefile +as described below. + +Modify the "install:" target in Makefile to use $(TARGETINST) to install your +prebuilt application or script to the host copy of the target file system +referring to the comments of the "install:" target. + +Before building the application, you will need to enable the application +from PetaLinux menuconfig by running: + "petalinux-config -c rootfs" +You will see your application in the "apps --->" submenu. + +To install your prebuilt application or script to the target file system +copy on the host, simply run the command. + "petalinux-build -c rootfs/bitstream-init" + +You will also need to rebuild PetaLinux bootable images so that the images +is updated with the updated target filesystem copy, run this command: + "petalinux-build -c rootfs" + +You can also run one PetaLinux command to install the application to the +target filesystem host copy and update the bootable images as follows: + "petalinux-build" + diff --git a/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-init/bitstream-init.bb b/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-init/bitstream-init.bb new file mode 100644 index 0000000000000000000000000000000000000000..58fac039ddb7b2aed5872cda16f473f718751b1f --- /dev/null +++ b/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-init/bitstream-init.bb @@ -0,0 +1,36 @@ +# +# This file is the bitstream-init recipe. +# + +SUMMARY = "Simple bitstream-init application" +SECTION = "PETALINUX/apps" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +SRC_URI = "file://bitstream-init \ + " + +S = "${WORKDIR}" + +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +inherit update-rc.d + +INITSCRIPT_NAME = "bitstream-init" + +INITSCRIPT_PARAMS = "start 03 S ." + +do_install() { + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${S}/bitstream-init ${D}${sysconfdir}/init.d/bitstream-init + install -d ${D}${sysconfdir}/rc2.d + install -m 0755 ${S}/bitstream-init ${D}${sysconfdir}/rc2.d/S03bitstream-init + install -d ${D}${sysconfdir}/rc3.d + install -m 0755 ${S}/bitstream-init ${D}${sysconfdir}/rc3.d/S03bitstream-init + install -d ${D}${sysconfdir}/rc4.d + install -m 0755 ${S}/bitstream-init ${D}${sysconfdir}/rc4.d/S03bitstream-init + install -d ${D}${sysconfdir}/rc5.d + install -m 0755 ${S}/bitstream-init ${D}${sysconfdir}/rc5.d/S03bitstream-init +} + +FILES_${PN} += "${sysconfdir}/*" diff --git a/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-init/files/bitstream-init b/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-init/files/bitstream-init new file mode 100644 index 0000000000000000000000000000000000000000..91c7ea250c744336e18280cd622f515560e0e7f3 --- /dev/null +++ b/scalp_safe_petalinux/project-spec/meta-user/recipes-apps/bitstream-init/files/bitstream-init @@ -0,0 +1,52 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: bitstream-init +# Required-Start: $local_fs $network $named $time $syslog +# Required-Stop: $local_fs $network $named $time $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Description: bitstream init.d script configuration. +### END INIT INFO + +SCRIPT=bitstream-conf +RUNAS=root + +PIDFILE=/var/run/bitstream-init.pid +LOGFILE=/var/log/bitstream-init.log + +start() { + if [ -f /var/run/$PIDNAME ] && kill -0 $(cat /var/run/$PIDNAME); then + echo 'Service already running' >&2 + return 1 + fi + echo 'Starting serviceā¦' >&2 + local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!" + su -c "$CMD" $RUNAS > "$PIDFILE" + echo 'Service started' >&2 +} + +stop() { + if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then + echo 'Service not running' >&2 + return 1 + fi + echo 'Stopping serviceā¦' >&2 + echo 'Log files /var/log/bitstream-init.log and /var/log/bitstream-conf.log' >&2 + kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE" + echo 'Service stopped' >&2 +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + retart) + stop + start + ;; + *) + echo "Usage: $0 {start|stop|restart|uninstall}" +esac