Reformatted the CMakeLists for consistency

This commit is contained in:
Avamander 2020-10-02 21:43:30 +03:00
parent 9348f9936d
commit 455d8319e4
2 changed files with 463 additions and 435 deletions

View file

@ -4,7 +4,7 @@ project(pinetime VERSION 0.8.2 LANGUAGES C CXX ASM)
set(NRF_TARGET "nrf52") set(NRF_TARGET "nrf52")
if (NOT ARM_NONE_EABI_TOOLCHAIN_PATH) if (NOT ARM_NONE_EABI_TOOLCHAIN_PATH)
message(FATAL_ERROR "The path to the toolchain (arm-non-eabi) must be specified on the command line (add -DARM_NONE_EABI_TOOLCHAIN_PATH=<path>") message(FATAL_ERROR "The path to the toolchain (arm-none-eabi) must be specified on the command line (add -DARM_NONE_EABI_TOOLCHAIN_PATH=<path>")
endif () endif ()
if (NOT NRF5_SDK_PATH) if (NOT NRF5_SDK_PATH)

View file

@ -719,6 +719,35 @@ elseif(USE_GDB_CLIENT)
COMMENT "flashing ${EXECUTABLE_NAME}.hex" COMMENT "flashing ${EXECUTABLE_NAME}.hex"
) )
elseif (USE_OPENOCD) elseif (USE_OPENOCD)
if (USE_CMSIS_DAP)
add_custom_target(FLASH_ERASE
COMMAND ${OPENOCD_BIN_PATH} -c 'source [find interface/cmsis-dap.cfg]' -c 'transport select swd'
-c 'source [find target/nrf52.cfg]'
-c 'init'
-c 'halt'
-c 'nrf5 mass_erase'
-c 'halt'
-c 'reset'
-c 'exit'
COMMENT "erasing flashing"
)
add_custom_target("FLASH_${EXECUTABLE_NAME}"
DEPENDS ${EXECUTABLE_NAME}
COMMAND ${OPENOCD_BIN_PATH}
-c 'tcl_port disabled'
-c 'gdb_port 3333'
-c 'telnet_port 4444'
-c 'source [find interface/cmsis-dap.cfg]'
-c 'transport select swd'
-c 'source [find target/nrf52.cfg]'
-c 'halt'
-c "program \"${EXECUTABLE_NAME}.hex\""
-c 'reset'
-c 'shutdown'
COMMENT "flashing ${EXECUTABLE_NAME}.hex"
)
else ()
message()
add_custom_target(FLASH_ERASE add_custom_target(FLASH_ERASE
COMMAND ${OPENOCD_BIN_PATH} -f interface/stlink.cfg -c 'transport select hla_swd' -f target/nrf52.cfg -c init -c halt -c 'nrf5 mass_erase' -c reset -c shutdown COMMAND ${OPENOCD_BIN_PATH} -f interface/stlink.cfg -c 'transport select hla_swd' -f target/nrf52.cfg -c init -c halt -c 'nrf5 mass_erase' -c reset -c shutdown
COMMENT "erasing flashing" COMMENT "erasing flashing"
@ -728,6 +757,5 @@ elseif(USE_OPENOCD)
COMMAND ${OPENOCD_BIN_PATH} -c "tcl_port disabled" -c "gdb_port 3333" -c "telnet_port 4444" -f interface/stlink.cfg -c 'transport select hla_swd' -f target/nrf52.cfg -c "program \"${EXECUTABLE_NAME}.hex\"" -c reset -c shutdown COMMAND ${OPENOCD_BIN_PATH} -c "tcl_port disabled" -c "gdb_port 3333" -c "telnet_port 4444" -f interface/stlink.cfg -c 'transport select hla_swd' -f target/nrf52.cfg -c "program \"${EXECUTABLE_NAME}.hex\"" -c reset -c shutdown
COMMENT "flashing ${EXECUTABLE_NAME}.hex" COMMENT "flashing ${EXECUTABLE_NAME}.hex"
) )
endif () endif ()
endif ()