blob: 28618bbd3227fb1f107199650447e55812db7d4b (
plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
@echo off
setlocal
REM ============================================================
REM APP Build Script
REM %1 = AXF file path (#L)
REM %2 = Project path ($P)
REM ============================================================
set "AXF=%~1"
set "PROJECT=%~2"
if not defined AXF (
echo ERROR: AXF path is empty.
exit /b 1
)
if not defined PROJECT (
echo ERROR: Project path is empty.
exit /b 1
)
if not exist "%AXF%" (
echo ERROR: AXF file not found:
echo %AXF%
exit /b 1
)
REM Get AXF directory and filename
for %%F in ("%AXF%") do (
set "AXF_DIR=%%~dpF"
set "AXF_NAME=%%~nxF"
set "BIN_NAME=%%~nF.bin"
)
set "BIN=%AXF_DIR%%BIN_NAME%"
echo.
echo ==========================================
echo APP Build / Sign
echo ==========================================
echo AXF : %AXF%
echo BIN : %BIN%
echo PROJECT : %PROJECT%
echo.
REM ------------------------------------------------------------
REM 1. Check BIN
REM ------------------------------------------------------------
if not exist "%BIN%" (
echo ERROR: BIN file not found:
echo %BIN%
exit /b 1
)
REM ------------------------------------------------------------
REM 2. Copy BIN to project directory
REM ------------------------------------------------------------
echo Copying BIN...
copy /Y "%BIN%" "%PROJECT%\"
if errorlevel 1 (
echo ERROR: Failed to copy BIN.
exit /b 1
)
REM ------------------------------------------------------------
REM 3. Sign APP
REM ------------------------------------------------------------
echo.
echo Signing APP...
where STM32_SigningTool_CLI.exe >nul 2>&1
if errorlevel 1 (
echo ERROR: STM32_SigningTool_CLI.exe not found.
exit /b 1
)
if exist "%PROJECT%\rtthread-trusted.bin" (
del /f /q "%PROJECT%\rtthread-trusted.bin" >nul 2>&1
if exist "%PROJECT%\rtthread-trusted.bin" (
echo ERROR: Cannot remove old signed APP image.
exit /b 1
)
)
STM32_SigningTool_CLI.exe ^
-bin "%PROJECT%\%BIN_NAME%" ^
-nk ^
-of 0x80000000 ^
-t fsbl ^
-o "%PROJECT%\rtthread-trusted.bin" ^
-hv 2.3 ^
-dump "%PROJECT%\rtthread-trusted.bin" ^
--align
if errorlevel 1 (
echo.
echo ERROR: Signing failed.
exit /b 1
)
if not exist "%PROJECT%\rtthread-trusted.bin" (
echo.
echo ERROR: Signed APP image was not generated.
exit /b 1
)
echo.
echo ==========================================
echo APP build and signing completed.
echo Output:
echo %PROJECT%\rtthread-trusted.bin
echo ==========================================
endlocal
exit /b 0
|