Skip to content

Commit be1f3bd

Browse files
committed
Normalize all the line endings
1 parent d0ccdc6 commit be1f3bd

File tree

2 files changed

+136
-136
lines changed

2 files changed

+136
-136
lines changed

win/massStorageCopy.bat

+39-39
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
@ECHO off
2-
3-
REM Exit codes for xcopy
4-
REM code | Description
5-
REM 0 | Files were copied without error.
6-
REM 1 | No files were found to copy.
7-
REM 2 | The user pressed CTRL+C to terminate xcopy.
8-
REM 4 | Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line.
9-
REM 5 | Disk write error occurred.
10-
11-
SET SOURCE=%2
12-
SET SRC_PARSE=%SOURCE:/=\%
13-
SET TARGET=%4
14-
SET TARGET=%TARGET:\=%
15-
16-
call :parse %TARGET%
17-
echo %TARGET% not found. Please ensure the device is correctly connected.
18-
exit 7
19-
20-
:parse
21-
set list=%1
22-
set list=%list:"=%
23-
24-
for /f "tokens=1* delims=," %%a in ("%list%") DO (
25-
if not "%%a" == "" call :sub %%a
26-
if not "%%b" == "" call :parse "%%b"
27-
)
28-
goto :eof
29-
30-
31-
:sub
32-
setlocal enabledelayedexpansion
33-
for /F "skip=1 tokens=*" %%a in ('WMIC LOGICALDISK where "volumename like '%~1'" get deviceid 2^>NUL') do if not defined id set id=%%a
34-
call Set "deviceid=%%id: =%%"
35-
if not "%deviceid%" == "" (
36-
XCOPY %SRC_PARSE% %deviceid% /Y /Q
37-
if !errorlevel! == 0 (echo Upload complete on %1 ^(%deviceid%^))
38-
exit !errorlevel!)
39-
goto :eof
1+
@ECHO off
2+
3+
REM Exit codes for xcopy
4+
REM code | Description
5+
REM 0 | Files were copied without error.
6+
REM 1 | No files were found to copy.
7+
REM 2 | The user pressed CTRL+C to terminate xcopy.
8+
REM 4 | Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line.
9+
REM 5 | Disk write error occurred.
10+
11+
SET SOURCE=%2
12+
SET SRC_PARSE=%SOURCE:/=\%
13+
SET TARGET=%4
14+
SET TARGET=%TARGET:\=%
15+
16+
call :parse %TARGET%
17+
echo %TARGET% not found. Please ensure the device is correctly connected.
18+
exit 7
19+
20+
:parse
21+
set list=%1
22+
set list=%list:"=%
23+
24+
for /f "tokens=1* delims=," %%a in ("%list%") DO (
25+
if not "%%a" == "" call :sub %%a
26+
if not "%%b" == "" call :parse "%%b"
27+
)
28+
goto :eof
29+
30+
31+
:sub
32+
setlocal enabledelayedexpansion
33+
for /F "skip=1 tokens=*" %%a in ('WMIC LOGICALDISK where "volumename like '%~1'" get deviceid 2^>NUL') do if not defined id set id=%%a
34+
call Set "deviceid=%%id: =%%"
35+
if not "%deviceid%" == "" (
36+
XCOPY %SRC_PARSE% %deviceid% /Y /Q
37+
if !errorlevel! == 0 (echo Upload complete on %1 ^(%deviceid%^))
38+
exit !errorlevel!)
39+
goto :eof

win/stm32CubeProg.bat

