nrb-tech / nrf5-cmake-scripts Goto Github PK
View Code? Open in Web Editor NEWCMake scripts for developing projects with Nordic Semiconductor nRF5 series SoCs
License: MIT License
CMake scripts for developing projects with Nordic Semiconductor nRF5 series SoCs
License: MIT License
mergehex utility is used with 4 files when nRF5_addBootloaderSoftDeviceAppMergeTarget is invoked, should be done sequentially instead. The command in nRF5-cmake.cmake that causes the problem:
COMMAND ${MERGEHEX} -m ${BOOTLOADER_HEX} "${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE_NAME}_bootloader_setting.hex" "${${SOFTDEVICE}_HEX_FILE}" "${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE_NAME}.hex" -o "${OP_FILE}
I suggest the following replacement:
COMMAND ${MERGEHEX} -m ${BOOTLOADER_HEX} "${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE_NAME}_bootloader_setting.hex" "${${SOFTDEVICE}_HEX_FILE}" -o "${OP_FILE}"
COMMAND ${MERGEHEX} -m "${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE_NAME}.hex" "${OP_FILE}" -o "${OP_FILE}"
I am using the template project in order to build for Nordic 52840 chip in CLion on Ubuntu 18.04. My version of gnome-terminal is 3.28.2 and the following commands doesn't work:
COMMAND ${TERMINAL} "${nRF5_CMAKE_PATH}/runJLink...${COMMAND_SUFFIX}" ${POST_OPTIONS}
This is due to updated syntax as far as I understand, see this.
That means that following change would work:
COMMAND ${TERMINAL} -- "${nRF5_CMAKE_PATH}/runJLink...${COMMAND_SUFFIX}" ${POST_OPTIONS}
I have updated nRF5-cmake-scripts locally in another branch by adding "COMMAND_PREFIX" variable that would contain "--" for unix distros:
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
set(TERMINAL "open")
set(COMMAND_PREFIX "")
set(COMMAND_SUFFIX "")
elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
find_program(CMD cmd)
set(TERMINAL ${CMD} /c start powershell -noexit -ExecutionPolicy Bypass -File)
set(POST_OPTIONS -JLinkPath ${JLINK} -JLinkGDBServerPath ${JLINKGDBSERVER} -JLinkRTTClientPath ${JLINKRTTCLIENT})
set(COMMAND_PREFIX "")
set(COMMAND_SUFFIX ".ps1")
else()
set(TERMINAL "gnome-terminal")
set(COMMAND_PREFIX "--")
set(COMMAND_SUFFIX "")
endif()
if(EXISTS "${JLINK}")
if(EXISTS "${JLINKGDBSERVER}" AND EXISTS "${JLINKRTTCLIENT}")
add_custom_target(START_JLINK_ALL ALL
COMMAND ${TERMINAL} ${COMMAND_PREFIX} "${nRF5_CMAKE_PATH}/runJLinkGDBServer${COMMAND_SUFFIX}" ${POST_OPTIONS}
COMMAND ${TERMINAL} ${COMMAND_PREFIX} "${nRF5_CMAKE_PATH}/runJLinkExe${COMMAND_SUFFIX}" ${POST_OPTIONS}
COMMAND cmake -E sleep 2
COMMAND ${TERMINAL} ${COMMAND_PREFIX} "${nRF5_CMAKE_PATH}/runJLinkRTTClient${COMMAND_SUFFIX}" ${POST_OPTIONS}
COMMENT "started JLink commands"
VERBATIM
)
endif()
if(EXISTS "${JLINKRTTCLIENT}")
add_custom_target(START_JLINK_RTT ALL
COMMAND ${TERMINAL} ${COMMAND_PREFIX} "${nRF5_CMAKE_PATH}/runJLinkExe${COMMAND_SUFFIX}" ${POST_OPTIONS}
COMMAND cmake -E sleep 2
COMMAND ${TERMINAL} ${COMMAND_PREFIX} "${nRF5_CMAKE_PATH}/runJLinkRTTClient${COMMAND_SUFFIX}" ${POST_OPTIONS}
COMMENT "started JLink RTT terminal"
VERBATIM
)
else()
message(WARNING "The path to the JLinkRTTClient utility (JLINKRTTCLIENT) is not set or does not exist, so START_JLINK_RTT and START_JLINK_ALL targets will not be available")
endif()
if(EXISTS "${JLINKGDBSERVER}")
add_custom_target(START_JLINK_GDBSERVER ALL
COMMAND ${TERMINAL} ${COMMAND_PREFIX} "${nRF5_CMAKE_PATH}/runJLinkExe${COMMAND_SUFFIX}" ${POST_OPTIONS}
COMMAND cmake -E sleep 2
COMMAND ${TERMINAL} ${COMMAND_PREFIX} "${nRF5_CMAKE_PATH}/runJLinkGDBServer${COMMAND_SUFFIX}" ${POST_OPTIONS}
COMMENT "started JLink GDB server"
VERBATIM
)
else()
message(WARNING "The path to the JLinkGDBServer utility (JLINKGDBSERVER) is not set or does not exist, so START_JLINK_GDBSERVER and START_JLINK_ALL targets will not be available")
endif()
else()
message(WARNING "The path to the JLink utility (JLINK) is not set or does not exist, so START_JLINK_* targets will not be available")
endif()
But I suppose that this probably needs another thought on how to keep it backward compatible?
The readme is out of date - states we can use flash_ and a number of other targets that do not exist.
I'm going off what's generated in the makefile:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... edit_cache"
@echo "... rebuild_cache"
@echo "... BlinkyExample_bl"
@echo "... BlinkyExample_bl_sd_app_merge"
@echo "... BlinkyExample_bl_sd_app_merge_flash"
@echo "... BlinkyExample_bl_sd_app_pkg"
@echo "... BlinkyExample_pkg"
@echo "... FLASH_ERASE"
@echo "... FLASH_SOFTDEVICE"
@echo "... START_JLINK_ALL"
@echo "... START_JLINK_GDBSERVER"
@echo "... START_JLINK_RTT"
@echo "... uECC"
@echo "... BlinkyExample"
But I don't see anyway to flash just the app, or app plus SD.
I use backend mbedtls w/ nRF5 SDK. I want to include files so both AES256CCM as well as AES256ECB gets compiled. AES 256 CCM cipher is in mbedtls_backend_aes_aead.c and AES 256 ECB cipher is in mbedtls_backend_aes.c. My suspicion is that they the if-statement used here is broken up because of the additional "_" in case of the aead
.
Would the best way be to change:
macro(nRF5_addCryptoBackend TYPE BACKEND)
to something like:
macro(nRF5_addCryptoBackend TYPE BACKEND USE_AEAD)
Is there any harm in calling setup macro twice?
nRF5_addCryptoBackend("aes" "mbedtls")
nRF5_addCryptoBackend("aead" "mbedtls")
If not, no change may be needed. If there is an issue, I can create a PR with the change when I finished setting up my project because I'll have to get it working anyways.
diff --git a/example/toolchains/nRF5/nRF5_SDK_17.1.0_ddde560/examples/dfu/secure_bootloader/pca10040_s132_ble/config/sdk_config.h b/example/toolchains/nRF5/nRF5_SDK_17.1.0_ddde560/examples/dfu/secure_bootloader/pca10040_s132_ble/config/sdk_config.h
index b00ff5e..88b54bf 100644
--- a/example/toolchains/nRF5/nRF5_SDK_17.1.0_ddde560/examples/dfu/secure_bootloader/pca10040_s132_ble/config/sdk_config.h
+++ b/example/toolchains/nRF5/nRF5_SDK_17.1.0_ddde560/examples/dfu/secure_bootloader/pca10040_s132_ble/config/sdk_config.h
@@ -42,6 +42,30 @@
#ifndef SDK_CONFIG_H
#define SDK_CONFIG_H
+
+#define SEGGER_RTT_SECTION ".rtt"
+
+#ifndef SEGGER_RTT_CONFIG_BUFFER_SIZE_UP
+#define SEGGER_RTT_CONFIG_BUFFER_SIZE_UP 512
+#endif
+
+#ifndef SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS
+#define SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS 2
+#endif
+
+#ifndef SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN
+#define SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN 16
+#endif
+
+#ifndef SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS
+#define SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS 2
+#endif
+
+#ifndef SEGGER_RTT_CONFIG_DEFAULT_MODE
+#define SEGGER_RTT_CONFIG_DEFAULT_MODE 0
+#endif
cmake --build cmake-build-debug --target BlinkyExample_bl
Linking target: _build_Debug_BlinkyExample/nrf52832_xxaa_s132.out
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: region FLASH overflowed with .data and user data
Not working in Windows! (I am using Visual Studio and VisualGDB)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.