Skip to content

Commit b02f246

Browse files
committed
feat: make Memfault project key optional
### Summary In cases where an upstream device uploads data to Memfault on behalf of a downstream device, the project key is not required. This change allows the project key to be optional in those cases, which for the NCS Memfault sources is when we are not using MDS or the Memfault Zephyr HTTP client. ### Test Plan Confirmed that before this change, the build fails if the project key is not set for a generic cortex-m application where Memfault is enabled: ``` west build -b qemu_cortex_m3 -p always zephyr/samples/hello_world -- \ -DCONFIG_MEMFAULT=y \ -DCONFIG_MEMFAULT_NCS_FW_TYPE=\"test-app\" \ -DCONFIG_MEMFAULT_NCS_DEVICE_ID=\"my-test-device\" ``` Confirmed after this change, the build succeeds with this same build command. Also confirmed that after this change, the build still fails if the project key is not set for projects where MDS or the Memfault Zephyr HTTP client are used: ``` west build --pristine always --board nrf52840dk/nrf52840 \ nrf/samples/bluetooth/peripheral_mds ... /Users/gminnehan/projects/memfault-sdk-nrf-workspace/zephyr/include/zephyr/toolchain/gcc.h:87:36: error: static assertion failed: "Memfault Project Key not configured. Please visit https://goto.memfault.com/create-key/nrf91 " 87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG) | ^~~~~~~~~~~~~~ /Users/gminnehan/projects/memfault-sdk-nrf-workspace/nrf/modules/memfault-firmware-sdk/memfault_integration.c:40:1: note: in expansion of macro 'BUILD_ASSERT' 40 | BUILD_ASSERT(sizeof(CONFIG_MEMFAULT_NCS_PROJECT_KEY) > 1, | ^~~~~~~~~~~~ ``` ``` west build -b thingy91/nrf9160/ns -p always \ nrf/applications/asset_tracker_v2 -- \ -DOVERLAY_CONFIG=overlay-memfault.conf ... /Users/gminnehan/projects/memfault-sdk-nrf-workspace/zephyr/include/zephyr/toolchain/gcc.h:87:36: error: static assertion failed: "Memfault Project Key not configured. Please visit https://goto.memfault.com/create-key/nrf91 " 87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG) | ^~~~~~~~~~~~~~ /Users/gminnehan/projects/memfault-sdk-nrf-workspace/nrf/modules/memfault-firmware-sdk/memfault_integration.c:40:1: note: in expansion of macro 'BUILD_ASSERT' 40 | BUILD_ASSERT(sizeof(CONFIG_MEMFAULT_NCS_PROJECT_KEY) > 1, | ^~~~~~~~~~~~ ```
1 parent 6e4a44d commit b02f246

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

modules/memfault-firmware-sdk/memfault_integration.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ LOG_MODULE_REGISTER(memfault_ncs, CONFIG_MEMFAULT_NCS_LOG_LEVEL);
3535
#define MEMFAULT_URL "https://goto.memfault.com/create-key/nrf"
3636
#endif
3737

38+
#if defined(CONFIG_BT_MDS) || defined(CONFIG_MEMFAULT_HTTP_ENABLE)
3839
/* Project key check */
3940
BUILD_ASSERT(sizeof(CONFIG_MEMFAULT_NCS_PROJECT_KEY) > 1,
4041
"Memfault Project Key not configured. Please visit " MEMFAULT_URL " ");
42+
#endif
4143

4244
/* Firmware type check */
4345
BUILD_ASSERT(sizeof(CONFIG_MEMFAULT_NCS_FW_TYPE) > 1, "Firmware type must be configured");

0 commit comments

Comments
 (0)