nrf_wifi fails : memory allocation failure at boot and crash at config

Using an nrf5340 with nrf7002 wifi, connected via SPI4. Using a shared (chip) antenna, and the COEX signals (pretty much exactly as per the dev board schema).

DTS snippets:

    // Wifi nrf7002 : SPI4 using SCK P0.08, MOSI P0.09, MISO P0.10, CS P0.11
    // BUCKEN P0.12, IRQ P0.23, COEX_GRANT P0.24, COEX_REQ P0.28, STATUS0 P0.30, STATUS1 P0.29, NRF7002_IOVDD_EN ioexp0/GPB0
    nrf_radio_coex: nrf7001-coex {
        status = "okay";
        compatible = "nordic,nrf700x-coex";
        req-gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
        status0-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>;
        grant-gpios = <&gpio0 24 (GPIO_PULL_DOWN | GPIO_ACTIVE_LOW)>;
        swctrl1-gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
        // btrf-switch-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; No, controlled by nrf7002 directly???
    };

    nordic_wlan0: nordic_wlan0 {
        compatible = "nordic,wlan0";
        status = "okay";
    };
&spi4 {                     // Wifi nrf7002
    status = "okay";
    compatible = "nordic,nrf-spim";
    pinctrl-0 = <&spi4_default>;
    pinctrl-1 = <&spi4_sleep>;
    cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; /* P0.11 */
    pinctrl-names = "default", "sleep";
    nrf700x: nrf7002@0 {
        status = "okay";
        compatible = "nordic,nrf700x-spi";
        reg = <0>;
        spi-max-frequency = <33000000>;
//      sck-frequency = <24000000>;
        /* Wi-Fi Pins used */
        iovdd-ctrl-gpios = <&ioexp0 8 GPIO_ACTIVE_HIGH>;            // GPB00
        bucken-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
        host-irq-gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
    };
};

I have configured prj.conf to have the wifi STA 'iot' operation, as per the docs:

# WIFI config
CONFIG_WIFI=y
CONFIG_WIFI_NRF700X=y

# WPA supplicant
CONFIG_WPA_SUPP=y
CONFIG_NRF700X_AP_MODE=n
CONFIG_NRF700X_P2P_MODE=n

# Networking layers
CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_LOG=y
CONFIG_NET_IPV4=y
CONFIG_NET_UDP=y
CONFIG_NET_TCP=y
CONFIG_NET_DHCPV4=y

CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=2
CONFIG_NET_MAX_CONTEXTS=1
CONFIG_NET_CONTEXT_SYNC_RECV=y

CONFIG_NET_L2_ETHERNET=y

CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONFIG_INIT_TIMEOUT=0

CONFIG_NET_SOCKETS_POLL_MAX=1

# Memory usage
CONFIG_NET_TX_STACK_SIZE=4096
CONFIG_NET_RX_STACK_SIZE=4096

# Optimized networking settings for memory usage (STA MODE IOT DEVICES profile)
# https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/wifi/stack_configuration.html
CONFIG_NRF700X_MAX_TX_TOKENS=5
CONFIG_NRF700X_MAX_TX_AGGREGATION=1
CONFIG_NRF700X_RX_NUM_BUFS=6

CONFIG_NET_TC_TX_COUNT=1
CONFIG_NET_PKT_RX_COUNT=6
CONFIG_NET_PKT_TX_COUNT=6

CONFIG_NET_BUF_RX_COUNT=6
CONFIG_NET_BUF_TX_COUNT=12
# can take BUF_DATAT_SIZE down to 500
CONFIG_NET_BUF_DATA_SIZE=800

However, at boot time I see these logs:

[00:00:00.015,686] <inf> wifi_nrf_bus: SPIM spi@a000: freq = 33 MHz
[00:00:00.022,369] <inf> wifi_nrf_bus: SPIM spi@a000: latency = 1
[00:00:01.074,981] <err> wifi_nrf: hal_fw_patch_load: Failed to allocate memory for patch UMAC-bin: chunk 1/6, size: 8192
[00:00:01.086,639] <err> wifi_nrf: nrf_wifi_fmac_fw_load: UMAC patch load failed

