rem post_build.bat
rem Copyright (c) 2012 Texas Instruments Incorporated ALL RIGHTS RESERVED
rem versione 15-14

rem ******************************************************
rem This batch file Generates binary files from .out file  
rem ******************************************************


setlocal 

set dirtemp="C:\isdk_temp_%random%_%random%"

IF NOT EXIST %dirtemp% (
mkdir %dirtemp%
)

set bintmp="%dirtemp%\appl_%random%_%random%_%random%.bin"

echo Creating binary file ...

call "%~1/utils/tiobj2bin/tiobj2bin.bat"  "%~3\%~4.out"  %bintmp% "%~2/bin/ofd470.exe"  "%~2/bin/hex470.exe"  "%~1/utils/tiobj2bin/mkhex4bin.exe"

IF EXIST %bintmp% (
copy /B %bintmp% "%~3\%~4.bin" /Y
echo Done
) ELSE (
echo Binary file does not exist in path
goto FINISH
)


cd "%~3"
"%~5\gd_image.exe" "%~4.bin" "cpu.bin" "%~6" "%~7" %8 %9


:FINISH

IF EXIST %dirtemp% (
rmdir /s /q %dirtemp%
)
echo  finished