From e8cb02449f6f15638997dffec3215a21ce12b56f Mon Sep 17 00:00:00 2001 From: andrey Date: Tue, 22 Sep 2026 12:56:45 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D1=85=D0=B5=D1=88=20Git-=D0=BA=D0=BE=D0=BC=D0=BC?= =?UTF-8?q?=D0=B8=D1=82=D0=B0=20=D0=B2=20=D0=B8=D0=BC=D1=8F=20BIN-=D1=84?= =?UTF-8?q?=D0=B0=D0=B9=D0=BB=D0=B0=20=D0=BF=D1=80=D0=BE=D1=88=D0=B8=D0=B2?= =?UTF-8?q?=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + UKSSTMS320F28335.pjt | 2 +- UKSSTMS320F28335/README.md | 6 +++++- UKSSTMS320F28335/postBuildStep_Debug.bat | 15 +++++++-------- build_bin.bat | 16 ++++++++++++++++ 5 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 build_bin.bat diff --git a/.gitignore b/.gitignore index 6dd1859..031575a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ /UKSSTMS320F28335.map /UKSSTMS320F28335.paf2 /UKSSTMS320F28335.sbl +/Bin/UKSSTMS320F28335_*.bin diff --git a/UKSSTMS320F28335.pjt b/UKSSTMS320F28335.pjt index 6f94824..45f911a 100644 --- a/UKSSTMS320F28335.pjt +++ b/UKSSTMS320F28335.pjt @@ -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 diff --git a/UKSSTMS320F28335/README.md b/UKSSTMS320F28335/README.md index ca1f3d8..53b42a2 100644 --- a/UKSSTMS320F28335/README.md +++ b/UKSSTMS320F28335/README.md @@ -16,7 +16,11 @@ Файл `28335_RAM_lnk.cmd`, как и в 167, исключён из сборки. Результаты сборки находятся в `166/Bin`: `UKSSTMS320F28335.out`, -`UKSSTMS320F28335.hex` (Intel HEX) и `UKSSTMS320F28335.bin`. +`UKSSTMS320F28335.hex` (Intel HEX) и `UKSSTMS320F28335_.bin`, +где `` — короткий хеш текущего коммита Git (не менее 8 символов). +BIN создаётся скриптом `build_bin.bat`; Git должен быть доступен в `PATH` +процесса CCS. Если определить коммит не удалось, сборка завершается ошибкой. +При наличии незакоммиченных правок хеш обозначает HEAD и не описывает эти правки. Post-build использует имеющийся `166/Bin/hex2000.exe` с параметрами `-boot -sci8`, как в 167. Карта линковки находится в корне 166, карта преобразования загрузочного образа — в `166/Bin`. diff --git a/UKSSTMS320F28335/postBuildStep_Debug.bat b/UKSSTMS320F28335/postBuildStep_Debug.bat index a054feb..2baef7c 100644 --- a/UKSSTMS320F28335/postBuildStep_Debug.bat +++ b/UKSSTMS320F28335/postBuildStep_Debug.bat @@ -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% diff --git a/build_bin.bat b/build_bin.bat new file mode 100644 index 0000000..7bac309 --- /dev/null +++ b/build_bin.bat @@ -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%