Skip to content

Commit e65aeac

Browse files
committed
Remove CMake targets and corresponding CLI arguments that are specific to the debugging environment (USE_JLINK, USE_OPENOCD and USE_GDB_CLIENT).
1 parent e051504 commit e65aeac

File tree

7 files changed

+5
-186
lines changed

7 files changed

+5
-186
lines changed

.devcontainer/build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ CmakeGenerate() {
6060

6161
cmake -G "Unix Makefiles" \
6262
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
63-
-DUSE_OPENOCD=1 \
6463
-DARM_NONE_EABI_TOOLCHAIN_PATH="$TOOLS_DIR/$GCC_ARM_VER" \
6564
-DNRF5_SDK_PATH="$TOOLS_DIR/$NRF_SDK_VER" \
6665
"$SOURCES_DIR"

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ jobs:
113113
run: |
114114
mkdir -p build
115115
cd build
116-
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=${{ runner.temp }}/arm-none-eabi -DNRF5_SDK_PATH=${{ runner.temp }}/nrf5_sdk -DUSE_OPENOCD=1 -DBUILD_DFU=1 ../
116+
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=${{ runner.temp }}/arm-none-eabi -DNRF5_SDK_PATH=${{ runner.temp }}/nrf5_sdk -DBUILD_DFU=1 ../
117117
118118
#########################################################################################
119119
# Make and Upload DFU Package

CMakeLists.txt

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,6 @@ if (NOT NRF5_SDK_PATH)
2121
message(FATAL_ERROR "The path to the NRF52 SDK must be specified on the command line (add -DNRF5_SDK_PATH=<path>")
2222
endif ()
2323

24-
if(USE_JLINK)
25-
if (NOT NRFJPROG)
26-
message(FATAL_ERROR "the path to the tool nrfjprog must be specified on the command line (add -DNRFJPROG=<path>")
27-
endif ()
28-
endif()
29-
30-
if(USE_GDB_CLIENT)
31-
if(NOT GDB_CLIENT_BIN_PATH)
32-
set(GDB_CLIENT_BIN_PATH "arm-none-eabi-gdb")
33-
endif()
34-
35-
if(NOT GDB_CLIENT_TARGET_REMOTE)
36-
message(FATAL_ERROR "The GDB target must be specified (add -DGDB_CLIENT_TARGET_REMOTE=<target>")
37-
endif()
38-
endif()
39-
40-
if(USE_OPENOCD)
41-
if(NOT OPENOCD_BIN_PATH)
42-
set(OPENOCD_BIN_PATH "openocd")
43-
endif()
44-
endif()
45-
4624
if(DEFINED USE_DEBUG_PINS AND USE_DEBUG_PINS)
4725
add_definitions(-DUSE_DEBUG_PINS)
4826
endif()
@@ -77,17 +55,6 @@ message(" * Toolchain : " ${ARM_NONE_EABI_TOOLCHAIN_PATH})
7755
message(" * GitRef(S) : " ${PROJECT_GIT_COMMIT_HASH})
7856
message(" * NRF52 SDK : " ${NRF5_SDK_PATH})
7957
message(" * Target device : " ${TARGET_DEVICE})
80-
set(PROGRAMMER "???")
81-
if(USE_JLINK)
82-
message(" * Programmer/debugger : JLINK")
83-
message(" * NrfJprog : " ${NRFJPROG})
84-
elseif(USE_GDB_CLIENT)
85-
message(" * Programmer/debugger : GDB Client")
86-
message(" * GDB Client path : " ${GDB_CLIENT_BIN_PATH})
87-
message(" * GDB Target : " ${GDB_CLIENT_TARGET_REMOTE})
88-
elseif(USE_OPENOCD)
89-
message(" * Programmer/debugger : OpenOCD Client")
90-
endif()
9158
if(USE_DEBUG_PINS)
9259
message(" * Debug pins : Enabled")
9360
else()

cmake-nRF5x/CMake_nRF5x.cmake

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -230,24 +230,6 @@ macro(nRF5x_setup)
230230
"${NRF5_SDK_PATH}/modules/nrfx/drivers/src/nrfx_twi.c"
231231
)
232232

