Skip to content

Commit 6ed8e98

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 c853681 commit 6ed8e98

File tree

6 files changed

+2
-189
lines changed

6 files changed

+2
-189
lines changed

.devcontainer/build.sh

-1
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"

CMakeLists.txt

-33
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,6 @@ if (NOT NRF5_SDK_PATH)
2424
message(FATAL_ERROR "The path to the NRF52 SDK must be specified on the command line (add -DNRF5_SDK_PATH=<path>")
2525
endif ()
2626

27-
if(USE_JLINK)
28-
if (NOT NRFJPROG)
29-
message(FATAL_ERROR "the path to the tool nrfjprog must be specified on the command line (add -DNRFJPROG=<path>")
30-
endif ()
31-
endif()
32-
33-
if(USE_GDB_CLIENT)
34-
if(NOT GDB_CLIENT_BIN_PATH)
35-
set(GDB_CLIENT_BIN_PATH "arm-none-eabi-gdb")
36-
endif()
37-
38-
if(NOT GDB_CLIENT_TARGET_REMOTE)
39-
message(FATAL_ERROR "The GDB target must be specified (add -DGDB_CLIENT_TARGET_REMOTE=<target>")
40-
endif()
41-
endif()
42-
43-
if(USE_OPENOCD)
44-
if(NOT OPENOCD_BIN_PATH)
45-
set(OPENOCD_BIN_PATH "openocd")
46-
endif()
47-
endif()
48-
4927
if(DEFINED USE_DEBUG_PINS AND USE_DEBUG_PINS)
5028
add_definitions(-DUSE_DEBUG_PINS)
5129
endif()
@@ -81,17 +59,6 @@ message(" * Toolchain : " ${ARM_NONE_EABI_TOOLCHAIN_PATH})
8159
message(" * GitRef(S) : " ${PROJECT_GIT_COMMIT_HASH})
8260
message(" * NRF52 SDK : " ${NRF5_SDK_PATH})
8361
message(" * Target device : " ${TARGET_DEVICE})
84-
set(PROGRAMMER "???")
85-
if(USE_JLINK)
86-
message(" * Programmer/debugger : JLINK")
87-
message(" * NrfJprog : " ${NRFJPROG})
88-
elseif(USE_GDB_CLIENT)
89-
message(" * Programmer/debugger : GDB Client")
90-
message(" * GDB Client path : " ${GDB_CLIENT_BIN_PATH})
91-
message(" * GDB Target : " ${GDB_CLIENT_TARGET_REMOTE})
92-
elseif(USE_OPENOCD)
93-
message(" * Programmer/debugger : OpenOCD Client")
94-
endif()
9562
if(USE_DEBUG_PINS)
9663
message(" * Debug pins : Enabled")
9764
else()

cmake-nRF5x/CMake_nRF5x.cmake

-51
Original file line numberDiff line numberDiff line change
@@ -229,24 +229,6 @@ macro(nRF5x_setup)
229229
"${NRF5_SDK_PATH}/modules/nrfx/drivers/src/nrfx_twi.c"
230230
)
231231

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

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

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

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

310259
# adds app-level scheduler library

doc/buildAndProgram.md

