CodeCoverage: Add CODE_COVERAGE_EN flag in build

Add CODE_COVERAGE_EN for Cmake command to TF-M when build with code
coverage feature required.

Signed-off-by: Karl Zhang <karl.zhang@arm.com>
Change-Id: I5715440a364dae239d3442006566c4036944629b
diff --git a/jenkins/ci.jpl b/jenkins/ci.jpl
index 28671a1..282d778 100644
--- a/jenkins/ci.jpl
+++ b/jenkins/ci.jpl
@@ -48,6 +48,7 @@
   params += string(name: 'CMSIS_VERSION', value: env.CMSIS_VERSION)
   params += string(name: 'MBEDCRYPTO_VERSION', value: env.MBEDCRYPTO_VERSION)
   params += string(name: 'CODE_REPO', value: env.CODE_REPO)
+  params += string(name: 'CODE_COVERAGE_EN', value: env.CODE_COVERAGE_EN)
   return { -> results
     def build_res = build(job: 'tf-m-build-config', parameters: params, propagate: false)
     def build_info = [build_res, config, params_collection]
diff --git a/run-build.sh b/run-build.sh
index a7f84f2..219df37 100755
--- a/run-build.sh
+++ b/run-build.sh
@@ -34,6 +34,12 @@
 set -ex
 build_commands=$(python3 tf-m-ci-scripts/configs.py -b -g all $CONFIG_NAME)
 
+if [ $CODE_COVERAGE_EN = "TRUE" ] && [[ $CONFIG_NAME =~ "GNUARM" ]] ; then
+    build_commands=${build_commands/-DCOMPILER=GNUARM/-DCOMPILER=GNUARM -DCODE_COVERAGE_EN=TRUE}
+    echo "Flag: Add compiler flag for build with code coverage supported."
+    echo $build_commands
+fi
+
 if [ -z "$build_commands" ] ; then
 	echo "No build commands found."
 	exit 1