Skip to content

Commit 1c04fc5

Browse files
Merge pull request ARMmbed#146 from ARMmbed/IOTUC-746-BOOTLOADERSIZE
[IOTUC-746] Support for running size checker for bootloader in jenkings and size graph generation
2 parents adaed90 + 0947851 commit 1c04fc5

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

Jenkinsfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,25 @@ def powerCutTestStep(step_name,
238238
}
239239
}
240240

241+
// runs test to only k64f target as defined in scripts/runSizeTestAndGenerateGraph.sh
242+
def sizeTestStepSimple(stepName) {
243+
return {
244+
stage(stepName) {
245+
node ("GCC_ARM") {
246+
dir("bootloader-internal") {
247+
deleteDir()
248+
unstash "deployed_bootloader_repo"
249+
execute("ls -al")
250+
execute("./scripts/runSizeTestAndGenerateGraph.sh")
251+
archiveArtifacts artifacts: 'mbed-os-linker-report/**/*.*', fingerprint: true
252+
// add this if you need all artifacts to debug something in this workspace
253+
//archive("/**/*.*")
254+
}
255+
}
256+
}
257+
}
258+
}
259+
241260
def bootloader_test_config = [
242261
["K64F", "ARM", "configs/test_configs/power_cut_test.json", "power_cut_test/test_spec_armcc.json"]
243262
]
@@ -255,6 +274,9 @@ for (int i = 0; i < bootloader_test_config.size(); i++) {
255274
app_config,
256275
test_spec)
257276
}
277+
def stepName = "K64F_Size_Test_and_Graph"
278+
stepsForParallel[stepName] = sizeTestStepSimple(stepName)
279+
258280

259281
/* Jenkins does not allow stages inside parallel execution,
260282
* https://issues.jenkins-ci.org/browse/JENKINS-26107 will solve this by adding labeled blocks
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
set -x
2+
#this script is used in Jenkings jobs to check size of bootloader and to generate graphical presentation of binary
3+
mbed compile -m K64F -t GCC_ARM --profile=tiny.json | tee buildLog
4+
# assuming there is only one string with Image: at the and following directly with created image
5+
# like Image: ./BUILD/K64F/GCC_ARM-TINY/mbed-bootloader-internal.bin
6+
imageFile=$(cat buildLog | grep Image: | cut -d ' ' -f 2)
7+
echo $imageFile
8+
echo $(stat --printf="%s" $imageFile) | tee BINSIZE # current build size
9+
git clone https://github.com/ARMmbed/mbed-os-linker-report.git --depth 1
10+
fileWithouEnd=$(echo $imageFile | cut -d '.' -f 2)
11+
python mbed-os-linker-report/elfsize.py -i .$fileWithouEnd.elf
12+
maxSize=32768
13+
currentBinSize=77777777 # just so that we will fail for sure later for size check
14+
currentBinSize=$(cat BINSIZE)
15+
# zip the results for local use as the Jenkings iframe does not allow external load (D3 module fails).
16+
# Maybe access will be relaxed later and this step becomes obsolete
17+
tar -zcvf USE_THIS_IF_JENKINGS_INDEX_HTML_DOES_NOT_LOAD.tar.gz mbed-os-linker-report/html/ mbed-os-linker-report/index.html
18+
mv USE_THIS_IF_JENKINGS_INDEX_HTML_DOES_NOT_LOAD.tar.gz mbed-os-linker-report/
19+
if [ $currentBinSize -le $maxSize ]; then
20+
echo "BINARY SIZE ok (max $maxSize current $currentBinSize)"
21+
exit 0
22+
else
23+
echo "error BINARY SIZE TOO LARGE max $maxSize current $currentBinSize"
24+
exit 1
25+
fi

0 commit comments

Comments
 (0)