1@ECHO OFF
2
3ECHO INFO: Setting up the environment for ARM GCC...
4
5SET AZRTOS_GCC_DIR="%ProgramFiles(x86)%\GNU Arm Embedded Toolchain\10 2021.10\bin"
6IF EXIST %AZRTOS_GCC_DIR% GOTO AZRTOS_GCC_DIR_FOUND
7SET AZRTOS_GCC_DIR="%ProgramFiles(x86)%\GNU Arm Embedded Toolchain\10 2021.07\bin"
8IF EXIST %AZRTOS_GCC_DIR% GOTO AZRTOS_GCC_DIR_FOUND
9SET AZRTOS_GCC_DIR="%ProgramFiles(x86)%\GNU Arm Embedded Toolchain\10 2020-q4-major\bin"
10IF EXIST %AZRTOS_GCC_DIR% GOTO AZRTOS_GCC_DIR_FOUND
11SET AZRTOS_GCC_DIR="%ProgramFiles(x86)%\GNU Arm Embedded Toolchain\9 2020-q2-update\bin"
12IF EXIST %AZRTOS_GCC_DIR% GOTO AZRTOS_GCC_DIR_FOUND
13SET AZRTOS_GCC_DIR="%ProgramFiles(x86)%\GNU Arm Embedded Toolchain\9 2019-q4-update\bin"
14IF EXIST %AZRTOS_GCC_DIR% GOTO AZRTOS_GCC_DIR_FOUND
15SET AZRTOS_GCC_DIR="%ProgramFiles(x86)%\GNU Arm Embedded Toolchain\8 2019-q3-update\bin"
16IF EXIST %AZRTOS_GCC_DIR% GOTO AZRTOS_GCC_DIR_FOUND
17SET AZRTOS_GCC_DIR="%ProgramFiles(x86)%\GNU Arm Embedded Toolchain\8 2018-q4-update\bin"
18IF EXIST %AZRTOS_GCC_DIR% GOTO AZRTOS_GCC_DIR_FOUND
19SET AZRTOS_GCC_DIR="%ProgramFiles(x86)%\GNU Arm Embedded Toolchain\7 2018-q2-update\bin"
20IF EXIST %AZRTOS_GCC_DIR% GOTO AZRTOS_GCC_DIR_FOUND
21SET AZRTOS_GCC_DIR="%ProgramFiles(x86)%\GNU Arm Embedded Toolchain\7 2017-q4-update\bin"
22IF EXIST %AZRTOS_GCC_DIR% GOTO AZRTOS_GCC_DIR_FOUND
23SET AZRTOS_GCC_DIR="%ProgramFiles(x86)%\GNU Tools ARM Embedded\9 2020-q2-update\bin"
24IF EXIST %AZRTOS_GCC_DIR% GOTO AZRTOS_GCC_DIR_FOUND
25SET AZRTOS_GCC_DIR="%ProgramFiles(x86)%\GNU Tools ARM Embedded\9 2019-q4-update\bin"
26IF EXIST %AZRTOS_GCC_DIR% GOTO AZRTOS_GCC_DIR_FOUND
27SET AZRTOS_GCC_DIR="%ProgramFiles(x86)%\GNU Tools ARM Embedded\8 2019-q3-update\bin"
28IF EXIST %AZRTOS_GCC_DIR% GOTO AZRTOS_GCC_DIR_FOUND
29SET AZRTOS_GCC_DIR="%ProgramFiles(x86)%\GNU Tools ARM Embedded\8 2018-q4-update\bin"
30IF EXIST %AZRTOS_GCC_DIR% GOTO AZRTOS_GCC_DIR_FOUND
31SET AZRTOS_GCC_DIR="%ProgramFiles(x86)%\GNU Tools ARM Embedded\7 2018-q2-update\bin"
32IF EXIST %AZRTOS_GCC_DIR% GOTO AZRTOS_GCC_DIR_FOUND
33SET AZRTOS_GCC_DIR="%ProgramFiles(x86)%\GNU Tools ARM Embedded\7 2017-q4-update\bin"
34IF EXIST %AZRTOS_GCC_DIR% GOTO AZRTOS_GCC_DIR_FOUND
35ECHO ERROR: GCC directory not found
36EXIT /B 2
37
38:AZRTOS_GCC_DIR_FOUND
39IF EXIST %AZRTOS_GCC_DIR%\arm-none-eabi-gcc.exe GOTO GCC_FOUND
40ECHO ERROR: arm-none-eabi-gcc.exe is not found in the GCC directory: %AZRTOS_GCC_DIR%
41EXIT /B 2
42
43:GCC_FOUND
44ECHO INFO: arm-none-eabi-gcc.exe is here %AZRTOS_GCC_DIR%
45
46IF DEFINED TL_PATH GOTO TL_PATH_DEFINED
47SET TL_PATH=%AZRTOS_GCC_DIR:"=%
48
49:TL_PATH_DEFINED
50ECHO INFO: TL_PATH defined as %TL_PATH%
51
52WHERE /Q arm-none-eabi-gcc.exe
53IF %ERRORLEVEL% NEQ 0 GOTO GCC_NOT_IN_PATH
54ECHO INFO: arm-none-eabi-gcc.exe is already in the path.
55GOTO DONE
56
57:GCC_NOT_IN_PATH
58SET PATH=%TL_PATH%;%PATH%
59
60:DONE
61ECHO INFO: ARM GCC environment setup completed successfully!
62