-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/project_file_copy_touch' into 'master'
hosted - scripts to setup project for STM32CubeIDE See merge request app-frameworks/esp_hosted!67
- Loading branch information
Showing
5 changed files
with
142 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
@echo off | ||
rem ### This is windows platform script to copy the project files and | ||
rem ### make them aligned to STM32CubeIDE needs | ||
|
||
set WORKSPACE=%1 | ||
set PROJ_NAME=stm_spi_host | ||
set CWD=%CD% | ||
|
||
rem ### Check argument passed ### | ||
IF "%1"=="" ( | ||
echo usage: %0 Workspace_directory_absolute_path | ||
goto error | ||
) | ||
|
||
rem ### store git repo base path### | ||
cd ..\..\.. | ||
set CODE_BASE=%CD% | ||
cd %CWD% | ||
|
||
rem ### check workspace directory exist ### | ||
IF not exist %WORKSPACE% ( | ||
echo %WORKSPACE% does not exist | ||
echo Please follow documentation to import STM project from stm_spi_host.ioc, if not already done | ||
goto error | ||
) | ||
|
||
rem ### check project directory exist ### | ||
IF not exist %WORKSPACE%\%PROJ_NAME% ( | ||
echo %WORKSPACE%\%PROJ_NAME% does not exist | ||
echo Either incorrect workspace directory or ioc project not imported | ||
echo Please follow documentation to import STM project from stm_spi_host.ioc, if not already done | ||
goto error | ||
) | ||
|
||
rem ### search and replace project files ### | ||
DEL %WORKSPACE%\%PROJ_NAME%\.project 2>NUL | ||
DEL %WORKSPACE%\%PROJ_NAME%\.cproject 2>NUL | ||
|
||
setLocal EnableDelayedExpansion | ||
For /f "tokens=* delims= " %%a in (.project) do ( | ||
Set str=%%a | ||
set str=!str:CODE_BASE_PLACE_HOLDER=%CODE_BASE%! | ||
echo !str!>> %WORKSPACE%\%PROJ_NAME%\.project | ||
) | ||
ENDLOCAL | ||
|
||
|
||
setLocal EnableDelayedExpansion | ||
For /f "tokens=* delims= " %%a in (.cproject) do ( | ||
Set str=%%a | ||
set str=!str:CODE_BASE_PLACE_HOLDER=%CODE_BASE%! | ||
echo !str!>> %WORKSPACE%\%PROJ_NAME%\.cproject | ||
) | ||
ENDLOCAL | ||
|
||
rem ### touch .mxproject file ### | ||
copy /b %WORKSPACE%\%PROJ_NAME%\.mxproject +,, >NUL | ||
|
||
echo success. Now open STM32CubeIDE with %WORKSPACE% | ||
:error | ||
EXIT /B 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
|
||
# This script copies and touches the .project, .cproject and .mxproject files | ||
# This is required to make STM32CubeIDE recognize the new project import | ||
|
||
PROJ_NAME=stm_spi_host | ||
CODE_BASE= | ||
|
||
function usage() { | ||
echo "$0 <Workspace directory>" | ||
} | ||
|
||
function copy_and_touch_files() { | ||
CWD=`pwd` | ||
cd ../../../ | ||
CODE_BASE=`pwd` | ||
cd $CWD | ||
cp ./.project $WORKSPACE/$PROJ_NAME/ | ||
cp ./.cproject $WORKSPACE/$PROJ_NAME/ | ||
sed -i.bak "s#CODE_BASE_PLACE_HOLDER#$CODE_BASE#" $WORKSPACE/$PROJ_NAME/.project | ||
sed -i.bak "s#CODE_BASE_PLACE_HOLDER#$CODE_BASE#" $WORKSPACE/$PROJ_NAME/.cproject | ||
touch $WORKSPACE/$PROJ_NAME/.mxproject | ||
echo "success. Now, please open STM32CubeIDE with $WORKSPACE" | ||
} | ||
|
||
if [ "$#" != "1" ] ; then | ||
echo "Err: Workspace directory created for STM32CubeIDE to be passed as argument" | ||
usage | ||
exit 1; | ||
else | ||
WORKSPACE=$1 | ||
fi | ||
|
||
if [ "$1" == '-h' ] || [ "$1" == '--help' ] ; then | ||
usage | ||
exit 0 | ||
fi | ||
|
||
|
||
if [ ! -d $WORKSPACE ]; then | ||
echo "Err: $WORKSPACE directory not found. Please follow documentation to import STM project from stm_spi_host.ioc first" | ||
usage | ||
exit 1; | ||
fi | ||
|
||
if [ ! -d $WORKSPACE/$PROJ_NAME ]; then | ||
echo "Err: Either incorrect Workspace directory or ioc project not imported." | ||
echo "Please follow documentation to import STM project from stm_spi_host.ioc if not already done" | ||
usage | ||
exit 1; | ||
fi | ||
|
||
copy_and_touch_files |