summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt252
1 files changed, 159 insertions, 93 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3467013d..0846b95c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,21 +9,21 @@ set(NRF_BOARD pca10040)
# check if all the necessary tools paths have been provided.
if (NOT NRF5_SDK_PATH)
- message(FATAL_ERROR "The path to the nRF5 SDK (NRF5_SDK_PATH) must be set.")
+ message(FATAL_ERROR "The path to the nRF5 SDK (NRF5_SDK_PATH) must be set.")
endif ()
if (DEFINED ARM_NONE_EABI_TOOLCHAIN_PATH)
- set(ARM_NONE_EABI_TOOLCHAIN_BIN_PATH ${ARM_NONE_EABI_TOOLCHAIN_PATH}/bin)
+ set(ARM_NONE_EABI_TOOLCHAIN_BIN_PATH ${ARM_NONE_EABI_TOOLCHAIN_PATH}/bin)
endif ()
if (NOT NRF_TARGET MATCHES "nrf52")
- message(FATAL_ERROR "Only rRF52 boards are supported right now")
+ message(FATAL_ERROR "Only rRF52 boards are supported right now")
endif ()
# Setup toolchain
include(${CMAKE_SOURCE_DIR}/cmake-nRF5x/arm-gcc-toolchain.cmake)
if (NOT DEFINED ARM_GCC_TOOLCHAIN)
- message(FATAL_ERROR "The toolchain must be set up before calling this macro")
+ message(FATAL_ERROR "The toolchain must be set up before calling this macro")
endif ()
set(CMAKE_OSX_SYSROOT "/")
set(CMAKE_OSX_DEPLOYMENT_TARGET "")
@@ -406,6 +406,8 @@ list(APPEND SOURCE_FILES
displayapp/screens/Styles.cpp
displayapp/Colors.cpp
displayapp/widgets/Counter.cpp
+ displayapp/widgets/PageIndicator.cpp
+ displayapp/widgets/StatusIcons.cpp
## Settings
displayapp/screens/settings/QuickSettings.cpp
@@ -478,7 +480,7 @@ list(APPEND SOURCE_FILES
FreeRTOS/port_cmsis.c
displayapp/LittleVgl.cpp
- displayapp/lv_pinetime_theme.c
+ displayapp/InfiniTimeTheme.cpp
systemtask/SystemTask.cpp
systemtask/SystemMonitor.cpp
@@ -613,6 +615,8 @@ set(INCLUDE_FILES
displayapp/screens/Alarm.h
displayapp/Colors.h
displayapp/widgets/Counter.h
+ displayapp/widgets/PageIndicator.h
+ displayapp/widgets/StatusIcons.h
drivers/St7789.h
drivers/SpiNorFlash.h
drivers/SpiMaster.h
@@ -654,16 +658,16 @@ set(INCLUDE_FILES
drivers/Cst816s.h
FreeRTOS/portmacro.h
FreeRTOS/portmacro_cmsis.h
- libs/date/includes/date/tz.h
- libs/date/includes/date/chrono_io.h
- libs/date/includes/date/date.h
- libs/date/includes/date/islamic.h
- libs/date/includes/date/iso_week.h
- libs/date/includes/date/julian.h
- libs/date/includes/date/ptz.h
- libs/date/includes/date/tz_private.h
+ libs/date/include/date/tz.h
+ libs/date/include/date/chrono_io.h
+ libs/date/include/date/date.h
+ libs/date/include/date/islamic.h
+ libs/date/include/date/iso_week.h
+ libs/date/include/date/julian.h
+ libs/date/include/date/ptz.h
+ libs/date/include/date/tz_private.h
displayapp/LittleVgl.h
- displayapp/lv_pinetime_theme.h
+ displayapp/InfiniTimeTheme.h
systemtask/SystemTask.h
systemtask/SystemMonitor.h
displayapp/screens/Symbols.h
@@ -684,7 +688,7 @@ include_directories(
../
libs/
FreeRTOS/
- libs/date/includes
+ libs/date/include
libs/mynewt-nimble/porting/npl/freertos/include
libs/mynewt-nimble/nimble/include
libs/mynewt-nimble/porting/nimble/include
@@ -782,14 +786,60 @@ add_definitions(-DNRF52 -DNRF52832 -DNRF52832_XXAA -DNRF52_PAN_74 -DNRF52_PAN_64
add_definitions(-DFREERTOS)
add_definitions(-D__STACK_SIZE=1024)
add_definitions(-D__HEAP_SIZE=4096)
+add_definitions(-DMYNEWT_VAL_BLE_LL_RFMGMT_ENABLE_TIME=1500)
+
+# Note: Only use this for debugging
+# Derive the low frequency clock from the main clock (SYNT)
+# add_definitions(-DCLOCK_CONFIG_LF_SRC=2)
+
+# Target hardware configuration options
+add_definitions(-DTARGET_DEVICE_${TARGET_DEVICE})
+add_definitions(-DTARGET_DEVICE_NAME="${TARGET_DEVICE}")
+if(TARGET_DEVICE STREQUAL "PINETIME")
+ add_definitions(-DDRIVER_PINMAP_PINETIME)
+ add_definitions(-DCLOCK_CONFIG_LF_SRC=1) # XTAL
+elseif(TARGET_DEVICE STREQUAL "MOY-TFK5") # P8a
+ add_definitions(-DDRIVER_PINMAP_P8)
+ add_definitions(-DCLOCK_CONFIG_LF_SRC=1) # XTAL
+elseif(TARGET_DEVICE STREQUAL "MOY-TIN5") # P8a variant 2
+ add_definitions(-DDRIVER_PINMAP_P8)
+ add_definitions(-DCLOCK_CONFIG_LF_SRC=1) # XTAL
+elseif(TARGET_DEVICE STREQUAL "MOY-TON5") # P8b
+ add_definitions(-DDRIVER_PINMAP_P8)
+ add_definitions(-DCLOCK_CONFIG_LF_SRC=0) # RC
+ add_definitions(-DMYNEWT_VAL_BLE_LL_SCA=500)
+ add_definitions(-DCLOCK_CONFIG_LF_CAL_ENABLED=1)
+elseif(TARGET_DEVICE STREQUAL "MOY-UNK") # P8b mirrored
+ add_definitions(-DDRIVER_PINMAP_P8)
+ add_definitions(-DCLOCK_CONFIG_LF_SRC=0) # RC
+ add_definitions(-DMYNEWT_VAL_BLE_LL_SCA=500)
+ add_definitions(-DCLOCK_CONFIG_LF_CAL_ENABLED=1)
+ add_definitions(-DDRIVER_DISPLAY_MIRROR)
+else()
+ message(FATAL_ERROR "Invalid TARGET_DEVICE")
+endif()
-# NOTE : Add the following defines to enable debug mode of the NRF SDK:
-#add_definitions(-DDEBUG)
-#add_definitions(-DDEBUG_NRF_USER)
-
-if (NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE "Release")
-endif ()
+# Debug configuration
+if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
+ add_definitions(-DDEBUG)
+ add_definitions(-DDEBUG_NRF_USER)
+
+ # NRF SDK Logging
+ add_definitions(-DNRF_LOG_ENABLED=1)
+ # add_definitions(-DNRF_LOG_BACKEND_RTT_ENABLED=1)
+ # add_definitions(-DNRF_LOG_BACKEND_SERIAL_USES_RTT=1)
+
+ # NRF SDK individual modules logging
+ # add_definitions(-DCLOCK_CONFIG_LOG_ENABLED=1)
+ # add_definitions(-DCLOCK_CONFIG_LOG_LEVEL=4)
+ # add_definitions(-DRTC_CONFIG_LOG_ENABLED=1)
+ # add_definitions(-DRTC_CONFIG_LOG_LEVEL=4)
+
+ # Nimble Logging
+ add_definitions(-DMYNEWT_VAL_NEWT_FEATURE_LOGCFG=1)
+ # add_definitions(-DMYNEWT_VAL_LOG_LEVEL=0)
+ # add_definitions(-DMYNEWT_VAL_BLE_HS_LOG_LVL=0)
+endif()
add_subdirectory(displayapp/fonts)
target_compile_options(infinitime_fonts PUBLIC
@@ -894,10 +944,15 @@ add_custom_command(TARGET ${EXECUTABLE_NAME}
COMMAND ${CMAKE_OBJCOPY} -O ihex ${EXECUTABLE_FILE_NAME}.out "${EXECUTABLE_FILE_NAME}.hex"
COMMENT "post build steps for ${EXECUTABLE_FILE_NAME}")
+if(BUILD_RESOURCES)
+ add_dependencies(${EXECUTABLE_NAME} GenerateResources)
+endif()
+
# Build binary intended to be used by bootloader
set(EXECUTABLE_MCUBOOT_NAME "pinetime-mcuboot-app")
set(EXECUTABLE_MCUBOOT_FILE_NAME ${EXECUTABLE_MCUBOOT_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH})
-set(IMAGE_MCUBOOT_FILE_NAME ${EXECUTABLE_MCUBOOT_NAME}-image-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.hex)
+set(IMAGE_MCUBOOT_FILE_NAME_HEX ${EXECUTABLE_MCUBOOT_NAME}-image-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.hex)
+set(IMAGE_MCUBOOT_FILE_NAME_BIN ${EXECUTABLE_MCUBOOT_NAME}-image-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.bin)
set(DFU_MCUBOOT_FILE_NAME ${EXECUTABLE_MCUBOOT_NAME}-dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip)
set(NRF5_LINKER_SCRIPT_MCUBOOT "${CMAKE_SOURCE_DIR}/gcc_nrf52-mcuboot.ld")
add_executable(${EXECUTABLE_MCUBOOT_NAME} ${SOURCE_FILES})
@@ -921,16 +976,21 @@ add_custom_command(TARGET ${EXECUTABLE_MCUBOOT_NAME}
COMMAND ${CMAKE_SIZE_UTIL} ${EXECUTABLE_MCUBOOT_FILE_NAME}.out
COMMAND ${CMAKE_OBJCOPY} -O binary ${EXECUTABLE_MCUBOOT_FILE_NAME}.out "${EXECUTABLE_MCUBOOT_FILE_NAME}.bin"
COMMAND ${CMAKE_OBJCOPY} -O ihex ${EXECUTABLE_MCUBOOT_FILE_NAME}.out "${EXECUTABLE_MCUBOOT_FILE_NAME}.hex"
- COMMAND ${CMAKE_SOURCE_DIR}/tools/mcuboot/imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header ${EXECUTABLE_MCUBOOT_FILE_NAME}.hex ${IMAGE_MCUBOOT_FILE_NAME}
+ COMMAND ${CMAKE_SOURCE_DIR}/tools/mcuboot/imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header ${EXECUTABLE_MCUBOOT_FILE_NAME}.hex ${IMAGE_MCUBOOT_FILE_NAME_HEX}
+ COMMAND ${CMAKE_SOURCE_DIR}/tools/mcuboot/imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header ${EXECUTABLE_MCUBOOT_FILE_NAME}.bin ${IMAGE_MCUBOOT_FILE_NAME_BIN}
COMMENT "post build steps for ${EXECUTABLE_MCUBOOT_FILE_NAME}"
)
+if(BUILD_RESOURCES)
+ add_dependencies(${EXECUTABLE_MCUBOOT_NAME} GenerateResources)
+endif()
+
if(BUILD_DFU)
- add_custom_command(TARGET ${EXECUTABLE_MCUBOOT_NAME}
- POST_BUILD
- COMMAND adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application ${IMAGE_MCUBOOT_FILE_NAME} ${DFU_MCUBOOT_FILE_NAME}
- COMMENT "post build (DFU) steps for ${EXECUTABLE_MCUBOOT_FILE_NAME}"
- )
+ add_custom_command(TARGET ${EXECUTABLE_MCUBOOT_NAME}
+ POST_BUILD
+ COMMAND adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application ${IMAGE_MCUBOOT_FILE_NAME_HEX} ${DFU_MCUBOOT_FILE_NAME}
+ COMMENT "post build (DFU) steps for ${EXECUTABLE_MCUBOOT_FILE_NAME}"
+ )
endif()
# InfiniTime recovery firmware (autonomous)
@@ -964,7 +1024,8 @@ add_custom_command(TARGET ${EXECUTABLE_RECOVERY_NAME}
# InfiniTime recovery firmware (mcuboot)
set(EXECUTABLE_RECOVERY_MCUBOOT_NAME "pinetime-mcuboot-recovery")
set(EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH})
-set(IMAGE_RECOVERY_MCUBOOT_FILE_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}-image-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.hex)
+set(IMAGE_RECOVERY_MCUBOOT_FILE_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}-image-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH})
+set(IMAGE_RECOVERY_MCUBOOT_FILE_NAME_HEX ${IMAGE_RECOVERY_MCUBOOT_FILE_NAME}.hex)
set(DFU_RECOVERY_MCUBOOT_FILE_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}-dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip)
add_executable(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} ${RECOVERY_SOURCE_FILES})
target_link_libraries(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} nimble nrf-sdk littlefs QCBOR infinitime_fonts)
@@ -988,18 +1049,18 @@ add_custom_command(TARGET ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}
COMMAND ${CMAKE_SIZE_UTIL} ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}.out
COMMAND ${CMAKE_OBJCOPY} -O binary ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}.out "${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}.bin"
COMMAND ${CMAKE_OBJCOPY} -O ihex ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}.out "${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}.hex"
- COMMAND ${CMAKE_SOURCE_DIR}/tools/mcuboot/imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}.hex ${IMAGE_RECOVERY_MCUBOOT_FILE_NAME}
- COMMAND ${CMAKE_OBJCOPY} -I ihex -O binary ${IMAGE_RECOVERY_MCUBOOT_FILE_NAME} "${IMAGE_RECOVERY_MCUBOOT_FILE_NAME}.bin"
+ COMMAND ${CMAKE_SOURCE_DIR}/tools/mcuboot/imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}.hex ${IMAGE_RECOVERY_MCUBOOT_FILE_NAME_HEX}
+ COMMAND ${CMAKE_OBJCOPY} -I ihex -O binary ${IMAGE_RECOVERY_MCUBOOT_FILE_NAME_HEX} "${IMAGE_RECOVERY_MCUBOOT_FILE_NAME}.bin"
COMMAND python3 ${CMAKE_SOURCE_DIR}/tools/bin2c.py ${IMAGE_RECOVERY_MCUBOOT_FILE_NAME}.bin recoveryImage > recoveryImage.h
COMMENT "post build steps for ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}"
)
if(BUILD_DFU)
- add_custom_command(TARGET ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}
- POST_BUILD
- COMMAND adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application ${IMAGE_RECOVERY_MCUBOOT_FILE_NAME} ${DFU_RECOVERY_MCUBOOT_FILE_NAME}
- COMMENT "post build (DFU) steps for ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}"
- )
+ add_custom_command(TARGET ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}
+ POST_BUILD
+ COMMAND adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application ${IMAGE_RECOVERY_MCUBOOT_FILE_NAME_HEX} ${DFU_RECOVERY_MCUBOOT_FILE_NAME}
+ COMMENT "post build (DFU) steps for ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}"
+ )
endif()
# Build binary that writes the recovery image into the SPI flash memory
@@ -1036,7 +1097,8 @@ add_custom_command(TARGET ${EXECUTABLE_RECOVERYLOADER_NAME}
# Build binary that writes the recovery image (MCUBoot version)
set(EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME "pinetime-mcuboot-recovery-loader")
set(EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH})
-set(IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME}-image-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.hex)
+set(IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME}-image-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH})
+set(IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME_HEX ${IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.hex)
set(DFU_MCUBOOT_RECOVERYLOADER_FILE_NAME ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME}-dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip)
add_executable(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} ${RECOVERYLOADER_SOURCE_FILES})
target_link_libraries(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} nrf-sdk QCBOR infinitime_fonts)
@@ -1063,82 +1125,86 @@ add_custom_command(TARGET ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME}
COMMAND ${CMAKE_SIZE_UTIL} ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.out
COMMAND ${CMAKE_OBJCOPY} -O binary ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.out "${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.bin"
COMMAND ${CMAKE_OBJCOPY} -O ihex ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.out "${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.hex"
- COMMAND ${CMAKE_SOURCE_DIR}/tools/mcuboot/imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.hex ${IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME}
- COMMAND ${CMAKE_OBJCOPY} -I ihex -O binary ${IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME} "${IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.bin"
+ COMMAND ${CMAKE_SOURCE_DIR}/tools/mcuboot/imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.hex ${IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME_HEX}
+ COMMAND ${CMAKE_OBJCOPY} -I ihex -O binary ${IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME_HEX} "${IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.bin"
COMMAND python3 ${CMAKE_SOURCE_DIR}/tools/bin2c.py ${IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.bin recoveryLoaderImage > recoveryLoaderImage.h
COMMENT "post build steps for ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}"
)
if(BUILD_DFU)
- add_custom_command(TARGET ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME}
- POST_BUILD
- COMMAND adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application ${IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME} ${DFU_MCUBOOT_RECOVERYLOADER_FILE_NAME}
- COMMENT "post build (DFU) steps for ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}"
- )
+ add_custom_command(TARGET ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME}
+ POST_BUILD
+ COMMAND adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application ${IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME_HEX} ${DFU_MCUBOOT_RECOVERYLOADER_FILE_NAME}
+ COMMENT "post build (DFU) steps for ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}"
+ )
+endif()
+
+if(BUILD_RESOURCES)
+ add_subdirectory(resources)
endif()
# FLASH
if (USE_JLINK)
+ add_custom_target(FLASH_ERASE
+ COMMAND ${NRFJPROG} --eraseall -f ${NRF_TARGET}
+ COMMENT "erasing flashing"
+ )
+ add_custom_target("FLASH_${EXECUTABLE_NAME}"
+ DEPENDS ${EXECUTABLE_NAME}
+ COMMAND ${NRFJPROG} --program ${EXECUTABLE_FILE_NAME}.hex -f ${NRF_TARGET} --sectorerase
+ COMMAND sleep 0.5s
+ COMMAND ${NRFJPROG} --reset -f ${NRF_TARGET}
+ COMMENT "flashing ${EXECUTABLE_FILE_NAME}.hex"
+ )
+
+elseif (USE_GDB_CLIENT)
+ add_custom_target(FLASH_ERASE
+ COMMAND ${GDB_CLIENT_BIN_PATH} -nx --batch -ex 'target extended-remote ${GDB_CLIENT_TARGET_REMOTE}' -ex 'monitor swdp_scan' -ex 'attach 1' -ex 'mon erase_mass'
+ COMMENT "erasing flashing"
+ )
+ add_custom_target("FLASH_${EXECUTABLE_NAME}"
+ DEPENDS ${EXECUTABLE_NAME}
+ COMMAND ${GDB_CLIENT_BIN_PATH} -nx --batch -ex 'target extended-remote ${GDB_CLIENT_TARGET_REMOTE}' -ex 'monitor swdp_scan' -ex 'attach 1' -ex 'load' -ex 'kill' ${EXECUTABLE_FILE_NAME}.hex
+ COMMENT "flashing ${EXECUTABLE_FILE_NAME}.hex"
+ )
+elseif (USE_OPENOCD)
+ if (USE_CMSIS_DAP)
add_custom_target(FLASH_ERASE
- COMMAND ${NRFJPROG} --eraseall -f ${NRF_TARGET}
+ 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 ${NRFJPROG} --program ${EXECUTABLE_FILE_NAME}.hex -f ${NRF_TARGET} --sectorerase
- COMMAND sleep 0.5s
- COMMAND ${NRFJPROG} --reset -f ${NRF_TARGET}
- COMMENT "flashing ${EXECUTABLE_FILE_NAME}.hex"
+ 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_FILE_NAME}.hex\""
+ -c 'reset'
+ -c 'shutdown'
+ COMMENT "flashing ${EXECUTABLE_BIN_NAME}.hex"
)
-
-elseif (USE_GDB_CLIENT)
+ else ()
add_custom_target(FLASH_ERASE
- COMMAND ${GDB_CLIENT_BIN_PATH} -nx --batch -ex 'target extended-remote ${GDB_CLIENT_TARGET_REMOTE}' -ex 'monitor swdp_scan' -ex 'attach 1' -ex 'mon erase_mass'
+ 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"
)
add_custom_target("FLASH_${EXECUTABLE_NAME}"
DEPENDS ${EXECUTABLE_NAME}
- COMMAND ${GDB_CLIENT_BIN_PATH} -nx --batch -ex 'target extended-remote ${GDB_CLIENT_TARGET_REMOTE}' -ex 'monitor swdp_scan' -ex 'attach 1' -ex 'load' -ex 'kill' ${EXECUTABLE_FILE_NAME}.hex
+ 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_FILE_NAME}.hex\"" -c reset -c shutdown
COMMENT "flashing ${EXECUTABLE_FILE_NAME}.hex"
)
-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_FILE_NAME}.hex\""
- -c 'reset'
- -c 'shutdown'
- COMMENT "flashing ${EXECUTABLE_BIN_NAME}.hex"
- )
- else ()
- 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
- 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" -f interface/stlink.cfg -c 'transport select hla_swd' -f target/nrf52.cfg -c "program \"${EXECUTABLE_FILE_NAME}.hex\"" -c reset -c shutdown
- COMMENT "flashing ${EXECUTABLE_FILE_NAME}.hex"
- )
- endif ()
+ endif ()
endif ()