cmsisdspconfig.py 19 KB

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