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 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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_volcano_workflow.c
  79. src/state_volcano_run.c
  80. src/crafty.c
  81. src/state_crafty.c
  82. src/mem.c
  83. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.c
  84. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ffunicode.c
  85. st7789/src/driver_st7789.c
  86. mcufont/decoder/mf_encoding.c
  87. mcufont/decoder/mf_font.c
  88. mcufont/decoder/mf_justify.c
  89. mcufont/decoder/mf_kerning.c
  90. mcufont/decoder/mf_rlefont.c
  91. mcufont/decoder/mf_bwfont.c
  92. mcufont/decoder/mf_scaledfont.c
  93. mcufont/decoder/mf_wordwrap.c
  94. )
  95. # external dependency include directories
  96. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
  97. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/fatfs)
  98. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/st7789/src)
  99. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/st7789/interface)
  100. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/mcufont/decoder)
  101. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/mcufont/fonts)
  102. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/build)
  103. # compress source code and stuff we want to include
  104. add_custom_target(pack bash -c "./pack_data.sh"
  105. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  106. BYPRODUCTS "build/pack_data.h"
  107. )
  108. add_dependencies(gadget pack)
  109. # enable generous warnings
  110. target_compile_options(gadget PUBLIC
  111. -Wall
  112. -Wextra
  113. -Werror
  114. )
  115. # suppress some warnings for borked 3rd party files in Pico SDK
  116. set_source_files_properties(pico-sdk/lib/btstack/src/ble/sm.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  117. set_source_files_properties(pico-sdk/lib/btstack/src/btstack_hid_parser.c PROPERTIES COMPILE_FLAGS -Wno-maybe-uninitialized)
  118. set_source_files_properties(pico-sdk/src/rp2_common/pico_cyw43_driver/cyw43_driver.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  119. set_source_files_properties(pico-sdk/lib/btstack/src/classic/avdtp_util.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  120. set_source_files_properties(pico-sdk/lib/btstack/src/classic/goep_client.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  121. set_source_files_properties(pico-sdk/lib/btstack/src/classic/goep_server.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  122. # pull in common dependencies
  123. target_link_libraries(gadget
  124. pico_stdlib
  125. pico_unique_id
  126. tinyusb_device
  127. tinyusb_board
  128. hardware_spi
  129. hardware_adc
  130. hardware_gpio
  131. hardware_pwm
  132. pico_btstack_ble
  133. pico_btstack_cyw43
  134. pico_cyw43_arch_threadsafe_background
  135. hardware_flash
  136. pico_flash
  137. )
  138. target_compile_definitions(gadget PUBLIC
  139. RUNNING_AS_CLIENT=1
  140. CYW43_LWIP=0
  141. )
  142. # fix for Errata RP2040-E5 (the fix requires use of GPIO 15)
  143. target_compile_definitions(gadget PUBLIC PICO_RP2040_USB_DEVICE_ENUMERATION_FIX=1)
  144. # create map/bin/hex/uf2 file etc.
  145. pico_add_extra_outputs(gadget)