1 include(CMakeForceCompiler)
4 set(PCB_TYPES X9LITE X9LITES X7 XLITE XLITES X9D X9D+ X9E X10 X12S SKY9X 9XRPRO AR9X)
5 set(GUI_LANGUAGES CZ DE EN ES FR IT PT SK SE PL HU NL)
6 set(TTS_LANGUAGES CZ DE EN ES FR IT PT SK SE PL HU NL RU)
8 set(PCB "X9D+" CACHE STRING "Radio type, one of: ${PCB_TYPES}")
9 set_property(CACHE PCB PROPERTY STRINGS ${PCB_TYPES})
10 set(TRANSLATIONS "EN" CACHE STRING "Radio language, one of: ${GUI_LANGUAGES}")
11 set_property(CACHE TRANSLATIONS PROPERTY STRINGS ${GUI_LANGUAGES})
12 set(SPLASH "DEFAULT" CACHE STRING "Splash (DEFAULT/OFF/FRSKY)")
13 set_property(CACHE SPLASH PROPERTY STRINGS DEFAULT OFF FRSKY)
14 set(PPM_UNIT "PERCENT_PREC1" CACHE STRING "PPM display unit (US/PERCENT_PREC1/PERCENT_PREC0)")
15 set_property(CACHE PPM_UNIT PROPERTY STRINGS US PERCENT_PREC1 PERCENT_PREC0)
16 set(DEFAULT_MODE "" CACHE STRING "Default sticks mode")
17 set(FONT "STD" CACHE STRING "Choose font : STD or SQT5")
18 set_property(CACHE FONT PROPERTY STRINGS SQT5)
19 set(POPUP_LEVEL 2 CACHE STRING "Popup level")
21 option(HELI "Heli menu" ON)
22 option(FLIGHT_MODES "Flight Modes" ON)
23 option(CURVES "Curves" ON)
24 option(GVARS "Global variables" ON)
25 option(GUI "GUI enabled" ON)
26 option(PPM_CENTER_ADJUSTABLE "PPM center adjustable" ON)
27 option(PPM_LIMITS_SYMETRICAL "PPM limits symetrical" OFF)
28 option(OVERRIDE_CHANNEL_FUNCTION "OverrideChannel function available" ON)
29 option(DANGEROUS_MODULE_FUNCTIONS "Dangerous module functions (RangeCheck / Bind / Module OFF, etc.) available" OFF)
30 option(FAI "Competition mode (no telemetry)" OFF)
31 option(AUTOSOURCE "Automatic source detection in menus" ON)
32 option(AUTOSWITCH "Automatic switch detection in menus" ON)
33 option(SEMIHOSTING "Enable debugger semihosting" OFF)
34 option(JITTER_MEASURE "Enable ADC jitter measurement" OFF)
35 option(WATCHDOG "Enable hardware Watchdog" ON)
36 option(ASTERISK "Enable asterisk icon (test only firmware)" OFF)
38 option(SIMU_AUDIO "Enable simulator audio." ON)
40 option(LUA "Enable LUA support" ON)
41 option(SIMU_DISKIO "Enable disk IO simulation in simulator. Simulator will use FatFs module and simulated IO layer that uses \"./sdcard.image\" file as image of SD card. This file must contain whole SD card from first to last sector" OFF)
42 option(SIMU_LUA_COMPILER "Pre-compile and save Lua scripts in simulator." ON)
43 option(FAS_PROTOTYPE "Support of old FAS prototypes (different resistors)" OFF)
44 option(RAS "RAS (SWR) enabled" ON)
45 option(TEMPLATES "Model templates menu" OFF)
46 option(TRACE_SIMPGMSPACE "Turn on traces in simpgmspace.cpp" ON)
47 option(TRACE_LUA_INTERNALS "Turn on traces for Lua internals" OFF)
48 option(FRSKY_STICKS "Reverse sticks for FrSky sticks" OFF)
49 option(NANO "Use nano newlib and binalloc")
50 option(NIGHTLY_BUILD_WARNING "Warn this is a nightly build" OFF)
51 option(MODULE_PROTOCOL_FCC "Add support for FCC modules" ON)
52 option(MODULE_PROTOCOL_LBT "Add support for EU/LBT modules" ON)
53 option(MODULE_PROTOCOL_FLEX "Add support for non certified FLEX modules" OFF)
54 option(MODULE_PROTOCOL_D8 "Add support for D8 modules" ON)
55 option(FRSKY_RELEASE "Used to build FrSky released firmware" OFF)
57 # since we reset all default CMAKE compiler flags for firmware builds, provide an alternate way for user to specify additional flags.
58 set(FIRMWARE_C_FLAGS "" CACHE STRING "Additional flags for firmware target c compiler (note: all CMAKE_C_FLAGS[_*] are ignored for firmware/bootloader).")
59 set(FIRMWARE_C_FLAGS_DEBUG "-g" CACHE STRING "Additional flags for firmware target (Debug config) c compiler (note: CMAKE_C_FLAGS_DEBUG is ignored for firmware/bootloader).")
60 set(FIRMWARE_CXX_FLAGS "" CACHE STRING "Additional flags for firmware target c++ compiler (note: all CMAKE_CXX_FLAGS[_*] are ignored for firmware/bootloader).")
61 set(FIRMWARE_CXX_FLAGS_DEBUG "-g" CACHE STRING "Additional flags for firmware target (Debug config) c++ compiler (note: CMAKE_CXX_FLAGS_DEBUG is ignored for firmware/bootloader).")
63 set(THIRDPARTY_DIR thirdparty)
64 set(LUA_DIR ${THIRDPARTY_DIR}/Lua/src)
65 set(COOS_DIR ${THIRDPARTY_DIR}/CoOS)
66 set(FATFS_DIR ${THIRDPARTY_DIR}/FatFs)
67 set(RADIO_BIN_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
69 configure_file(stamp.h.in stamp.h @ONLY)
71 add_subdirectory(translations)
72 add_subdirectory(bitmaps)
73 add_subdirectory(fonts)
80 set(RADIO_DEPENDENCIES firmware_translations)
84 ${FATFS_DIR}/fattime.c
85 ${FATFS_DIR}/option/ccsbcs.c
88 if(PCB STREQUAL X12S OR PCB STREQUAL X10)
89 include(targets/horus/CMakeLists.txt)
90 elseif(PCB STREQUAL X9E OR PCB STREQUAL X9D+ OR PCB STREQUAL X9D OR PCB STREQUAL X7 OR PCB STREQUAL X9LITE OR PCB STREQUAL X9LITES OR PCB STREQUAL XLITE OR PCB STREQUAL XLITES)
91 include(targets/taranis/CMakeLists.txt)
92 elseif(PCB STREQUAL SKY9X OR PCB STREQUAL 9XRPRO OR PCB STREQUAL AR9X)
93 include(targets/sky9x/CMakeLists.txt)
95 message(FATAL_ERROR "Unknown PCB '${PCB}'")
98 if(NOT PCB STREQUAL 9XRPRO)
99 option(DBLKEYS "Double Keys" ON)
101 add_definitions(-DDBLKEYS)
105 if(CPU_TYPE STREQUAL STM32F4)
106 include(targets/common/arm/stm32/f4/CMakeLists.txt)
109 if(CPU_TYPE STREQUAL STM32F2)
110 include(targets/common/arm/stm32/f2/CMakeLists.txt)
113 if(CPU_FAMILY STREQUAL STM32)
114 include(targets/common/arm/stm32/CMakeLists.txt)
117 if(ARCH STREQUAL ARM)
118 include(targets/common/arm/CMakeLists.txt)
121 include_directories(targets/${TARGET_DIR} ${THIRDPARTY_DIR})
123 foreach(LANGUAGE ${GUI_LANGUAGES})
124 if(TRANSLATIONS STREQUAL ${LANGUAGE})
125 add_definitions(-DTRANSLATIONS_${LANGUAGE} -DTRANSLATIONS="${LANGUAGE}")
129 set(SRC ${SRC} debug.cpp)
131 if(${EEPROM} STREQUAL SDCARD)
132 set(SRC ${SRC} storage/storage_common.cpp storage/sdcard_raw.cpp storage/modelslist.cpp)
133 elseif(${EEPROM} STREQUAL EEPROM_RLC)
134 set(SRC ${SRC} storage/storage_common.cpp storage/eeprom_common.cpp storage/eeprom_rlc.cpp)
135 add_definitions(-DEEPROM -DEEPROM_RLC)
137 set(SRC ${SRC} storage/storage_common.cpp storage/eeprom_common.cpp storage/eeprom_raw.cpp)
138 add_definitions(-DEEPROM -DEEPROM_RAW)
141 include(storage/conversions/CMakeLists.txt)
143 add_definitions(-DFLAVOUR="${FLAVOUR}")
145 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
146 include_directories(${CMAKE_CURRENT_BINARY_DIR})
147 include_directories(${CMAKE_CURRENT_BINARY_DIR}/bitmaps/${GUI_DIR})
149 add_subdirectory(lua)
150 include(gui/CMakeLists.txt)
153 add_definitions(-DRTC_BACKUP_RAM)
154 set(SRC ${SRC} storage/rlc.cpp)
155 set(FIRMWARE_SRC ${FIRMWARE_SRC} storage/rtc_backup.cpp)
156 set(GTEST_SRC ${GTEST_SRC} ${RADIO_SRC_DIRECTORY}/storage/rtc_backup.cpp)
159 if(NOT LUA STREQUAL NO)
160 add_definitions(-DLUA)
162 add_definitions(-DLUA_COMPILER)
164 if(LUA_ALLOCATOR_TRACER AND DEBUG)
165 add_definitions(-DLUA_ALLOCATOR_TRACER)
167 if(NOT "${LUA_SCRIPT_LOAD_MODE}" STREQUAL "")
168 add_definitions(-DLUA_SCRIPT_LOAD_MODE="${LUA_SCRIPT_LOAD_MODE}")
170 include_directories(${LUA_DIR})
171 set(RADIO_DEPENDENCIES ${RADIO_DEPENDENCIES} ${LUA_EXPORT})
173 add_definitions(-DLUA_MODEL_SCRIPTS)
174 set(GUI_SRC ${GUI_SRC} model_custom_scripts.cpp)
176 set(SRC ${SRC} lua/interface.cpp lua/api_general.cpp lua/api_lcd.cpp lua/api_model.cpp)
177 if(PCB STREQUAL X12S OR PCB STREQUAL X10)
178 set(SRC ${SRC} lua/widgets.cpp)
180 set(LUA_SRC lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c lparser.c
181 lstate.c lstring.c ltable.c lrotable.c ltm.c lundump.c lvm.c lzio.c linit.c
182 lbaselib.c lmathlib.c lbitlib.c loadlib.c lauxlib.c ltablib.c lcorolib.c liolib.c lstrlib.c
184 foreach(FILE ${LUA_SRC})
185 set(SRC ${SRC} ${LUA_DIR}/${FILE})
188 # silence lots of warnings regarding "insecure" use of functions (sprintf, strcpy, etc) from Lua code
189 set(WARNING_FLAGS "${WARNING_FLAGS} /D_CRT_SECURE_NO_WARNINGS")
194 add_definitions(-DHELI)
198 add_definitions(-DFLIGHT_MODES)
199 set(GUI_SRC ${GUI_SRC} model_flightmodes.cpp)
203 add_definitions(-DCURVES)
204 set(SRC ${SRC} curves.cpp)
208 add_definitions(-DGVARS)
209 set(SRC ${SRC} gvars.cpp)
210 math(EXPR EEPROM_VARIANT ${EEPROM_VARIANT}+${GVARS_VARIANT})
214 add_definitions(-DFAI)
215 elseif(FAI STREQUAL CHOICE)
216 add_definitions(-DFAI_CHOICE)
220 add_definitions(-DNO_RAS)
224 add_definitions(-DFAS_PROTOTYPE)
228 add_definitions(-DAUTOSOURCE)
232 add_definitions(-DAUTOSWITCH)
236 add_definitions(-DJITTER_MEASURE)
240 add_definitions(-DASTERISK)
244 add_definitions(-DWATCHDOG)
248 add_definitions(-DSIMU_AUDIO)
252 add_definitions(-DSIMU_DISKIO)
256 add_definitions(-DSDCARD)
257 include_directories(${FATFS_DIR} ${FATFS_DIR}/option)
258 set(SRC ${SRC} sdcard.cpp rtc.cpp logs.cpp)
259 set(FIRMWARE_SRC ${FIRMWARE_SRC} ${FATFS_SRC})
262 if(SHUTDOWN_CONFIRMATION)
263 add_definitions(-DSHUTDOWN_CONFIRMATION)
266 if(PPM_UNIT STREQUAL US)
267 add_definitions(-DPPM_UNIT_US)
268 elseif(PPM_UNIT STREQUAL PERCENT_PREC1)
269 add_definitions(-DPPM_UNIT_PERCENT_PREC1)
271 add_definitions(-DPPM_UNIT_PERCENT_PREC0)
274 if(PPM_CENTER_ADJUSTABLE)
275 add_definitions(-DPPM_CENTER_ADJUSTABLE)
278 if(PPM_LIMITS_SYMETRICAL)
279 add_definitions(-DPPM_LIMITS_SYMETRICAL)
282 if(OVERRIDE_CHANNEL_FUNCTION)
283 add_definitions(-DOVERRIDE_CHANNEL_FUNCTION)
286 if(DANGEROUS_MODULE_FUNCTIONS)
287 add_definitions(-DDANGEROUS_MODULE_FUNCTIONS)
290 if(NOT SPLASH STREQUAL OFF)
291 add_definitions(-DSPLASH)
294 if(NOT DEFAULT_MODE STREQUAL "")
295 add_definitions(-DDEFAULT_MODE=${DEFAULT_MODE})
298 if(TRACE_SIMPGMSPACE)
299 add_definitions(-DTRACE_SIMPGMSPACE)
302 if(TRACE_LUA_INTERNALS)
303 add_definitions(-DTRACE_LUA_INTERNALS_ENABLED)
307 add_definitions(-DFRSKY_STICKS)
310 if(NOT FONT STREQUAL "")
311 add_definitions(-DFONT=${DEFAULT_MODE})
314 if(EEPROM_VARIANT_NEEDED)
315 add_definitions(-DEEPROM_VARIANT=${EEPROM_VARIANT})
318 if(NIGHTLY_BUILD_WARNING)
319 add_definitions(-DNIGHTLY_BUILD_WARNING)
322 if(MODULE_PROTOCOL_FCC)
323 add_definitions(-DMODULE_PROTOCOL_FCC)
326 if(MODULE_PROTOCOL_LBT)
327 add_definitions(-DMODULE_PROTOCOL_LBT)
330 if(MODULE_PROTOCOL_FLEX)
331 add_definitions(-DMODULE_PROTOCOL_FLEX)
334 if(MODULE_PROTOCOL_D8)
335 add_definitions(-DMODULE_PROTOCOL_D8)
339 add_definitions(-DJUMPER_RELEASE)
343 add_definitions(-DFRSKY_RELEASE)
347 add_definitions(-DPOPUP_LEVEL=${POPUP_LEVEL})
362 add_definitions(-DGUI)
370 foreach(FILE ${GUI_SRC})
371 set(SRC ${SRC} gui/${GUI_DIR}/${FILE})
375 foreach(FILE ${TARGET_SRC})
376 set(SRC targets/${TARGET_DIR}/${FILE} ${SRC})
379 foreach(FILE ${FIRMWARE_TARGET_SRC})
380 set(FIRMWARE_SRC ${FIRMWARE_SRC} targets/${TARGET_DIR}/${FILE})
383 foreach(FILE ${PULSES_SRC})
384 set(SRC ${SRC} pulses/${FILE})
387 add_definitions(-DCORRECT_NEGATIVE_SHIFTS)
390 set(WARNING_FLAGS "${WARNING_FLAGS} -Wall -Wno-address-of-packed-member -Wno-strict-aliasing -Wformat -Wreturn-type -Wunused -Wuninitialized -Wunknown-pragmas -Wno-switch -Wtype-limits")
391 if(WARNINGS_AS_ERRORS)
392 set(WARNING_FLAGS "${WARNING_FLAGS} -Werror")
393 endif(WARNINGS_AS_ERRORS)
395 add_definitions(-DHAVE_STRUCT_TIMESPEC) # this is for pthread.h
396 if(WARNINGS_AS_ERRORS)
397 set(WARNING_FLAGS "${WARNING_FLAGS} /WX")
398 endif(WARNINGS_AS_ERRORS)
401 add_subdirectory(targets/simu)
403 add_subdirectory(tests)
406 set(SRC ${SRC} ${FIRMWARE_SRC})
409 ##### firmware target #####
411 option(FIRMWARE_TARGET "Configure Firmware target (can be turned of for compiling Companion only)" ON)
412 if(NOT FIRMWARE_TARGET)
413 message(STATUS "firmware target disabled")
417 set(CMAKE_EXECUTABLE_SUFFIX ".elf")
418 # trick to remove the -rdynamic and --out-implib issues
419 set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
420 set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
421 # similar for -mmacosx-version-min="
422 set(CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG "")
423 set(CMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG "")
424 # reset some CMake default flags which assume optimization levels/etc
425 set(CMAKE_C_FLAGS "${FIRMWARE_C_FLAGS}")
426 set(CMAKE_C_FLAGS_DEBUG "${FIRMWARE_C_FLAGS_DEBUG}")
427 set(CMAKE_C_FLAGS_RELEASE "")
428 set(CMAKE_C_FLAGS_MINSIZEREL "")
429 set(CMAKE_C_FLAGS_RELWITHDEBINFO "")
430 set(CMAKE_CXX_FLAGS "${FIRMWARE_CXX_FLAGS}")
431 set(CMAKE_CXX_FLAGS_DEBUG "${FIRMWARE_CXX_FLAGS_DEBUG}")
432 set(CMAKE_CXX_FLAGS_RELEASE "")
433 set(CMAKE_CXX_FLAGS_MINSIZEREL "")
434 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "")
435 # customize linker command
436 set(CMAKE_EXE_LINKER_FLAGS "")
437 set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET>")
438 set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET>")
440 use_cxx11() # ensure gnu++11 in CXX_FLAGS with CMake < 3.1
442 find_program(BASH bash HINTS "c:/cygwin/bin/" "c:/msys/bin/" DOC "bash shell for firmware size report (eg. c:/cygwin/bin/bash.exe on Windows).")
447 if(ARCH STREQUAL ARM)
449 set(CMAKE_C_COMPILER arm-none-eabi-gcc)
450 set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
451 set(CMAKE_ASM_COMPILER arm-none-eabi-as)
453 set(CMAKE_SYSTEM_NAME Generic)
454 set(CMAKE_SYSTEM_VERSION 1)
455 set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -o <OBJECT> <SOURCE>")
457 set(COMMON_FLAGS "-mcpu=${MCU} -mthumb -fomit-frame-pointer -fverbose-asm -Wa,-ahlms=firmware.lst -O${OPT} -gdwarf-2 -DHSE_VALUE=${HSE_VALUE} -fno-exceptions -fdata-sections -ffunction-sections ${WARNING_FLAGS}")
458 set(COMMON_FLAGS "${COMMON_FLAGS} ${FPU_FLAGS}")
460 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_FLAGS} -Wimplicit")
461 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAGS}")
463 # these are in addition to CMAKE_CXX_FLAGS
464 set(CMAKE_EXE_LINKER_FLAGS "-lm -T${RADIO_SRC_DIRECTORY}/${LINKER_SCRIPT} -Wl,-Map=firmware.map,--cref,--no-warn-mismatch,--gc-sections")
467 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--whole-archive ${RADIO_SRC_DIRECTORY}/${THIRDPARTY_DIR}/libACCESS/libAccess.a -Wl,--no-whole-archive")
471 add_definitions(-DSEMIHOSTING)
472 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --specs=rdimon.specs")
475 # Use newlib nano, which saves a few kilobytes.
476 if(NOT NANO STREQUAL NO)
477 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --specs=nano.specs")
478 if(NOT LUA STREQUAL NO)
479 # Lua needs %g and %f
480 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -u _printf_float -u _scanf_float")
482 # Nano's malloc does work well with lua, use our own
483 add_definitions(-DUSE_BIN_ALLOCATOR)
484 set(SRC ${SRC} bin_allocator.cpp)
487 if(PCB STREQUAL XLITE OR PCB STREQUAL XLITES OR PCB STREQUAL X9D OR PCB STREQUAL X9D+ OR PCB STREQUAL X9E OR PCB STREQUAL X7 OR PCB STREQUAL X9LITE OR PCB STREQUAL X9LITES OR PCB STREQUAL X10 OR PCB STREQUAL X12S)
488 add_subdirectory(targets/common/arm/stm32/bootloader)
489 include_directories(${CMAKE_CURRENT_BINARY_DIR}/targets/common/arm/stm32/bootloader)
490 set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} bootloader)
491 elseif(OPENRC_BOOTLOADER)
492 # We fetch Mike's bootloader as it is not included inside OpenTX
493 message(STATUS "Downloading Mike's bootloader: https://github.com/MikeBland/OpenRcBootloader/releases/download/V1.9/${OPENRC_BOOTLOADER}")
494 file(DOWNLOAD https://github.com/MikeBland/OpenRcBootloader/releases/download/V1.9/${OPENRC_BOOTLOADER} ${CMAKE_CURRENT_BINARY_DIR}/bootloader.lbm STATUS status)
495 list(GET status 0 error_code)
497 list(GET status 1 error_message)
498 message(FATAL_ERROR "Download failed: ${error_message}")
502 add_definitions(-DRTOS_COOS)
504 add_executable(firmware ${SRC} ${FIRMWARE_HEADERS})
505 link_libraries(firmware -lstdc++)
506 add_dependencies(firmware ${RADIO_DEPENDENCIES} ${FIRMWARE_DEPENDENCIES})
507 set_target_properties(firmware PROPERTIES EXCLUDE_FROM_ALL TRUE)
510 TARGET firmware POST_BUILD
511 COMMAND arm-none-eabi-objcopy -O binary firmware.elf firmware.bin
512 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
515 find_program(GAWK gawk HINTS "c:/cygwin/bin/" "c:/msys/bin/" DOC "gawk for firmware size report.") # OS X might only have "awk"
517 add_custom_target(firmware-size
518 COMMAND ${BASH} -kc '${RADIO_DIRECTORY}/util/elf-size-report.sh --mcu=${CPU_TYPE_FULL} ${SIZE_TARGET_MEM_DEFINE} firmware.elf'
520 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
523 add_custom_target(firmware-size
524 COMMAND arm-none-eabi-size -A firmware.elf
526 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
531 if(CPU_FAMILY STREQUAL STM32)
532 add_custom_target(flash
533 COMMAND dfu-util --alt 0 --dfuse-address 0x08000000:leave -d 0483:df11 -D firmware.bin
535 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
538 add_custom_target(flash-jtag
539 COMMAND st-flash --reset write firmware.bin 0x8000000
541 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
544 add_custom_target(flash-stlink
545 COMMAND ST-LINK_CLI -c SWD -P firmware.bin 0x8000000 -Rst -Q
546 DEPENDS firmware-size
547 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
551 PrintTargetReport("firmware")