Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polarfire SD-MUX flashing #72

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 41 additions & 21 deletions Jenkinsfiles/hw_test_set
Original file line number Diff line number Diff line change
Expand Up @@ -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}" }
Expand All @@ -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"){
Expand All @@ -47,17 +50,28 @@ pipeline {
deviceName = 'NUC2'
} else if (params.device == "orin-nx"){
deviceName = 'OrinNX2'
} else if (params.device == "riscv"){
deviceName = 'Polarfire1'
}
}
echo "DEVICE: ${deviceName}"

// 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
Expand All @@ -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}"
}
}
}
}
Expand Down