[00:00:01.094,818] <err> wifi_nrf: nrf_wifi_fw_load: nrf_wifi_fmac_fw_load failed
[00:00:01.103,027] <err> wifi_nrf: nrf_wifi_fmac_dev_add_zep: nrf_wifi_fw_load failed
[00:00:01.113,891] <err> wifi_nrf: nrf_wifi_if_start_zep: nrf_wifi_fmac_dev_add_zep failed

Note I also have configured malloc to use the system heap, and for it to occupy all remaining RAM:

CONFIG_COMMON_LIBC_MALLOC=y
CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1
The heap size at boot time is 233576 bytes so no reason for a malloc to fail?

Then when I attempt to initialise the wifi I get this crash

[00:00:13.322,784] <err> os: ***** USAGE FAULT *****
[00:00:13.328,399] <err> os: Unaligned memory access
[00:00:13.334,197] <err> os: r0/a1: 0xa07eeaff r1/a2: 0x00000068 r2/a3: 0x0000005c
[00:00:13.342,834] <err> os: r3/a4: 0x20047130 r12/ip: 0x00000000 r14/lr: 0x00063dc9
[00:00:13.351,440] <err> os: xpsr: 0x61000000
[00:00:13.356,628] <err> os: Faulting instruction address (r15/pc): 0x0009bafe
[00:00:13.364,501] <err> os: >>> ZEPHYR FATAL ERROR 31: Unknown error on CPU 0
[00:00:13.372,375] <err> os: Current thread: 0x20007340 (sysworkq)
[00:00:13.379,180] <err> os: Halting system

in  nrf_wifi_osal_mem_zalloc() according to zephyr.map.

This is called somewherr from nrf_wifi_coex_config_non_pta():

    /* Configure Coexistence Hardware */
    log_info("netwifi: Configuring non-PTA registers. seperate antennas:%s  is_sr_protocol_ble: %s",separate_antennas?"YES":"NO", is_sr_protocol_ble?"YES":"NO");
    ret = nrf_wifi_coex_config_non_pta(separate_antennas, is_sr_protocol_ble);
    if (ret != 0) {
        log_warn("netwifi: Configuring non-PTA registers of CoexHardware FAIL");
        return false;
    }
