This commit is contained in:
Dan Hawkins 2018-12-16 21:36:52 +00:00
commit 2d5b29fa04

View file

@ -0,0 +1,116 @@
// Gets the debug and optimization flags.
// Arg1 is "app" or "lib". Returns flags.
// Restore the debug and optimization levels, in case this is a dev machine.
// Arg1 is "app" or "lib". Arg2-3 is flags from getFlags. Returns nothing.
def setFlagsToRelease(NIOSEDS, project, wdir) {
if ( project == "app" ) {
if (isUnix()) {
sh """#!/bin/bash
set -x
cd "${wdir}"
"${NIOSEDS}/nios2_command_shell.sh" nios2-app-update-makefile --app-dir=. --set-optimization=-O2 --set-debug-level=
"""
}
}
else if ( project == "lib" ) {
if (isUnix()) {
sh """#!/bin/bash
set -x
cd "${wdir}"
"${NIOSEDS}/nios2_command_shell.sh" nios2-lib-update-makefile --lib-dir=. --set-optimization=-O2 --set-debug-level=
"""
}
}
}
def remake_and_check(NIOSEDS, wdir) {
if (isUnix()) {
sh """#!/bin/bash
set -x
cd "${wdir}"
# Use the makefile to clean and build
"${NIOSEDS}/nios2_command_shell.sh" make clean
if [ \$? -ne 0 ]; then exit 1; fi
# Set the debug and optimization levels to production values
"${NIOSEDS}/nios2_command_shell.sh" make -j12 all
if [ \$? -ne 0 ]; then exit 1; fi
"""
}
}
def generate_bsp(NIOSEDS, bspfolder) {
if (isUnix()) {
sh """#!/bin/bash
set -x
"${NIOSEDS}/nios2_command_shell.sh" nios2-bsp-generate-files --bsp-dir "${bspfolder}" --log "${bspfolder}/bsp.log" --settings "${bspfolder}/settings.bsp"
"""
}
}
def modifylib(NIOSEDS, bspfolder, buildconfig, wdir) {
if (isUnix()) {
sh """#!/bin/bash
set -x
cd "${wdir}"
"${NIOSEDS}/nios2_command_shell.sh" nios2-lib-update-makefile --lib-dir=. --set-bsp-dir "${bspfolder}" --set-active-build-config "${buildconfig}"
"""
}
}
def modifyapp(NIOSEDS, bspfolder, wdir) {
if (isUnix()) {
sh """#!/bin/bash
set -x
cd "${wdir}"
"${NIOSEDS}/nios2_command_shell.sh" nios2-app-update-makefile --app-dir=. --set-bsp-dir "${bspfolder}"
"""
}
}
def dump_elf_info(NIOSEDS, elffile, meta, custominfokeyprefix) {
if (isUnix()) {
def cpu_name = sh(script: """#!/bin/bash
"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --cpu_name
""",
returnStdout: true
).trim()
meta.addCustomInfo("${custominfokeyprefix}_cpu_name", cpu_name)
def sidp = sh(script: """#!/bin/bash
"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sidp
""",
returnStdout: true
).trim()
meta.addCustomInfo("${custominfokeyprefix}_sidp", sidp)
def id = sh(script: """#!/bin/bash
"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --id
""",
returnStdout: true
).trim()
meta.addCustomInfo("${custominfokeyprefix}_id", id)
def timestamp = sh(script: """#!/bin/bash
"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --timestamp
""",
returnStdout: true
).trim()
meta.addCustomInfo("${custominfokeyprefix}_timestamp", timestamp)
/*
def sopcinfo = sh(script: """#!/bin/bash
"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sopcinfo
""",
returnStdout: true
).trim()
meta.addCustomInfo("${custominfokeyprefix}_sopcinfo", sopcinfo)
*/
}
}
return this;