Martin Günther | 89be652 | 2016-05-13 07:57:31 +0200 | [diff] [blame^] | 1 | :: Batch file for generating CMSIS pack |
| 2 | :: This batch file uses: |
| 3 | :: 7-Zip for packaging. |
| 4 | :: goxygen for creating documentation. |
| 5 | :: the generated pack file can be found in folder ../../Local_Release |
| 6 | @ECHO off |
| 7 | |
| 8 | SETLOCAL |
| 9 | |
| 10 | :: Tool path for zipping tool 7-Zip |
| 11 | SET ZIPPATH=C:\Program Files\7-Zip |
| 12 | |
| 13 | :: Tool path for doxygen |
| 14 | SET DOXYGENPATH=C:\Program Files\doxygen\bin |
| 15 | |
| 16 | :: Tool path for mscgen utility |
| 17 | SET MSCGENPATH=C:\Program Files (x86)\Mscgen |
| 18 | |
| 19 | :: These settings should be passed on to subprocesses as well |
| 20 | SET PATH=%ZIPPATH%;%DOXYGENPATH%;%MSCGENPATH%;%PATH% |
| 21 | |
| 22 | :: Pack Path (where generated pack is stored) |
| 23 | SET RELEASE_PATH=..\..\Local_Release |
| 24 | |
| 25 | |
| 26 | :: Remove previous build |
| 27 | IF EXIST %RELEASE_PATH% ( |
| 28 | ECHO removing %RELEASE_PATH% |
| 29 | RMDIR /Q /S %RELEASE_PATH% |
| 30 | ) |
| 31 | |
| 32 | :: Create build output directory |
| 33 | MKDIR %RELEASE_PATH% |
| 34 | |
| 35 | :: Copy PDSC file |
| 36 | COPY ..\..\ARM.CMSIS.pdsc %RELEASE_PATH%\ARM.CMSIS.pdsc |
| 37 | |
| 38 | :: Copy Device folder |
| 39 | XCOPY /Q /S /Y ..\..\Device\*.* %RELEASE_PATH%\Device\*.* |
| 40 | |
| 41 | :: Copy CMSIS folder |
| 42 | :: -- Core files |
| 43 | XCOPY /Q /S /Y ..\..\CMSIS\Core\Include\*.* %RELEASE_PATH%\CMSIS\Include\*.* |
| 44 | |
| 45 | :: -- DAP files |
| 46 | XCOPY /Q /S /Y ..\..\CMSIS\DAP\*.* %RELEASE_PATH%\CMSIS\DAP\*.* |
| 47 | |
| 48 | :: -- Driver files |
| 49 | XCOPY /Q /S /Y ..\..\CMSIS\Driver\*.* %RELEASE_PATH%\CMSIS\Driver\*.* |
| 50 | |
| 51 | :: -- DSP files |
| 52 | XCOPY /Q /S /Y ..\..\CMSIS\DSP\Include\*.* %RELEASE_PATH%\CMSIS\Include\*.* |
| 53 | XCOPY /Q /S /Y ..\..\CMSIS\DSP\Source\*.* %RELEASE_PATH%\CMSIS\DSP_Lib\Source\*.* |
| 54 | XCOPY /Q /S /Y ..\..\CMSIS\DSP\Examples\*.* %RELEASE_PATH%\CMSIS\DSP_Lib\Examples\*.* |
| 55 | |
| 56 | :: -- DSP libraries |
| 57 | XCOPY /Q /S /Y ..\..\CMSIS\DSP\Lib\ARM\*.lib %RELEASE_PATH%\CMSIS\Lib\ARM\*.* |
| 58 | XCOPY /Q /S /Y ..\..\CMSIS\DSP\Lib\GCC\*.a %RELEASE_PATH%\CMSIS\Lib\GCC\*.* |
| 59 | |
| 60 | :: -- Pack files |
| 61 | XCOPY /Q /S /Y ..\..\CMSIS\Pack\Example\*.* %RELEASE_PATH%\CMSIS\Pack\Example\*.* |
| 62 | XCOPY /Q /S /Y ..\..\CMSIS\Pack\Tutorials\*.* %RELEASE_PATH%\CMSIS\Pack\Tutorials\*.* |
| 63 | |
| 64 | :: -- RTOS files |
| 65 | XCOPY /Q /S /Y ..\..\CMSIS\RTOS\Template\*.* %RELEASE_PATH%\CMSIS\RTOS\Template\*.* |
| 66 | XCOPY /Q /S /Y ..\..\CMSIS\RTOS\RTX\*.* %RELEASE_PATH%\CMSIS\RTOS\RTX\*.* |
| 67 | |
| 68 | :: -- RTOS2 files |
| 69 | XCOPY /Q /S /Y ..\..\CMSIS\RTOS2\Template\*.* %RELEASE_PATH%\CMSIS\RTOS2\Template\*.* |
| 70 | |
| 71 | :: -- SVD files |
| 72 | XCOPY /Q /S /Y ..\..\CMSIS\Utilities\ARM_Example.* %RELEASE_PATH%\CMSIS\SVD\*.* |
| 73 | |
| 74 | :: -- Utilities files |
| 75 | XCOPY /Q /S /Y ..\..\CMSIS\Utilities\CMSIS-SVD.xsd %RELEASE_PATH%\CMSIS\Utilities\*.* |
| 76 | XCOPY /Q /S /Y ..\..\CMSIS\Utilities\PACK.xsd %RELEASE_PATH%\CMSIS\Utilities\*.* |
| 77 | XCOPY /Q /S /Y ..\..\CMSIS\Utilities\PackChk.exe %RELEASE_PATH%\CMSIS\Utilities\*.* |
| 78 | XCOPY /Q /S /Y ..\..\CMSIS\Utilities\SVDConv.exe %RELEASE_PATH%\CMSIS\Utilities\*.* |
| 79 | XCOPY /Q /S /Y ..\..\CMSIS\Utilities\SVDConv.linux %RELEASE_PATH%\CMSIS\Utilities\*.* |
| 80 | |
| 81 | |
| 82 | :: Generate Documentation |
| 83 | :: -- Generate doxygen files |
| 84 | PUSHD ..\DoxyGen |
| 85 | |
| 86 | :: -- Delete previous generated HTML files |
| 87 | ECHO. |
| 88 | ECHO Delete previous generated HTML files |
| 89 | |
| 90 | PUSHD ..\Documentation |
| 91 | FOR %%A IN (Core, DAP, Driver, DSP, General, Pack, RTOS, RTOS2, SVD) DO IF EXIST %%A (RMDIR /S /Q %%A) |
| 92 | POPD |
| 93 | |
| 94 | :: -- Generate HTML Files |
| 95 | ECHO. |
| 96 | ECHO Generate HTML Files |
| 97 | |
| 98 | pushd Core |
| 99 | doxygen core.dxy |
| 100 | popd |
| 101 | |
| 102 | pushd DAP |
| 103 | doxygen dap.dxy |
| 104 | popd |
| 105 | |
| 106 | pushd Driver |
| 107 | doxygen Driver.dxy |
| 108 | popd |
| 109 | |
| 110 | pushd DSP |
| 111 | doxygen dsp.dxy |
| 112 | popd |
| 113 | |
| 114 | pushd General |
| 115 | doxygen general.dxy |
| 116 | popd |
| 117 | |
| 118 | pushd Pack |
| 119 | doxygen Pack.dxy |
| 120 | popd |
| 121 | |
| 122 | pushd RTOS |
| 123 | doxygen rtos.dxy |
| 124 | popd |
| 125 | |
| 126 | pushd RTOS2 |
| 127 | doxygen rtos.dxy |
| 128 | popd |
| 129 | |
| 130 | pushd SVD |
| 131 | doxygen svd.dxy |
| 132 | popd |
| 133 | |
| 134 | :: -- Copy search style sheet |
| 135 | ECHO. |
| 136 | ECHO Copy search style sheets |
| 137 | copy /Y Doxygen_Templates\search.css ..\Documentation\CORE\html\search\. |
| 138 | copy /Y Doxygen_Templates\search.css ..\Documentation\Driver\html\search\. |
| 139 | REM copy /Y Doxygen_Templates\search.css ..\Documentation\General\html\search\. |
| 140 | copy /Y Doxygen_Templates\search.css ..\Documentation\Pack\html\search\. |
| 141 | REM copy /Y Doxygen_Templates\search.css ..\Documentation\SVD\html\search\. |
| 142 | copy /Y Doxygen_Templates\search.css ..\Documentation\DSP\html\search\. |
| 143 | copy /Y Doxygen_Templates\search.css ..\Documentation\DAP\html\search\. |
| 144 | |
| 145 | ECHO. |
| 146 | POPD |
| 147 | |
| 148 | :: -- Copy generated doxygen files |
| 149 | XCOPY /Q /S /Y ..\Documentation\*.* %RELEASE_PATH%\CMSIS\Documentation\*.* |
| 150 | |
| 151 | :: -- Remove generated doxygen files |
| 152 | PUSHD ..\Documentation |
| 153 | FOR %%A IN (Core, DAP, Driver, DSP, General, Pack, RTOS, RTOS2, SVD) DO IF EXIST %%A (RMDIR /S /Q %%A) |
| 154 | POPD |
| 155 | |
| 156 | |
| 157 | :: Checking |
| 158 | PackChk.exe %RELEASE_PATH%\ARM.CMSIS.pdsc -n %RELEASE_PATH%\PackName.txt -x M353 |
| 159 | |
| 160 | :: --Check if PackChk.exe has completed successfully |
| 161 | IF %errorlevel% neq 0 GOTO ErrPackChk |
| 162 | |
| 163 | |
| 164 | :: Packing |
| 165 | PUSHD %RELEASE_PATH% |
| 166 | |
| 167 | :: -- Pipe Pack's Name into Variable |
| 168 | set /p PackName=<PackName.txt |
| 169 | del /q PackName.txt |
| 170 | |
| 171 | :: Pack files |
| 172 | 7z.exe a %PackName% -tzip |
| 173 | REM MOVE %PackName% ..\ |
| 174 | POPD |
| 175 | GOTO End |
| 176 | |
| 177 | |
| 178 | :ErrPackChk |
| 179 | ECHO PackChk.exe has encountered an error! |
| 180 | EXIT /b |
| 181 | |
| 182 | :End |
| 183 | ECHO removing temporary folders |
| 184 | RMDIR /Q /S %RELEASE_PATH%\CMSIS |
| 185 | RMDIR /Q /S %RELEASE_PATH%\Device |
| 186 | |
| 187 | ECHO PACK generation completed. |