+2-38
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ CMake configures the project according to variables you specify the command line
4040
----------|-------------|--------|
4141
**ARM_NONE_EABI_TOOLCHAIN_PATH**|path to the toolchain directory|`-DARM_NONE_EABI_TOOLCHAIN_PATH=/home/jf/nrf52/gcc-arm-none-eabi-10.3-2021.10/`|
4242
**NRF5_SDK_PATH**|path to the NRF52 SDK|`-DNRF5_SDK_PATH=/home/jf/nrf52/Pinetime/sdk`|
43-
**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`
4443
**CMAKE_BUILD_TYPE (\*)**| Build type (Release or Debug). Release is applied by default if this variable is not specified.|`-DCMAKE_BUILD_TYPE=Debug`
45-
**NRFJPROG**|Path to the NRFJProg executable. Used only if `USE_JLINK` is 1.|`-DNRFJPROG=/opt/nrfjprog/nrfjprog`
46-
**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`
47-
**GDB_CLIENT_TARGET_REMOTE**|Target remote connection string. Used only if `USE_GDB_CLIENT` is 1.|`-DGDB_CLIENT_TARGET_REMOTE=/dev/ttyACM0`
4844
**BUILD_DFU (\*\*)**|Build DFU files while building (needs [adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil)).|`-DBUILD_DFU=1`
4945
**BUILD_RESOURCES (\*\*)**| Generate external resource while building (needs [lv_font_conv](https://github.com/lvgl/lv_font_conv) and [lv_img_conv](https://github.com/lvgl/lv_img_conv). |`-DBUILD_RESOURCES=1`
5046
**TARGET_DEVICE**|Target device, used for hardware configuration. Allowed: `PINETIME, MOY-TFK5, MOY-TIN5, MOY-TON5, MOY-UNK`|`-DTARGET_DEVICE=PINETIME` (Default)
@@ -57,30 +53,16 @@ The *Debug* mode disables all optimizations, which makes the code easier to debu
5753
#### (\*\*) Note about **BUILD_DFU**
5854
DFU files are the files you'll need to install your build of InfiniTime using OTA (over-the-air) mechanism. 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.
5955
60-
#### CMake command line for JLink
56+
#### CMake command
6157
6258
```
63-
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=... -DNRF5_SDK_PATH=... -DUSE_JLINK=1 -DNRFJPROG=... ../
64-
```
65-
66-
#### CMake command line for GDB Client (Black Magic Probe)
67-
68-
```
69-
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=... -DNRF5_SDK_PATH=... -DUSE_GDB_CLIENT=1 -DGDB_CLIENT_BIN_PATH=... -DGDB_CLIENT_TARGET_REMOTE=... ../
70-
```
71-
72-
#### CMake command line for OpenOCD
73-
74-
```
75-
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=... -DNRF5_SDK_PATH=... -DUSE_OPENOCD=1 -DGDB_CLIENT_BIN_PATH=[optional] ../
59+
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=... -DNRF5_SDK_PATH=...
7660
```
7761
7862
### Build the project
7963
8064
During the project generation, CMake created the following targets:
8165
82-
- **FLASH_ERASE** : mass erase the flash memory of the NRF52.
83-
- **FLASH_pinetime-app** : flash the firmware into the NRF52.
8466
- **pinetime-app** : build the standalone (without bootloader support) version of the firmware.
8567
- **pinetime-recovery** : build the standalone recovery version of infinitime (light firmware that only supports OTA and basic UI)
8668
- **pinetime-recovery-loader** : build the standalone tool that flashes the recovery firmware into the external SPI flash
@@ -108,24 +90,6 @@ Binary files are generated into the folder `src`:
10890
10991
The same files are generated for **pinetime-recovery** and **pinetime-recoveryloader**
11092
111-
### Program and run
112-
113-
#### Using CMake targets
114-
115-
These target have been configured during the project generation by CMake according to the parameters you provided to the command line.
116-
117-
Mass erase:
118-
119-
```
120-
make FLASH_ERASE
121-
```
122-
123-
Flash the application:
124-
125-
```
126-
make FLASH_pinetime-app
127-
```
128-
12993
### How to generate files needed by the factory
13094
13195
These files are needed by the Pine64 factory to flash InfiniTime as the default firmware on the PineTimes.

docker/build.sh

-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ CmakeGenerate() {
6363
-S "$SOURCES_DIR" \
6464
-B "$BUILD_DIR" \
6565
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
66-
-DUSE_OPENOCD=1 \
6766
-DARM_NONE_EABI_TOOLCHAIN_PATH="$TOOLS_DIR/$GCC_ARM_PATH" \
6867
-DNRF5_SDK_PATH="$TOOLS_DIR/$NRF_SDK_VER" \
6968
-DBUILD_DFU=1 \

src/CMakeLists.txt

-65
Original file line numberDiff line numberDiff line change
@@ -1139,68 +1139,3 @@ if(BUILD_RESOURCES)
11391139
add_subdirectory(resources)
11401140
endif()
11411141

1142-
1143-
# FLASH
1144-
if (USE_JLINK)
1145-
add_custom_target(FLASH_ERASE
1146-
COMMAND ${NRFJPROG} --eraseall -f ${NRF_TARGET}
1147-
COMMENT "erasing flashing"
1148-
)
1149-
add_custom_target("FLASH_${EXECUTABLE_NAME}"
1150-
DEPENDS ${EXECUTABLE_NAME}
1151-
COMMAND ${NRFJPROG} --program ${EXECUTABLE_FILE_NAME}.hex -f ${NRF_TARGET} --sectorerase
1152-
COMMAND sleep 0.5s
1153-
COMMAND ${NRFJPROG} --reset -f ${NRF_TARGET}
1154-
COMMENT "flashing ${EXECUTABLE_FILE_NAME}.hex"
1155-
)
1156-
1157-
elseif (USE_GDB_CLIENT)
1158-
add_custom_target(FLASH_ERASE
1159-
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'
1160-
COMMENT "erasing flashing"
1161-
)
1162-
add_custom_target("FLASH_${EXECUTABLE_NAME}"
1163-
DEPENDS ${EXECUTABLE_NAME}
1164-
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
1165-
COMMENT "flashing ${EXECUTABLE_FILE_NAME}.hex"
1166-
)
1167-
elseif (USE_OPENOCD)
1168-
if (USE_CMSIS_DAP)
1169-
add_custom_target(FLASH_ERASE
1170-
COMMAND ${OPENOCD_BIN_PATH} -c 'source [find interface/cmsis-dap.cfg]' -c 'transport select swd'
1171-
-c 'source [find target/nrf52.cfg]'
1172-
-c 'init'
1173-
-c 'halt'
1174-
-c 'nrf5 mass_erase'
1175-
-c 'halt'
1176-
-c 'reset'
1177-
-c 'exit'
1178-
COMMENT "erasing flashing"
1179-
)
1180-
add_custom_target("FLASH_${EXECUTABLE_NAME}"
1181-
DEPENDS ${EXECUTABLE_NAME}
1182-
COMMAND ${OPENOCD_BIN_PATH}
1183-
-c 'tcl_port disabled'
1184-
-c 'gdb_port 3333'
1185-
-c 'telnet_port 4444'
1186-
-c 'source [find interface/cmsis-dap.cfg]'
1187-
-c 'transport select swd'
1188-
-c 'source [find target/nrf52.cfg]'
1189-
-c 'halt'
1190-
-c "program \"${EXECUTABLE_FILE_NAME}.hex\""
1191-
-c 'reset'
1192-
-c 'shutdown'
1193-
COMMENT "flashing ${EXECUTABLE_BIN_NAME}.hex"
1194-
)
1195-
else ()
1196-
add_custom_target(FLASH_ERASE
1197-
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
1198-
COMMENT "erasing flashing"
1199-
)
1200-
add_custom_target("FLASH_${EXECUTABLE_NAME}"
1201-
DEPENDS ${EXECUTABLE_NAME}
1202-
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
1203-
COMMENT "flashing ${EXECUTABLE_FILE_NAME}.hex"
1204-
)
1205-
endif ()
1206-
endif ()

0 commit comments

Comments
 (0)