Import independent seat firmware source without build artifacts
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
# This is the only firmware build entry point used by the composing Codex.
|
||||
# Codex may modify the complete writable task source; the service supplies
|
||||
# separate incremental build/output directories. Every compiler control is one.
|
||||
script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
workspace=$(CDPATH= cd -- "$script_dir/../../../.." && pwd)
|
||||
build_dir=${N7_CODEX_FIRMWARE_BUILD_DIR:?N7_CODEX_FIRMWARE_BUILD_DIR is required}
|
||||
output_dir=${N7_CODEX_FIRMWARE_OUTPUT_DIR:?N7_CODEX_FIRMWARE_OUTPUT_DIR is required}
|
||||
task_build_dir="$build_dir/task-workspace"
|
||||
generated_source="$build_dir/generated-application-source"
|
||||
build_cpu=${N7_BUILD_CPU:-0}
|
||||
|
||||
report_failure() {
|
||||
result=$?
|
||||
trap - EXIT
|
||||
if [ "$result" -ne 0 ]; then
|
||||
echo "N7_CODEX_FIRMWARE_BUILD_FAILED exit=$result" >&2
|
||||
fi
|
||||
exit "$result"
|
||||
}
|
||||
trap report_failure EXIT
|
||||
|
||||
export N7_BUILD_JOBS=1
|
||||
export CMAKE_BUILD_PARALLEL_LEVEL=1
|
||||
export MAKEFLAGS=-j1
|
||||
export NINJAFLAGS=-j1
|
||||
export OMP_NUM_THREADS=1
|
||||
export OPENBLAS_NUM_THREADS=1
|
||||
export MKL_NUM_THREADS=1
|
||||
export NUMEXPR_NUM_THREADS=1
|
||||
export RAYON_NUM_THREADS=1
|
||||
export GOMAXPROCS=1
|
||||
|
||||
mkdir -p "$build_dir" "$output_dir"
|
||||
rm -rf "$generated_source"
|
||||
python3 "$workspace/tools/prepare_gcc_application_source.py" \
|
||||
--source-root "$workspace/third_party/ZL-test-scripts" \
|
||||
--project-root "$workspace" \
|
||||
--output-root "$generated_source"
|
||||
test -s "$generated_source/src/main_cm0plus.c"
|
||||
test -s "$generated_source/src/ota_self_compose_plan.h"
|
||||
|
||||
echo "N7_CODEX_FIRMWARE_BUILD_START cpu=1"
|
||||
taskset -c "$build_cpu" cmake \
|
||||
-S "$workspace/firmware/gcc" -B "$task_build_dir" -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$workspace/firmware/gcc/arm-none-eabi-toolchain.cmake" \
|
||||
-DOTA_PROJECT_ROOT="$workspace" \
|
||||
-DOTA_SDK_ROOT="$workspace/third_party/ZL-test-scripts/T2G_Sample_Driver_Library_7.9.0" \
|
||||
-DOTA_SOURCE_ROOT="$workspace/third_party/ZL-test-scripts" \
|
||||
-DOTA_GENERATED_SOURCE_ROOT="$generated_source" \
|
||||
-DOTA_OUTPUT_DIR="$output_dir"
|
||||
taskset -c "$build_cpu" cmake --build "$task_build_dir" \
|
||||
--target app_self_compose --parallel 1
|
||||
|
||||
firmware="$output_dir/self-compose.raw.bin"
|
||||
test -s "$firmware"
|
||||
size=$(wc -c <"$firmware" | tr -d ' ')
|
||||
sha256=$(sha256sum "$firmware" | awk '{print $1}')
|
||||
echo "N7_CODEX_FIRMWARE_BUILD_OK cpu=1 bytes=$size sha256=$sha256"
|
||||
trap - EXIT
|
||||
Reference in New Issue
Block a user