luat_conf_bsp.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. #ifndef LUAT_CONF_BSP
  2. #define LUAT_CONF_BSP
  3. #define LUAT_BSP_VERSION "V1023"
  4. //------------------------------------------------------
  5. // 以下custom --> 到 <-- custom 之间的内容,是供用户配置的
  6. // 同时也是云编译可配置的部分. 提交代码时切勿删除会修改标识
  7. //custom -->
  8. //------------------------------------------------------
  9. // Air101 与 Air103 的Flash大小有差异,需要区分
  10. // 可选值, AIR101 AIR103 AIR601 分别对应3种模块
  11. #define AIR601
  12. // 启用64位虚拟机
  13. // #define LUAT_CONF_VM_64bit
  14. // FLASH_FS_REGION_SIZE包含2部分: 脚本区和文件系统区
  15. // 其中文件系统区固定48k, 脚本区默认64k, 两者加起来就是默认值 64+48=112
  16. // 若需要增加脚本区的大小, 那么大小必须是64的整数倍, 例如变成 128,192,256
  17. // 128k脚本区, 对应的 FLASH_FS_REGION_SIZE 为 176, 因为 128+48=176
  18. // 192k脚本区, 对应的 FLASH_FS_REGION_SIZE 为 240, 因为 192+48=240
  19. // 256k脚本区, 对应的 FLASH_FS_REGION_SIZE 为 304, 因为 256+48=304
  20. #define LUAT_FS_SIZE 48 //文件系统大小
  21. #define LUAT_SCRIPT_SIZE 64 //脚本大小
  22. //----------------------------
  23. // 外设,按需启用, 最起码启用uart和wdt库
  24. #define LUAT_USE_UART 1
  25. #define LUAT_USE_GPIO 1
  26. #define LUAT_USE_I2C 1
  27. #define LUAT_USE_SPI 1
  28. #define LUAT_USE_ADC 1
  29. #define LUAT_USE_PWM 1
  30. #define LUAT_USE_WDT 1
  31. #define LUAT_USE_PM 1
  32. #define LUAT_USE_MCU 1
  33. #define LUAT_USE_RTC 1
  34. // SDIO 仅支持TF/SD卡的挂载
  35. #define LUAT_USE_SDIO 1
  36. // 段码屏/段式屏, 按需启用
  37. #define LUAT_USE_LCDSEG 1
  38. // OTP
  39. #define LUAT_USE_OTP 1
  40. #define LUAT_USE_TOUCHKEY 1
  41. // #define LUAT_USE_ICONV 1
  42. // wlan库相关, 仅AIR601
  43. // #define LUAT_USE_WLAN
  44. // 外置网络支持
  45. // #define LUAT_USE_W5500
  46. // 开启TLS
  47. #define LUAT_USE_TLS
  48. #define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
  49. // #define LUAT_USE_CRYPTO_AES_MBEDTLS 1
  50. // 其他网络功能
  51. // #define LUAT_USE_SNTP
  52. // #define LUAT_USE_HTTPSRV
  53. // #define LUAT_USE_FTP
  54. // #define LUAT_USE_ERRDUMP 1
  55. #define LUAT_USE_IOTAUTH 1
  56. //----------------------------
  57. // 常用工具库, 按需启用, cjson和pack是强烈推荐启用的
  58. #define LUAT_USE_CRYPTO 1
  59. #define LUAT_USE_CJSON 1
  60. #define LUAT_USE_ZBUFF 1
  61. #define LUAT_USE_PACK 1
  62. #define LUAT_USE_LIBGNSS 1
  63. #define LUAT_USE_FS 1
  64. #define LUAT_USE_SENSOR 1
  65. #define LUAT_USE_SFUD 1
  66. // #define LUAT_USE_STATEM 1
  67. // 性能测试,跑完就是玩,不要与lvgl一起启用,生产环境的固件别加这个库
  68. // #define LUAT_USE_COREMARK 1
  69. // #define LUAT_USE_ZLIB 1
  70. #define LUAT_USE_IR 1
  71. // FDB 提供kv数据库, 与nvm库类似
  72. // #define LUAT_USE_FDB 1
  73. // fskv提供与fdb库兼容的API,旨在替换fdb库
  74. #define LUAT_USE_FSKV 1
  75. #define LUAT_USE_OTA 1
  76. #define LUAT_USE_I2CTOOLS 1
  77. #define LUAT_USE_LORA 1
  78. #define LUAT_USE_MLX90640 1
  79. // #define LUAT_USE_MAX30102 1
  80. // zlib压缩,更快更小的实现
  81. #define LUAT_USE_MINIZ 1
  82. // FASTLZ的内存需求小,压缩比不如miniz
  83. // #define LUAT_USE_FASTLZ 1
  84. // RSA 加解密,加签验签
  85. #define LUAT_USE_RSA 1
  86. // #define LUAT_USE_XXTEA 1
  87. // 国密算法 SM2/SM3/SM4
  88. // #define LUAT_USE_GMSSL 1
  89. // #define LUAT_USE_SQLITE3 1
  90. // #define LUAT_USE_WS2812 1
  91. // // 使用 TLSF 内存池, 实验性, 内存利用率更高一些
  92. // #define LUAT_USE_TLSF 1
  93. // 禁用AES的硬件加速版本, 改用mbedtls的软件版本
  94. // 硬件加速的版本只支持AES128,若使用AES256就报错了
  95. #define LUAT_USE_CRYPTO_AES_MBEDTLS 1
  96. // 音频相关
  97. // #define LUAT_USE_I2S 1
  98. // #define LUAT_USE_MEDIA 1
  99. //---------------SDIO-FATFS特别配置
  100. // sdio库对接的是fatfs
  101. // fatfs的长文件名和非英文文件名支持需要180k的ROM, 非常奢侈
  102. // 从v0006开始默认关闭之, 需要用到就打开吧
  103. // #define LUAT_USE_FATFS
  104. // #define LUAT_USE_FATFS_CHINESE 1
  105. //----------------------------
  106. // 高通字体, 需配合芯片使用
  107. // #define LUAT_USE_GTFONT 1
  108. // #define LUAT_USE_GTFONT_UTF8 1
  109. // #define LUAT_USE_YMODEM 1
  110. // #define LUAT_USE_MQTTCORE 1
  111. // #define LUAT_USE_LIBCOAP 1
  112. // #define LUAT_USE_ERCOAP 1
  113. //----------------------------
  114. // 高级功能, 推荐使用REPL, 因为SHELL已废弃
  115. // #define LUAT_USE_SHELL 1
  116. // #define LUAT_USE_DBG
  117. // NIMBLE 是蓝牙功能, 名为BLE, 但绝非低功耗.
  118. // #define LUAT_USE_NIMBLE 1
  119. // 多虚拟机支持,实验性,一般不启用
  120. // #define LUAT_USE_VMX 1
  121. // #define LUAT_USE_NES
  122. // #define LUAT_USE_PROTOBUF 1
  123. // #define LUAT_USE_REPL 1
  124. //---------------------
  125. // UI
  126. // LCD 是彩屏, 若使用LVGL就必须启用LCD
  127. // #define LUAT_USE_LCD
  128. // #define LUAT_USE_TJPGD
  129. // EINK 是墨水屏
  130. // #define LUAT_USE_EINK
  131. //---------------------
  132. // U8G2
  133. // 单色屏, 支持i2c/spi
  134. // #define LUAT_USE_DISP
  135. // #define LUAT_USE_U8G2
  136. /**************FONT*****************/
  137. // #define LUAT_USE_FONTS
  138. /**********U8G2&LCD&EINK FONT*************/
  139. // #define USE_U8G2_OPPOSANSM_ENGLISH 1
  140. // #define USE_U8G2_OPPOSANSM8_CHINESE
  141. // #define USE_U8G2_OPPOSANSM10_CHINESE
  142. // #define USE_U8G2_OPPOSANSM12_CHINESE
  143. // #define USE_U8G2_OPPOSANSM16_CHINESE
  144. // #define USE_U8G2_OPPOSANSM24_CHINESE
  145. // #define USE_U8G2_OPPOSANSM32_CHINESE
  146. // SARASA
  147. // #define USE_U8G2_SARASA_ENGLISH
  148. // #define USE_U8G2_SARASA_M8_CHINESE
  149. // #define USE_U8G2_SARASA_M10_CHINESE
  150. // #define USE_U8G2_SARASA_M12_CHINESE
  151. // #define USE_U8G2_SARASA_M14_CHINESE
  152. // #define USE_U8G2_SARASA_M16_CHINESE
  153. // #define USE_U8G2_SARASA_M18_CHINESE
  154. // #define USE_U8G2_SARASA_M20_CHINESE
  155. // #define USE_U8G2_SARASA_M22_CHINESE
  156. // #define USE_U8G2_SARASA_M24_CHINESE
  157. // #define USE_U8G2_SARASA_M26_CHINESE
  158. // #define USE_U8G2_SARASA_M28_CHINESE
  159. /**********LVGL FONT*************/
  160. // #define LV_FONT_OPPOSANS_M_8
  161. // #define LV_FONT_OPPOSANS_M_10
  162. // #define LV_FONT_OPPOSANS_M_12
  163. // #define LV_FONT_OPPOSANS_M_16
  164. // -------------------------------------
  165. // PSRAM
  166. // 需要外挂PSRAM芯片, 否则不要启用, 必死机
  167. // air101虽然支持psram,但与spi存在复用冲突
  168. // air103支持psram与spi同时使用,复用不冲突
  169. // #define LUAT_USE_PSRAM 1
  170. // LVGL推荐把部分方法放入内存, 按需采用
  171. // #define LV_ATTRIBUTE_FAST_MEM __attribute__((section (".ram_run")))
  172. // ROTABLE技术是节省内存的关键技术, 启用PSRAM后内存不缺, 禁用可提高性能
  173. // #define LUAT_CONF_DISABLE_ROTABLE 1
  174. //---------------------------------------
  175. //---------------------
  176. // LVGL
  177. // 主推的UI库, 功能强大但API繁琐
  178. // #define LUAT_USE_LVGL 1
  179. #define LUAT_USE_LVGL_INDEV 1 // 输入设备
  180. #define LUAT_USE_LVGL_ARC //圆弧 无依赖
  181. #define LUAT_USE_LVGL_BAR //进度条 无依赖
  182. #define LUAT_USE_LVGL_BTN //按钮 依赖容器CONT
  183. #define LUAT_USE_LVGL_BTNMATRIX //按钮矩阵 无依赖
  184. #define LUAT_USE_LVGL_CALENDAR //日历 无依赖
  185. #define LUAT_USE_LVGL_CANVAS //画布 依赖图片IMG
  186. #define LUAT_USE_LVGL_CHECKBOX //复选框 依赖按钮BTN 标签LABEL
  187. #define LUAT_USE_LVGL_CHART //图表 无依赖
  188. #define LUAT_USE_LVGL_CONT //容器 无依赖
  189. #define LUAT_USE_LVGL_CPICKER //颜色选择器 无依赖
  190. #define LUAT_USE_LVGL_DROPDOWN //下拉列表 依赖页面PAGE 标签LABEL
  191. #define LUAT_USE_LVGL_GAUGE //仪表 依赖进度条BAR 仪表(弧形刻度)LINEMETER
  192. #define LUAT_USE_LVGL_IMG //图片 依赖标签LABEL
  193. #define LUAT_USE_LVGL_IMGBTN //图片按钮 依赖按钮BTN
  194. #define LUAT_USE_LVGL_KEYBOARD //键盘 依赖图片按钮IMGBTN
  195. #define LUAT_USE_LVGL_LABEL //标签 无依赖
  196. #define LUAT_USE_LVGL_LED //LED 无依赖
  197. #define LUAT_USE_LVGL_LINE //线 无依赖
  198. #define LUAT_USE_LVGL_LIST //列表 依赖页面PAGE 按钮BTN 标签LABEL
  199. #define LUAT_USE_LVGL_LINEMETER //仪表(弧形刻度) 无依赖
  200. #define LUAT_USE_LVGL_OBJMASK //对象蒙版 无依赖
  201. #define LUAT_USE_LVGL_MSGBOX //消息框 依赖图片按钮IMGBTN 标签LABEL
  202. #define LUAT_USE_LVGL_PAGE //页面 依赖容器CONT
  203. #define LUAT_USE_LVGL_SPINNER //旋转器 依赖圆弧ARC 动画ANIM
  204. #define LUAT_USE_LVGL_ROLLER //滚筒 无依赖
  205. #define LUAT_USE_LVGL_SLIDER //滑杆 依赖进度条BAR
  206. #define LUAT_USE_LVGL_SPINBOX //数字调整框 无依赖
  207. #define LUAT_USE_LVGL_SWITCH //开关 依赖滑杆SLIDER
  208. #define LUAT_USE_LVGL_TEXTAREA //文本框 依赖标签LABEL 页面PAGE
  209. #define LUAT_USE_LVGL_TABLE //表格 依赖标签LABEL
  210. #define LUAT_USE_LVGL_TABVIEW //页签 依赖页面PAGE 图片按钮IMGBTN
  211. #define LUAT_USE_LVGL_TILEVIEW //平铺视图 依赖页面PAGE
  212. #define LUAT_USE_LVGL_WIN //窗口 依赖容器CONT 按钮BTN 标签LABEL 图片IMG 页面PAGE
  213. // 新字体系列
  214. // #define LUAT_FONTS_SARASA_BOLD_M8_CHINESE
  215. // #define LUAT_FONTS_SARASA_BOLD_M10_CHINESE
  216. // #define LUAT_FONTS_SARASA_BOLD_M12_CHINESE
  217. // #define LUAT_FONTS_SARASA_BOLD_M14_CHINESE
  218. // #define LUAT_FONTS_SARASA_BOLD_M16_CHINESE
  219. // #define LUAT_FONTS_SARASA_BOLD_M18_CHINESE
  220. // #define LUAT_FONTS_SARASA_BOLD_M20_CHINESE
  221. // #define LUAT_FONTS_SARASA_BOLD_M22_CHINESE
  222. // #define LUAT_FONTS_SARASA_BOLD_M24_CHINESE
  223. // #define LUAT_FONTS_SARASA_LIGHT_M8_CHINESE
  224. // #define LUAT_FONTS_SARASA_LIGHT_M10_CHINESE
  225. // #define LUAT_FONTS_SARASA_LIGHT_M12_CHINESE
  226. // #define LUAT_FONTS_SARASA_LIGHT_M14_CHINESE
  227. // #define LUAT_FONTS_SARASA_LIGHT_M16_CHINESE
  228. // #define LUAT_FONTS_SARASA_LIGHT_M18_CHINESE
  229. // #define LUAT_FONTS_SARASA_LIGHT_M20_CHINESE
  230. // #define LUAT_FONTS_SARASA_LIGHT_M22_CHINESE
  231. // #define LUAT_FONTS_SARASA_LIGHT_M24_CHINESE
  232. // #define LUAT_FONTS_SARASA_REGULAR_M8_CHINESE
  233. // #define LUAT_FONTS_SARASA_REGULAR_M10_CHINESE
  234. // #define LUAT_FONTS_SARASA_REGULAR_M12_CHINESE
  235. // #define LUAT_FONTS_SARASA_REGULAR_M14_CHINESE
  236. // #define LUAT_FONTS_SARASA_REGULAR_M16_CHINESE
  237. // #define LUAT_FONTS_SARASA_REGULAR_M18_CHINESE
  238. // #define LUAT_FONTS_SARASA_REGULAR_M20_CHINESE
  239. // #define LUAT_FONTS_SARASA_REGULAR_M22_CHINESE
  240. // #define LUAT_FONTS_SARASA_REGULAR_M24_CHINESE
  241. // #define LUAT_FONTS_SARASA_SEMIBOLD_M8_CHINESE
  242. // #define LUAT_FONTS_SARASA_SEMIBOLD_M10_CHINESE
  243. // #define LUAT_FONTS_SARASA_SEMIBOLD_M12_CHINESE
  244. // #define LUAT_FONTS_SARASA_SEMIBOLD_M14_CHINESE
  245. // #define LUAT_FONTS_SARASA_SEMIBOLD_M16_CHINESE
  246. // #define LUAT_FONTS_SARASA_SEMIBOLD_M18_CHINESE
  247. // #define LUAT_FONTS_SARASA_SEMIBOLD_M20_CHINESE
  248. // #define LUAT_FONTS_SARASA_SEMIBOLD_M22_CHINESE
  249. // #define LUAT_FONTS_SARASA_SEMIBOLD_M24_CHINESE
  250. // #define LUAT_FONTS_SARASA_EXTRALIGHT_M8_CHINESE
  251. // #define LUAT_FONTS_SARASA_EXTRALIGHT_M10_CHINESE
  252. // #define LUAT_FONTS_SARASA_EXTRALIGHT_M12_CHINESE
  253. // #define LUAT_FONTS_SARASA_EXTRALIGHT_M14_CHINESE
  254. // #define LUAT_FONTS_SARASA_EXTRALIGHT_M16_CHINESE
  255. // #define LUAT_FONTS_SARASA_EXTRALIGHT_M18_CHINESE
  256. // #define LUAT_FONTS_SARASA_EXTRALIGHT_M20_CHINESE
  257. // #define LUAT_FONTS_SARASA_EXTRALIGHT_M22_CHINESE
  258. // #define LUAT_FONTS_SARASA_EXTRALIGHT_M24_CHINESE
  259. // #define LUAT_FONTS_OPPO_BOLD_M8_CHINESE
  260. // #define LUAT_FONTS_OPPO_BOLD_M10_CHINESE
  261. // #define LUAT_FONTS_OPPO_BOLD_M12_CHINESE
  262. // #define LUAT_FONTS_OPPO_BOLD_M14_CHINESE
  263. // #define LUAT_FONTS_OPPO_BOLD_M16_CHINESE
  264. // #define LUAT_FONTS_OPPO_BOLD_M18_CHINESE
  265. // #define LUAT_FONTS_OPPO_BOLD_M20_CHINESE
  266. // #define LUAT_FONTS_OPPO_BOLD_M22_CHINESE
  267. // #define LUAT_FONTS_OPPO_BOLD_M24_CHINESE
  268. // #define LUAT_FONTS_OPPO_HEAVY_M8_CHINESE
  269. // #define LUAT_FONTS_OPPO_HEAVY_M10_CHINESE
  270. // #define LUAT_FONTS_OPPO_HEAVY_M12_CHINESE
  271. // #define LUAT_FONTS_OPPO_HEAVY_M14_CHINESE
  272. // #define LUAT_FONTS_OPPO_HEAVY_M16_CHINESE
  273. // #define LUAT_FONTS_OPPO_HEAVY_M18_CHINESE
  274. // #define LUAT_FONTS_OPPO_HEAVY_M20_CHINESE
  275. // #define LUAT_FONTS_OPPO_HEAVY_M22_CHINESE
  276. // #define LUAT_FONTS_OPPO_HEAVY_M24_CHINESE
  277. // #define LUAT_FONTS_OPPO_LIGHT_M8_CHINESE
  278. // #define LUAT_FONTS_OPPO_LIGHT_M10_CHINESE
  279. // #define LUAT_FONTS_OPPO_LIGHT_M12_CHINESE
  280. // #define LUAT_FONTS_OPPO_LIGHT_M14_CHINESE
  281. // #define LUAT_FONTS_OPPO_LIGHT_M16_CHINESE
  282. // #define LUAT_FONTS_OPPO_LIGHT_M18_CHINESE
  283. // #define LUAT_FONTS_OPPO_LIGHT_M20_CHINESE
  284. // #define LUAT_FONTS_OPPO_LIGHT_M22_CHINESE
  285. // #define LUAT_FONTS_OPPO_LIGHT_M24_CHINESE
  286. // #define LUAT_FONTS_OPPO_MEDIUM_M8_CHINESE
  287. // #define LUAT_FONTS_OPPO_MEDIUM_M10_CHINESE
  288. // #define LUAT_FONTS_OPPO_MEDIUM_M12_CHINESE
  289. // #define LUAT_FONTS_OPPO_MEDIUM_M14_CHINESE
  290. // #define LUAT_FONTS_OPPO_MEDIUM_M16_CHINESE
  291. // #define LUAT_FONTS_OPPO_MEDIUM_M18_CHINESE
  292. // #define LUAT_FONTS_OPPO_MEDIUM_M20_CHINESE
  293. // #define LUAT_FONTS_OPPO_MEDIUM_M22_CHINESE
  294. // #define LUAT_FONTS_OPPO_MEDIUM_M24_CHINESE
  295. // #define LUAT_FONTS_OPPO_REGULAR_M8_CHINESE
  296. // #define LUAT_FONTS_OPPO_REGULAR_M10_CHINESE
  297. // #define LUAT_FONTS_OPPO_REGULAR_M12_CHINESE
  298. // #define LUAT_FONTS_OPPO_REGULAR_M14_CHINESE
  299. // #define LUAT_FONTS_OPPO_REGULAR_M16_CHINESE
  300. // #define LUAT_FONTS_OPPO_REGULAR_M18_CHINESE
  301. // #define LUAT_FONTS_OPPO_REGULAR_M20_CHINESE
  302. // #define LUAT_FONTS_OPPO_REGULAR_M22_CHINESE
  303. // #define LUAT_FONTS_OPPO_REGULAR_M24_CHINESE
  304. //-------------------------------------------------------------------------------
  305. //<-- custom
  306. //------------------------------------------------------------------------------
  307. #ifdef AIR601
  308. #ifndef LUAT_USE_WLAN
  309. #define LUAT_USE_WLAN 1
  310. #endif
  311. #endif
  312. #if defined(LUAT_USE_WLAN) || defined(LUAT_USE_W5500)
  313. #ifndef LUAT_USE_NETWORK
  314. #define LUAT_USE_NETWORK
  315. #define LUAT_USE_DNS
  316. #endif
  317. #ifndef LUAT_USE_DNS
  318. #define LUAT_USE_DNS 1
  319. #endif
  320. #endif
  321. #ifdef LUAT_USE_WLAN
  322. #ifndef LUAT_USE_LWIP
  323. #define LUAT_USE_LWIP
  324. #endif
  325. #endif
  326. #ifdef LUAT_USE_W5500
  327. #ifndef LUAT_USE_DHCP
  328. #define LUAT_USE_DHCP
  329. #endif
  330. #endif
  331. #define LV_DISP_DEF_REFR_PERIOD 30
  332. #define LUAT_LV_DEBUG 0
  333. #define LV_MEM_CUSTOM 1
  334. #define FLASH_FS_REGION_SIZE (LUAT_FS_SIZE + LUAT_SCRIPT_SIZE)
  335. // 内存优化: 减少内存消耗, 会稍微减低性能
  336. // #define LUAT_USE_MEMORY_OPTIMIZATION_CODE_MMAP 1
  337. //----------------------------------
  338. // 使用VFS(虚拟文件系统)和内置库文件, 必须启用
  339. #define LUAT_USE_FS_VFS 1
  340. #define LUAT_USE_VFS_INLINE_LIB 1
  341. //----------------------------------
  342. #define LV_HOR_RES_MAX (160)
  343. #define LV_VER_RES_MAX (80)
  344. #define LV_COLOR_DEPTH 16
  345. #define LV_COLOR_16_SWAP 1
  346. #define LUAT_RET int
  347. #define LUAT_RT_RET_TYPE void
  348. #define LUAT_RT_CB_PARAM void *param
  349. // 单纯为了生成文档的宏
  350. #define LUAT_USE_PIN 1
  351. #define LUAT_GPIO_PIN_MAX (48)
  352. #define LUAT_CONF_SPI_HALF_DUPLEX_ONLY 1
  353. #ifdef LUAT_USE_SHELL
  354. #undef LUAT_USE_REPL
  355. #endif
  356. #ifdef LUAT_USE_MEDIA
  357. #ifndef LUAT_USE_I2S
  358. #define LUAT_USE_I2S 1
  359. #endif
  360. #endif
  361. #endif