Skip to content

Commit

Permalink
Add model configuration via build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
antimonyB committed Jul 16, 2023
1 parent 6d7648e commit b3bc8a1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
3 changes: 0 additions & 3 deletions Tools/Firmware/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..)

## TODO: Make this configurable via build script
Set(MODEL_NAME testmodel1)

include_directories(
## Common Includes ##
${ROOT_DIR}/Common/Inc
Expand Down
1 change: 1 addition & 0 deletions Tools/default_config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

COMPILE_TYPE="Firmware"
PLATFORM="nucleol552zeq"
MODEL_NAME="testmodel1"

# --- Compile settings end ---

Expand Down
8 changes: 6 additions & 2 deletions Tools/tools.bash
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if [[ $# -eq 0 ]]; then
elif [[ $1 == "compile" ]]; then
RUN_TEST=false
CLEAN=false
shift 1 && while getopts :t:p:c opt
shift 1 && while getopts :t:p:m:c opt
do
case ${opt} in
t)
Expand All @@ -60,6 +60,9 @@ elif [[ $1 == "compile" ]]; then
p)
PLATFORM=${OPTARG}
;;
m)
MODEL_NAME=${OPTARG}
;;
c)
CLEAN=true
;;
Expand Down Expand Up @@ -114,7 +117,7 @@ if [[ $RUN_TEST == false ]]; then
echo "Building ZeroPilot for $(echo $COMPILE_TYPE | tr '[:upper:]' '[:lower:]')."
COMPILE_DIR="$SCRIPT_PATH/$COMPILE_TYPE/build"
if [[ $COMPILE_TYPE == "Firmware" ]]; then
echo "Building for $PLATFORM."
echo "Building for platform $PLATFORM and model $MODEL_NAME."
fi
if [[ $CLEAN == true ]]; then
echo "Cleaning old $(echo $COMPILE_TYPE | tr '[:upper:]' '[:lower:]') build environment."
Expand All @@ -131,6 +134,7 @@ if [[ $RUN_TEST == false ]]; then
-G "${GENERATOR}" \
-DCMAKE_BUILD_TYPE="Debug" \
-DCMAKE_TOOLCHAIN_FILE="../../../Boardfiles/$PLATFORM/$PLATFORM.cmake" \
-DMODEL_NAME="$MODEL_NAME" \
-Wdev \
-Wdeprecated \
../
Expand Down
7 changes: 5 additions & 2 deletions Tools/tools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ param(
[string] $t,
[string] $p,
[switch] $c,
[string] $f
[string] $f,
[string] $m
)

# read defaults from file, and set variable intial value
Expand All @@ -29,6 +30,7 @@ foreach($line in Get-Content "$PSScriptRoot/default_config.txt") {
$COMPILE_TYPE = if ($t) {$t} else {$COMPILE_TYPE}
$PLATFORM = if ($p) {$p} else {$PLATFORM}
$TEST_FILTER = if ($f) {$f} else {$TEST_FILTER}
$MODEL_NAME = if ($m) {$m} else {$MODEL_NAME}


# ====================
Expand Down Expand Up @@ -61,7 +63,7 @@ if($FUNCTION -eq "compile") {
Write-Host "Building ZeroPilot for $($COMPILE_TYPE.ToLower())."
$COMPILE_DIR = "$PSScriptRoot/$COMPILE_TYPE/build"
if($COMPILE_TYPE -eq "Firmware") {
Write-Host "Building for $PLATFORM."
Write-Host "Building for platform $PLATFORM and model $MODEL_NAME."
}
if($c) {
Write-Host "Cleaning old $($COMPILE_TYPE.ToLower()) build environment."
Expand All @@ -77,6 +79,7 @@ if($FUNCTION -eq "compile") {
-G "${GENERATOR}" `
-DCMAKE_BUILD_TYPE="Debug" `
-DCMAKE_TOOLCHAIN_FILE="../../../Boardfiles/$PLATFORM/$PLATFORM.cmake" `
-DMODEL_NAME="$MODEL_NAME" `
-Wdev `
-Wdeprecated `
..
Expand Down

0 comments on commit b3bc8a1

Please sign in to comment.