From 56083a094de1ab672c52038d39cf771b701c8962 Mon Sep 17 00:00:00 2001 From: Ville-Pekka Juntunen Date: Wed, 29 Nov 2023 16:48:29 +0200 Subject: [PATCH] Polarfire SD-MUX flashing Add polarfire flashing via USB-SD-MUX Signed-off-by: Ville-Pekka Juntunen --- Jenkinsfiles/hw_test_set | 62 ++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 21 deletions(-) diff --git a/Jenkinsfiles/hw_test_set b/Jenkinsfiles/hw_test_set index 7c07bb0..eac43b5 100644 --- a/Jenkinsfiles/hw_test_set +++ b/Jenkinsfiles/hw_test_set @@ -11,12 +11,13 @@ batJob = '' resultsDirectory = '' configPath = '' zipImagePath = '' -bootSuite = 'boot_test.robot' -performanceSuite = 'performance/' -batSuite = './' +bootSuite = 'boot-test/' +performanceSuite = 'performance-tests/' +batSuite = 'bat-tests/' deviceName = '' usbHubSerial = '' -usbDrive = 'PSSD' +sdMuxUsbPort = '' +externalDrive = '' pipeline { agent { label "${params.label}" } @@ -39,6 +40,8 @@ pipeline { deviceName = 'NUC1' } else if (params.device == "orin-nx"){ deviceName = 'OrinNX1' + } else if (params.device == "riscv"){ + deviceName = 'Polarfire1' } } else if ("${params.label}" == "tc-agent03"){ if (params.device == "orin-agx"){ @@ -47,6 +50,8 @@ pipeline { deviceName = 'NUC2' } else if (params.device == "orin-nx"){ deviceName = 'OrinNX2' + } else if (params.device == "riscv"){ + deviceName = 'Polarfire1' } } echo "DEVICE: ${deviceName}" @@ -54,10 +59,19 @@ pipeline { // Set pipeline description currentBuild.description = "${params.server} ${params.device} BuildID: ${params.buildID}" - // Read test devices configfile and set usbHub serial to use right device - def deviceData = readJSON file: "${configPath}" - usbHubSerial = "${deviceData['addresses']["${deviceName}"]['usbhub_serial']}" - println("USB HUB serial: ${usbHubSerial}") + // Read test devices configfile and set usbHub serial or sd-mux usb port to use right device + if ("${params.device}" == "riscv"){ + externalDrive = 'sdmux' + def deviceData = readJSON file: "${configPath}" + sdMuxUsbPort = "${deviceData['addresses']["${deviceName}"]['usb_sd_mux_port']}" + println("SD-MUX USB port: ${sdMuxUsbPort}") + + } else { + externalDrive = 'PSSD' + def deviceData = readJSON file: "${configPath}" + usbHubSerial = "${deviceData['addresses']["${deviceName}"]['usbhub_serial']}" + println("USB HUB serial: ${usbHubSerial}") + } if ("${params.device}" == "orin-agx" || "${params.device}" == "orin-nx") { // Read zipped image file path from buildID.json to flash usb drive for Orin device @@ -68,47 +82,53 @@ pipeline { } } } - stage('Change USB HUB host to PC') { + stage('Change host to PC') { steps { script{ - sh "./BrainStem_dev_kit/bin/AcronameHubCLI -u 0 -s ${usbHubSerial}" - + if ("${params.device}" == "riscv"){ + sh "sudo usbsdmux ${sdMuxUsbPort} host" + } else { + sh "./BrainStem_dev_kit/bin/AcronameHubCLI -u 0 -s ${usbHubSerial}" + } // wait that USB drive is mounted sh 'sleep 10' def output = sh ( // Check for usb drive that is connected to target test device - script: "lsblk -o model,name |grep ${usbDrive}", + script: "lsblk -o model,name |grep ${externalDrive}", returnStdout: true - ).trim() + ).trim() def list = output.split(' ') // Take last element which is the target USB device USBDEVICE = list[-1] println("USB device: ${USBDEVICE}") + } } } - stage('Write OS image to USB disk') { + stage('Write OS image') { steps { script{ println("${params.image}") println("${params.device}") if ("${params.device}" == "orin-nx" || "${params.device}" == "orin-agx") { - // unzip zipped image, remove .zst ending from path and use that for flashing usb drive. Remove unzipped image after flashing. - sh "sudo zstd -d ${zipImagePath}" - unzippedPath = zipImagePath.minus(".zst") - sh "sudo dd if=${unzippedPath} of=/dev/${USBDEVICE} bs=1M status=progress conv=fsync" - sh "sudo rm -rf ${unzippedPath}" + // Use zstd to decompress the image and write directly to the USB drive. + sh "sudo zstd -d ${zipImagePath} -o /dev/${USBDEVICE}" + sh "sync" } else { sh "sudo dd if=${params.image} of=/dev/${USBDEVICE} bs=1M status=progress conv=fsync" } } } } - stage('Change USB HUB host back to test device') { + stage('Change host back to test device') { steps { script{ - sh "./BrainStem_dev_kit/bin/AcronameHubCLI -u 1 -s ${usbHubSerial}" + if ("${params.device}" == "riscv"){ + sh "sudo usbsdmux ${sdMuxUsbPort} dut" + } else { + sh "./BrainStem_dev_kit/bin/AcronameHubCLI -u 1 -s ${usbHubSerial}" + } } } }