S&B Volcano vaporizer remote control with Pi Pico W
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

CMakeLists.txt 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. # initialize pico-sdk from submodule
  25. include(pico-sdk/pico_sdk_init.cmake)
  26. project(gadget C CXX)
  27. set(CMAKE_C_STANDARD 11)
  28. set(CMAKE_CXX_STANDARD 17)
  29. # initialize the Raspberry Pi Pico SDK
  30. pico_sdk_init()
  31. # copy FatFS source files to build dir, so we can use our own ffconf.h
  32. configure_file(
  33. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ff.c
  34. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.c
  35. COPYONLY
  36. )
  37. configure_file(
  38. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ff.h
  39. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.h
  40. COPYONLY
  41. )
  42. configure_file(
  43. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/diskio.h
  44. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/diskio.h
  45. COPYONLY
  46. )
  47. configure_file(
  48. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ffunicode.c
  49. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ffunicode.c
  50. COPYONLY
  51. )
  52. add_executable(gadget)
  53. target_sources(gadget PUBLIC
  54. src/main.c
  55. src/console.c
  56. src/log.c
  57. src/util.c
  58. src/usb.c
  59. src/usb_cdc.c
  60. src/usb_descriptors.c
  61. src/usb_msc.c
  62. src/fat_disk.c
  63. src/debug_disk.c
  64. src/buttons.c
  65. src/lipo.c
  66. src/ble.c
  67. src/lcd.c
  68. src/text.c
  69. src/image.c
  70. src/state.c
  71. src/volcano.c
  72. src/serial.c
  73. src/ring.c
  74. src/models.c
  75. src/state_scan.c
  76. src/workflow.c
  77. src/menu.c
  78. src/state_workflow.c
  79. src/state_volcano_run.c
  80. src/crafty.c
  81. src/state_crafty.c
  82. src/mem.c
  83. src/state_edit_workflow.c
  84. src/workflow_default.c
  85. src/state_settings.c
  86. src/state_about.c
  87. src/state_value.c
  88. src/textbox.c
  89. src/state_volcano_conf.c
  90. src/wifi.c
  91. src/venty.c
  92. src/state_venty.c
  93. src/state_wifi.c
  94. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.c
  95. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ffunicode.c
  96. st7789/src/driver_st7789.c
  97. mcufont/decoder/mf_encoding.c
  98. mcufont/decoder/mf_font.c
  99. mcufont/decoder/mf_justify.c
  100. mcufont/decoder/mf_kerning.c
  101. mcufont/decoder/mf_rlefont.c
  102. mcufont/decoder/mf_bwfont.c
  103. mcufont/decoder/mf_scaledfont.c
  104. mcufont/decoder/mf_wordwrap.c
  105. )
  106. # external dependency include directories
  107. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
  108. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/fatfs)
  109. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/st7789/src)
  110. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/st7789/interface)
  111. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/mcufont/decoder)
  112. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/data)
  113. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/build)
  114. # compress source code and stuff we want to include
  115. add_custom_target(pack bash -c "./pack_data.sh"
  116. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  117. BYPRODUCTS "build/pack_data.h"
  118. )
  119. add_dependencies(gadget pack)
  120. # enable generous warnings
  121. target_compile_options(gadget PUBLIC
  122. -Wall
  123. -Wextra
  124. -Werror
  125. )
  126. # suppress some warnings for borked 3rd party files in Pico SDK
  127. set_source_files_properties(pico-sdk/lib/btstack/src/ble/sm.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  128. set_source_files_properties(pico-sdk/lib/btstack/src/btstack_hid_parser.c PROPERTIES COMPILE_FLAGS -Wno-maybe-uninitialized)
  129. set_source_files_properties(pico-sdk/src/rp2_common/pico_cyw43_driver/cyw43_driver.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  130. set_source_files_properties(pico-sdk/lib/btstack/src/classic/avdtp_util.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  131. set_source_files_properties(pico-sdk/lib/btstack/src/classic/goep_client.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  132. set_source_files_properties(pico-sdk/lib/btstack/src/classic/goep_server.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  133. # pull in common dependencies
  134. target_link_libraries(gadget
  135. pico_stdlib
  136. pico_unique_id
  137. tinyusb_device
  138. tinyusb_board
  139. hardware_spi
  140. hardware_adc
  141. hardware_gpio
  142. hardware_pwm
  143. pico_btstack_ble
  144. pico_btstack_cyw43
  145. pico_cyw43_arch_lwip_threadsafe_background
  146. hardware_flash
  147. pico_flash
  148. picowota_reboot
  149. )
  150. pico_set_linker_script(gadget ${CMAKE_CURRENT_SOURCE_DIR}/src/memmap_custom.ld)
  151. # fix for Errata RP2040-E5 (the fix requires use of GPIO 15)
  152. target_compile_definitions(gadget PUBLIC PICO_RP2040_USB_DEVICE_ENUMERATION_FIX=1)
  153. set(PICOWOTA_WIFI_SSID "WIFI_SSID_HERE")
  154. set(PICOWOTA_WIFI_PASS "WIFI_PASS_HERE")
  155. set(PICOWOTA_WIFI_AP 0)
  156. target_compile_definitions(gadget PUBLIC
  157. RUNNING_AS_CLIENT=1
  158. DEFAULT_WIFI_SSID="${PICOWOTA_WIFI_SSID}"
  159. DEFAULT_WIFI_PASS="${PICOWOTA_WIFI_PASS}"
  160. )
  161. add_subdirectory(picowota)
  162. picowota_build_combined(gadget)