Skip to content
Snippets Groups Projects
Commit c34cd7d3 authored by BRONES Romain's avatar BRONES Romain
Browse files

feat(map): Use desy-utils recipe for map file install

* Append the recipe with the on the fly fix for mapt
parent 2548934e
Branches
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@
PATH_CFG="/opt/fofb/cfg/"
PATH_MAP="/opt/fofb/map/"
PATH_MAPT="/usr/share/deviceaccess/map/"
PATH_FPGABIN=${PATH_CFG}/fpga_bitstream.bin
LOCK_FILE=/var/lock/subsys/fofb-init
......@@ -71,7 +72,7 @@ link_mapt() {
exit 1
fi
LINK_TARGET="${PATH_MAP}/app_${FOFB_APP}.mapt"
LINK_TARGET="${PATH_MAPT}/${FOFB_APP}/${FOFB_APP}_ch8.mapt"
if [ ! -f ${LINK_TARGET} ]; then
log -p user.error "MAPT file not found: ${LINK_TARGET}"
exit 1
......
......@@ -14,7 +14,8 @@ SRC_URI += " file://fofb-configurator.py"
SRC_URI += " file://configuration.example"
SRC_URI += " file://config"
RDEPENDS_${PN}=" fpga-manager-script bash variant-mapt"
DEPENDS=" deviceaccess-mapfiles"
RDEPENDS_${PN}=" deviceaccess-mapfiles fpga-manager-script bash"
FILES_${PN}+="/etc/init.d/fofb-init.sh"
FILES_${PN}+="/usr/bin/fpgaversion"
......
......@@ -16,7 +16,8 @@ SRC_URI = " \
file://fofb-opcua-server.sh \
"
RDEPENDS_${PN}=" genericdeviceserver-opcua bash variant-mapt"
DEPENDS=" deviceaccess-mapfiles"
RDEPENDS_${PN}=" genericdeviceserver-opcua bash"
FILES_${PN}+="/opt/fofb/opcua-server/*"
FILES_${PN}+="/etc/init.d/fofb-opcua-server.sh"
......
SUMMARY = "Install MAPT files for each variants"
SECTION = "opt"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
# Adding MAPT files to SRC_URI and FILES for each variant
python () {
import os, glob
from pathlib import Path
src_dir = d.getVar('PL_VARIANTS_DIR')
dest_path = os.path.join('/opt', 'fofb', 'map')
for var_name in d.getVar('PL_VARIANTS').split():
mapt_path = next(Path(src_dir).rglob(f"{var_name}*ch8.mapt")).absolute()
dest_file = os.path.join(dest_path, f"app_{var_name}.mapt")
d.appendVar("SRC_URI", f" file://{mapt_path}")
d.appendVar("PL_MAPT_PATH", f" {mapt_path}")
d.appendVar("FILES_"+d.getVar("PN"), " "+dest_file)
}
# Changing BAR of mapt files to 0 (field #5 receive 0)
# Replace each line of MATRIX coeff by a global entry
do_compile () {
for MAPT in ${PL_MAPT_PATH}
do
awk 'FNR>1 {$5=0} {if ($1 ~ /MATRIXCOEF\.[^0]/ ) next} {if ($1 ~ /MATRIXCOEF\.0/) {$1="APP.corr_matrix_0.MATRIXCOEF" ; $2="12800" ; $4="51200"}} {print}' ${WORKDIR}/${MAPT} > ${WORKDIR}/${MAPT}.bar0
done
}
# Adding MAPT files to install dir
python do_install () {
import shutil, os
dest_path = os.path.join(d.getVar('D'), 'opt', 'fofb', 'map')
os.makedirs(dest_path, exist_ok=True)
for var_name, mapt_path in zip(
d.getVar('PL_VARIANTS').split(),
d.getVar('PL_MAPT_PATH').split(),
):
orig_file = d.getVar("WORKDIR")+mapt_path+".bar0"
dest_file = os.path.join(dest_path, f"app_{var_name}.mapt")
print(f"Install {orig_file} in {dest_file}")
shutil.copy(orig_file, dest_file)
}
MAPFILES_SRC_ORIG = "${RECIPE_SYSROOT}/opt/xilinx/hw-design"
MAPFILES_SRC_BASE = "${WORKDIR}/map"
# Changing BAR of mapt files to 0 (field #5 receive 0)
# Replace each line of MATRIX coeff by a global entry
do_compile () {
if [ "${PL_VARIANTS}" != "" ]; then
for PL_VARIANT in ${PL_VARIANTS}; do
VAR_SRCDIR=${MAPFILES_SRC_ORIG}/${PL_VARIANT}
VAR_DESTDIR=${MAPFILES_SRC_BASE}/${PL_VARIANT}
mkdir -p ${VAR_DESTDIR}
for MAPFILE_SRC in ${VAR_SRCDIR}/*.map[pt]; do
echo "Transform file ${MAPFILE_SRC}"
awk 'FNR>1 {$5=0}
{if ($1 ~ /MATRIXCOEF\.[^0]/ ) next}
{if ($1 ~ /MATRIXCOEF\.0/) {$1="APP.corr_matrix_0.MATRIXCOEF" ; $2="12800" ; $4="51200"}}
{print}' ${MAPFILE_SRC} > ${VAR_DESTDIR}/$(basename ${MAPFILE_SRC})
done
done
else
HDF_BASENAME=$(echo ${HDF_SUFFIX} | cut -c2-)
VAR_DESTDIR=${D}${MAPFILES_DST_BASE}/${HDF_BASENAME}
for MAPFILE_SRC in ${MAPFILES_SRC_BASE}/*.map[pt]; do
echo "Transform file ${MAPFILE_SRC}"
awk 'FNR>1 {$5=0}
{if ($1 ~ /MATRIXCOEF\.[^0]/ ) next}
{if ($1 ~ /MATRIXCOEF\.0/) {$1="APP.corr_matrix_0.MATRIXCOEF" ; $2="12800" ; $4="51200"}}
{print}' ${MAPFILE_SRC} > ${VAR_DESTDIR}/$(basename ${MAPFILE_SRC})
done
fi
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment