From 2371eff2e841e448c32bf7c2e84f5023a0b44e19 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 16 Dec 2018 17:24:46 +0000 Subject: [PATCH] Move eclipse nios operation into common area --- compile/eclipsebuild/eclipseniosbuild.groovy | 103 +++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 compile/eclipsebuild/eclipseniosbuild.groovy diff --git a/compile/eclipsebuild/eclipseniosbuild.groovy b/compile/eclipsebuild/eclipseniosbuild.groovy new file mode 100644 index 0000000..18c31d1 --- /dev/null +++ b/compile/eclipsebuild/eclipseniosbuild.groovy @@ -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; \ No newline at end of file