Append Git commit hash to firmware BIN filename
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
/Debug/
|
||||
/UKSSTMS320F28335.CS_/
|
||||
/Bin/UKSSTMS320F28335_*.bin
|
||||
|
||||
@@ -45,7 +45,7 @@ Source="Source\External\v120\DSP2833x_headers\cmd\DSP2833x_Headers_nonBIOS.cmd"
|
||||
|
||||
["Debug" Settings]
|
||||
FinalBuildCmd=$(Proj_dir)\bin\hex2000.exe $(Proj_dir)\bin\UKSSTMS320F28335.out -boot -sci8 -map $(Proj_dir)\bin\UKSSTMS320F28335.map -o $(Proj_dir)\bin\UKSSTMS320F28335.hex -i
|
||||
FinalBuildCmd=$(Proj_dir)\bin\hex2000.exe $(Proj_dir)\bin\UKSSTMS320F28335.out -boot -sci8 -map $(Proj_dir)\bin\UKSSTMS320F28335.map -o $(Proj_dir)\bin\UKSSTMS320F28335.bin -b
|
||||
FinalBuildCmd=cmd /c ""$(Proj_dir)\build_bin.bat""
|
||||
|
||||
["Compiler" Settings: "Debug"]
|
||||
Options=-g -pdsw225 -o1 -fr"$(Proj_dir)\Debug" -fs"$(Proj_dir)\Asm" -i"$(Proj_dir)\Source\External\v120\DSP2833x_headers\include" -i"$(Proj_dir)\Source\Internal\Include" -i"$(Proj_dir)\Source\External\v120\DSP2833x_common\include" -d"_DEBUG" -d"LARGE_MODEL" -md -ml -v28 --float_support=fpu32
|
||||
|
||||
9
UKSSTMS320F28335/README.md
Normal file
9
UKSSTMS320F28335/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Результаты сборки
|
||||
|
||||
После сборки Debug в `Bin` создаётся файл
|
||||
`UKSSTMS320F28335_<commit>.bin`, где `<commit>` — короткий хеш текущего
|
||||
коммита Git (не менее 8 символов). HEX сохраняет прежнее имя.
|
||||
|
||||
BIN создаётся скриптом `build_bin.bat`; Git должен быть доступен в `PATH`
|
||||
процесса CCS. Если определить коммит не удалось, сборка завершается ошибкой.
|
||||
При наличии незакоммиченных правок хеш обозначает HEAD и не описывает эти правки.
|
||||
@@ -23,12 +23,11 @@ shift
|
||||
goto process_arg
|
||||
:end_process_arg
|
||||
|
||||
echo. > temp_postBuildStep_Debug.bat
|
||||
pushd "%SRC_ROOT%\Bin" || exit /b 1
|
||||
hex2000.exe UKSSTMS320F28335.out -boot -sci8 -map UKSSTMS320F28335.map -o UKSSTMS320F28335.hex -i
|
||||
set "BUILD_RESULT=%errorlevel%"
|
||||
popd
|
||||
if not "%BUILD_RESULT%"=="0" exit /b %BUILD_RESULT%
|
||||
|
||||
echo "%SRC_ROOT%\Bin\hex2000.exe" "%SRC_ROOT%\Bin\UKSSTMS320F28335.out" -boot -sci8 -map "%SRC_ROOT%\Bin\UKSSTMS320F28335.map" -o "%SRC_ROOT%\Bin\UKSSTMS320F28335.hex" -i >> temp_postBuildStep_Debug.bat
|
||||
echo "%SRC_ROOT%\Bin\hex2000.exe" "%SRC_ROOT%\Bin\UKSSTMS320F28335.out" -boot -sci8 -map "%SRC_ROOT%\Bin\UKSSTMS320F28335.map" -o "%SRC_ROOT%\Bin\UKSSTMS320F28335.bin" -b >> temp_postBuildStep_Debug.bat
|
||||
|
||||
call temp_postBuildStep_Debug.bat
|
||||
del temp_postBuildStep_Debug.bat
|
||||
|
||||
endlocal
|
||||
call "%SRC_ROOT%\build_bin.bat"
|
||||
exit /b %errorlevel%
|
||||
|
||||
16
build_bin.bat
Normal file
16
build_bin.bat
Normal file
@@ -0,0 +1,16 @@
|
||||
@echo off
|
||||
setlocal
|
||||
set "SRC_ROOT=%~dp0"
|
||||
set "GIT_COMMIT="
|
||||
|
||||
for /f "delims=" %%H in ('git -C "%SRC_ROOT%." rev-parse --short^=8 HEAD') do set "GIT_COMMIT=%%H"
|
||||
if not defined GIT_COMMIT (
|
||||
echo ERROR: Cannot determine the Git commit. Make Git available in PATH. 1>&2
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
pushd "%SRC_ROOT%Bin" || exit /b 1
|
||||
hex2000.exe UKSSTMS320F28335.out -boot -sci8 -map UKSSTMS320F28335.map -o UKSSTMS320F28335_%GIT_COMMIT%.bin -b
|
||||
set "BUILD_RESULT=%errorlevel%"
|
||||
popd
|
||||
exit /b %BUILD_RESULT%
|
||||
Reference in New Issue
Block a user