USB modes cleanup (#5396)
[opentx.git] / radio / src / targets / common / arm / stm32 / CMakeLists.txt
bloba2c232e5a59c6ed58258ab8042830f6a06038903
1 set(LUA "NO" CACHE STRING "Lua scripts (YES/NO/NO_MODEL_SCRIPTS)")
2 set_property(CACHE LUA PROPERTY STRINGS YES NO NO_MODEL_SCRIPTS)
3 set(LUA_SCRIPT_LOAD_MODE "" CACHE STRING "Script loading mode and compilation flags [btTxcd] (see loadScript() API docs). Blank for default ('bt' on radio, 'T' on SIMU/DEBUG builds)")
4 option(LUA_COMPILER "Pre-compile and save Lua scripts" OFF)
5 option(LUA_ALLOCATOR_TRACER "Trace Lua memory (de)allocations to debug port (also needs DEBUG=YES NANO=NO)" OFF)
7 set(ARCH ARM)
8 set(STM32USB_DIR ${THIRDPARTY_DIR}/STM32_USB-Host-Device_Lib_V2.2.0/Libraries)
9 add_definitions(-DSTM32 -DLUA_INPUTS -DVARIO -DSBUS -DCROSSFIRE)
10 include_directories(${RADIO_SRC_DIRECTORY}/targets/common/arm/stm32)
11 include_directories(${STM32USB_DIR}/STM32_USB_OTG_Driver/inc)
12 include_directories(${STM32USB_DIR}/STM32_USB_Device_Library/Core/inc)
13 include_directories(${STM32USB_DIR}/STM32_USB_Device_Library/Class/msc/inc)
14 include_directories(${STM32USB_DIR}/STM32_USB_Device_Library/Class/hid/inc)
15 include_directories(${STM32USB_DIR}/STM32_USB_Device_Library/Class/cdc/inc)
16 include_directories(${STM32USB_DIR}/STM32_USB_Device_Library/Core/inc/)
17 include_directories(${STM32USB_DIR}/STM32_USB_OTG_Driver/inc)
18 set(STM32USB_SRC
19   STM32_USB_OTG_Driver/src/usb_core.c
20   STM32_USB_OTG_Driver/src/usb_dcd.c
21   STM32_USB_OTG_Driver/src/usb_dcd_int.c
22   STM32_USB_Device_Library/Core/src/usbd_core.c
23   STM32_USB_Device_Library/Core/src/usbd_ioreq.c
24   STM32_USB_Device_Library/Core/src/usbd_req.c
25   )
26 set(TARGET_SRC
27   ${TARGET_SRC}
28   ../common/arm/stm32/rtc_driver.cpp
29   ../common/arm/stm32/cpu_id.cpp
30   ${SERIAL2_DRIVER}
31   )
32 set(FIRMWARE_TARGET_SRC
33   ${FIRMWARE_TARGET_SRC}
34   ../common/arm/stm32/delays.cpp
35   ../common/arm/stm32/usb_bsp.c
36   ../common/arm/stm32/usbd_desc.c
37   ../common/arm/stm32/usbd_usr.cpp
38   ../common/arm/stm32/usb_driver.cpp
39   )
40 set(FIRMWARE_TARGET_SRC
41   ${FIRMWARE_TARGET_SRC}
42   ../common/arm/stm32/usbd_cdc.cpp
43   )
44 set(STM32USB_SRC
45   ${STM32USB_SRC}
46   STM32_USB_Device_Library/Class/cdc/src/usbd_cdc_core.c
47   )
48 set(STM32USB_SRC
49   ${STM32USB_SRC}
50   STM32_USB_Device_Library/Class/msc/src/usbd_msc_data.c
51   STM32_USB_Device_Library/Class/msc/src/usbd_msc_scsi.c
52   STM32_USB_Device_Library/Class/msc/src/usbd_msc_bot.c
53   STM32_USB_Device_Library/Class/msc/src/usbd_msc_core.c
54   )
55 set(FIRMWARE_TARGET_SRC
56   ${FIRMWARE_TARGET_SRC}
57   ../common/arm/stm32/usbd_storage_msd.cpp
58   )
59 set(FIRMWARE_TARGET_SRC
60   ${FIRMWARE_TARGET_SRC}
61   ../common/arm/stm32/usbd_hid_joystick.c
62   )
63 if(GVARS)
64   set(GUI_SRC
65     ${GUI_SRC}
66     ${GVAR_SCREEN}
67     )
68 endif()
69 set(FIRMWARE_SRC
70   ${FIRMWARE_SRC}
71   serial.cpp
72   syscalls.c
73   )
74 foreach(FILE ${STM32LIB_SRC})
75   set(FIRMWARE_SRC
76     ${FIRMWARE_SRC}
77     ${STM32LIB_DIR}/${FILE}
78     )
79 endforeach()
80 foreach(FILE ${STM32USB_SRC})
81   set(FIRMWARE_SRC
82     ${FIRMWARE_SRC}
83     ${STM32USB_DIR}/${FILE}
84     )
85 endforeach()
86 set(SRC
87   ${SRC}
88   sbus.cpp
89   telemetry/crossfire.cpp
90   io/bootloader_flash.cpp
91   )
92 set(PULSES_SRC
93   ${PULSES_SRC}
94   crossfire.cpp
95   )