Compare commits
1 Commits
rei/develo
...
remove-cma
Author | SHA1 | Date |
---|---|---|
Jean-François Milants | e65aeac3d9 |
|
@ -60,7 +60,6 @@ CmakeGenerate() {
|
|||
|
||||
cmake -G "Unix Makefiles" \
|
||||
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
||||
-DUSE_OPENOCD=1 \
|
||||
-DARM_NONE_EABI_TOOLCHAIN_PATH="$TOOLS_DIR/$GCC_ARM_VER" \
|
||||
-DNRF5_SDK_PATH="$TOOLS_DIR/$NRF_SDK_VER" \
|
||||
"$SOURCES_DIR"
|
||||
|
|
|
@ -113,7 +113,7 @@ jobs:
|
|||
run: |
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=${{ runner.temp }}/arm-none-eabi -DNRF5_SDK_PATH=${{ runner.temp }}/nrf5_sdk -DUSE_OPENOCD=1 -DBUILD_DFU=1 ../
|
||||
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=${{ runner.temp }}/arm-none-eabi -DNRF5_SDK_PATH=${{ runner.temp }}/nrf5_sdk -DBUILD_DFU=1 ../
|
||||
|
||||
#########################################################################################
|
||||
# Make and Upload DFU Package
|
||||
|
|
|
@ -21,28 +21,6 @@ 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>")
|
||||
endif ()
|
||||
|
||||
if(USE_JLINK)
|
||||
if (NOT NRFJPROG)
|
||||
message(FATAL_ERROR "the path to the tool nrfjprog must be specified on the command line (add -DNRFJPROG=<path>")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
if(USE_GDB_CLIENT)
|
||||
if(NOT GDB_CLIENT_BIN_PATH)
|
||||
set(GDB_CLIENT_BIN_PATH "arm-none-eabi-gdb")
|
||||
endif()
|
||||
|
||||
if(NOT GDB_CLIENT_TARGET_REMOTE)
|
||||
message(FATAL_ERROR "The GDB target must be specified (add -DGDB_CLIENT_TARGET_REMOTE=<target>")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_OPENOCD)
|
||||
if(NOT OPENOCD_BIN_PATH)
|
||||
set(OPENOCD_BIN_PATH "openocd")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(DEFINED USE_DEBUG_PINS AND USE_DEBUG_PINS)
|
||||
add_definitions(-DUSE_DEBUG_PINS)
|
||||
endif()
|
||||
|
@ -77,17 +55,6 @@ message(" * Toolchain : " ${ARM_NONE_EABI_TOOLCHAIN_PATH})
|
|||
message(" * GitRef(S) : " ${PROJECT_GIT_COMMIT_HASH})
|
||||
message(" * NRF52 SDK : " ${NRF5_SDK_PATH})
|
||||
message(" * Target device : " ${TARGET_DEVICE})
|
||||
set(PROGRAMMER "???")
|
||||
if(USE_JLINK)
|
||||
message(" * Programmer/debugger : JLINK")
|
||||
message(" * NrfJprog : " ${NRFJPROG})
|
||||
elseif(USE_GDB_CLIENT)
|
||||
message(" * Programmer/debugger : GDB Client")
|
||||
message(" * GDB Client path : " ${GDB_CLIENT_BIN_PATH})
|
||||
message(" * GDB Target : " ${GDB_CLIENT_TARGET_REMOTE})
|
||||
elseif(USE_OPENOCD)
|
||||
message(" * Programmer/debugger : OpenOCD Client")
|
||||
endif()
|
||||
if(USE_DEBUG_PINS)
|
||||
message(" * Debug pins : Enabled")
|
||||
else()
|
||||
|
|
|
@ -230,24 +230,6 @@ macro(nRF5x_setup)
|
|||
"${NRF5_SDK_PATH}/modules/nrfx/drivers/src/nrfx_twi.c"
|
||||
)
|
||||
|
||||
# adds target for erasing
|
||||
if(USE_JLINK)
|
||||
add_custom_target(FLASH_ERASE
|
||||
COMMAND ${NRFJPROG} --eraseall -f ${NRF_TARGET}
|
||||
COMMENT "erasing flashing"
|
||||
)
|
||||
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"
|
||||
)
|
||||
elseif(USE_OPENOCD)
|
||||
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()
|
||||
|
||||
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
set(TERMINAL "open")
|
||||
elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
|
||||
|
@ -256,16 +238,6 @@ macro(nRF5x_setup)
|
|||
set(TERMINAL "gnome-terminal")
|
||||
endif()
|
||||
|
||||
if(USE_JLINK)
|
||||
add_custom_target(START_JLINK
|
||||
COMMAND ${TERMINAL} "${DIR_OF_nRF5x_CMAKE}/runJLinkGDBServer-${NRF_TARGET}"
|
||||
COMMAND ${TERMINAL} "${DIR_OF_nRF5x_CMAKE}/runJLinkExe-${NRF_TARGET}"
|
||||
COMMAND sleep 2s
|
||||
COMMAND ${TERMINAL} "${DIR_OF_nRF5x_CMAKE}/runJLinkRTTClient"
|
||||
COMMENT "started JLink commands"
|
||||
)
|
||||
endif()
|
||||
|
||||
endmacro(nRF5x_setup)
|
||||
|
||||
# adds a target for comiling and flashing an executable
|
||||
|
@ -283,29 +255,6 @@ macro(nRF5x_addExecutable EXECUTABLE_NAME SOURCE_FILES)
|
|||
COMMAND ${CMAKE_OBJCOPY} -O ihex ${EXECUTABLE_NAME}.out "${EXECUTABLE_NAME}.hex"
|
||||
COMMENT "post build steps for ${EXECUTABLE_NAME}")
|
||||
|
||||
# custom target for flashing the board
|
||||
if(USE_JLINK)
|
||||
add_custom_target("FLASH_${EXECUTABLE_NAME}"
|
||||
DEPENDS ${EXECUTABLE_NAME}
|
||||
COMMAND ${NRFJPROG} --program ${EXECUTABLE_NAME}.hex -f ${NRF_TARGET} --sectorerase
|
||||
COMMAND sleep 0.5s
|
||||
COMMAND ${NRFJPROG} --reset -f ${NRF_TARGET}
|
||||
COMMENT "flashing ${EXECUTABLE_NAME}.hex"
|
||||
)
|
||||
elseif(USE_GDB_CLIENT)
|
||||
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_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()
|
||||
|
||||
endmacro()
|
||||
|
||||
# adds app-level scheduler library
|
||||
|
|
|
@ -29,15 +29,11 @@ CMake configures the project according to variables you specify the command line
|
|||
----------|-------------|--------|
|
||||
**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/`|
|
||||
**NRF5_SDK_PATH**|path to the NRF52 SDK|`-DNRF5_SDK_PATH=/home/jf/nrf52/Pinetime/sdk`|
|
||||
**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`
|
||||
**CMAKE_BUILD_TYPE (\*)**| Build type (Release or Debug). Release is applied by default if this variable is not specified.|`-DCMAKE_BUILD_TYPE=Debug`
|
||||
**NRFJPROG**|Path to the NRFJProg executable. Used only if `USE_JLINK` is 1.|`-DNRFJPROG=/opt/nrfjprog/nrfjprog`
|
||||
**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`
|
||||
**GDB_CLIENT_TARGET_REMOTE**|Target remote connection string. Used only if `USE_GDB_CLIENT` is 1.|`-DGDB_CLIENT_TARGET_REMOTE=/dev/ttyACM0`
|
||||
**BUILD_DFU (\*\*)**|Build DFU files while building (needs [adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil)).|`-DBUILD_DFU=1`
|
||||
**WATCH_COLMI_P8**|Use pin configuration for Colmi P8 watch|`-DWATCH_COLMI_P8=1`
|
||||
|
||||
####(**) Note about **CMAKE_BUILD_TYPE**:
|
||||
####(*) Note about **CMAKE_BUILD_TYPE**:
|
||||
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.
|
||||
|
||||
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.
|
||||
|
@ -45,25 +41,13 @@ The *Debug* mode disables all optimizations, which makes the code easier to debu
|
|||
####(**) Note about **BUILD_DFU**:
|
||||
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.
|
||||
|
||||
#### CMake command line for JLink
|
||||
#### CMake command
|
||||
```
|
||||
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=... -DNRF5_SDK_PATH=... -DUSE_JLINK=1 -DNRFJPROG=... ../
|
||||
```
|
||||
|
||||
#### CMake command line for GDB Client (Black Magic Probe)
|
||||
```
|
||||
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=... -DNRF5_SDK_PATH=... -DUSE_GDB_CLIENT=1 -DGDB_CLIENT_BIN_PATH=... -DGDB_CLIENT_TARGET_REMOTE=... ../
|
||||
```
|
||||
|
||||
#### CMake command line for OpenOCD
|
||||
```
|
||||
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=... -DNRF5_SDK_PATH=... -DUSE_OPENOCD=1 -DGDB_CLIENT_BIN_PATH=[optional] ../
|
||||
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=... -DNRF5_SDK_PATH=...
|
||||
```
|
||||
|
||||
### Build the project
|
||||
During the project generation, CMake created the following targets:
|
||||
- **FLASH_ERASE** : mass erase the flash memory of the NRF52.
|
||||
- **FLASH_pinetime-app** : flash the firmware into the NRF52.
|
||||
- **pinetime-app** : build the standalone (without bootloader support) version of the firmware.
|
||||
- **pinetime-recovery** : build the standalone recovery version of infinitime (light firmware that only supports OTA and basic UI)
|
||||
- **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
|
|||
|
||||
|
||||
### Program and run
|
||||
#### Using CMake targets
|
||||
These target have been configured during the project generation by CMake according to the parameters you provided to the command line.
|
||||
|
||||
Mass erase:
|
||||
```
|
||||
make FLASH_ERASE
|
||||
```
|
||||
|
||||
Flash the application:
|
||||
```
|
||||
make FLASH_pinetime-app
|
||||
```
|
||||
|
||||
### Using JLink
|
||||
#### Using JLink
|
||||
Start JLinkExe:
|
||||
```
|
||||
$ /opt/SEGGER/JLink/JLinkExe -device nrf52 -if swd -speed 4000 -autoconnect 1
|
||||
|
|
|
@ -60,7 +60,6 @@ CmakeGenerate() {
|
|||
|
||||
cmake -G "Unix Makefiles" \
|
||||
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
||||
-DUSE_OPENOCD=1 \
|
||||
-DARM_NONE_EABI_TOOLCHAIN_PATH="$TOOLS_DIR/$GCC_ARM_VER" \
|
||||
-DNRF5_SDK_PATH="$TOOLS_DIR/$NRF_SDK_VER" \
|
||||
-DBUILD_DFU=1 \
|
||||
|
|
|
@ -1052,69 +1052,3 @@ if(BUILD_DFU)
|
|||
COMMENT "post build (DFU) steps for ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}"
|
||||
)
|
||||
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 ${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 ()
|
||||
|
|
Loading…
Reference in New Issue