S&B Volcano vaporizer remote control with Pi Pico W
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

CMakeLists.txt 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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. # TODO should use C version instead of Perl script, for
  26. # TODO added file compression. but how to compile it?
  27. set(MAKE_FS_DATA_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/pico-sdk/lib/lwip/src/apps/http/makefsdata/makefsdata)
  28. execute_process(
  29. COMMAND perl ${MAKE_FS_DATA_SCRIPT}
  30. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  31. ECHO_OUTPUT_VARIABLE
  32. ECHO_ERROR_VARIABLE
  33. )
  34. file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/fsdata.c ${CMAKE_CURRENT_BINARY_DIR}/httpd_fsdata.c)
  35. # initialize pico-sdk from submodule
  36. include(pico-sdk/pico_sdk_init.cmake)
  37. project(gadget C CXX)
  38. set(CMAKE_C_STANDARD 11)
  39. set(CMAKE_CXX_STANDARD 17)
  40. # initialize the Raspberry Pi Pico SDK
  41. pico_sdk_init()
  42. # copy FatFS source files to build dir, so we can use our own ffconf.h
  43. configure_file(
  44. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ff.c
  45. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.c
  46. COPYONLY
  47. )
  48. configure_file(
  49. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ff.h
  50. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.h
  51. COPYONLY
  52. )
  53. configure_file(
  54. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/diskio.h
  55. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/diskio.h
  56. COPYONLY
  57. )
  58. configure_file(
  59. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ffunicode.c
  60. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ffunicode.c
  61. COPYONLY
  62. )
  63. add_executable(gadget)
  64. target_sources(gadget PUBLIC
  65. src/main.c
  66. src/console.c
  67. src/log.c
  68. src/util.c
  69. src/usb.c
  70. src/usb_cdc.c
  71. src/usb_descriptors.c
  72. src/usb_msc.c
  73. src/fat_disk.c
  74. src/debug_disk.c
  75. src/buttons.c
  76. src/lipo.c
  77. src/ble.c
  78. src/lcd.c
  79. src/text.c
  80. src/image.c
  81. src/state.c
  82. src/volcano.c
  83. src/serial.c
  84. src/ring.c
  85. src/models.c
  86. src/state_scan.c
  87. src/workflow.c
  88. src/menu.c
  89. src/state_workflow.c
  90. src/state_volcano_run.c
  91. src/crafty.c
  92. src/state_crafty.c
  93. src/mem.c
  94. src/state_edit_workflow.c
  95. src/workflow_default.c
  96. src/state_settings.c
  97. src/state_about.c
  98. src/state_value.c
  99. src/textbox.c
  100. src/state_volcano_conf.c
  101. src/wifi.c
  102. src/venty.c
  103. src/state_venty.c
  104. src/state_wifi.c
  105. src/state_wifi_edit.c
  106. src/state_string.c
  107. src/http.c
  108. src/cache.c
  109. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.c
  110. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ffunicode.c
  111. st7789/src/driver_st7789.c
  112. mcufont/decoder/mf_encoding.c
  113. mcufont/decoder/mf_font.c
  114. mcufont/decoder/mf_justify.c
  115. mcufont/decoder/mf_kerning.c
  116. mcufont/decoder/mf_rlefont.c
  117. mcufont/decoder/mf_bwfont.c
  118. mcufont/decoder/mf_scaledfont.c
  119. mcufont/decoder/mf_wordwrap.c
  120. picowota/dhcpserver/dhcpserver.c
  121. )
  122. # external dependency include directories
  123. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/conf)
  124. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
  125. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/fatfs)
  126. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/st7789/src)
  127. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/st7789/interface)
  128. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/mcufont/decoder)
  129. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/data)
  130. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/build)
  131. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
  132. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/picowota/dhcpserver)
  133. # compress source code and stuff we want to include
  134. add_custom_target(pack bash -c "./pack_data.sh ${CMAKE_CURRENT_BINARY_DIR}"
  135. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  136. BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/fat_fs.o"
  137. )
  138. add_dependencies(gadget pack)
  139. # enable generous warnings
  140. target_compile_options(gadget PUBLIC
  141. -Wall
  142. -Wextra
  143. -Werror
  144. )
  145. # suppress some warnings for borked 3rd party files in Pico SDK
  146. set_source_files_properties(pico-sdk/lib/btstack/src/ble/sm.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  147. set_source_files_properties(pico-sdk/lib/btstack/src/btstack_hid_parser.c PROPERTIES COMPILE_FLAGS -Wno-maybe-uninitialized)
  148. set_source_files_properties(pico-sdk/src/rp2_common/pico_cyw43_driver/cyw43_driver.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  149. set_source_files_properties(pico-sdk/lib/btstack/src/classic/avdtp_util.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  150. set_source_files_properties(pico-sdk/lib/btstack/src/classic/goep_client.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  151. set_source_files_properties(pico-sdk/lib/btstack/src/classic/goep_server.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  152. # pull in common dependencies
  153. target_link_libraries(gadget
  154. pico_stdlib
  155. pico_unique_id
  156. tinyusb_device
  157. tinyusb_board
  158. hardware_spi
  159. hardware_adc
  160. hardware_gpio
  161. hardware_pwm
  162. pico_btstack_ble
  163. pico_btstack_cyw43
  164. pico_cyw43_arch_lwip_threadsafe_background
  165. hardware_flash
  166. pico_flash
  167. picowota_reboot
  168. pico_lwip_http
  169. )
  170. pico_set_linker_script(gadget ${CMAKE_CURRENT_SOURCE_DIR}/conf/memmap_custom.ld)
  171. # fix for Errata RP2040-E5 (the fix requires use of GPIO 15)
  172. target_compile_definitions(gadget PUBLIC PICO_RP2040_USB_DEVICE_ENUMERATION_FIX=1)
  173. set(PICOWOTA_WIFI_SSID "WIFI_SSID_HERE")
  174. set(PICOWOTA_WIFI_PASS "WIFI_PASS_HERE")
  175. set(PICOWOTA_WIFI_AP 0)
  176. target_compile_definitions(gadget PUBLIC
  177. RUNNING_AS_CLIENT=1
  178. DEFAULT_WIFI_SSID="${PICOWOTA_WIFI_SSID}"
  179. DEFAULT_WIFI_PASS="${PICOWOTA_WIFI_PASS}"
  180. CYW43_HOST_NAME="pico-volcano"
  181. )
  182. set(PICOWOTA_ADDITIONAL_SOURCES
  183. ${CMAKE_CURRENT_SOURCE_DIR}/src/wifi.c
  184. ${CMAKE_CURRENT_SOURCE_DIR}/src/lcd.c
  185. ${CMAKE_CURRENT_SOURCE_DIR}/src/log.c
  186. ${CMAKE_CURRENT_SOURCE_DIR}/src/mem.c
  187. ${CMAKE_CURRENT_SOURCE_DIR}/src/ring.c
  188. ${CMAKE_CURRENT_SOURCE_DIR}/src/textbox.c
  189. ${CMAKE_CURRENT_SOURCE_DIR}/src/text.c
  190. ${CMAKE_CURRENT_SOURCE_DIR}/src/ota_shim.c
  191. ${CMAKE_CURRENT_SOURCE_DIR}/src/workflow_default.c
  192. ${CMAKE_CURRENT_SOURCE_DIR}/src/buttons.c
  193. ${CMAKE_CURRENT_SOURCE_DIR}/src/util.c
  194. ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
  195. ${CMAKE_CURRENT_SOURCE_DIR}/st7789/src/driver_st7789.c
  196. ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/decoder/mf_encoding.c
  197. ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/decoder/mf_font.c
  198. ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/decoder/mf_justify.c
  199. ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/decoder/mf_kerning.c
  200. ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/decoder/mf_rlefont.c
  201. ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/decoder/mf_bwfont.c
  202. ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/decoder/mf_scaledfont.c
  203. ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/decoder/mf_wordwrap.c
  204. )
  205. set(PICOWOTA_ADDITIONAL_INCLUDES
  206. ${CMAKE_CURRENT_SOURCE_DIR}/include
  207. ${CMAKE_CURRENT_SOURCE_DIR}/conf
  208. ${CMAKE_CURRENT_SOURCE_DIR}/data
  209. ${CMAKE_CURRENT_SOURCE_DIR}/st7789/src
  210. ${CMAKE_CURRENT_SOURCE_DIR}/st7789/interface
  211. ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/decoder
  212. ${CMAKE_CURRENT_BINARY_DIR}/fatfs
  213. ${CMAKE_CURRENT_SOURCE_DIR}/pico-sdk/src/rp2_common/pico_btstack/include
  214. ${CMAKE_CURRENT_SOURCE_DIR}/pico-sdk/lib/btstack/platform/embedded
  215. )
  216. set(PICOWOTA_ADDITIONAL_LIBS
  217. hardware_spi
  218. hardware_pwm
  219. hardware_flash
  220. pico_flash
  221. )
  222. add_subdirectory(picowota)
  223. picowota_build_combined(gadget)