static assertion failed: "CONFIG_WIFI_CREDENTIALS_STATIC_SSID required" when building mqtt example with nRF7002 dev board

Hi.

I am new to using VS Code so i am thinking i am doing something wrong. I am using the NCS 2.4, the nrf7002dk_nrf5340  dev board with the MQTT example that is here. 

I am trying to compile the example here https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/net/mqtt/doc/description.html

I have used the below build configuration

But the compile is failing with the following error: 

C:\ncs\v2.4.0\zephyr\include\zephyr\toolchain\gcc.h:81:36: error: static assertion failed: "CONFIG_WIFI_CREDENTIALS_STATIC_SSID required"
81 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)
| ^~~~~~~~~~~~~~
C:\ncs\v2.4.0\nrf\subsys\net\lib\wifi_mgmt_ext\wifi_mgmt_ext.c:23:9: note: in expansion of macro 'BUILD_ASSERT'
23 | BUILD_ASSERT(sizeof(CONFIG_WIFI_CREDENTIALS_STATIC_SSID) != 1,
| ^~~~~~~~~~~~

and looking further back into the build log i see:

-- Found assembler: C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
CMake Warning at C:/ncs/v2.4.0/nrf/subsys/net/lib/mqtt_helper/CMakeLists.txt:12 (message):
Credentials are exposed in non-secure memory. This should be avoided in
production.


CMake Warning at C:/ncs/v2.4.0/zephyr/CMakeLists.txt:838 (message):
No SOURCES given to Zephyr library: lib__libc__common

Excluding target from build.


CMake Warning at C:/ncs/v2.4.0/zephyr/CMakeLists.txt:838 (message):
No SOURCES given to Zephyr library: drivers__ethernet

Excluding target from build.


CMake Warning at C:/ncs/v2.4.0/zephyr/CMakeLists.txt:838 (message):
No SOURCES given to Zephyr library: drivers__wifi

Excluding target from build.


CMake Warning at C:/ncs/v2.4.0/zephyr/CMakeLists.txt:1864 (message):
__ASSERT() statements are globally ENABLED

 I am able to build the provisioning example for the dev board fine. However i cant seem to build this example.

Any ideas?

Mark

Parents
  • Hi,

    You need to configure the SSID for your Wi-Fi network in prj.conf. If your Wi-Fi network is password protected, then you must also configure the password.

    CONFIG_WIFI_CREDENTIALS_STATIC_SSID="my_network_ssid"
    CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="my_network_password"

    Best regards,
    Marte

  • Hi, thanks this was not clear to me that needed to be added to the defines from the kconfig. I have configured this now and get this far. 

    [00:00:00.475,799] <inf> fs_nvs: 6 Sectors of 4096 bytes
    [00:00:00.475,830] <inf> fs_nvs: alloc wra: 0, fe8
    [00:00:00.475,830] <inf> fs_nvs: data wra: 0, 0
    *** Booting Zephyr OS build v3.3.99-ncs1-1 ***
    [00:00:01.479,614] <wrn> wifi_credentials: Cannot retrieve WiFi credentials, no entry found for the provided SSID
    [00:00:01.479,644] <inf> wifi_mgmt_ext: Adding statically configured WiFi network [Irwin] to internal list.
    [00:00:08.128,540] <inf> network: Wi-Fi Connected, waiting for IP address
    [00:00:08.282,470] <inf> network: IPv4 address acquired
    ASSERTION FAIL [dns_offload] @ WEST_TOPDIR/zephyr/subsys/net/lib/sockets/socket_offload.c:29
    [00:00:13.286,132] <err> os: r0/a1: 0x00000004 r1/a2: 0x0000001d r2/a3: 0x20001190
    [00:00:13.286,132] <err> os: r3/a4: 0x20004dfc r12/ip: 0x00000003 r14/lr: 0x00007cbd
    [00:00:13.286,132] <err> os: xpsr: 0x61000000
    [00:00:13.286,163] <err> os: Faulting instruction address (r15/pc): 0x00049e7c
    [00:00:13.286,193] <err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
    [00:00:13.286,224] <err> os: Current thread: 0x20001190 (unknown)

    Any ideas about this kernel panic?

  • Hi,

    Have you made any changes to the sample other than configuring the network credentials? Do you get the same error if you build without TLS, that is, without adding overlay-tls-nrf7002.conf in the build configuration?

    Best regards,
    Marte

  • I will check now if there is any other code snippets missing. Or added, i was trying to load the boilerplate example.

    I have cleaned and rebuilt the configuration file but it still keeps crashing with the kernel panic. 

    I have noticed that VS Code is adding that CMake arguements and even if i delete them it re-adds it next time it builds. 

    I am seeing the first LED light thats its connecting to the server then its crashing.

    A snippet from the prj.conf is below

    Could the fact the head size being set cause it to crash?

  • Interestingly i built the library again from scratch to make sure i make no edits and defined the client id as above and then it doesn't panic?

Reply Children
  • Hi,

    When rebuilding a project with an existing build directory, the VS Code extension will create the build command based on what is in CMake cache, including for example overlay configurations. There might be some cache in the build directory that is not removed when rebuilding, which could have caused this issue.

    Are you able to run the sample successfully now, or are you still seeing some issues?

    Best regards,
    Marte

  • It is sending messages over MQTT to the server so its working as expected now. 

    I am trying to get the mqtt provisioning example from the blog working now. But it is also crashing but on a different error. https://github.com/AliNordic/mqtt_over_wifi_nrf7002DK This is not built for the 2.4.1 stack and i have been debugging it. 

    So far I have been able to get it provision by looking at added defines and file changes in the provisioning example  for example the below is added now.

    #include <net/wifi_mgmt_ext.h>

    I can get the code to provision but it is crashing on the mqtt_connect(&client); I assume this might be to do with some changes in the SDK and i wanted to see an simple example of the MQTT to figure out how you are supposed to init then connect to the server to figure out how come its panicing.

    <err> os: usage_fault: ***** USAGE FAULT *****
    [00:02:43.536,743] <err> os: usage_fault: Stack overflow (context area not valid)

  • Hi,

    Are you using the latest version of the example? The github repository was updated just two days ago with a patch to make it work in v2.4.0. I just built the example in v2.4.1 and it runs without issues on my side.

    Also make sure to change the MQTT client ID and topics in the project configuration to something unique:

    CONFIG_MQTT_PUB_TOPIC="nRF7002DK/publish/my_unique_topic"
    CONFIG_MQTT_SUB_TOPIC="nRF7002DK/subscribe/my_unique_topic"
    CONFIG_MQTT_CLIENT_ID="my_unique_client_id"

    Best regards,
    Marte

  • Hi Marte,

    Thanks i have pulled the latest from the repo and now its working, i hadn't noticed that it was updated as i only pulled it a few days back. 

Related