+97-97
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,97 @@
1-
@echo off
2-
3-
set ERROR=0
4-
set STM32CP_CLI=STM32_Programmer_CLI.exe
5-
set ADDRESS=0x8000000
6-
set ERASE=
7-
set MODE=
8-
set PORT=
9-
set OPTS=
10-
11-
:: Check tool
12-
where /Q %STM32CP_CLI%
13-
if %errorlevel%==0 goto :param
14-
::Check with default path
15-
set STM32CP=%ProgramW6432%\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin
16-
set STM32CP86=%ProgramFiles(X86)%\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin
17-
set PATH=%PATH%;%STM32CP%;%STM32CP86%
18-
where /Q %STM32CP_CLI%
19-
if %errorlevel%==0 goto :param
20-
echo %STM32CP_CLI% not found.
21-
echo Please install it or add ^<STM32CubeProgrammer path^>\bin' to your PATH environment:
22-
echo https://www.st.com/en/development-tools/stm32cubeprog.html
23-
echo Aborting!
24-
exit 1
25-
26-
:param
27-
:: Parse options
28-
if "%~1"=="" echo Not enough arguments! & set ERROR=2 & goto :usage
29-
if "%~2"=="" echo Not enough arguments! & set ERROR=2 & goto :usage
30-
31-
set PROTOCOL=%~1
32-
set FILEPATH=%~2
33-
34-
:: Protocol
35-
:: 1x: Erase all sectors
36-
if %~1 lss 10 goto :proto
37-
set ERASE=-e all
38-
set /a PROTOCOL-=10
39-
40-
:: 0: SWD
41-
:: 1: Serial
42-
:: 2: DFU
43-
:proto
44-
if %PROTOCOL%==0 goto :SWD
45-
if %PROTOCOL%==1 goto :SERIAL
46-
if %PROTOCOL%==2 goto :DFU
47-
echo Protocol unknown!
48-
set ERROR=4
49-
goto :usage
50-
51-
:SWD
52-
set PORT=SWD
53-
set MODE=mode=UR
54-
goto :opt
55-
56-
:SERIAL
57-
if "%~3"=="" set ERROR=3 & goto :usage
58-
set PORT=%~3
59-
shift
60-
goto :opt
61-
62-
:DFU
63-
set PORT=USB1
64-
goto :opt
65-
66-
:opt
67-
shift
68-
shift
69-
if "%~1"=="" goto :prog
70-
set OPTS=%1 %2 %3 %4 %5 %6 %7 %8 %9
71-
goto :prog
72-
73-
:prog
74-
%STM32CP_CLI% -c port=%PORT% %MODE% %ERASE% -q -d %FILEPATH% %ADDRESS% %OPTS%
75-
exit 0
76-
77-
:usage
78-
echo %0 ^<protocol^> ^<file_path^> [OPTIONS]
79-
echo.
80-
echo protocol:
81-
echo 0: SWD
82-
echo 1: Serial
83-
echo 2: DFU
84-
echo Note: prefix it by 1 to erase all sectors
85-
echo Ex: 10 erase all sectors using SWD interface
86-
echo file_path: file path name to be downloaded: (bin, hex)
87-
echo Options:
88-
echo For SWD and DFU: no mandatory options
89-
echo For Serial: ^<com_port^>
90-
echo com_port: serial identifier (mandatory). Ex: COM15
91-
echo.
92-
echo Note: all trailing arguments will be passed to the %STM32CP_CLI%
93-
echo They have to be valid commands for STM32 MCU
94-
echo Ex: -g: Run the code at the specified address
95-
echo -rst: Reset system
96-
echo -s: start automatically (optional)
97-
exit %ERROR%
1+
@echo off
2+
3+
set ERROR=0
4+
set STM32CP_CLI=STM32_Programmer_CLI.exe
5+
set ADDRESS=0x8000000
6+
set ERASE=
7+
set MODE=
8+
set PORT=
9+
set OPTS=
10+
11+
:: Check tool
12+
where /Q %STM32CP_CLI%
13+
if %errorlevel%==0 goto :param
14+
::Check with default path
15+
set STM32CP=%ProgramW6432%\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin
16+
set STM32CP86=%ProgramFiles(X86)%\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin
17+
set PATH=%PATH%;%STM32CP%;%STM32CP86%
18+
where /Q %STM32CP_CLI%
19+
if %errorlevel%==0 goto :param
20+
echo %STM32CP_CLI% not found.
21+
echo Please install it or add ^<STM32CubeProgrammer path^>\bin' to your PATH environment:
22+
echo https://www.st.com/en/development-tools/stm32cubeprog.html
23+
echo Aborting!
24+
exit 1
25+
26+
:param
27+
:: Parse options
28+
if "%~1"=="" echo Not enough arguments! & set ERROR=2 & goto :usage
29+
if "%~2"=="" echo Not enough arguments! & set ERROR=2 & goto :usage
30+
31+
set PROTOCOL=%~1
32+
set FILEPATH=%~2
33+
34+
:: Protocol
35+
:: 1x: Erase all sectors
36+
if %~1 lss 10 goto :proto
37+
set ERASE=-e all
38+
set /a PROTOCOL-=10
39+
40+
:: 0: SWD
41+
:: 1: Serial
42+
:: 2: DFU
43+
:proto
44+
if %PROTOCOL%==0 goto :SWD
45+
if %PROTOCOL%==1 goto :SERIAL
46+
if %PROTOCOL%==2 goto :DFU
47+
echo Protocol unknown!
48+
set ERROR=4
49+
goto :usage
50+
51+
:SWD
52+
set PORT=SWD
53+
set MODE=mode=UR
54+
goto :opt
55+
56+
:SERIAL
57+
if "%~3"=="" set ERROR=3 & goto :usage
58+
set PORT=%~3
59+
shift
60+
goto :opt
61+
62+
:DFU
63+
set PORT=USB1
64+
goto :opt
65+
66+
:opt
67+
shift
68+
shift
69+
if "%~1"=="" goto :prog
70+
set OPTS=%1 %2 %3 %4 %5 %6 %7 %8 %9
71+
goto :prog
72+
73+
:prog
74+
%STM32CP_CLI% -c port=%PORT% %MODE% %ERASE% -q -d %FILEPATH% %ADDRESS% %OPTS%
75+
exit 0
76+
77+
:usage
78+
echo %0 ^<protocol^> ^<file_path^> [OPTIONS]
79+
echo.
80+
echo protocol:
81+
echo 0: SWD
82+
echo 1: Serial
83+
echo 2: DFU
84+
echo Note: prefix it by 1 to erase all sectors
85+
echo Ex: 10 erase all sectors using SWD interface
86+
echo file_path: file path name to be downloaded: (bin, hex)
87+
echo Options:
88+
echo For SWD and DFU: no mandatory options
89+
echo For Serial: ^<com_port^>
90+
echo com_port: serial identifier (mandatory). Ex: COM15
91+
echo.
92+
echo Note: all trailing arguments will be passed to the %STM32CP_CLI%
93+
echo They have to be valid commands for STM32 MCU
94+
echo Ex: -g: Run the code at the specified address
95+
echo -rst: Reset system
96+
echo -s: start automatically (optional)
97+
exit %ERROR%

0 commit comments

Comments
 (0)