build_all.bat 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. :: Copyright (C) 2018 RDA Technologies Limited and\or its affiliates("RDA").
  2. :: All rights reserved.
  3. ::
  4. :: This software is supplied "AS IS" without any warranties.
  5. :: RDA assumes no responsibility or liability for the use of the software,
  6. :: conveys no license or title under any patent, copyright, or mask work
  7. :: right to the product. RDA reserves the right to make changes in the
  8. :: software without notification. RDA also make no representation or
  9. :: warranty that such application will be suitable for the specified use
  10. :: without further testing or modification.
  11. @echo off
  12. ::to config task num for ninja
  13. ::set build_tasknum=
  14. set Start_at=%time%
  15. set curtitle=cmd: %~n0 %*
  16. title %curtitle% @ %time%
  17. set ret=0
  18. set def_proj=EC800GCN_GA
  19. set buildtype_src=%1
  20. set buildoption=
  21. set ql_ext_flash=N
  22. if "%buildtype_src%"=="" (
  23. set buildoption=r
  24. ) else if /i "%buildtype_src%"=="r" (
  25. set buildoption=r
  26. ) else if /i "%buildtype_src%"=="new" (
  27. set buildoption=new
  28. ) else if /i "%buildtype_src%"=="n" (
  29. set buildoption=new
  30. ) else if /i "%buildtype_src%"=="clean" (
  31. set buildoption=clean
  32. ) else if /i "%buildtype_src%"=="c" (
  33. set buildoption=clean
  34. ) else if /i "%buildtype_src%"=="h" (
  35. set buildoption=h
  36. ) else if /i "%buildtype_src%"=="-h" (
  37. set buildoption=h
  38. ) else if /i "%buildtype_src%"=="help" (
  39. set buildoption=h
  40. ) else if /i "%buildtype_src%"=="/h" (
  41. set buildoption=h
  42. ) else if /i "%buildtype_src%"=="/?" (
  43. set buildoption=h
  44. ) else if /i "%buildtype_src%"=="?" (
  45. set buildoption=h
  46. ) else (
  47. echo !!!unknown build type: %buildtype_src%, should be r/new/clean/h/-h!!!
  48. echo=
  49. goto helpinfo
  50. )
  51. echo=
  52. if /i "%buildoption%"=="h" (
  53. goto buildinfo
  54. )
  55. if /i "%buildoption%"=="clean" (
  56. goto buildstart
  57. )
  58. echo %PATH%
  59. echo=
  60. set ql_buildproj=%2
  61. if "%ql_buildproj%"=="" (
  62. set ql_buildproj=%def_proj%
  63. )
  64. if /i "%ql_buildproj%" == "EC800GCN_GA" (
  65. set hardware_type=UIS8850DG
  66. ) else if /i "%ql_buildproj%" == "EC800GCN_LD" (
  67. set hardware_type=UIS8850BM
  68. ) else if /i "%ql_buildproj%" == "EC800GCN_MD" (
  69. set hardware_type=UIS8850BM
  70. ) else if /i "%ql_buildproj%" == "EG800GEU_LD" (
  71. set hardware_type=UIS8850BM
  72. ) else if /i "%ql_buildproj%" == "EC800GCN_LB" (
  73. set hardware_type=UIS8850CM
  74. ) else if /i "%ql_buildproj%" == "EG800GCN_GB" (
  75. set hardware_type=UIS8850CM
  76. ) else if /i "%ql_buildproj%" == "EC600GCN_LC" (
  77. set hardware_type=UIS8850BM
  78. ) else if /i "%ql_buildproj%" == "EC600GCN_LA" (
  79. set hardware_type=UIS8850CM
  80. ) else if /i "%ql_buildproj%" == "EC600GCN_LD" (
  81. set hardware_type=UIS8850BM
  82. ) else if /i "%ql_buildproj%" == "EC600GCN_CD" (
  83. set hardware_type=UIS8850BM
  84. ) else if /i "%ql_buildproj%" == "EC600GCN_MD" (
  85. set hardware_type=UIS8850BM
  86. ) else if /i "%ql_buildproj%" == "EC600GCN_GA" (
  87. set hardware_type=UIS8850DG
  88. ) else if /i "%ql_buildproj%" == "EG700GCN_LC" (
  89. set hardware_type=UIS8850BM
  90. ) else if /i "%ql_buildproj%" == "EG700GCN_LD" (
  91. set hardware_type=UIS8850BM
  92. ) else if /i "%ql_buildproj%" == "EG700GCN_MD" (
  93. set hardware_type=UIS8850BM
  94. ) else if /i "%ql_buildproj%" == "EG700GCN_ND" (
  95. set hardware_type=UIS8850BM
  96. ) else if /i "%ql_buildproj%" == "EC200GCN_LE" (
  97. set hardware_type=UIS8850BM
  98. ) else if /i "%ql_buildproj%" == "EC200GCN_LF" (
  99. set hardware_type=UIS8850CM
  100. ) else (
  101. echo !!!unknown Project: %ql_buildproj%!!!
  102. echo=
  103. goto helpinfo
  104. )
  105. if /i "%3" == "" (
  106. echo=
  107. echo we need your version label...
  108. echo=
  109. goto helpinfo
  110. )
  111. set buildver=%3
  112. for %%i in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do call set buildver=%%buildver:%%i=%%i%%
  113. set outputtype=%6
  114. if /i not "%outputtype%"=="debug" (
  115. set outputtype=release
  116. )
  117. set _ccsdk_build=ON
  118. set _OPEN_=OPEN_CPU
  119. set PROJECT_ROOT=%CD%
  120. set BUILD_TARGET=8850DG_cat1_open
  121. set BUILD_RELEASE_TYPE=%outputtype%
  122. set ql_app_ver=%buildver%_APP
  123. set ql_app2_ver=%buildver%_APP2
  124. if /i "%hardware_type%"=="UIS8850BM" (
  125. set BUILD_TARGET=8850XM_cat1_open
  126. ) else if /i "%hardware_type%"=="UIS8850CM" (
  127. set BUILD_TARGET=8850XM_cat1_open
  128. )
  129. if not exist "%PROJECT_ROOT%\components\ql-config\build\%ql_buildproj%\%BUILD_TARGET%" (
  130. echo.
  131. echo ******************** ERROR ***********************
  132. echo your target.config is not exist:
  133. echo %PROJECT_ROOT%\components\ql-config\build\%ql_buildproj%\%BUILD_TARGET%
  134. echo ****************************************************************
  135. echo.
  136. set ret=1
  137. goto buildinfo
  138. )
  139. set KCONFIG_CONFIG=%PROJECT_ROOT%\components\ql-config\build\%ql_buildproj%\%BUILD_TARGET%\target.config
  140. set target_out_dir=out\%BUILD_TARGET%_%BUILD_RELEASE_TYPE%
  141. set PROJECT_OUT=%PROJECT_ROOT%\%target_out_dir%
  142. set region=%ql_buildproj:~6,2%
  143. if /i "%region%" == "CN" (
  144. set IMS_DELTA_NV_ROOT=components\ql-kernel\modem\ims\cn
  145. ) else if /i "%region%" == "EU" (
  146. set IMS_DELTA_NV_ROOT=components\ql-kernel\modem\ims\eu
  147. ) else if /i "%region%" == "LA" (
  148. set IMS_DELTA_NV_ROOT=components\ql-kernel\modem\ims\la
  149. ) else if /i "%region%" == "AU" (
  150. set IMS_DELTA_NV_ROOT=components\ql-kernel\modem\ims\au
  151. ) else if /i "%region%" == "GL" (
  152. set IMS_DELTA_NV_ROOT=components\ql-kernel\modem\ims\gl
  153. ) else (
  154. set IMS_DELTA_NV_ROOT=components\ql-kernel\modem\ims\xx
  155. )
  156. echo %IMS_DELTA_NV_ROOT%
  157. set COMPILER_VERSION=gcc-arm-none-eabi-9.2.1
  158. call :add_path %PROJECT_ROOT%\prebuilts\win32\bin
  159. call :add_path %PROJECT_ROOT%\prebuilts\win32\cmake\bin
  160. call :add_path %PROJECT_ROOT%\prebuilts\win32\python3
  161. call :add_path %PROJECT_ROOT%\prebuilts\win32\gcc-arm-none-eabi\%COMPILER_VERSION%\bin
  162. call :add_path %PROJECT_ROOT%\prebuilts\win32\gcc-mips-rda-elf\bin
  163. call :add_path %PROJECT_ROOT%\prebuilts\win32\gcc-rv32-elf\bin
  164. call :add_path %PROJECT_ROOT%\prebuilts\win32\nanopb
  165. call :add_path %PROJECT_ROOT%\tools
  166. call :add_path %PROJECT_ROOT%\tools\win32
  167. ::call :add_path %PROJECT_ROOT%\tools\win32\vlrsign
  168. :buildstart
  169. set optionhelp=0
  170. if /i "%buildoption%"=="clean" (
  171. echo=
  172. rd /s/q out
  173. echo=
  174. echo cleaning done
  175. echo=
  176. goto doneseg
  177. ) else if /i "%buildoption%"=="r" (
  178. echo=
  179. goto buildseg
  180. ) else if /i "%buildoption%"=="new" (
  181. echo cleaning...
  182. echo=
  183. rd /s/q out
  184. echo=
  185. echo cleaning done
  186. echo=
  187. goto buildseg
  188. ) else (
  189. set optionhelp=1
  190. goto doneseg
  191. )
  192. :buildseg
  193. set volte_enable=%4
  194. set quec_dsim=%5
  195. set ql_dsim_cfg=n
  196. if /i not "%volte_enable%"=="VOLTE" (
  197. set volte_enable=NOVOLTE
  198. )
  199. ::set y for VSIM STD solution
  200. set ql_vsim_std=n
  201. echo %volte_enable% %quec_dsim% %build_tasknum%
  202. set ql_dsim_cfg=n
  203. set modemdir=8850XG_cat1bis_gnss_ds_ab
  204. set ims_delta_nv=n
  205. set partitionfile=components/hal/config/8850/partinfo_8850_8m_opencpu.json
  206. set quec_ims_feature=n
  207. if /i "%quec_dsim%"=="DOUBLESIM" (
  208. set ql_dsim_cfg=y
  209. )
  210. if /i "%hardware_type%"=="UIS8850DG" (
  211. if /i "%volte_enable%"=="VOLTE" (
  212. set partitionfile=components/hal/config/8850/partinfo_8850_8m_opencpu.json
  213. set modemdir=8850XG_cat1bis_volte_gnss_ds_ab
  214. set quec_ims_feature=y
  215. set ims_delta_nv=y
  216. ) else (
  217. set partitionfile=components/hal/config/8850/partinfo_8850_8m_opencpu_novolte.json
  218. set modemdir=8850XG_cat1bis_gnss_ds_ab
  219. )
  220. ) else if /i "%hardware_type%"=="UIS8850BM" (
  221. if /i "%ql_ext_flash%"=="Y" (
  222. set partitionfile=components/hal/config/8850/partinfo_8850_4m_4m_opencpu_novolte.json
  223. ) else (
  224. set partitionfile=components/hal/config/8850/partinfo_8850_4m_opencpu_novolte.json
  225. )
  226. set modemdir=8850XM_cat1bis_ds_ab
  227. ) else if /i "%hardware_type%"=="UIS8850CM" (
  228. set partitionfile=components/hal/config/8850/partinfo_8850_8m_opencpu_novolte.json
  229. set modemdir=8850CM_cat1bis_ds
  230. )
  231. if /i "%ql_vsim_std%"=="y" (
  232. set partitionfile=components/hal/config/8850/partinfo_8850_8m_quec_vsim_novolte.json
  233. if /i "%hardware_type%"=="UIS8850BM" (
  234. set partitionfile=components/hal/config/8850/partinfo_8850_4m_quec_vsim_novolte.json
  235. if /i "%ql_ext_flash%"=="Y" (
  236. set partitionfile=components/hal/config/8850/partinfo_8850_4m_4m_quec_vsim_novolte.json
  237. )
  238. )
  239. )
  240. call python3.exe build_check.py --partinfo %partitionfile%
  241. if not %errorlevel% == 0 (
  242. echo.
  243. echo ****************************************************************
  244. echo xxxxxxxxxxxxxxxxx flash partition error xxxxxxxxxxxxxxxxxxxxxx
  245. echo ****************************************************************
  246. set ret=1
  247. goto doneseg
  248. )
  249. set prepack_json_path=components/ql-config/download/prepack/ql_prepack.json
  250. ::if exist prebuilts\modem\8850\%modemdir%\nvitem\*.prj del /f/a prebuilts\modem\8850\%modemdir%\nvitem\*.prj
  251. copy /y "components\ql-config\build\%ql_buildproj%\nvitem\delta_static.nv" "components\nvitem\8850\default\deltanv\"
  252. copy /y "components\ql-config\build\%ql_buildproj%\nvitem\delta_rf.nv" "components\nvitem\8850\default\deltanv\"
  253. copy /y "components\ql-config\build\%ql_buildproj%\nvitem\delta_ims.nv" "components\nvitem\8850\default\deltanv\"
  254. copy /y "components\ql-config\build\%ql_buildproj%\nvitem\delta_simcard2.nv" "components\nvitem\8850\default\deltanv\"
  255. ::xcopy /y components\ql-config\build\%ql_buildproj%\quec_proj_config.h components\ql-kernel\inc
  256. ::xcopy /y components\ql-config\build\%ql_buildproj%\quec_proj_config_at.h components\ql-kernel\inc
  257. xcopy /y components\ql-config\build\%ql_buildproj%\ql_libs\libql_at.a components\ql-kernel\libs
  258. Setlocal Enabledelayedexpansion
  259. if not exist %PROJECT_OUT% mkdir %PROJECT_OUT%
  260. if not exist %PROJECT_OUT%\include mkdir %PROJECT_OUT%\include
  261. cd /d out\%BUILD_TARGET%_%BUILD_RELEASE_TYPE%
  262. echo=
  263. echo %PATH%
  264. echo=
  265. cmake ..\.. -G Ninja
  266. echo=
  267. if not "%build_tasknum%"=="" (
  268. set /a tasknumCheck=%build_tasknum%
  269. if "!tasknumCheck!" == "%build_tasknum%" (
  270. ninja -j 2
  271. ) else (
  272. cd /d %PROJECT_ROOT%
  273. echo.
  274. echo ****************************************************************
  275. echo xxxxxxxxxxxxxxxxxx ninja tasknum error xxxxxxxxxxxxxxxxxxxxxx
  276. echo ****************************************************************
  277. set ret=1
  278. goto doneseg
  279. )
  280. ) else (
  281. ninja -j 2
  282. )
  283. if not %errorlevel% == 0 (
  284. cd /d %PROJECT_ROOT%
  285. echo.
  286. echo.
  287. echo ******************** ERROR ***********************
  288. echo ******************** ERROR ***********************
  289. echo ****************************************************************
  290. echo xxxxxxxxxxxxxxxxxx build ended error xxxxxxxxxxxxxxxxxxxxxxx
  291. echo ****************************************************************
  292. echo ****************************************************************
  293. @echo 
  294. @echo 
  295. @echo 
  296. set ret=1
  297. goto doneseg
  298. )
  299. echo=
  300. echo.
  301. echo ******************** PASS ***********************
  302. echo ************** build ended successfully ********************
  303. echo ******************** PASS ***********************
  304. @echo 
  305. echo=
  306. call python3.exe ..\..\build_check.py --partinfo ..\..\%partitionfile% --splimg .\hex\spl.img --splsignimg .\hex\spl.sign.img
  307. if %errorlevel% NEQ 0 (
  308. cd /d %PROJECT_ROOT%
  309. echo=
  310. echo ******************** ERROR ***********************
  311. echo ******************** FILE SIZE ERROR ***********************
  312. set ret=1
  313. goto doneseg
  314. )
  315. call python3.exe ..\..\build_check.py --partinfo ..\..\%partitionfile% --coreimg .\hex\%BUILD_TARGET%.img
  316. if %errorlevel% NEQ 0 (
  317. cd /d %PROJECT_ROOT%
  318. echo=
  319. echo ******************** ERROR ***********************
  320. echo ******************** FILE SIZE ERROR ***********************
  321. set ret=1
  322. goto doneseg
  323. )
  324. call python3.exe ..\..\build_check.py --partinfo ..\..\%partitionfile% --appimg .\hex\examples\%ql_app_ver%.img
  325. if %errorlevel% NEQ 0 (
  326. cd /d %PROJECT_ROOT%
  327. echo=
  328. echo ******************** ERROR ***********************
  329. echo ******************** FILE SIZE ERROR ***********************
  330. set ret=1
  331. goto doneseg
  332. )
  333. echo=
  334. echo %ql_buildproj% %buildver% %BUILD_RELEASE_TYPE% %volte_enable% %quec_dsim% %build_tasknum%
  335. echo=
  336. set version_path=..\..\target\%ql_buildproj%_%buildver%\
  337. if exist %version_path%\ rd /s/q %version_path%\
  338. mkdir %version_path%\
  339. ::每次编译完删除out目录下生成的indeltanv,避免NV工具导致NV文件中多出一些字节
  340. rd /s/q %PROJECT_OUT%\vargen\%modemdir%\indeltanv
  341. xcopy /y .\hex %version_path%\prepack\
  342. move /y %version_path%\prepack\%BUILD_TARGET%.elf %version_path%\
  343. move /y %version_path%\prepack\%BUILD_TARGET%.map %version_path%\
  344. move /y %version_path%\prepack\%BUILD_TARGET%*%BUILD_RELEASE_TYPE%.pac %version_path%\
  345. rename %version_path%\%BUILD_TARGET%*%BUILD_RELEASE_TYPE%.pac %BUILD_TARGET%_%buildver%.pac
  346. xcopy .\target.cmake %version_path%\prepack\
  347. xcopy /y .\hex\examples\*.* %version_path%\app\
  348. set ql_prepack_opt=N
  349. if exist ql_prepack.opt (
  350. set ql_prepack_opt=Y
  351. )
  352. if /i "%ql_prepack_opt%"=="Y" (
  353. ::如果没生成merge.pac,并且报failed to copy APPIMG before PREPACK as APPIMG,或者预置文件失败等,要检查下ql_prepack.opt和prepack_json_path是否正确
  354. ..\..\tools\win32\dtools pacmerge --id APPIMG,CP --id PREPACK,SPL %version_path%\%BUILD_TARGET%_%buildver%.pac %version_path%\app\%ql_app_ver%.pac %version_path%\%BUILD_TARGET%_%buildver%_merge.pac
  355. ) else (
  356. ..\..\tools\win32\dtools pacmerge --id APPIMG,CP %version_path%\%BUILD_TARGET%_%buildver%.pac %version_path%\app\%ql_app_ver%.pac %version_path%\%BUILD_TARGET%_%buildver%_merge.pac
  357. )
  358. ::如果不存在APPIMG2,这里不会生成带APPIMG2的merge pac
  359. ..\..\tools\win32\dtools pacmerge --id APPIMG2,CP %version_path%\%BUILD_TARGET%_%buildver%_merge.pac %version_path%\app\%ql_app2_ver%.pac %version_path%\%BUILD_TARGET%_%buildver%_merge_APPIMG2.pac
  360. echo=
  361. call pythonw.exe ..\..\tools\codesize.py --map .\hex\%BUILD_TARGET%.map
  362. move /y .\outlib.csv %version_path%\prepack\
  363. move /y .\outobj.csv %version_path%\prepack\
  364. move /y .\outsect.csv %version_path%\prepack\
  365. cd /d %PROJECT_ROOT%
  366. :doneseg
  367. if "%optionhelp%"=="0" (
  368. echo=
  369. echo %date%
  370. echo START TIME: %Start_at%
  371. echo END TIME: %time%
  372. echo=
  373. goto exit
  374. )
  375. :helpinfo
  376. echo=
  377. echo ********************************************************************
  378. echo !!!!!!!!!!! Please input right build option !!!!!!!!!!!!!!
  379. echo ********************************************************************
  380. echo=
  381. :buildinfo
  382. echo For your information:
  383. echo.Usage: %~n0 r/new Project Version [VOLTE] [DSIM] [debug/release]
  384. echo. %~n0 clean
  385. echo. %~n0 h/-h
  386. echo.Example:
  387. echo. %~n0 new %def_proj% your_version_label
  388. echo. %~n0 new %def_proj% your_version_label NOVOLTE SINGLESIM release
  389. echo=
  390. echo Note: Optional parameter: [VOLTE] [DSIM]
  391. echo The previous optional parameter is required for the latter optional parameter.
  392. echo For example, If you need DOUBLESIM with NOVOLTE, please set [VOLTE] as NOVOLTE and [DSIM] as DOUBLESIM.
  393. echo=
  394. echo [VOLTE] option is for VoLTE feature, and NOVOLTE is default.
  395. echo If you want volte, you can ignore [VOLTE] with SINGLESIM or set it as VOLTE. If you want no volte, please set [VOLTE] as NOVOLTE!
  396. echo [DSIM] option is for single or double sim card. and SINGLESIM is default.
  397. echo DOUBLESIM is used for Dual SIM Dual Standby(DSDS), and SINGLESIM is used for single SIM or Dual SIM Single Standby(DSSS).
  398. echo furthermore, you should enable the CONFIG_QUEC_PROJECT_FEATURE_DSSS feature for DSSS.
  399. echo Only determine the dual sim feautre when the dual sim feature is not saved in NV,
  400. echo when the dual sim feature is switched through ql_sim_set_ds_feature, the DOUBLESIM build option and
  401. echo CONFIG_QUEC_PROJECT_FEATURE_DSSS macro will not take effect.
  402. echo=
  403. echo you can get supported [Project] at the directory components\ql-config\build,
  404. echo the name of folders are supported [Project], as below:
  405. echo=
  406. dir components\ql-config\build\
  407. echo=
  408. echo=
  409. :exit
  410. exit /B %ret%
  411. :add_path
  412. (echo ";%PATH%;" | find /C /I ";%1;" > nul) || set "PATH=%1;%PATH%"
  413. goto :eof