Note the wifi sample projects (wifi_radio_test, wifi_shell)all run just FINE (with no error logs at boot) so the hardware is apparently good, but I haven't managed to get from them to my full app without this problem occuring...
Any ideas?
  • The memory allocation failure at boot is because I don't set a specific size for the system heap (as used by k_malloc), and the wifi code apparently doesn't set a 'minimum required' size as it should do...

    But, when I have this config:

    CONFIG_COMMON_LIBC_MALLOC=y
    CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1
    CONFIG_HEAP_MEM_POOL_SIZE=100000
    the wifi stack boot is fine, but the libc malloc calls fail very quickly! 
    As the malloc heap is : System Stats: Heap 137672 at boot, now : free 133028, used 4068, max used 4068.
    there should be plenty of malloc space, but instead I get during system init:
    [00:00:01.757,751] <err> base: ** Malloc request for 104 bytes failed. Allocated cumulative to now was 3167 bytes....
    ASSERTION FAIL [*lock != ((void *)0)] @ WEST_TOPDIR/zephyr/lib/libc/newlib/libc-hooks.c:385
    recursive lock allocation failed
    [00:00:01.779,968] <err> os: r0/a1: 0x00000004 r1/a2: 0x00000181 r2/a3: 0x00000001
    [00:00:01.788,604] <err> os: r3/a4: 0x000445e9 r12/ip: 0x00000000 r14/lr: 0x0002af33
    [00:00:01.797,241] <err> os: xpsr: 0x49000000
    [00:00:01.802,429] <err> os: Faulting instruction address (r15/pc): 0x00086dcc
    [00:00:01.810,272] <err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
    [00:00:01.817,962] <err> os: Current thread: 0x20007228 (main)
    [00:00:01.824,432] <err> os: Halting system
    Could it be that the system heap (allocated how? on BSS?) and the malloc heap (_end to end of RAM) are overlapping and corrupting each other?
     
    Really, I'd like to have a single heap for k_malloc AND for malloc (without modifying the zephyr or libc sources). Is this possible?  I can't believe I'm the only person with this problem.... but maybe the only one that hasn't found the answer easily...
  • I have managed to achieve a truce between k_malloc and malloc heaps, with 

    CONFIG_COMMON_LIBC_MALLOC=y
    CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1
    CONFIG_HEAP_MEM_POOL_SIZE=20000
     
    However, the k_malloc heap size is a total guess, and I don't want to make it too big and waste space for the application's mallocs... If I recode k_malloc to use malloc I think there may be locking issues?
  • Hi Brain,

    Thanks for the update. Heap Listener is the useful tool for monitoring your memory heap changes(alloc and free actions).

    You can refer to the following smaple to learn about its usage.

    zephyr/samples/subsys/zbus/msg_subscriber

    Best regards,

    Charlie

  • Soemthing is bad in my config anyway: I cannot get the wifi code to attempt the connect to the AP.

    the net_mgmt() call with the connect request always returns a -134 error, ie ENOSYS. I setup and call it like this:

    	static struct wifi_connect_req_params cnx_params;
    	int ret = 0;
    	ctx->connect_requested = true;
    	cnx_params.timeout = 10000;		//SYS_FOREVER_MS;
    
    	/* Defaults */
    	cnx_params.band = WIFI_FREQ_BAND_2_4_GHZ;		// WIFI_FREQ_BAND_UNKNOWN;
    	cnx_params.channel = WIFI_CHANNEL_ANY;
    	cnx_params.mfp = WIFI_MFP_OPTIONAL;
    
    	/* SSID */
    	cnx_params.ssid = wvmgr_get_item_as_str("net.ap.ssid", "kiosk");
    	// TODO inspect config to see if WPA2 or WPA2-ENTERPRISE
    	cnx_params.ssid_length = strlen(cnx_params.ssid);
    	cnx_params.security = WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL;		// 1;	// WPA2
    	cnx_params.psk = wvmgr_get_item_as_str("net.ap.pass", "infrafon-2022");
    	cnx_params.psk_length = strlen(cnx_params.psk);
    	cnx_params.sae_password = NULL;
    	cnx_params.sae_password_length = 0;
    
    	if ((ret=net_mgmt(NET_REQUEST_WIFI_CONNECT, ctx->iface,
    		     &cnx_params, sizeof(struct wifi_connect_req_params)))!=0) {
    		log_warn("netwifi: Connection request failed (%d)", ret);
    		ctx->connect_requested = false;
    
    		return false;
    	}
    

    The interface comes from:

        ctx->iface = net_if_get_default();
    And I added a call to net_if_is_wifi() to check its the wifi interface, which says it is!
    And yet when I call the net_mgmt() it complains that there is no 'connect' function in the ops (I added a log to check this was why it returned the ENOSYS).
    I see this should be filled in in nrf/modules/hostap/src/supp_main.c:
    line 73:     .connect = z_wpa_supplicant_connect,
    Its obviously my config that is problematic, as the wifi_shell applications work fine and can do the connect.
    my prj.conf - normally I carried over all the elements required from the wifi_shell example...
    #
    # Copyright (c) 2021 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    #debug core dump : TODO change to use flash partition
    CONFIG_DEBUG_COREDUMP=n
    CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING=n
    CONFIG_DEBUG_COREDUMP_MEMORY_DUMP_MIN=n
    
    # debug/memory/thread/stack check analysis : 
    # TODO remove for runtime
    CONFIG_DEBUG=n
    CONFIG_DEBUG_INFO=n
    
    CONFIG_THREAD_NAME=y
    # TODO remove for runtime
    CONFIG_THREAD_ANALYZER=y
    CONFIG_THREAD_ANALYZER_USE_PRINTK=n
    CONFIG_THREAD_ANALYZER_AUTO=n
    #CONFIG_THREAD_ANALYZER_AUTO_INTERVAL=60
    #CONFIG_THREAD_ANALYZER_RUN_UNLOCKED=y
    
    CONFIG_SYS_HEAP_RUNTIME_STATS=y
    CONFIG_INIT_STACKS=y
    
    # TODO remove for runtime
    CONFIG_ASSERT=y
    CONFIG_ASSERT_VERBOSE=y
    CONFIG_ASSERT_NO_COND_INFO=n
    CONFIG_ASSERT_NO_MSG_INFO=n
    CONFIG_STACK_SENTINEL=y
    # system HALT on error (useful for debugger?)
    # TODO remove for runtime
    CONFIG_RESET_ON_FATAL_ERROR=n
    CONFIG_REBOOT=y
    
    #CONFIG_NCS_SAMPLES_DEFAULTS=y
    CONFIG_LOG=y
    CONFIG_LOG_MODE_MINIMAL=y
    CONFIG_LOG_MODE_IMMEDIATE=y
    CONFIG_LOG_BACKEND_UART=y
    CONFIG_LOG_DEFAULT_LEVEL=3
    CONFIG_LOG_PRINTK=n
    # warning : if shell enabled this caused fatal crash at boot...
    CONFIG_SHELL=n
    CONFIG_SHELL_MINIMAL=n
    CONFIG_SHELL_LOG_BACKEND=n
    
    # cannot access binary says ninja, also the info is not available to the source code
    #CONFIG_BINDESC=y
    #CONFIG_BINDESC_DEFINE=y
    #CONFIG_BINDESC_DEFINE_BUILD_TIME=y
    #CONFIG_BINDESC_BUILD_DATE_TIME_STRING=y
    #CONFIG_BINDESC_BUILD_DATE_TIME_STRING_FORMAT="%Y-%m-%dT%H:%M"
    
    CONFIG_GPIO=y
    CONFIG_GPIO_MCP230XX=y
    CONFIG_SERIAL=y
    CONFIG_UART_CONSOLE=y
    CONFIG_UART_INTERRUPT_DRIVEN=y
    CONFIG_UART_ASYNC_API=y
    CONFIG_UART_LINE_CTRL=y
    
    CONFIG_I2C=y
    CONFIG_I2C_CALLBACK=y
    CONFIG_I2C_NRFX=y
    #CONFIG_I2C_NRFX_TWIM=y
    #CONFIG_NRFX_TXI_ENABLED=y
    
    CONFIG_SPI=y
    CONFIG_SPI_ASYNC=y
    
    # Using AEF event system for inter-module comm and sync
    CONFIG_APP_EVENT_MANAGER=y
    CONFIG_APP_EVENT_MANAGER_POSTINIT_HOOK=y
    CONFIG_CAF=y
    CONFIG_CAF_PM_EVENTS=y
    CONFIG_CAF_POWER_MANAGER=n
    #CONFIG_CAF_BUTTONS=y
    #CONFIG_CAF_BUTTONS_DEF_PATH="cc1_med_buttons_def.h"
    CONFIG_CAF_BUTTON_EVENTS=y
    #CONFIG_CAF_BUTTONS_PM_EVENTS=y
    # button polarity inverse on DK board... tbd on real hw
    #CONFIG_CAF_BUTTONS_POLARITY_INVERSED=y
    #CONFIG_CAF_BUTTONS_PM_KEEP_ALIVE=n
    CONFIG_CAF_CLICK_DETECTOR=y
    CONFIG_CAF_CLICK_DETECTOR_LONG_CLICK_MSEC=2000
    CONFIG_CAF_CLICK_DETECTOR_PM_EVENTS=y
    CONFIG_CAF_CLICK_DETECTOR_DEF_PATH="cc1_med_buttons_click_def.h"
    CONFIG_LED=y
    CONFIG_LED_GPIO=y
    
    # libaries
    CONFIG_NEWLIB_LIBC=y
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    # use malloc that maps to k_malloc(), and allocate all remaing RAM to heap (-1)
    CONFIG_COMMON_LIBC_MALLOC=y
    CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1
    CONFIG_HEAP_MEM_POOL_SIZE=20000
    
    CONFIG_FLASH=y
    CONFIG_I2S=y
    CONFIG_I2S_NRFX=y
    CONFIG_NRFX_PDM=y
    CONFIG_PWM=y
    CONFIG_SYS_HASH_MAP=y
    # using cJSON
    CONFIG_CJSON_LIB=y
    CONFIG_JSON_LIBRARY=n
    CONFIG_BASE64=y
    CONFIG_UTF8=y
    CONFIG_CHARACTER_FRAMEBUFFER=y
    # using NVS system for blobmgr. NVS partition defined in pm_static.yml
    CONFIG_NVS=y
    
    CONFIG_STDOUT_CONSOLE=y
    
    # turn on Partition manager (must be on) to use partitions from pm_static.yml
    CONFIG_PM_SINGLE_IMAGE=y
    
    #USB related configs
    CONFIG_LOG=y
    CONFIG_USB_DEVICE_STACK=y
    CONFIG_USB_DEVICE_PRODUCT="Infrafon CC2-WDD"
    # USB VID is MCS electronics, who sell individual PIDs. 0x138F is for CC2 purchases 25/08/2024
    CONFIG_USB_DEVICE_VID=0x16D0
    CONFIG_USB_DEVICE_PID=0x138F
    CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
    
    CONFIG_USB_DEVICE_HID=y
    CONFIG_USB_HID_DEVICE_COUNT=2
    
    CONFIG_USB_MASS_STORAGE=y
    CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y
    CONFIG_USB_MASS_STORAGE_LOG_LEVEL_ERR=y
    CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n
    CONFIG_NORDIC_QSPI_NOR=y
    
    # flash disk config
    # The mx25 erase page size
    CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
    CONFIG_DISK_DRIVERS=y
    CONFIG_DISK_DRIVER_FLASH=y
    # use ELM FATFS with long file names (not 8.3)
    CONFIG_FILE_SYSTEM=y
    CONFIG_FAT_FILESYSTEM_ELM=y
    CONFIG_FS_FATFS_MOUNT_MKFS=y
    CONFIG_FS_FATFS_LFN=y
    CONFIG_FS_FATFS_EXFAT=n
    
    CONFIG_MASS_STORAGE_DISK_NAME="NAND"
    CONFIG_FLASH_MAP=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    
    # BT/BLE config
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="CC2-WDD-2"
    CONFIG_BT_DEVICE_APPEARANCE=512
    CONFIG_BT_DEVICE_NAME_DYNAMIC=y
    
    CONFIG_BT_EXT_ADV=y
    CONFIG_BT_EXT_ADV_MAX_ADV_SET=2
    
    CONFIG_BT_DIS=y
    CONFIG_BT_DIS_PNP=y
    CONFIG_BT_DIS_MANUF="Infrafon"
    CONFIG_BT_DIS_PNP_VID_SRC=2
    CONFIG_BT_DIS_PNP_VID=0x1915
    CONFIG_BT_DIS_PNP_PID=0xEEF1
    CONFIG_BT_DIS_PNP_VER=0x0100
    
    CONFIG_BT_OBSERVER=y
    CONFIG_BT_SCAN=y
    CONFIG_BT_NUS=y
    
    # Must call net_config_init() explicitly
    CONFIG_NET_CONFIG_AUTO_INIT=n
    
    # WIFI config
    CONFIG_WIFI=y
    CONFIG_WIFI_NRF700X=y
    CONFIG_NRF_WIFI_PATCHES_BUILTIN=y
    #CONFIG_NRF700X_RADIO_COEX=y
    
    CONFIG_NRF700X_AP_MODE=n
    CONFIG_NRF700X_P2P_MODE=n
    CONFIG_NRF700X_STA_MODE=y
    
    # WPA supplicant
    CONFIG_WPA_SUPP=y
    CONFIG_WPA_SUPP_LOG_LEVEL_INF=y
    CONFIG_WIFI_NM=y
    CONFIG_WIFI_NM_LOG_LEVEL_INF=y
    #CONFIG_WIFI_NM_WPA_SUPPLICANT=y
    #CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_INF=y
    #CONFIG_NO_WPA=n
    
    CONFIG_NET_L2_ETHERNET=y
    CONFIG_NET_L2_WIFI_MGMT=y
    CONFIG_NET_CONFIG_SETTINGS=y
    
    # Networking layers
    CONFIG_NETWORKING=y
    CONFIG_NET_SOCKETS=y
    CONFIG_NET_LOG=y
    CONFIG_NET_IPV4=y
    CONFIG_NET_UDP=y
    CONFIG_NET_TCP=y
    CONFIG_NET_DHCPV4=y
    CONFIG_DNS_RESOLVER=y
    CONFIG_HTTP_CLIENT=y
    CONFIG_MQTT_LIB=y
    
    CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=1
    CONFIG_NET_MAX_CONTEXTS=1
    CONFIG_NET_CONTEXT_SYNC_RECV=y
    
    #CONFIG_NET_CONFIG_SETTINGS=y
    CONFIG_NET_CONFIG_INIT_TIMEOUT=0
    
    CONFIG_NET_SOCKETS_POLL_MAX=1
    
    # Memory usage
    CONFIG_NET_TX_STACK_SIZE=4096
    CONFIG_NET_RX_STACK_SIZE=4096
    
    # Optimized networking settings for memory usage (STA MODE IOT DEVICES profile)
    # https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/wifi/stack_configuration.html
    CONFIG_NRF700X_MAX_TX_TOKENS=5
    CONFIG_NRF700X_MAX_TX_AGGREGATION=1
    CONFIG_NRF700X_RX_NUM_BUFS=6
    
    CONFIG_NET_TC_TX_COUNT=1
    CONFIG_NET_PKT_RX_COUNT=6
    CONFIG_NET_PKT_TX_COUNT=6
    
    CONFIG_NET_BUF_RX_COUNT=6
    CONFIG_NET_BUF_TX_COUNT=12
    # can take BUF_DATAT_SIZE down to 500
    CONFIG_NET_BUF_DATA_SIZE=800
    
    # Below configs need to be modified based on security
    # CONFIG_STA_KEY_MGMT_NONE=y
    #CONFIG_STA_KEY_MGMT_WPA2=y
    #CONFIG_STA_KEY_MGMT_WPA2_256=y
    # CONFIG_STA_KEY_MGMT_WPA3=y
    
    # NFC config
    CONFIG_NFC_T2T_NRFXLIB=y
    CONFIG_NFC_T4T_NRFXLIB=y
    CONFIG_NFC_T4T_ISODEP=y
    
    CONFIG_NFC_NDEF=y
    CONFIG_NFC_NDEF_MSG=y
    CONFIG_NFC_NDEF_RECORD=y
    CONFIG_NFC_NDEF_URI_REC=y
    CONFIG_NFC_NDEF_URI_MSG=y
    
    CONFIG_MAIN_STACK_SIZE=4096
    # need big stack for system workqueue thread, as this is where we execute pretty much all real operations
    #CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=32796
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
    
    CONFIG_BOOTLOADER_MCUBOOT=y
    # put slot2 in external flash
    CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
    CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_WITHOUT_SCRATCH=y
    CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE=y
    #CONFIG_MCUBOOT_BOOTUTIL_LIB=n
    #CONFIG_MCUBOOT_IMG_MANAGER=n
    CONFIG_MCUBOOT_SHELL=n
    #CONFIG_MCUBOOT_USB_SUPPORT=n
    #CONFIG_MCUBOOT_UTIL_LOG_LEVEL_ERR=n
    
    # sign with our own key
    CONFIG_MCUBOOT_BUILD_STRATEGY_FROM_SOURCE=y
    #CONFIG_BOOT_SIGNATURE_KEY_FILE="/work/dev/if-device-nrf53/keys/bootloader_priv-ecdsa256.pem"
    #CONFIG_MCUBOOT_SIGNATURE_KEY_FILE="/work/dev/if-device-nrf53/keys/bootloader_priv-ecdsa256.pem"
    # not using 2 stage bootloader
    #CONFIG_SECURE_BOOT=y
    #CONFIG_SB_SIGNING_KEY_FILE="/work/dev/if-device-nrf53/keys/bootloader_priv-ecdsa256.pem"
    #CONFIG_SB_SIGNING_OPENSSL=y
    # want bin and hexes
    CONFIG_BUILD_OUTPUT_BIN=y
    CONFIG_BUILD_OUTPUT_HEX=y
    
    # to allow net CPU update (complex & hard...)
    #CONFIG_UPDATEABLE_IMAGE_NUMBER=2
    #CONFIG_PCD_APP=y
    #CONFIG_FLASH_SIMULATOR=y
    #CONFIG_NRF53_MULTI_IMAGE_UPDATE=n
    #CONFIG_USE_NRF53_MULTI_IMAGE_WITHOUT_UPGRADE_ONLY=n
    
    # Enable DFU target for application image, this lets us write an image downloaded from whereever into the secondary slot for update by mcuboot
    CONFIG_DFU_TARGET=y
    CONFIG_STREAM_FLASH=y
    CONFIG_STREAM_FLASH_ERASE=y
    CONFIG_DFU_TARGET_STREAM=y
    CONFIG_IMG_MANAGER=y
    CONFIG_DFU_TARGET_MCUBOOT=y
    Any ideas?
  • Hi Brian,

    If wifi_shell work as expected on your custom HW, this means at least HW should has no problem.

    You application sounds more like sta sample intead of more comprohensive wifi shell sample

    Could you have a try with sta sample and use a similar way in your application to setup connection with target AP?

    Best regards,

    Charlie

Related