From 2371eff2e841e448c32bf7c2e84f5023a0b44e19 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 16 Dec 2018 17:24:46 +0000 Subject: [PATCH 1/4] 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 From 5127186c4f974c68c635d82a28ef6d7a80be1ee9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 16 Dec 2018 18:26:50 +0000 Subject: [PATCH 2/4] Output version information to meta --- compile/eclipsebuild/eclipseniosbuild.groovy | 55 ++++++++++++-------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/compile/eclipsebuild/eclipseniosbuild.groovy b/compile/eclipsebuild/eclipseniosbuild.groovy index 18c31d1..a3bb4b9 100644 --- a/compile/eclipsebuild/eclipseniosbuild.groovy +++ b/compile/eclipsebuild/eclipseniosbuild.groovy @@ -76,28 +76,39 @@ def modifyapp(NIOSEDS, bspfolder, wdir) { } } -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 - """ +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 + ) + 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 + ) + meta.addCustomInfo("${custominfokeyprefix}_sidp", sidp) + def id = sh(script: """#!/bin/bash + `"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --id` + """, + returnStdout: true + ) + meta.addCustomInfo("${custominfokeyprefix}_id", id) + def timestamp = sh(script: """#!/bin/bash + `"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --timestamp` + """, + returnStdout: true + ) + meta.addCustomInfo("${custominfokeyprefix}_timestamp", timestamp) + def sopcinfo = sh(script: """#!/bin/bash + `"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sopcinfo` + """, + returnStdout: true + ) + meta.addCustomInfo("${custominfokeyprefix}_sopcinfo", sopcinfo) + } } return this; \ No newline at end of file From a20fce505017824b40b7185b6ee4127e24a92c75 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 16 Dec 2018 18:33:06 +0000 Subject: [PATCH 3/4] Output version information to meta --- compile/eclipsebuild/eclipseniosbuild.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compile/eclipsebuild/eclipseniosbuild.groovy b/compile/eclipsebuild/eclipseniosbuild.groovy index a3bb4b9..ce7d798 100644 --- a/compile/eclipsebuild/eclipseniosbuild.groovy +++ b/compile/eclipsebuild/eclipseniosbuild.groovy @@ -79,31 +79,31 @@ def modifyapp(NIOSEDS, bspfolder, wdir) { 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` + "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --cpu_name """, returnStdout: true ) meta.addCustomInfo("${custominfokeyprefix}_cpu_name", cpu_name) def sidp = sh(script: """#!/bin/bash - `"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sidp` + "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sidp """, returnStdout: true ) meta.addCustomInfo("${custominfokeyprefix}_sidp", sidp) def id = sh(script: """#!/bin/bash - `"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --id` + "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --id """, returnStdout: true ) meta.addCustomInfo("${custominfokeyprefix}_id", id) def timestamp = sh(script: """#!/bin/bash - `"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --timestamp` + "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --timestamp """, returnStdout: true ) meta.addCustomInfo("${custominfokeyprefix}_timestamp", timestamp) def sopcinfo = sh(script: """#!/bin/bash - `"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sopcinfo` + "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sopcinfo """, returnStdout: true ) From d1f32dc580e9b5b299fddcc11d0289a780f00b00 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 16 Dec 2018 21:33:59 +0000 Subject: [PATCH 4/4] Output version information to meta --- compile/eclipsebuild/eclipseniosbuild.groovy | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/compile/eclipsebuild/eclipseniosbuild.groovy b/compile/eclipsebuild/eclipseniosbuild.groovy index ce7d798..a808932 100644 --- a/compile/eclipsebuild/eclipseniosbuild.groovy +++ b/compile/eclipsebuild/eclipseniosbuild.groovy @@ -82,32 +82,34 @@ def dump_elf_info(NIOSEDS, elffile, meta, custominfokeyprefix) { "${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) +*/ } }