cmsisdspconfig.py 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. # Web UI for configuration of the CMSIS-DSP Build
  2. #
  3. # How to install
  4. # pip install streamlit
  5. #
  6. # How to use
  7. # streamlit run cmsisdspconfig.py
  8. #
  9. import streamlit as st
  10. import textwrap
  11. import re
  12. st.set_page_config(page_title="CMSIS-DSP Configuration",layout="wide" )
  13. # Options requiring a special management
  14. NOTSTANDARD=["allTables","allInterpolations","allFFTs","Float16"]
  15. HELIUM=False
  16. config={}
  17. # Used in UI
  18. config["allTables"] = True
  19. config["allFFTs"] = True
  20. config["allInterpolations"] = True
  21. config["MVEI"]=False
  22. config["MVEF"]=False
  23. config["NEON"]=False
  24. config["HELIUM"]=False
  25. config["HELIUMEXPERIMENTAL"]=False
  26. config["Float16"]=True
  27. config["HOST"]=False
  28. config["COS_F32"]=False
  29. config["COS_Q31"]=False
  30. config["COS_Q15"]=False
  31. config["SIN_F32"]=False
  32. config["SIN_Q31"]=False
  33. config["SIN_Q15"]=False
  34. config["SIN_COS_F32"]=False
  35. config["SIN_COS_Q31"]=False
  36. config["LMS_NORM_Q31"]=False
  37. config["LMS_NORM_Q15"]=False
  38. config["CMPLX_MAG_Q31"]=False
  39. config["CMPLX_MAG_Q15"]=False
  40. config["CFFT_RADIX2_Q15"]=False
  41. config["CFFT_RADIX4_Q15"]=False
  42. config["CFFT_RADIX2_Q31"]=False
  43. config["CFFT_RADIX4_Q31"]=False
  44. config["BASICMATH"]=True
  45. config["COMPLEXMATH"]=True
  46. config["CONTROLLER"]=True
  47. config["FASTMATH"]=True
  48. config["FILTERING"]=True
  49. config["MATRIX"]=True
  50. config["STATISTICS"]=True
  51. config["SUPPORT"]=True
  52. config["TRANSFORM"]=True
  53. config["SVM"]=True
  54. config["BAYES"]=True
  55. config["DISTANCE"]=True
  56. config["INTERPOLATION"]=True
  57. config["QUATERNIONMATH"]=True
  58. config["LOOPUNROLL"]=True
  59. config["ROUNDING"]=False
  60. config["MATRIXCHECK"]=False
  61. config["AUTOVECTORIZE"] = False
  62. # Used as options in command line
  63. # in case the UI option is worded differently
  64. realname={}
  65. realname["COS_F32"]="ARM_COS_F32"
  66. realname["COS_Q31"]="ARM_COS_Q31"
  67. realname["COS_Q15"]="ARM_COS_Q15"
  68. realname["SIN_F32"]="ARM_SIN_F32"
  69. realname["SIN_Q31"]="ARM_SIN_Q31"
  70. realname["SIN_Q15"]="ARM_SIN_Q15"
  71. realname["SIN_COS_F32"]="ARM_SIN_COS_F32"
  72. realname["SIN_COS_Q31"]="ARM_SIN_COS_Q31"
  73. realname["LMS_NORM_Q31"]="ARM_LMS_NORM_Q31"
  74. realname["LMS_NORM_Q15"]="ARM_LMS_NORM_Q15"
  75. realname["CMPLX_MAG_Q31"]="ARM_CMPLX_MAG_Q31"
  76. realname["CMPLX_MAG_Q15"]="ARM_CMPLX_MAG_Q15"
  77. realname["CFFT_RADIX2_Q15"]="ARM_CFFT_RADIX2_Q15"
  78. realname["CFFT_RADIX4_Q15"]="ARM_CFFT_RADIX4_Q15"
  79. realname["CFFT_RADIX2_Q31"]="ARM_CFFT_RADIX2_Q31"
  80. realname["CFFT_RADIX4_Q31"]="ARM_CFFT_RADIX4_Q31"
  81. defaulton={}
  82. defaulton["LOOPUNROLL"]=True
  83. defaulton["BASICMATH"]=True
  84. defaulton["COMPLEXMATH"]=True
  85. defaulton["CONTROLLER"]=True
  86. defaulton["FASTMATH"]=True
  87. defaulton["FILTERING"]=True
  88. defaulton["MATRIX"]=True
  89. defaulton["STATISTICS"]=True
  90. defaulton["SUPPORT"]=True
  91. defaulton["TRANSFORM"]=True
  92. defaulton["SVM"]=True
  93. defaulton["BAYES"]=True
  94. defaulton["DISTANCE"]=True
  95. defaulton["INTERPOLATION"]=True
  96. defaulton["QUATERNIONMATH"]=True
  97. CFFTSIZE=[16,32,64,128,256,512,1024,2048,4096]
  98. CFFTDATATYPE=['F64','F32','F16','Q31','Q15']
  99. RFFTFASTSIZE=[32,64,128,256,512,1024,2048,4096]
  100. RFFTFASTDATATYPE=['F64','F32','F16']
  101. RFFTSIZE=[32,64,128,256,512,1024,2048,4096,8192]
  102. RFFTDATATYPE=['F32','Q31','Q15']
  103. DCTSIZE=[128,512,2048,8192]
  104. DCTDATATYPE=['F32','Q31','Q15']
  105. def joinit(iterable, delimiter):
  106. # Intersperse a delimiter between element of a list
  107. it = iter(iterable)
  108. yield next(it)
  109. for x in it:
  110. yield delimiter
  111. yield x
  112. def options(l):
  113. return("".join(joinit(l," ")))
  114. def computeCmakeOptions(config):
  115. global defaulton
  116. cmake={}
  117. if not config["allTables"]:
  118. cmake["CONFIGTABLE"]=True
  119. if config["allInterpolations"]:
  120. cmake["ALLFAST"]=True
  121. if config["allFFTs"]:
  122. cmake["ALLFFT"]=True
  123. if config["Float16"]:
  124. cmake["FLOAT16"]=True
  125. else:
  126. cmake["DISABLEFLOAT16"]=True
  127. for c in config:
  128. if not (c in NOTSTANDARD):
  129. if c in defaulton:
  130. if not config[c]:
  131. if c in realname:
  132. cmake[realname[c]]=False
  133. else:
  134. cmake[c]=False
  135. else:
  136. if config[c]:
  137. if c in realname:
  138. cmake[realname[c]]=True
  139. else:
  140. cmake[c]=True
  141. return cmake
  142. def removeDuplicates(l):
  143. return list(dict.fromkeys(l))
  144. def genCMakeOptions(config):
  145. r=[]
  146. cmake = computeCmakeOptions(config)
  147. for c in cmake:
  148. if cmake[c]:
  149. r.append("-D%s=ON" % c)
  150. else:
  151. r.append("-D%s=OFF" % c)
  152. return(removeDuplicates(r),cmake)
  153. def test(cmake,s):
  154. global defaulton
  155. if s in defaulton and not (s in cmake):
  156. return True
  157. return(s in cmake and cmake[s])
  158. def cfftCF32Config(cmake,size):
  159. result=[]
  160. if test(cmake,"CFFT_F32_%d" % size):
  161. a="-DARM_TABLE_TWIDDLECOEF_F32_%d" % size
  162. if HELIUM:
  163. b = "-DARM_TABLE_BITREVIDX_FXT_%d" % size
  164. else:
  165. b = "-DARM_TABLE_BITREVIDX_FLT_%d" % size
  166. result=[a,b]
  167. return(result)
  168. def cfftCF16Config(cmake,size):
  169. result=[]
  170. if test(cmake,"CFFT_F16_%d" % size):
  171. result =["-DARM_TABLE_TWIDDLECOEF_F16_%d" % size]
  172. result.append("-DARM_TABLE_BITREVIDX_FXT_%d" % size)
  173. result.append("-DARM_TABLE_BITREVIDX_FLT_%d" % size)
  174. return(result)
  175. def cfftCF64Config(cmake,size):
  176. result=[]
  177. if test(cmake,"CFFT_F64_%d" % size):
  178. result =["-DARM_TABLE_TWIDDLECOEF_F64_%d" % size]
  179. result.append("-DARM_TABLE_BITREVIDX_FLT64_%d" % size)
  180. return(result)
  181. def cfftCFixedConfig(cmake,dt,size):
  182. result=[]
  183. if test(cmake,"CFFT_%s_%d" % (dt,size)):
  184. a="-DARM_TABLE_TWIDDLECOEF_%s_%d" % (dt,size)
  185. b = "-DARM_TABLE_BITREVIDX_FXT_%d" % size
  186. result=[a,b]
  187. return(result)
  188. def crfftFastCF64Config(cmake,size):
  189. result=[]
  190. s1 = size >> 1
  191. if test(cmake,"RFFT_FAST_F64_%d" % size):
  192. result =[]
  193. result.append("-DARM_TABLE_TWIDDLECOEF_F64_%d" % s1)
  194. result.append("-DARM_TABLE_BITREVIDX_FLT64_%d" % s1)
  195. result.append("-DARM_TABLE_TWIDDLECOEF_RFFT_F64_%d" % size)
  196. result.append("-DARM_TABLE_TWIDDLECOEF_F64_%d" % s1)
  197. return(result)
  198. def crfftFastCF32Config(cmake,size):
  199. result=[]
  200. s1 = size >> 1
  201. if test(cmake,"RFFT_FAST_F32_%d" % size):
  202. result =[]
  203. result.append("-DARM_TABLE_TWIDDLECOEF_F32_%d" % s1)
  204. result.append("-DARM_TABLE_BITREVIDX_FLT_%d" % s1)
  205. result.append("-DARM_TABLE_TWIDDLECOEF_RFFT_F32_%d" % size)
  206. return(result)
  207. def crfftFastCF16Config(cmake,size):
  208. result=[]
  209. s1 = size >> 1
  210. if test(cmake,"RFFT_FAST_F16_%d" % size):
  211. result =[]
  212. result.append("-DARM_TABLE_TWIDDLECOEF_F16_%d" % s1)
  213. result.append("-DARM_TABLE_BITREVIDX_FLT_%d" % s1)
  214. result.append("-DARM_TABLE_BITREVIDX_FXT_%d" % s1)
  215. result.append("-DARM_TABLE_TWIDDLECOEF_RFFT_F16_%d" % size)
  216. return(result)
  217. # Deprecated RFFT used in DCT
  218. def crfftF32Config(cmake,size):
  219. result=[]
  220. s1 = size >> 1
  221. if test(cmake,"RFFT_FAST_F16_%d" % size):
  222. result =[]
  223. result.append("-DARM_TABLE_REALCOEF_F32")
  224. result.append("-ARM_TABLE_BITREV_%d" % s1)
  225. result.append("-ARM_TABLE_TWIDDLECOEF_F32_%d" % s1)
  226. return(result)
  227. def crfftFixedConfig(cmake,dt,size):
  228. result=[]
  229. s1 = size >> 1
  230. if test(cmake,"RFFT_%s_%d" % (dt,size)):
  231. result =[]
  232. result.append("-DARM_TABLE_REALCOEF_%s" % dt)
  233. result.append("-DARM_TABLE_TWIDDLECOEF_%s_%d" % (dt,s1))
  234. result.append("-DARM_TABLE_BITREVIDX_FXT_%d" % s1)
  235. return(result)
  236. def dctConfig(cmake,dt,size):
  237. result=[]
  238. if test(cmake,"DCT4_%s_%d" % (dt,size)):
  239. result =[]
  240. result.append("-DARM_TABLE_DCT4_%s_%d" % (dt,size))
  241. result.append("-DARM_TABLE_REALCOEF_F32")
  242. result.append("-DARM_TABLE_BITREV_1024" )
  243. result.append("-DARM_TABLE_TWIDDLECOEF_%s_4096" % dt)
  244. return(result)
  245. # Convert cmake options to make flags
  246. def interpretCmakeOptions(cmake):
  247. r=[]
  248. if test(cmake,"CONFIGTABLE"):
  249. r.append("-DARM_DSP_CONFIG_TABLES")
  250. # In Make configuration we build all modules.
  251. # So the code for FFT and FAST maths may be included
  252. # so we allow the table to be included if they are needed.
  253. r.append("-DARM_FAST_ALLOW_TABLES")
  254. r.append("-DARM_FFT_ALLOW_TABLES")
  255. for size in CFFTSIZE:
  256. r += cfftCF32Config(cmake,size)
  257. r += cfftCF16Config(cmake,size)
  258. r += cfftCF64Config(cmake,size)
  259. r += cfftCFixedConfig(cmake,"Q31",size)
  260. r += cfftCFixedConfig(cmake,"Q15",size)
  261. for size in RFFTFASTSIZE:
  262. r += crfftFastCF64Config(cmake,size)
  263. r += crfftFastCF32Config(cmake,size)
  264. r += crfftFastCF16Config(cmake,size)
  265. for size in RFFTSIZE:
  266. r += crfftFixedConfig(cmake,"F32",size)
  267. r += crfftFixedConfig(cmake,"Q31",size)
  268. r += crfftFixedConfig(cmake,"Q15",size)
  269. for size in DCTSIZE:
  270. r += dctConfig(cmake,"F32",size)
  271. r += dctConfig(cmake,"Q31",size)
  272. r += dctConfig(cmake,"Q15",size)
  273. if test(cmake,"ALLFAST"):
  274. r.append("-DARM_ALL_FAST_TABLES")
  275. if test(cmake,"ALLFFT"):
  276. r.append("-DARM_ALL_FFT_TABLES")
  277. if test(cmake,"LOOPUNROLL"):
  278. r.append("-DARM_MATH_LOOPUNROLL")
  279. if test(cmake,"ROUNDING"):
  280. r.append("-DARM_MATH_ROUNDING")
  281. if test(cmake,"MATRIXCHECK"):
  282. r.append("-DARM_MATH_MATRIX_CHECK")
  283. if test(cmake,"AUTOVECTORIZE"):
  284. r.append("-DARM_MATH_AUTOVECTORIZE")
  285. if test(cmake,"DISABLEFLOAT16"):
  286. r.append("-DDISABLEFLOAT16")
  287. if test(cmake,"NEON"):
  288. r.append("-DARM_MATH_NEON")
  289. r.append("-DARM_MATH_NEON_EXPERIMENTAL")
  290. if test(cmake,"HOST"):
  291. r.append("-D__GNUC_PYTHON__")
  292. if test(cmake,"ARM_COS_F32"):
  293. r.append("-DARM_TABLE_SIN_F32")
  294. if test(cmake,"ARM_COS_Q31"):
  295. r.append("-DARM_TABLE_SIN_Q31")
  296. if test(cmake,"ARM_COS_Q15"):
  297. r.append("-DARM_TABLE_SIN_Q15")
  298. if test(cmake,"ARM_SIN_F32"):
  299. r.append("-DARM_TABLE_SIN_F32")
  300. if test(cmake,"ARM_SIN_Q31"):
  301. r.append("-DARM_TABLE_SIN_Q31")
  302. if test(cmake,"ARM_SIN_Q15"):
  303. r.append("-DARM_TABLE_SIN_Q15")
  304. if test(cmake,"ARM_SIN_COS_F32"):
  305. r.append("-DARM_TABLE_SIN_F32")
  306. if test(cmake,"ARM_SIN_COS_Q31"):
  307. r.append("-DARM_TABLE_SIN_Q31")
  308. if test(cmake,"ARM_LMS_NORM_Q31"):
  309. r.append("-DARM_TABLE_RECIP_Q31")
  310. if test(cmake,"ARM_LMS_NORM_Q15"):
  311. r.append("-DARM_TABLE_RECIP_Q15")
  312. if test(cmake,"ARM_CMPLX_MAG_Q31"):
  313. r.append("-DARM_TABLE_FAST_SQRT_Q31_MVE")
  314. if test(cmake,"ARM_CMPLX_MAG_Q15"):
  315. r.append("-DARM_TABLE_FAST_SQRT_Q15_MVE")
  316. if test(cmake,"MVEI"):
  317. r.append("-DARM_MATH_MVEI")
  318. if test(cmake,"MVEF"):
  319. r.append("-DARM_MATH_MVEF")
  320. if test(cmake,"HELIUMEXPERIMENTAL"):
  321. r.append("-DARM_MATH_HELIUM_EXPERIMENTAL")
  322. if test(cmake,"HELIUM") or test(cmake,"MVEF") or test(cmake,"MVEI"):
  323. r.append("-IPrivateInclude")
  324. if test(cmake,"NEON") or test(cmake,"NEONEXPERIMENTAL"):
  325. r.append("-IComputeLibrary/Include")
  326. if test(cmake,"ARM_CFFT_RADIX2_Q15") or test(cmake,"ARM_CFFT_RADIX4_Q15"):
  327. r.append("-DARM_TABLE_TWIDDLECOEF_Q15_4096")
  328. r.append("-DARM_TABLE_BITREV_1024")
  329. if test(cmake,"ARM_CFFT_RADIX2_Q31") or test(cmake,"ARM_CFFT_RADIX4_Q31"):
  330. r.append("-DARM_TABLE_TWIDDLECOEF_Q31_4096")
  331. r.append("-DARM_TABLE_BITREV_1024")
  332. return (removeDuplicates(r))
  333. def genMakeOptions(config):
  334. cmake = computeCmakeOptions(config)
  335. r=interpretCmakeOptions(cmake)
  336. return(r,cmake)
  337. def check(config,s,name=None,comment=None):
  338. if comment is not None:
  339. st.sidebar.text(comment)
  340. if name is None:
  341. config[s]=st.sidebar.checkbox(s,value=config[s])
  342. else:
  343. config[s]=st.sidebar.checkbox(name,value=config[s])
  344. return(config[s])
  345. def genconfig(config,transform,sizes,datatypes):
  346. global realname
  347. for size in sizes:
  348. for dt in datatypes:
  349. s="%s_%s_%s" % (transform,dt,size)
  350. config[s] = False
  351. realname[s] = s
  352. def hasDCTF32(config):
  353. result=False
  354. for size in DCTSIZE:
  355. s="DCT4_F32_%s" % size
  356. if config[s]:
  357. result = True
  358. return(result)
  359. def multiselect(config,name,options):
  360. default=[]
  361. for r in options:
  362. if config[r]:
  363. default.append(r)
  364. result=st.sidebar.multiselect(name,options,default=default)
  365. for r in options:
  366. config[r] = False
  367. for r in result:
  368. config[r] = True
  369. def genui(config,transform,sizes,datatypes):
  370. keepF32 = True
  371. # RFFT F32 is deprecated and needed only for DCT4
  372. if transform == "RFFT":
  373. keepF32 = hasDCTF32(config)
  374. selected=st.sidebar.multiselect("Sizes",sizes)
  375. for size in selected:
  376. options=[]
  377. for dt in datatypes:
  378. if dt != "F32" or keepF32:
  379. s="%s_%s_%s" % (transform,dt,size)
  380. options.append(s)
  381. multiselect(config,"Nb = %d" % size,options)
  382. def configMake(config):
  383. st.sidebar.header('Table Configuration')
  384. st.sidebar.info("Several options to include only the tables needed in an app and minimize code size.")
  385. if not check(config,"allTables","All tables included"):
  386. if not check(config,"allFFTs","All FFT tables included"):
  387. st.sidebar.markdown("#### CFFT")
  388. genui(config,"CFFT",CFFTSIZE,CFFTDATATYPE)
  389. st.sidebar.info("Following transforms are using the CFFT. You need to enable the needed CFFTs above.")
  390. st.sidebar.markdown("#### RFFT FAST")
  391. genui(config,"RFFT_FAST",RFFTFASTSIZE,RFFTFASTDATATYPE)
  392. st.sidebar.markdown("#### DCT4")
  393. genui(config,"DCT4",DCTSIZE,DCTDATATYPE)
  394. st.sidebar.markdown("#### RFFT")
  395. genui(config,"RFFT",RFFTSIZE,RFFTDATATYPE)
  396. st.sidebar.markdown("#### Radix2 and Radix4 CFFT")
  397. st.sidebar.info("Those functions are deprecated")
  398. multiselect(config,"Radix",["CFFT_RADIX2_Q15","CFFT_RADIX4_Q15","CFFT_RADIX2_Q31","CFFT_RADIX4_Q31"])
  399. if not check(config,"allInterpolations",'All interpolation tables included'):
  400. selected=st.sidebar.multiselect("Functions",["Cosine","Sine","SineCosine","Normalized LMS"])
  401. for s in selected:
  402. if s == "Cosine":
  403. multiselect(config,"Cosine",["COS_F32","COS_Q31","COS_Q15"])
  404. if s == "Sine":
  405. multiselect(config,"Sine",["SIN_F32","SIN_Q31","SIN_Q15"])
  406. if s == "SineCosine":
  407. multiselect(config,"SineCosine",["SIN_COS_F32","SIN_COS_Q31"])
  408. if s == "Normalized LMS":
  409. multiselect(config,"Normalized LMS",["LMS_NORM_Q31","LMS_NORM_Q15"])
  410. if config["MVEI"]:
  411. st.sidebar.markdown("#### Complex Magnitude")
  412. multiselect(config,"Complex Magnitude",["CMPLX_MAG_Q31","CMPLX_MAG_Q15"])
  413. def configCMake(config):
  414. multiselect(config,"Folders",["BASICMATH",
  415. "COMPLEXMATH",
  416. "CONTROLLER",
  417. "FASTMATH",
  418. "FILTERING",
  419. "MATRIX",
  420. "STATISTICS",
  421. "SUPPORT",
  422. "TRANSFORM",
  423. "SVM",
  424. "BAYES",
  425. "DISTANCE",
  426. "INTERPOLATION","QUATERNIONMATH"])
  427. configMake(config)
  428. genconfig(config,"CFFT",CFFTSIZE,CFFTDATATYPE)
  429. genconfig(config,"RFFT_FAST",RFFTFASTSIZE,RFFTFASTDATATYPE)
  430. genconfig(config,"RFFT",RFFTSIZE,RFFTDATATYPE)
  431. genconfig(config,"DCT4",DCTSIZE,DCTDATATYPE)
  432. st.title('CMSIS-DSP Configuration')
  433. st.warning("It is a work in progress. Only a small subset of the combinations has been tested.")
  434. st.sidebar.header('Feature Configuration')
  435. st.sidebar.info("To build on host. All features will be enabled.")
  436. forHost=check(config,"HOST")
  437. if not forHost:
  438. st.sidebar.info("Enable or disable float16 support")
  439. check(config,"Float16")
  440. st.sidebar.info("Some configurations for the CMSIS-DSP code.")
  441. check(config,"LOOPUNROLL")
  442. st.sidebar.text("Decrease performances when selected:")
  443. check(config,"ROUNDING")
  444. check(config,"MATRIXCHECK")
  445. st.sidebar.header('Vector extensions')
  446. st.sidebar.info("Enable vector code. It is not automatic for Neon. Use of Helium will enable new options to select some interpolation tables.")
  447. archi=st.sidebar.selectbox("Vector",('None','Helium','Neon'))
  448. if archi == 'Neon':
  449. config["NEON"]=True
  450. if archi == 'Helium':
  451. multiselect(config,"MVE configuration",["MVEI","MVEF"])
  452. HELIUM=True
  453. st.sidebar.info("When checked some experimental versions will be enabled and may be less performant than scalar version depending on the architecture.")
  454. check(config,"HELIUMEXPERIMENTAL")
  455. if archi != 'None':
  456. st.sidebar.info("When autovectorization is on, pure C code will be compiled. The version with C intrinsics won't be compiled.")
  457. check(config,"AUTOVECTORIZE")
  458. st.sidebar.header('Build Method')
  459. st.sidebar.info("With cmake, some folders can be removed from the build.")
  460. selected=st.sidebar.selectbox('Select', ("Make","Cmake"),index=1)
  461. if selected == "Make":
  462. if not forHost:
  463. configMake(config)
  464. result,cmake=genMakeOptions(config)
  465. else:
  466. if not forHost:
  467. configCMake(config)
  468. result,cmake=genCMakeOptions(config)
  469. st.header('Build options for %s command line' % selected)
  470. if selected == "Make":
  471. if test(cmake,"FLOAT16"):
  472. st.info("Float16 is selected. You may need to pass compiler specific options for the compiler to recognize the float16 type.")
  473. mode=st.selectbox("Mode",["txt","MDK","sh","bat"])
  474. if mode=="txt":
  475. st.code(textwrap.fill(options(result)))
  476. if mode=="MDK":
  477. opts=options(result)
  478. includes=""
  479. maybeincludes=re.findall(r'\-I([^\s]+)',opts)
  480. # Managed in MDK pack file
  481. #if maybeincludes:
  482. # includes = maybeincludes
  483. # st.text("Following include directories must be added")
  484. # st.code(includes)
  485. opts=re.sub(r'\-D','',opts)
  486. opts=re.sub(r'\-I[^\s]+','',opts)
  487. st.text("MDK Preprocessor Symbols ")
  488. st.code(opts)
  489. if mode=="sh":
  490. lines=options(result).split()
  491. txt=""
  492. for l in lines:
  493. txt += " %s \\\n" % l
  494. txt += "\n"
  495. st.code(txt)
  496. if mode=="bat":
  497. lines=options(result).split()
  498. txt=""
  499. for l in lines:
  500. txt += " %s ^\n" % l
  501. txt += "\n"
  502. st.code(txt)