Move eclipse nios operation into common area

This commit is contained in:
Dan Hawkins 2018-12-16 17:24:46 +00:00
commit 2371eff2e8

View file

@ -0,0 +1,103 @@
// 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, outputdir) {
sh """#!/bin/bash
set -x
mkdir -p "${outputdir}"
if [ \$? -ne 0 ]; then exit 1; fi
"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --cpu_name > "${outputdir}/lower_cpu_name.txt"
if [ \$? -ne 0 ]; then exit 1; fi
"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sidp > "${outputdir}/lower_sidp.txt"
if [ \$? -ne 0 ]; then exit 1; fi
"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --id > "${outputdir}/lower_id.txt"
if [ \$? -ne 0 ]; then exit 1; fi
"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --timestamp > "${outputdir}/lower_timestamp.txt"
if [ \$? -ne 0 ]; then exit 1; fi
"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sopcinfo > "${outputdir}/lower_sopcinfo.txt"
if [ \$? -ne 0 ]; then exit 1; fi
"""
}
return this;