233-
# adds target for erasing
234-
if(USE_JLINK)
235-
add_custom_target(FLASH_ERASE
236-
COMMAND ${NRFJPROG} --eraseall -f ${NRF_TARGET}
237-
COMMENT "erasing flashing"
238-
)
239-
elseif(USE_GDB_CLIENT)
240-
add_custom_target(FLASH_ERASE
241-
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'
242-
COMMENT "erasing flashing"
243-
)
244-
elseif(USE_OPENOCD)
245-
add_custom_target(FLASH_ERASE
246-
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
247-
COMMENT "erasing flashing"
248-
)
249-
endif()
250-
251233
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
252234
set(TERMINAL "open")
253235
elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
@@ -256,16 +238,6 @@ macro(nRF5x_setup)
256238
set(TERMINAL "gnome-terminal")
257239
endif()
258240

259-
if(USE_JLINK)
260-
add_custom_target(START_JLINK
261-
COMMAND ${TERMINAL} "${DIR_OF_nRF5x_CMAKE}/runJLinkGDBServer-${NRF_TARGET}"
262-
COMMAND ${TERMINAL} "${DIR_OF_nRF5x_CMAKE}/runJLinkExe-${NRF_TARGET}"
263-
COMMAND sleep 2s
264-
COMMAND ${TERMINAL} "${DIR_OF_nRF5x_CMAKE}/runJLinkRTTClient"
265-
COMMENT "started JLink commands"
266-
)
267-
endif()
268-
269241
endmacro(nRF5x_setup)
270242

271243
# adds a target for comiling and flashing an executable
@@ -283,29 +255,6 @@ macro(nRF5x_addExecutable EXECUTABLE_NAME SOURCE_FILES)
283255
COMMAND ${CMAKE_OBJCOPY} -O ihex ${EXECUTABLE_NAME}.out "${EXECUTABLE_NAME}.hex"
284256
COMMENT "post build steps for ${EXECUTABLE_NAME}")
285257

286-
# custom target for flashing the board
287-
if(USE_JLINK)
288-
add_custom_target("FLASH_${EXECUTABLE_NAME}"
289-
DEPENDS ${EXECUTABLE_NAME}
290-
COMMAND ${NRFJPROG} --program ${EXECUTABLE_NAME}.hex -f ${NRF_TARGET} --sectorerase
291-
COMMAND sleep 0.5s
292-
COMMAND ${NRFJPROG} --reset -f ${NRF_TARGET}
293-
COMMENT "flashing ${EXECUTABLE_NAME}.hex"
294-
)
295-
elseif(USE_GDB_CLIENT)
296-
add_custom_target("FLASH_${EXECUTABLE_NAME}"
297-
DEPENDS ${EXECUTABLE_NAME}
298-
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_NAME}.hex
299-
COMMENT "flashing ${EXECUTABLE_NAME}.hex"
300-
)
301-
elseif(USE_OPENOCD)
302-
add_custom_target("FLASH_${EXECUTABLE_NAME}"
303-
DEPENDS ${EXECUTABLE_NAME}
304-
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
305-
COMMENT "flashing ${EXECUTABLE_NAME}.hex"
306-
)
307-
endif()
308-
309258
endmacro()
310259

311260
# adds app-level scheduler library

