runTest.bat 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. @echo off
  2. set UVEXE=C:\Keil_v5\UV4\UV4.EXE
  3. if .%1==. goto help
  4. for %%a in (ARM GCC) do if %1==%%a goto checkParam2
  5. echo parameter %1 not supported.
  6. goto help
  7. :checkParam2
  8. if .%2==. goto help
  9. for %%a in ( ^
  10. cortexM0l ^
  11. cortexM3l ^
  12. cortexM4l ^
  13. cortexM4lf ^
  14. cortexM7l ^
  15. cortexM7lfsp ^
  16. cortexM7lfdp ^
  17. ARMv8MBLl ^
  18. ARMv8MMLl ^
  19. ARMv8MMLlfsp ^
  20. ARMv8MMLlfdp ^
  21. ARMv8MMLld ^
  22. ARMv8MMLldfsp ^
  23. ARMv8MMLldfdp ^
  24. ) do if %2==%%a goto checkParam3
  25. echo parameter %2 not supported.
  26. goto help
  27. :checkParam3
  28. if .%3==. goto help
  29. for %%a in (MPS2 FVP Simulator) do if %3==%%a goto CheckLibraries
  30. echo parameter %3 not supported.
  31. goto help
  32. :CheckLibraries
  33. if %1==ARM goto CheckLibrariesARM
  34. if %1==GCC goto CheckLibrariesGCC
  35. :CheckLibrariesARM
  36. if not exist ".\RefLibs\%1\Lib\arm_%2_ref.lib" (echo ".\RefLibs\%1\Lib\arm_%2_ref.lib" not found. & goto end)
  37. if not exist "..\Lib\%1\arm_%2_math.lib" (echo "..\Lib\%1\arm_%2_ref.lib" not found. & goto end)
  38. goto CopyLibrariesARM
  39. :CheckLibrariesGCC
  40. if not exist ".\RefLibs\%1\Lib\libarm_%2_ref.a" (echo ".\RefLibs\%1\Lib\libarm_%2_ref.a" not found. & goto end)
  41. if not exist "..\Lib\%1\libarm_%2_math.a" (echo "..\Lib\%1\libarm_%2_math.a" not found. & goto end)
  42. goto CopyLibrariesGCC
  43. :CopyLibrariesARM
  44. copy /B ".\RefLibs\%1\Lib\arm_%2_ref.lib" .\DspLibTest_%3\%1\Lib\arm_ref.lib /B /Y
  45. copy /B "..\Lib\%1\arm_%2_math.lib" .\DspLibTest_%3\%1\Lib\arm_math.lib /B /Y
  46. goto buildProject
  47. :CopyLibrariesGCC
  48. copy /B ".\RefLibs\%1\Lib\libarm_%2_ref.a" .\DspLibTest_%3\%1\Lib\libarm_ref.a /B /Y
  49. copy /B "..\Lib\%1\libarm_%2_math.a" .\DspLibTest_%3\%1\Lib\libarm_math.a /B /Y
  50. goto buildProject
  51. :buildProject
  52. echo Build Test Project ...
  53. %UVEXE% -r -j0 .\DspLibTest_%3\%1\DspLibTest_%3.uvprojx -t "%2" -o ".\Logs\DspLibTest_%3_%2_build.log"
  54. echo Run Test ...
  55. del /Q ".\DspLibTest_%3\%1\Logs\DspLibTest_%3.log" 2>NUL
  56. del /Q ".\DspLibTest_%3\%1\Logs\DspLibTest_%3_%2.log" 2>NUL
  57. rem get start time (The format of %TIME% is HH:MM:SS,CS for example 23:59:59,99)
  58. set STARTTIME=%TIME%
  59. rem run the test
  60. %UVEXE% -d .\DspLibTest_%3\%1\DspLibTest_%3.uvprojx -t "%2"
  61. rem get end time
  62. set ENDTIME=%TIME%
  63. rem calculate duration
  64. rem Change formatting for the start and end times
  65. for /F "tokens=1-4 delims=:.," %%a in ("%STARTTIME%") do (
  66. set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
  67. )
  68. for /F "tokens=1-4 delims=:.," %%a in ("%ENDTIME%") do (
  69. set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
  70. )
  71. rem Test midnight rollover. If so, add 1 day=8640000 1/100ths secs
  72. if %end% lss %start% set /a end+=8640000
  73. rem Calculate the elapsed time by subtracting values
  74. set /A elapsed=end-start
  75. rem Format the results for output
  76. set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
  77. if %hh% lss 10 set hh=0%hh%
  78. if %mm% lss 10 set mm=0%mm%
  79. if %ss% lss 10 set ss=0%ss%
  80. if %cc% lss 10 set cc=0%cc%
  81. set DURATION=%hh%:%mm%:%ss%,%cc%
  82. rem write time to file
  83. echo Test %1 %2 : > ".\DspLibTest_%3\%1\Logs\DspLibTest_%3_%2_time.log"
  84. echo Start time: %STARTTIME% >> ".\DspLibTest_%3\%1\Logs\DspLibTest_%3_%2_time.log"
  85. echo End time: %ENDTIME% >> ".\DspLibTest_%3\%1\Logs\DspLibTest_%3_%2_time.log"
  86. echo Duration: %DURATION% >> ".\DspLibTest_%3\%1\Logs\DspLibTest_%3_%2_time.log"
  87. echo Copy Logfile ...
  88. copy /B ".\DspLibTest_%3\%1\Logs\DspLibTest_%3.log" ".\DspLibTest_%3\%1\Logs\DspLibTest_%3_%2.log"
  89. goto end
  90. :help
  91. echo.
  92. echo Syntax: runTest toolchain core test
  93. echo.
  94. echo toolchain: ARM ^| GCC
  95. echo core: cortexM0l ^| cortexM3l ^| cortexM4l ^| cortexM4lf ^| cortexM7l ^| cortexM7lfsp ^| cortexM7lfdp
  96. echo ARMv8MBLl
  97. echo ARMv8MMLl ^| ARMv8MMLlfsp ^| ARMv8MMLlfdp
  98. echo ARMv8MMLld ^| ARMv8MMLldfsp ^| ARMv8MMLldfdp
  99. echo test: MPS2 ^| FVP ^| Simulator
  100. echo.
  101. echo e.g.: runTest ARM cortexM3l Simulator
  102. :end
  103. @echo on