CMakeLists.txt 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. # Copyright (C) 2018 LongSung Technologies Limited and/or its affiliates("LongSung").
  2. # All rights reserved.
  3. #
  4. # This software is supplied "AS IS" without any warranties.
  5. # LongSung 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. LongSung reserves the right to make changes in the
  8. # software without notification. LongSung also make no representation or
  9. # warranty that such application will be suitable for the specified use
  10. # without further testing or modification.
  11. #####################################evrc files#####################################
  12. option(ENABLE_ANT_MODE "只使能天线测试模式" OFF)
  13. if(ENABLE_ANT_MODE)
  14. add_definitions(-D ENABLE_ANT_MODE)
  15. else()
  16. option(ENABLE_TICKET "使能深度休眠功能" ON)
  17. option(ENABLE_QUE_TASK_LOCK "使能消息队列加任务锁" ON)
  18. option(ENABLE_EVRC_ARM "使能EVRC的汇编驱动" OFF)
  19. option(ENABLE_EVRC "使能EVRC编码驱动" OFF)
  20. option(ENABLE_AMRNB "使能AMRNB编码驱动" ON)
  21. option(ENABLE_DEV_KIT "使能开板板音频通道,否则RTL271音频通道" OFF)
  22. endif()
  23. option(ENABLE_USB_PORT "使能USB虚拟的PORTx功能" ON)
  24. option(ENABLE_UART1_MCU_CMD_ONLY "使能UART1只处理MCU指令" ON)
  25. if(ENABLE_UART1_MCU_CMD_ONLY)
  26. add_definitions(-D ENABLE_UART1_MCU_CMD_ONLY)
  27. endif()
  28. if(ENABLE_USB_PORT)
  29. add_definitions(-D ENABLE_USB_PORT)
  30. endif()
  31. if(ENABLE_USB_PORT)
  32. if(ENABLE_UART1_MCU_CMD_ONLY)
  33. option(ENABLE_NO_ERROR "使能编译主程序" ON)
  34. else()
  35. message(STATUS "error:打开ENABLE_USB_PORT时必须打开ENABLE_UART1_MCU_CMD_ONLY")
  36. endif()
  37. else()
  38. option(ENABLE_NO_ERROR "使能编译主程序" ON)
  39. endif()
  40. if(ENABLE_NO_ERROR)
  41. if(ENABLE_DEV_KIT)
  42. add_definitions(-D ENABLE_DEV_KIT)
  43. endif()
  44. if(ENABLE_TICKET)
  45. add_definitions(-D ENABLE_TICKET)
  46. endif()
  47. if(ENABLE_QUE_TASK_LOCK)
  48. add_definitions(-D ENABLE_QUE_TASK_LOCK)
  49. endif()
  50. set(hpoc_evrc_dir ./evrcc)
  51. set(hpoc_evrc_code_dir ${hpoc_evrc_dir}/code)
  52. set(hpoc_evrc_dsp_arm_dir ${hpoc_evrc_dir}/dsp_arm)
  53. set(hpoc_evrc_dspmath_dir ${hpoc_evrc_dir}/dspmath)
  54. set(hpoc_evrc_all_dir ${hpoc_evrc_dir}
  55. ${hpoc_evrc_dir}/include
  56. ${hpoc_evrc_dsp_arm_dir}
  57. ${hpoc_evrc_dspmath_dir})
  58. if(ENABLE_EVRC_ARM)
  59. set(hpoc_evrc_dspmath_files ${hpoc_evrc_dspmath_dir}/mathadv.c
  60. ${hpoc_evrc_dspmath_dir}/ehwutl.c
  61. ${hpoc_evrc_dspmath_dir}/globdefs.c)
  62. set(hpoc_evrc_arm_files ${hpoc_evrc_dsp_arm_dir}/abs_s.s
  63. ${hpoc_evrc_dsp_arm_dir}/dsp_math.c
  64. ${hpoc_evrc_dsp_arm_dir}/l_add.s
  65. ${hpoc_evrc_dsp_arm_dir}/l_sub.s
  66. ${hpoc_evrc_dsp_arm_dir}/l_mac.s
  67. ${hpoc_evrc_dsp_arm_dir}/l_msu.s
  68. ${hpoc_evrc_dsp_arm_dir}/l_shr.s
  69. ${hpoc_evrc_dsp_arm_dir}/l_shl.s
  70. ${hpoc_evrc_dsp_arm_dir}/divide_s.s
  71. ${hpoc_evrc_dsp_arm_dir}/l_abs.s
  72. ${hpoc_evrc_dsp_arm_dir}/l_mult.s
  73. ${hpoc_evrc_dsp_arm_dir}/mac_r.s
  74. ${hpoc_evrc_dsp_arm_dir}/sub.s
  75. ${hpoc_evrc_dsp_arm_dir}/add.s
  76. ${hpoc_evrc_dsp_arm_dir}/mult_r.s
  77. ${hpoc_evrc_dsp_arm_dir}/negate.s
  78. ${hpoc_evrc_dsp_arm_dir}/norm_s.s
  79. ${hpoc_evrc_dsp_arm_dir}/shr_r.s
  80. ${hpoc_evrc_dsp_arm_dir}/shift_r.s
  81. ${hpoc_evrc_dsp_arm_dir}/msu_r.s
  82. ${hpoc_evrc_dsp_arm_dir}/l_negate.s
  83. ${hpoc_evrc_dsp_arm_dir}/l_shr_r.s
  84. ${hpoc_evrc_dsp_arm_dir}/l_shift_r.s
  85. ${hpoc_evrc_dsp_arm_dir}/norm_l.s
  86. ${hpoc_evrc_dsp_arm_dir}/mult.s
  87. ${hpoc_evrc_dsp_arm_dir}/round32.s
  88. ${hpoc_evrc_dsp_arm_dir}/shl.s
  89. ${hpoc_evrc_dsp_arm_dir}/shr.s
  90. ${hpoc_evrc_dsp_arm_dir}/saturate.s
  91. ${hpoc_evrc_dsp_arm_dir}/l_mpy_ls.s
  92. ${hpoc_evrc_dsp_arm_dir}/l_mpy_ll.s
  93. ${hpoc_evrc_dsp_arm_dir}/div_32.s
  94. ${hpoc_evrc_dsp_arm_dir}/fft_tabs.s
  95. ${hpoc_evrc_dsp_arm_dir}/c_fft.s
  96. ${hpoc_evrc_dsp_arm_dir}/test.s)
  97. else()
  98. set(hpoc_evrc_dspmath_files ${hpoc_evrc_dspmath_dir}/mathevrc.c
  99. ${hpoc_evrc_dspmath_dir}/mathadv.c
  100. ${hpoc_evrc_dspmath_dir}/ehwutl.c
  101. ${hpoc_evrc_dspmath_dir}/globdefs.c
  102. ${hpoc_evrc_dspmath_dir}/mathdp31.c)
  103. set(hpoc_evrc_arm_files )
  104. endif()
  105. set(hpoc_evrc_code_files ${hpoc_evrc_code_dir}/acb_ex.c
  106. ${hpoc_evrc_code_dir}/acelp_pf.c
  107. ${hpoc_evrc_code_dir}/apf.c
  108. ${hpoc_evrc_code_dir}/auto.c
  109. ${hpoc_evrc_code_dir}/a2lsp.c
  110. ${hpoc_evrc_code_dir}/bitpack.c
  111. ${hpoc_evrc_code_dir}/bitupack.c
  112. ${hpoc_evrc_code_dir}/bl_intrp.c
  113. ${hpoc_evrc_code_dir}/bqiir.c
  114. ${hpoc_evrc_code_dir}/c3_10pf.c
  115. ${hpoc_evrc_code_dir}/c8_35pf.c
  116. ${hpoc_evrc_code_dir}/comacb.c
  117. ${hpoc_evrc_code_dir}/convh.c
  118. ${hpoc_evrc_code_dir}/cshift.c
  119. ${hpoc_evrc_code_dir}/d3_10pf.c
  120. ${hpoc_evrc_code_dir}/d8_35pf.c
  121. ${hpoc_evrc_code_dir}/decode.c
  122. ${hpoc_evrc_code_dir}/d_fer.c
  123. ${hpoc_evrc_code_dir}/d_no_fer.c
  124. ${hpoc_evrc_code_dir}/d_rate_1.c
  125. ${hpoc_evrc_code_dir}/durbin.c
  126. ${hpoc_evrc_code_dir}/encode.c
  127. ${hpoc_evrc_code_dir}/fcbgq.c
  128. ${hpoc_evrc_code_dir}/fer.c
  129. ${hpoc_evrc_code_dir}/filter.c
  130. ${hpoc_evrc_code_dir}/fndppf.c
  131. ${hpoc_evrc_code_dir}/getext1k.c
  132. ${hpoc_evrc_code_dir}/getgain.c
  133. ${hpoc_evrc_code_dir}/getres.c
  134. ${hpoc_evrc_code_dir}/impulser.c
  135. ${hpoc_evrc_code_dir}/interpol.c
  136. ${hpoc_evrc_code_dir}/intr_cos.c
  137. ${hpoc_evrc_code_dir}/inv_sqrt.c
  138. ${hpoc_evrc_code_dir}/lpcana.c
  139. ${hpoc_evrc_code_dir}/lspmaq.c
  140. ${hpoc_evrc_code_dir}/lsp2a.c
  141. ${hpoc_evrc_code_dir}/maxeloc.c
  142. ${hpoc_evrc_code_dir}/mdfyorig.c
  143. ${hpoc_evrc_code_dir}/mod.c
  144. ${hpoc_evrc_code_dir}/ns127.c
  145. ${hpoc_evrc_code_dir}/pit_shrp.c
  146. ${hpoc_evrc_code_dir}/pktoav.c
  147. ${hpoc_evrc_code_dir}/pre_enc.c
  148. ${hpoc_evrc_code_dir}/putacbc.c
  149. ${hpoc_evrc_code_dir}/r_fft.c
  150. ${hpoc_evrc_code_dir}/rda.c
  151. ${hpoc_evrc_code_dir}/rom.c
  152. ${hpoc_evrc_code_dir}/synfltr.c
  153. ${hpoc_evrc_code_dir}/weight.c
  154. ${hpoc_evrc_code_dir}/w2res.c
  155. ${hpoc_evrc_code_dir}/zeroinpt.c
  156. ${hpoc_evrc_code_dir}/globs.c
  157. ${hpoc_evrc_code_dir}/e_globs.c
  158. ${hpoc_evrc_code_dir}/d_globs.c)
  159. if(ENABLE_EVRC)
  160. add_definitions(-D ENABLE_EVRC)
  161. set(hpoc_evrc_files ${hpoc_evrc_code_files}
  162. ${hpoc_evrc_dspmath_files}
  163. ${hpoc_evrc_arm_files}
  164. ${hpoc_evrc_dir}/evrcc.c
  165. ${hpoc_evrc_dir}/evrcpacket.c)
  166. else()
  167. set(hpoc_evrc_files )
  168. endif()
  169. #####################################amr files#####################################
  170. set(hpoc_amr_dir ./amrnb)
  171. if (ENABLE_AMRNB)
  172. add_definitions(-D ENABLE_AMRNB)
  173. set(hpoc_amr_files ${hpoc_amr_dir}/agc.c
  174. ${hpoc_amr_dir}/autocorr.c
  175. ${hpoc_amr_dir}/az_lsp.c
  176. ${hpoc_amr_dir}/bits2prm.c
  177. ${hpoc_amr_dir}/cl_ltp.c
  178. ${hpoc_amr_dir}/convolve.c
  179. ${hpoc_amr_dir}/c1035pf.c
  180. ${hpoc_amr_dir}/d_plsf.c
  181. ${hpoc_amr_dir}/d_plsf_5.c
  182. ${hpoc_amr_dir}/d_gain_c.c
  183. ${hpoc_amr_dir}/d_gain_p.c
  184. ${hpoc_amr_dir}/dec_lag6.c
  185. ${hpoc_amr_dir}/d1035pf.c
  186. ${hpoc_amr_dir}/cor_h.c
  187. ${hpoc_amr_dir}/enc_lag3.c
  188. ${hpoc_amr_dir}/enc_lag6.c
  189. ${hpoc_amr_dir}/g_code.c
  190. ${hpoc_amr_dir}/g_pitch.c
  191. ${hpoc_amr_dir}/int_lpc.c
  192. ${hpoc_amr_dir}/inter_36.c
  193. ${hpoc_amr_dir}/inv_sqrt_ex.c
  194. ${hpoc_amr_dir}/lag_wind.c
  195. ${hpoc_amr_dir}/levinson.c
  196. ${hpoc_amr_dir}/lsp_az.c
  197. ${hpoc_amr_dir}/lsp_lsf.c
  198. ${hpoc_amr_dir}/ol_ltp.c
  199. ${hpoc_amr_dir}/pitch_fr.c
  200. ${hpoc_amr_dir}/pitch_ol.c
  201. ${hpoc_amr_dir}/pow2.c
  202. ${hpoc_amr_dir}/pre_big.c
  203. ${hpoc_amr_dir}/pre_proc.c
  204. ${hpoc_amr_dir}/pred_lt.c
  205. ${hpoc_amr_dir}/preemph.c
  206. ${hpoc_amr_dir}/prm2bits.c
  207. ${hpoc_amr_dir}/pstfilt.c
  208. ${hpoc_amr_dir}/q_gain_c.c
  209. ${hpoc_amr_dir}/q_gain_p.c
  210. ${hpoc_amr_dir}/q_plsf.c
  211. ${hpoc_amr_dir}/q_plsf_5.c
  212. ${hpoc_amr_dir}/lsfwt.c
  213. ${hpoc_amr_dir}/reorder.c
  214. ${hpoc_amr_dir}/residu.c
  215. ${hpoc_amr_dir}/lsp.c
  216. ${hpoc_amr_dir}/lpc.c
  217. ${hpoc_amr_dir}/ec_gains.c
  218. ${hpoc_amr_dir}/spreproc.c
  219. ${hpoc_amr_dir}/syn_filt.c
  220. ${hpoc_amr_dir}/weight_a.c
  221. ${hpoc_amr_dir}/qua_gain.c
  222. ${hpoc_amr_dir}/gc_pred.c
  223. ${hpoc_amr_dir}/q_plsf_3.c
  224. ${hpoc_amr_dir}/post_pro.c
  225. ${hpoc_amr_dir}/dec_lag3.c
  226. ${hpoc_amr_dir}/dec_gain.c
  227. ${hpoc_amr_dir}/d_plsf_3.c
  228. ${hpoc_amr_dir}/d4_17pf.c
  229. ${hpoc_amr_dir}/c4_17pf.c
  230. ${hpoc_amr_dir}/d3_14pf.c
  231. ${hpoc_amr_dir}/c3_14pf.c
  232. ${hpoc_amr_dir}/d2_11pf.c
  233. ${hpoc_amr_dir}/c2_11pf.c
  234. ${hpoc_amr_dir}/d2_9pf.c
  235. ${hpoc_amr_dir}/c2_9pf.c
  236. ${hpoc_amr_dir}/cbsearch.c
  237. ${hpoc_amr_dir}/spstproc.c
  238. ${hpoc_amr_dir}/gain_q.c
  239. ${hpoc_amr_dir}/cod_amr.c
  240. ${hpoc_amr_dir}/dec_amr.c
  241. ${hpoc_amr_dir}/sp_enc.c
  242. ${hpoc_amr_dir}/sp_dec.c
  243. ${hpoc_amr_dir}/ph_disp.c
  244. ${hpoc_amr_dir}/g_adapt.c
  245. ${hpoc_amr_dir}/calc_en.c
  246. ${hpoc_amr_dir}/qgain795.c
  247. ${hpoc_amr_dir}/qgain475.c
  248. ${hpoc_amr_dir}/sqrt_l.c
  249. ${hpoc_amr_dir}/set_sign.c
  250. ${hpoc_amr_dir}/s10_8pf.c
  251. ${hpoc_amr_dir}/bgnscd.c
  252. ${hpoc_amr_dir}/gmed_n.c
  253. ${hpoc_amr_dir}/mac_32.c
  254. ${hpoc_amr_dir}/ex_ctrl.c
  255. ${hpoc_amr_dir}/c_g_aver.c
  256. ${hpoc_amr_dir}/lsp_avg.c
  257. ${hpoc_amr_dir}/int_lsf.c
  258. ${hpoc_amr_dir}/c8_31pf.c
  259. ${hpoc_amr_dir}/d8_31pf.c
  260. ${hpoc_amr_dir}/p_ol_wgh.c
  261. ${hpoc_amr_dir}/ton_stab.c
  262. ${hpoc_amr_dir}/vad1.c
  263. ${hpoc_amr_dir}/dtx_enc.c
  264. ${hpoc_amr_dir}/dtx_dec.c
  265. ${hpoc_amr_dir}/a_refl.c
  266. ${hpoc_amr_dir}/b_cn_cod.c
  267. ${hpoc_amr_dir}/calc_cor.c
  268. ${hpoc_amr_dir}/hp_max.c
  269. ${hpoc_amr_dir}/vadname.c
  270. ${hpoc_amr_dir}/vad2.c
  271. ${hpoc_amr_dir}/r_fft_ex.c
  272. ${hpoc_amr_dir}/lflg_upd.c
  273. ${hpoc_amr_dir}/e_homing.c
  274. ${hpoc_amr_dir}/d_homing.c
  275. ${hpoc_amr_dir}/sid_sync.c
  276. ${hpoc_amr_dir}/count.c
  277. ${hpoc_amr_dir}/basicop2.c
  278. ${hpoc_amr_dir}/oper_32b.c
  279. ${hpoc_amr_dir}/set_zero.c
  280. ${hpoc_amr_dir}/log2.c
  281. ${hpoc_amr_dir}/copy.c
  282. ${hpoc_amr_dir}/wamr.c)
  283. else()
  284. set(hpoc_amr_files )
  285. endif()
  286. #####################################pt files#####################################
  287. set(hpoc_pt_dir ./pt)
  288. set(hpoc_pt_files ${hpoc_pt_dir}/pt-timer.c)
  289. #####################################queue#####################################
  290. set(hpoc_queue_dir ./queue)
  291. set(hpoc_queue_files ${hpoc_queue_dir}/bufQueue.c)
  292. #####################################log#####################################
  293. set(hpoc_log_dir ./log)
  294. set(hpoc_log_files ${hpoc_log_dir}/log.c)
  295. #####################################app files#####################################
  296. set(hpoc_app_dir ./app)
  297. set(hpoc_app_file ./hpocapp.c
  298. ${hpoc_app_dir}/main.c
  299. ${hpoc_app_dir}/atCmdList.c
  300. ${hpoc_app_dir}/netWork.c
  301. ${hpoc_app_dir}/app.c
  302. ${hpoc_app_dir}/para.c
  303. ${hpoc_app_dir}/domain.c
  304. ${hpoc_app_dir}/common.c
  305. ${hpoc_app_dir}/tts.c
  306. ${hpoc_app_dir}/plyRec.c
  307. ${hpoc_app_dir}/bsp.c
  308. ${hpoc_app_dir}/tupApi.c
  309. ${hpoc_app_dir}/ticket.c
  310. ${hpoc_app_dir}/authLogin.c
  311. ${hpoc_app_dir}/ProtocolPack.c
  312. ${hpoc_app_dir}/location.c
  313. ${hpoc_app_dir}/nmea.c
  314. ${hpoc_app_dir}/mcuIap.c
  315. ${hpoc_app_dir}/mcu.c
  316. ${hpoc_app_dir}/crc.c
  317. ${hpoc_app_dir}/http.c
  318. ${hpoc_app_dir}/mcuCmds.c
  319. ${hpoc_app_dir}/devMsg.c
  320. ${hpoc_app_dir}/records.c
  321. ${hpoc_app_dir}/hook.c)
  322. #####################################include path#####################################
  323. set(hpoc_all_files ${hpoc_app_file}
  324. ${hpoc_evrc_files}
  325. ${hpoc_amr_files}
  326. ${hpoc_pt_files}
  327. ${hpoc_queue_files}
  328. ${hpoc_log_files}
  329. ${lsapi_osi_api_dir})
  330. ##################################################################################
  331. #aux_source_directory(${SOURCE_TOP_DIR}/hpoc/app SRC_LIST)
  332. include_directories(${hpoc_app_dir}
  333. ${hpoc_evrc_all_dir}
  334. ${hpoc_amr_dir}
  335. ${hpoc_pt_dir}
  336. ${hpoc_queue_dir}
  337. ${hpoc_log_dir})
  338. #add_definitions(-Wall)
  339. add_definitions(-w)
  340. add_definitions(-D PLATFORM_MS5700
  341. -D NO_EXIT_ABORT_CALL
  342. -D UNUSED_STD_MALLOC
  343. -D NDEBUG
  344. -D __unix
  345. -D linux)
  346. if(ENABLE_EVRC_ARM)
  347. add_definitions(-D ANDROID
  348. -D __ARM_ARCH__=7
  349. )
  350. #enable_language(ASM-ATT)
  351. endif()
  352. if(CONFIG_APPIMG_LOAD_FLASH)
  353. set(target RTL271)
  354. add_appimg(${target} ${flash_ldscript} ${hpoc_all_files})
  355. target_link_libraries(${target} PRIVATE ${libc_file_name} ${libm_file_name} ${libgcc_file_name})
  356. set(pac_file ${out_hex_dir}/${target}.pac)
  357. set(target_img_file ${out_hex_dir}/${target}.img)
  358. pac_init_fdl(init_fdl)
  359. add_custom_command(OUTPUT ${pac_file}
  360. COMMAND python3 ${pacgen_py} ${init_fdl}
  361. cfg-image -i APPIMG -a ${CONFIG_APPIMG_FLASH_ADDRESS}
  362. -s ${CONFIG_APPIMG_FLASH_SIZE}
  363. -p ${target_img_file}
  364. pac-gen ${pac_file}
  365. DEPENDS ${pacgen_py} ${target_img_file}
  366. WORKING_DIRECTORY ${SOURCE_TOP_DIR}
  367. )
  368. add_custom_target(${target}_pacgen ALL DEPENDS ${pac_file})
  369. endif()
  370. endif()