doc/buildAndProgram.md

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -29,41 +29,25 @@ CMake configures the project according to variables you specify the command line
2929
----------|-------------|--------|
3030
**ARM_NONE_EABI_TOOLCHAIN_PATH**|path to the toolchain directory|`-DARM_NONE_EABI_TOOLCHAIN_PATH=/home/jf/nrf52/gcc-arm-none-eabi-9-2020-q2-update/`|
3131
**NRF5_SDK_PATH**|path to the NRF52 SDK|`-DNRF5_SDK_PATH=/home/jf/nrf52/Pinetime/sdk`|
32-
**USE_JLINK, USE_GDB_CLIENT and USE_OPENOCD**|Enable *JLink* mode, *GDB Client* (Black Magic Probe) mode or *OpenOCD* mode (set the one you want to use to `1`)|`-DUSE_JLINK=1`
3332
**CMAKE_BUILD_TYPE (\*)**| Build type (Release or Debug). Release is applied by default if this variable is not specified.|`-DCMAKE_BUILD_TYPE=Debug`
34-
**NRFJPROG**|Path to the NRFJProg executable. Used only if `USE_JLINK` is 1.|`-DNRFJPROG=/opt/nrfjprog/nrfjprog`
35-
**GDB_CLIENT_BIN_PATH**|Path to arm-none-eabi-gdb executable. Used only if `USE_GDB_CLIENT` is 1.|`-DGDB_CLIENT_BIN_PATH=/home/jf/nrf52/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gdb`
36-
**GDB_CLIENT_TARGET_REMOTE**|Target remote connection string. Used only if `USE_GDB_CLIENT` is 1.|`-DGDB_CLIENT_TARGET_REMOTE=/dev/ttyACM0`
3733
**BUILD_DFU (\*\*)**|Build DFU files while building (needs [adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil)).|`-DBUILD_DFU=1`
3834
**WATCH_COLMI_P8**|Use pin configuration for Colmi P8 watch|`-DWATCH_COLMI_P8=1`
3935
40-
####(**) Note about **CMAKE_BUILD_TYPE**:
36+
####(*) Note about **CMAKE_BUILD_TYPE**:
4137
By default, this variable is set to *Release*. It compiles the code with size and speed optimizations. We use this value for all the binaries we publish when we [release](https://github.com/InfiniTimeOrg/InfiniTime/releases) new versions of InfiniTime.
4238
4339
The *Debug* mode disables all optimizations, which makes the code easier to debug. However, the binary size will likely be too big to fit in the internal flash memory. If you want to build and debug a *Debug* binary, you'll need to disable some parts of the code. For example, the icons for the **Navigation** app use a lot of memory space. You can comment the content of `m_iconMap` in the [Navigation](https://github.com/InfiniTimeOrg/InfiniTime/blob/develop/src/displayapp/screens/Navigation.h#L148) application to free some memory.
4440
4541
####(**) Note about **BUILD_DFU**:
4642
DFU files are the files you'll need to install your build of InfiniTime using OTA (over-the-air) mecanism. To generate the DFU file, the Python tool [adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil) is needed on your system. Check that this tool is properly installed before enabling this option.
4743
48-
#### CMake command line for JLink
44+
#### CMake command
4945
```
50-
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=... -DNRF5_SDK_PATH=... -DUSE_JLINK=1 -DNRFJPROG=... ../
51-
```
52-
53-
#### CMake command line for GDB Client (Black Magic Probe)
54-
```
55-
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=... -DNRF5_SDK_PATH=... -DUSE_GDB_CLIENT=1 -DGDB_CLIENT_BIN_PATH=... -DGDB_CLIENT_TARGET_REMOTE=... ../
56-
```
57-
58-
#### CMake command line for OpenOCD
59-
```
60-
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=... -DNRF5_SDK_PATH=... -DUSE_OPENOCD=1 -DGDB_CLIENT_BIN_PATH=[optional] ../
46+
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=... -DNRF5_SDK_PATH=...
6147
```
6248
6349
### Build the project
6450
During the project generation, CMake created the following targets:
65-
- **FLASH_ERASE** : mass erase the flash memory of the NRF52.
66-
- **FLASH_pinetime-app** : flash the firmware into the NRF52.
6751
- **pinetime-app** : build the standalone (without bootloader support) version of the firmware.
6852
- **pinetime-recovery** : build the standalone recovery version of infinitime (light firmware that only supports OTA and basic UI)
6953
- **pinetime-recovery-loader** : build the standalone tool that flashes the recovery firmware into the external SPI flash
@@ -91,20 +75,7 @@ The same files are generated for **pinetime-recovery** and **pinetime-recoverylo
9175
9276
9377
### Program and run
94-
#### Using CMake targets
95-
These target have been configured during the project generation by CMake according to the parameters you provided to the command line.
96-
97-
Mass erase:
98-
```
99-
make FLASH_ERASE
100-
```
101-
102-
Flash the application:
103-
```
104-
make FLASH_pinetime-app
105-
```
106-
107-
### Using JLink
78+
#### Using JLink
10879
Start JLinkExe:
10980
```
11081
$ /opt/SEGGER/JLink/JLinkExe -device nrf52 -if swd -speed 4000 -autoconnect 1

docker/build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ CmakeGenerate() {
6060

6161
cmake -G "Unix Makefiles" \
6262
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
63-
-DUSE_OPENOCD=1 \
6463
-DARM_NONE_EABI_TOOLCHAIN_PATH="$TOOLS_DIR/$GCC_ARM_VER" \
6564
-DNRF5_SDK_PATH="$TOOLS_DIR/$NRF_SDK_VER" \
6665
-DBUILD_DFU=1 \

src/CMakeLists.txt

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,69 +1052,3 @@ if(BUILD_DFU)
10521052
COMMENT "post build (DFU) steps for ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}"
10531053
)
10541054
endif()
1055-
1056-
1057-
# FLASH
1058-
if (USE_JLINK)
1059-
add_custom_target(FLASH_ERASE
1060-
COMMAND ${NRFJPROG} --eraseall -f ${NRF_TARGET}
1061-
COMMENT "erasing flashing"
1062-
)
1063-
add_custom_target("FLASH_${EXECUTABLE_NAME}"
1064-
DEPENDS ${EXECUTABLE_NAME}
1065-
COMMAND ${NRFJPROG} --program ${EXECUTABLE_FILE_NAME}.hex -f ${NRF_TARGET} --sectorerase
1066-
COMMAND sleep 0.5s
1067-
COMMAND ${NRFJPROG} --reset -f ${NRF_TARGET}
1068-
COMMENT "flashing ${EXECUTABLE_FILE_NAME}.hex"
1069-
)
1070-
1071-
elseif (USE_GDB_CLIENT)
1072-
add_custom_target(FLASH_ERASE
1073-
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'
1074-
COMMENT "erasing flashing"
1075-
)
1076-
add_custom_target("FLASH_${EXECUTABLE_NAME}"
1077-
DEPENDS ${EXECUTABLE_NAME}
1078-
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
1079-
COMMENT "flashing ${EXECUTABLE_FILE_NAME}.hex"
1080-
)
1081-
elseif (USE_OPENOCD)
1082-
if (USE_CMSIS_DAP)
1083-
add_custom_target(FLASH_ERASE
1084-
COMMAND ${OPENOCD_BIN_PATH} -c 'source [find interface/cmsis-dap.cfg]' -c 'transport select swd'
1085-
-c 'source [find target/nrf52.cfg]'
1086-
-c 'init'
1087-
-c 'halt'
1088-
-c 'nrf5 mass_erase'
1089-
-c 'halt'
1090-
-c 'reset'
1091-
-c 'exit'
1092-
COMMENT "erasing flashing"
1093-
)
1094-
add_custom_target("FLASH_${EXECUTABLE_NAME}"
1095-
DEPENDS ${EXECUTABLE_NAME}
1096-
COMMAND ${OPENOCD_BIN_PATH}
1097-
-c 'tcl_port disabled'
1098-
-c 'gdb_port 3333'
1099-
-c 'telnet_port 4444'
1100-
-c 'source [find interface/cmsis-dap.cfg]'
1101-
-c 'transport select swd'
1102-
-c 'source [find target/nrf52.cfg]'
1103-
-c 'halt'
1104-
-c "program \"${EXECUTABLE_FILE_NAME}.hex\""
1105-
-c 'reset'
1106-
-c 'shutdown'
1107-
COMMENT "flashing ${EXECUTABLE_BIN_NAME}.hex"
1108-
)
1109-
else ()
1110-
add_custom_target(FLASH_ERASE
1111-
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
1112-
COMMENT "erasing flashing"
1113-
)
1114-
add_custom_target("FLASH_${EXECUTABLE_NAME}"
1115-
DEPENDS ${EXECUTABLE_NAME}
1116-
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
1117-
COMMENT "flashing ${EXECUTABLE_FILE_NAME}.hex"
1118-
)
1119-
endif ()
1120-
endif ()

0 commit comments

Comments
 (0)