Merge branch 'luben93-messing-with-openocd'
This commit is contained in:
commit
dff0d747c4
|
@ -11,7 +11,7 @@ if (NOT NRF5_SDK_PATH)
|
||||||
message(FATAL_ERROR "The path to the NRF52 SDK must be specified on the command line (add -DNRF5_SDK_PATH=<path>")
|
message(FATAL_ERROR "The path to the NRF52 SDK must be specified on the command line (add -DNRF5_SDK_PATH=<path>")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if(NOT USE_JLINK AND NOT USE_GDB_CLIENT)
|
if(NOT USE_JLINK AND NOT USE_GDB_CLIENT AND NOT USE_OPENOCD)
|
||||||
set(USE_JLINK true)
|
set(USE_JLINK true)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -31,6 +31,12 @@ if(USE_GDB_CLIENT)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(USE_OPENOCD)
|
||||||
|
if(NOT OPENOCD_BIN_PATH)
|
||||||
|
set(OPENOCD_BIN_PATH "openocd")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
message("BUILD CONFIGURATION")
|
message("BUILD CONFIGURATION")
|
||||||
message("-------------------")
|
message("-------------------")
|
||||||
message(" * Version : " ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
message(" * Version : " ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||||
|
@ -44,6 +50,8 @@ elseif(USE_GDB_CLIENT)
|
||||||
message(" * Programmer/debugger : GDB Client")
|
message(" * Programmer/debugger : GDB Client")
|
||||||
message(" * GDB Client path : " ${GDB_CLIENT_BIN_PATH})
|
message(" * GDB Client path : " ${GDB_CLIENT_BIN_PATH})
|
||||||
message(" * GDB Target : " ${GDB_CLIENT_TARGET_REMOTE})
|
message(" * GDB Target : " ${GDB_CLIENT_TARGET_REMOTE})
|
||||||
|
elseif(USE_OPENOCD)
|
||||||
|
message(" * Programmer/debugger : OpenOCD Client")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(VERSION_EDIT_WARNING "// Do not edit this file, it is automatically generated by CMAKE!")
|
set(VERSION_EDIT_WARNING "// Do not edit this file, it is automatically generated by CMAKE!")
|
||||||
|
|
27
README.md
27
README.md
|
@ -44,10 +44,10 @@ See [this page](./doc/PinetimeStubWithNrf52DK.md)
|
||||||
* Clone this repo
|
* Clone this repo
|
||||||
* **[JLINK]** Call CMake with the following command line argument
|
* **[JLINK]** Call CMake with the following command line argument
|
||||||
|
|
||||||
- -DARM_NONE_EABI_TOOLCHAIN_PATH=[Path to the toolchain directory]
|
- -DARM_NONE_EABI_TOOLCHAIN_PATH=[Path to the toolchain directory]
|
||||||
- -DNRF5_SDK_PATH=[Path to the SDK directory]
|
- -DNRF5_SDK_PATH=[Path to the SDK directory]
|
||||||
- -DUSE_JLINK=1
|
- -DUSE_JLINK=1
|
||||||
- -DNRFJPROG=[Path to NRFJProg executable]
|
- -DNRFJPROG=[Path to NRFJProg executable]
|
||||||
|
|
||||||
* OR
|
* OR
|
||||||
* **[GDB CLIENT (if you use a BlackMagicProbe, for example)]** Call CMake with the following command line argument
|
* **[GDB CLIENT (if you use a BlackMagicProbe, for example)]** Call CMake with the following command line argument
|
||||||
|
@ -58,6 +58,18 @@ See [this page](./doc/PinetimeStubWithNrf52DK.md)
|
||||||
- -DGDB_CLIENT_BIN_PATH=[Path to arm-none-eabi-gdb executable]
|
- -DGDB_CLIENT_BIN_PATH=[Path to arm-none-eabi-gdb executable]
|
||||||
- -DGDB_CLIENT_TARGET_REMOTE=[Target remote connetion string. Ex : /dev/ttyACM0]
|
- -DGDB_CLIENT_TARGET_REMOTE=[Target remote connetion string. Ex : /dev/ttyACM0]
|
||||||
|
|
||||||
|
* OR
|
||||||
|
* **[OPENOCD (if you use a STlink v2 clone, for example)]** Call CMake with the following command line argument
|
||||||
|
|
||||||
|
- -DARM_NONE_EABI_TOOLCHAIN_PATH=[Path to the toolchain directory]
|
||||||
|
- -DNRF5_SDK_PATH=[Path to the SDK directory]
|
||||||
|
- -DUSE_OPENOCD=1
|
||||||
|
|
||||||
|
* Optionally, if you want to use a another version then whats on your path
|
||||||
|
|
||||||
|
- -DOPENOCD_BIN_PATH=[path to openocd]
|
||||||
|
|
||||||
|
|
||||||
* Optionally, you can define MERGEHEX with the path to the ```mergehex``` tool from [NRF5X Command Line Tools](https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_nrf5x_cltools%2FUG%2Fcltools%2Fnrf5x_command_line_tools_lpage.html&cp=6_1) to be able to merge the application and softdevice into one HEX file. In this case the merged file is generated in src/pinetime-app-full.hex
|
* Optionally, you can define MERGEHEX with the path to the ```mergehex``` tool from [NRF5X Command Line Tools](https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_nrf5x_cltools%2FUG%2Fcltools%2Fnrf5x_command_line_tools_lpage.html&cp=6_1) to be able to merge the application and softdevice into one HEX file. In this case the merged file is generated in src/pinetime-app-full.hex
|
||||||
|
|
||||||
- -DMERGEHEX=[Path to the mergehex executable]
|
- -DMERGEHEX=[Path to the mergehex executable]
|
||||||
|
@ -74,6 +86,13 @@ GDB (Back Magic Probe)
|
||||||
$ mkdir build
|
$ mkdir build
|
||||||
$ cd build
|
$ cd build
|
||||||
$ cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=... -DNRF5_SDK_PATH=... -DUSE_GDB_CLIENT=1 -DGDB_CLIENT_BIN_PATH=... -DGDB_CLIENT_TARGET_REMOTE=... -DMERGEHEX=... ../
|
$ cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=... -DNRF5_SDK_PATH=... -DUSE_GDB_CLIENT=1 -DGDB_CLIENT_BIN_PATH=... -DGDB_CLIENT_TARGET_REMOTE=... -DMERGEHEX=... ../
|
||||||
|
```
|
||||||
|
|
||||||
|
OpenOCD (STlink v2 clones)
|
||||||
|
```
|
||||||
|
$ mkdir build
|
||||||
|
$ cd build
|
||||||
|
$ cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=... -DNRF5_SDK_PATH=... -DUSE_OPENOCD=1 -DGDB_CLIENT_BIN_PATH=[optional] -DMERGEHEX=... ../
|
||||||
```
|
```
|
||||||
|
|
||||||
* Make
|
* Make
|
||||||
|
|
|
@ -344,6 +344,15 @@ macro(nRF5x_setup)
|
||||||
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 ${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"
|
COMMENT "erasing flashing"
|
||||||
)
|
)
|
||||||
|
elseif(USE_OPENOCD)
|
||||||
|
add_custom_target(FLASH_SOFTDEVICE
|
||||||
|
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 \"${SOFTDEVICE_PATH}\"" -c reset -c shutdown
|
||||||
|
COMMENT "flashing SoftDevice"
|
||||||
|
)
|
||||||
|
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"
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
|
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
|
||||||
|
@ -401,6 +410,12 @@ macro(nRF5x_addExecutable EXECUTABLE_NAME SOURCE_FILES)
|
||||||
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}-full.hex
|
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}-full.hex
|
||||||
COMMENT "flashing ${EXECUTABLE_NAME}-full.hex"
|
COMMENT "flashing ${EXECUTABLE_NAME}-full.hex"
|
||||||
)
|
)
|
||||||
|
elseif(USE_OPENOCD)
|
||||||
|
add_custom_target("FLASH_MERGED_${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_NAME}-full.hex\"" -c reset -c shutdown
|
||||||
|
COMMENT "flashing ${EXECUTABLE_NAME}-full.hex"
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -419,7 +434,12 @@ macro(nRF5x_addExecutable EXECUTABLE_NAME SOURCE_FILES)
|
||||||
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
|
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
|
||||||
COMMENT "flashing ${EXECUTABLE_NAME}.hex"
|
COMMENT "flashing ${EXECUTABLE_NAME}.hex"
|
||||||
)
|
)
|
||||||
|
elseif(USE_OPENOCD)
|
||||||
|
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_NAME}.hex\"" -c reset -c shutdown
|
||||||
|
COMMENT "flashing ${EXECUTABLE_NAME}.hex"
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user