S&B Volcano vaporizer remote control with Pi Pico W
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

CMakeLists.txt 7.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. # ----------------------------------------------------------------------------
  2. # Copyright (c) 2023 Thomas Buck (thomas@xythobuz.de)
  3. #
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # See <http://www.gnu.org/licenses/>.
  15. # ----------------------------------------------------------------------------
  16. cmake_minimum_required(VERSION 3.13)
  17. # build MCUFont encoder host tool and convert included example fonts
  18. execute_process(COMMAND make
  19. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/encoder
  20. )
  21. execute_process(COMMAND make
  22. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/fonts
  23. )
  24. # build lwip httpd fs
  25. set(MAKE_FS_DATA_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/pico-sdk/lib/lwip/src/apps/http/makefsdata/makefsdata)
  26. execute_process(
  27. COMMAND perl ${MAKE_FS_DATA_SCRIPT}
  28. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  29. ECHO_OUTPUT_VARIABLE
  30. ECHO_ERROR_VARIABLE
  31. )
  32. file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/fsdata.c ${CMAKE_CURRENT_BINARY_DIR}/httpd_fsdata.c)
  33. # initialize pico-sdk from submodule
  34. include(pico-sdk/pico_sdk_init.cmake)
  35. project(gadget C CXX)
  36. set(CMAKE_C_STANDARD 11)
  37. set(CMAKE_CXX_STANDARD 17)
  38. # initialize the Raspberry Pi Pico SDK
  39. pico_sdk_init()
  40. # copy FatFS source files to build dir, so we can use our own ffconf.h
  41. configure_file(
  42. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ff.c
  43. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.c
  44. COPYONLY
  45. )
  46. configure_file(
  47. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ff.h
  48. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.h
  49. COPYONLY
  50. )
  51. configure_file(
  52. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/diskio.h
  53. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/diskio.h
  54. COPYONLY
  55. )
  56. configure_file(
  57. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ffunicode.c
  58. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ffunicode.c
  59. COPYONLY
  60. )
  61. add_executable(gadget)
  62. target_sources(gadget PUBLIC
  63. src/main.c
  64. src/console.c
  65. src/log.c
  66. src/util.c
  67. src/usb.c
  68. src/usb_cdc.c
  69. src/usb_descriptors.c
  70. src/usb_msc.c
  71. src/fat_disk.c
  72. src/debug_disk.c
  73. src/buttons.c
  74. src/lipo.c
  75. src/ble.c
  76. src/lcd.c
  77. src/text.c
  78. src/image.c
  79. src/state.c
  80. src/volcano.c
  81. src/serial.c
  82. src/ring.c
  83. src/models.c
  84. src/state_scan.c
  85. src/workflow.c
  86. src/menu.c
  87. src/state_workflow.c
  88. src/state_volcano_run.c
  89. src/crafty.c
  90. src/state_crafty.c
  91. src/mem.c
  92. src/state_edit_workflow.c
  93. src/workflow_default.c
  94. src/state_settings.c
  95. src/state_about.c
  96. src/state_value.c
  97. src/textbox.c
  98. src/state_volcano_conf.c
  99. src/wifi.c
  100. src/venty.c
  101. src/state_venty.c
  102. src/state_wifi.c
  103. src/state_wifi_edit.c
  104. src/state_string.c
  105. src/http.c
  106. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.c
  107. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ffunicode.c
  108. st7789/src/driver_st7789.c
  109. mcufont/decoder/mf_encoding.c
  110. mcufont/decoder/mf_font.c
  111. mcufont/decoder/mf_justify.c
  112. mcufont/decoder/mf_kerning.c
  113. mcufont/decoder/mf_rlefont.c
  114. mcufont/decoder/mf_bwfont.c
  115. mcufont/decoder/mf_scaledfont.c
  116. mcufont/decoder/mf_wordwrap.c
  117. )
  118. # external dependency include directories
  119. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/conf)
  120. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
  121. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/fatfs)
  122. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/st7789/src)
  123. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/st7789/interface)
  124. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/mcufont/decoder)
  125. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/data)
  126. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/build)
  127. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
  128. # compress source code and stuff we want to include
  129. add_custom_target(pack bash -c "./pack_data.sh"
  130. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  131. BYPRODUCTS "build/pack_data.h"
  132. )
  133. add_dependencies(gadget pack)
  134. # enable generous warnings
  135. target_compile_options(gadget PUBLIC
  136. -Wall
  137. -Wextra
  138. -Werror
  139. )
  140. # suppress some warnings for borked 3rd party files in Pico SDK
  141. set_source_files_properties(pico-sdk/lib/btstack/src/ble/sm.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  142. set_source_files_properties(pico-sdk/lib/btstack/src/btstack_hid_parser.c PROPERTIES COMPILE_FLAGS -Wno-maybe-uninitialized)
  143. set_source_files_properties(pico-sdk/src/rp2_common/pico_cyw43_driver/cyw43_driver.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  144. set_source_files_properties(pico-sdk/lib/btstack/src/classic/avdtp_util.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  145. set_source_files_properties(pico-sdk/lib/btstack/src/classic/goep_client.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  146. set_source_files_properties(pico-sdk/lib/btstack/src/classic/goep_server.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  147. # suppress warnings for BittyHTTP
  148. set_source_files_properties(BittyHTTP/src/WebServer.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare -Wno-unused-parameter -Wno-maybe-uninitialized")
  149. # pull in common dependencies
  150. target_link_libraries(gadget
  151. pico_stdlib
  152. pico_unique_id
  153. tinyusb_device
  154. tinyusb_board
  155. hardware_spi
  156. hardware_adc
  157. hardware_gpio
  158. hardware_pwm
  159. pico_btstack_ble
  160. pico_btstack_cyw43
  161. pico_cyw43_arch_lwip_threadsafe_background
  162. hardware_flash
  163. pico_flash
  164. picowota_reboot
  165. pico_lwip_http
  166. )
  167. pico_set_linker_script(gadget ${CMAKE_CURRENT_SOURCE_DIR}/conf/memmap_custom.ld)
  168. # fix for Errata RP2040-E5 (the fix requires use of GPIO 15)
  169. target_compile_definitions(gadget PUBLIC PICO_RP2040_USB_DEVICE_ENUMERATION_FIX=1)
  170. set(PICOWOTA_WIFI_SSID "WIFI_SSID_HERE")
  171. set(PICOWOTA_WIFI_PASS "WIFI_PASS_HERE")
  172. set(PICOWOTA_WIFI_AP 0)
  173. target_compile_definitions(gadget PUBLIC
  174. RUNNING_AS_CLIENT=1
  175. DEFAULT_WIFI_SSID="${PICOWOTA_WIFI_SSID}"
  176. DEFAULT_WIFI_PASS="${PICOWOTA_WIFI_PASS}"
  177. CYW43_HOST_NAME="pico-volcano"
  178. )
  179. set(PICOWOTA_ADDITIONAL_SOURCES
  180. ${CMAKE_CURRENT_SOURCE_DIR}/src/wifi.c
  181. ${CMAKE_CURRENT_SOURCE_DIR}/src/lcd.c
  182. ${CMAKE_CURRENT_SOURCE_DIR}/src/log.c
  183. ${CMAKE_CURRENT_SOURCE_DIR}/src/mem.c
  184. ${CMAKE_CURRENT_SOURCE_DIR}/src/ring.c
  185. ${CMAKE_CURRENT_SOURCE_DIR}/src/textbox.c
  186. ${CMAKE_CURRENT_SOURCE_DIR}/src/text.c
  187. ${CMAKE_CURRENT_SOURCE_DIR}/src/ota_shim.c
  188. ${CMAKE_CURRENT_SOURCE_DIR}/src/workflow_default.c
  189. ${CMAKE_CURRENT_SOURCE_DIR}/st7789/src/driver_st7789.c
  190. ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/decoder/mf_encoding.c
  191. ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/decoder/mf_font.c
  192. ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/decoder/mf_justify.c
  193. ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/decoder/mf_kerning.c
  194. ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/decoder/mf_rlefont.c
  195. ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/decoder/mf_bwfont.c
  196. ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/decoder/mf_scaledfont.c
  197. ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/decoder/mf_wordwrap.c
  198. )
  199. set(PICOWOTA_ADDITIONAL_INCLUDES
  200. ${CMAKE_CURRENT_SOURCE_DIR}/include
  201. ${CMAKE_CURRENT_SOURCE_DIR}/conf
  202. ${CMAKE_CURRENT_SOURCE_DIR}/data
  203. ${CMAKE_CURRENT_SOURCE_DIR}/st7789/src
  204. ${CMAKE_CURRENT_SOURCE_DIR}/st7789/interface
  205. ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/decoder
  206. ${CMAKE_CURRENT_BINARY_DIR}/fatfs
  207. ${CMAKE_CURRENT_SOURCE_DIR}/pico-sdk/src/rp2_common/pico_btstack/include
  208. ${CMAKE_CURRENT_SOURCE_DIR}/pico-sdk/lib/btstack/platform/embedded
  209. )
  210. set(PICOWOTA_ADDITIONAL_LIBS
  211. hardware_spi
  212. hardware_pwm
  213. hardware_flash
  214. pico_flash
  215. )
  216. add_subdirectory(picowota)
  217. picowota_build_combined(gadget)