-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.bat
61 lines (54 loc) · 1.42 KB
/
build.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
@echo off
setlocal
rem get current folder name
for %%I in (.) do set CurrDirName=%%~nxI
rem Set default command
set "commands="
if "%1" == "" (
rem if %1 is blank there were no arguments. Show how to use this batch
echo Usage: %0 [option]
echo -c compile
echo -f flash .sof only, volatile
echo -p program .pof configuration img, perminant
exit /b
)
if "%1" == "-h" (
rem if %1 is blank there were no arguments. Show how to use this batch
echo Usage: %0 [option]
echo -c compile
echo -f flash .sof only, volatile
echo -p program .pof configuration img, perminant
exit /b
)
rem Process command-line arguments
:parse_args
if "%~1"=="-c" (
set "commands=compile %commands%"
shift
goto :parse_args
)
if "%~1"=="-f" (
set "commands=%commands% flash_sof"
shift
goto :parse_args
)
if "%~1"=="-p" (
set "commands=%commands% flash_pof"
shift
goto :parse_args
)
rem Execute Quartus Prime commands based on the selected commands
for %%c in (%commands%) do (
rem echo %%c
if "%%c"=="compile" (
quartus_sh --flow compile %CurrDirName%
) else if "%%c"=="flash_sof" (
quartus_pgm -z --mode=jtag --operation="p;output_files\%CurrDirName%.sof"
) else if "%%c"=="flash_pof" (
quartus_pgm -z --mode=jtag --operation="p;output_files\%CurrDirName%.pof"
) else (
echo Invalid command: %%c
exit /b 1
)
)
endlocal