Enabling Wifi on nRF7002

Hello everyone,

I'm trying to set up the Wifi stack on the nRF7002 and use it with MicroPython, but encountering a lot of difficulty with it. I cropped up a network_wlan.c file and added it to the build. I configured the CMakeLists.txt, prj.conf and nrf7002dk_nrf5340_cpuapp_ns.conf to the best of my knowledge (based on the given wifi samples) but I've hit a roadblock.

Since I've got no prior experience with this board or Zephyr, I decided to start by just enabling the Wifi_scan functionality.

Right now I can "choose" which error I'd like to see:
1). Given this "main_scan()" function which I'm calling via REPL to use in microPy:

STATIC mp_obj_t main_scan(void)
 {
	scan_result = 0U;
 
	 net_mgmt_init_event_callback(&wifi_shell_mgmt_cb,
					  wifi_mgmt_event_handler,
					  WIFI_SHELL_MGMT_EVENTS);
 
	 net_mgmt_add_event_callback(&wifi_shell_mgmt_cb);
 
	 k_sleep(K_SECONDS(1));
	 printk("Starting %s with CPU frequency: %d MHz\n", CONFIG_BOARD, SystemCoreClock / MHZ(1));

	 if (net_if_get_default() == NULL) {
		printk("Bad!!! \n");
		return 0;
	}

	 if (!is_mac_addr_set(net_if_get_default())) {
		printk("0000\n");
		 struct net_if *iface = net_if_get_default();
		 int ret;
		 struct ethernet_req_params params;
 
		 /* Set a local MAC address with Nordic OUI */
		 if (net_if_is_admin_up(iface)) {
			 ret = net_if_down(iface);
			 if (ret < 0 && ret != -EALREADY) {
				 LOG_ERR("Cannot bring down iface (%d)", ret);
				 printk("11111\n");
				 return ret;
			 }
		 }
 
		 ret = net_bytes_from_str(params.mac_address.addr, sizeof(CONFIG_WIFI_MAC_ADDRESS),
					  CONFIG_WIFI_MAC_ADDRESS);
		 if (ret) {
			 LOG_ERR("Failed to parse MAC address: %s (%d)",
				 CONFIG_WIFI_MAC_ADDRESS, ret);
				 printk("2222\n");
			 return ret;
		 }
 
		 net_mgmt(NET_REQUEST_ETHERNET_SET_MAC_ADDRESS, iface,
			  &params, sizeof(params));
 
		 ret = net_if_up(iface);
		 if (ret < 0 && ret != -EALREADY) {
			 LOG_ERR("Cannot bring up iface (%d)", ret);
			 return ret;
		 }
 
		 LOG_INF("OTP not programmed, proceeding with local MAC: %s", net_sprint_ll_addr(
							 net_if_get_link_addr(iface)->addr,
							 net_if_get_link_addr(iface)->len));
	 }
 
	 while (1) {
		 wifi_scan();
		 printk("Scanning\n");
		 k_sleep(K_SECONDS(CONFIG_WIFI_SCAN_INTERVAL_S));
	 }
 
	 return 0;
 }
 static MP_DEFINE_CONST_FUN_OBJ_1(scan_obj, main_scan);


When I try to invoke it via these commands, I get a Secure Fault:
>>> [00:00:00.000,000] <dbg> counteMicroPython c44a93be3-dirty on 2025-04-18; zephyr-nrf7002dk with nrf5340
Type "help()" for more information.
>>> 
>>> 
>>> 
>>> 
>>> import network
>>> 
>>> w = network.WLAN(network.AP_IF)
>>> 
>>> w.scanwifi()
r_rtc.0: init_rtc: Initialized
--- 99 messages dropped ---
[00:00:00.473,236] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x20030d64, count: 1, orig prio: 0
[00:00:00.473,266] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030d64 lock_count: 1
[00:00:00.473,297] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030d64: (nil) (prio: -1000)
[00:00:00.473,480] <inf> wifi_supplicant: wpa_supplicant initialized
[00:00:00.474,151] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x20030d64, count: 1, orig prio: 0
[00:00:00.474,182] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030d64 lock_count: 1
[00:00:00.474,212] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030d64: (nil) (prio: -1000)
[00:00:00.474,914] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x20030d64, count: 1, orig prio: 0
[00:00:00.474,945] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030d64 lock_count: 1
[00:00:00.474,975] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030d64: (nil) (prio: -1000)
[00:00:00.475,280] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x200300e8, count: 1, orig prio: 0
[00:00:00.475,341] <dbg> os: z_impl_k_mutex_unlock: mutex 0x200300e8 lock_count: 1
[00:00:00.475,372] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x200300e8: (nil) (prio: -1000)
[00:00:00.475,402] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x20030178, count: 1, orig prio: 0
[00:00:00.475,433] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030178 lock_count: 1
[00:00:00.475,463] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030178: (nil) (prio: -1000)
[00:00:10.473,632] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x200300e8, count: 1, orig prio: 0
[00:00:10.473,663] <dbg> os: z_impl_k_mutex_unlock: mutex 0x200300e8 lock_count: 1
[00:00:10.473,693] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x200300e8: (nil) (prio: -1000)
[00:00:10.473,724] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x20030178, count: 1, orig prio: 0
[00:00:10.473,785] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030178 lock_count: 1
[00:00:10.473,815] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030178: (nil) (prio: -1000)
[00:00:10.473,907] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x200300e8, count: 1, orig prio: 0
[00:00:10.473,937] <dbg> os: z_impl_k_mutex_unlock: mutex 0x200300e8 lock_count: 1
[00:00:10.473,968] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x200300e8: (nil) (prio: -1000)
[00:00:10.473,999] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x20030178, count: 1, orig prio: 0
[00:00:10.474,060] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030178 lock_count: 1
[00:00:10.474,090] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030178: (nil) (prio: -1000)
[00:00:20.473,999] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x200300e8, count: 1, orig prio: 0
[00:00:20.474,029] <dbg> os: z_impl_k_mutex_unlock: mutex 0x200300e8 lock_count: 1
[00:00:20.474,060] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x200300e8: (nil) (prio: -1000)
[00:00:20.474,090] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x20030178, count: 1, orig prio: 0
[00:00:20.474,151] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030178 lock_count: 1
[00:00:20.474,182] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030178: (nil) (prio: -1000)
[00:00:20.474,273] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x200300e8, count: 1, orig prio: 0
[00:00:20.474,304] <dbg> os: z_impl_k_mutex_unlock: mutex 0x200300e8 lock_count: 1
[00:00:20.474,334] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x200300e8: (nil) (prio: -1000)
[00:00:20.474,365] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x20030178, count: 1, orig prio: 0
[00:00:20.474,426] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030178 lock_count: 1
[00:00:20.474,456] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030178: (nil) (prio: -1000)
[00:00:30.474,365] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x200300e8, count: 1, orig prio: 0
[00:00:30.474,426] <dbg> os: z_impl_k_mutex_unlock: mutex 0x200300e8 lock_count: 1
[00:00:30.474,456] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x200300e8: (nil) (prio: -1000)
[00:00:30.474,487] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x20030178, count: 1, orig prio: 0
[00:00:30.474,517] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030178 lock_count: 1
[00:00:30.474,548] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030178: (nil) (prio: -1000)
[00:00:30.474,670] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x200300e8, count: 1, orig prio: 0
[00:00:30.474,700] <dbg> os: z_impl_k_mutex_unlock: mutex 0x200300e8 lock_count: 1
[00:00:30.474,731] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x200300e8: (nil) (prio: -1000)
[00:00:30.474,761] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x20030178, count: 1, orig prio: 0
[00:00:30.474,792] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030178 lock_count: 1
[00:00:30.474,822] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030178: (nil) (prio: -1000)
[00:00:40.474,792] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x200300e8, count: 1, orig prio: 0
[00:00:40.474,822] <dbg> os: z_impl_k_mutex_unlock: mutex 0x200300e8 lock_count: 1
[00:00:40.474,853] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x200300e8: (nil) (prio: -1000)
[00:00:40.474,884] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x20030178, count: 1, orig prio: 0
[00:00:40.474,914] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030178 lock_count: 1
[00:00:40.474,945] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030178: (nil) (prio: -1000)
[00:00:40.475,067] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x200300e8, count: 1, orig prio: 0
[00:00:40.475,097] <dbg> os: z_impl_k_mutex_unlock: mutex 0x200300e8 lock_count: 1
[00:00:40.475,128] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x200300e8: (nil) (prio: -1000)
[00:00:40.475,158] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x20030178, count: 1, orig prio: 0
[00:00:40.475,189] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030178 lock_count: 1
[00:00:40.475,219] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030178: (nil) (prio: -1000)
[00:00:50.475,128] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x200300e8, count: 1, orig prio: 0
[00:00:50.475,189] <dbg> os: z_impl_k_mutex_unlock: mutex 0x200300e8 lock_count: 1
[00:00:50.475,219] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x200300e8: (nil) (prio: -1000)
[00:00:50.475,250] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x20030178, count: 1, orig prio: 0
[00:00:50.475,280] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030178 lock_count: 1
[00:00:50.475,311] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030178: (nil) (prio: -1000)
[00:00:50.475,402] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x200300e8, count: 1, orig prio: 0
[00:00:50.475,463] <dbg> os: z_impl_k_mutex_unlock: mutex 0x200300e8 lock_count: 1
[00:00:50.475,494] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x200300e8: (nil) (prio: -1000)
[00:00:50.475,524] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x20030178, count: 1, orig prio: 0
[00:00:50.475,555] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030178 lock_count: 1
[00:00:50.475,585] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030178: (nil) (prio: -1000)
[00:01:00.475,524] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x200300e8, count: 1, orig prio: 0
[00:01:00.475,555] <dbg> os: z_impl_k_mutex_unlock: mutex 0x200300e8 lock_count: 1
[00:01:00.475,585] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x200300e8: (nil) (prio: -1000)
[00:01:00.475,616] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x20030178, count: 1, orig prio: 0
[00:01:00.475,646] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030178 lock_count: 1
[00:01:00.475,677] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030178: (nil) (prio: -1000)
[00:01:00.475,799] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x200300e8, count: 1, orig prio: 0
[00:01:00.475,830] <dbg> os: z_impl_k_mutex_unlock: mutex 0x200300e8 lock_count: 1
[00:01:00.475,860] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x200300e8: (nil) (prio: -1000)
[00:01:00.475,891] <dbg> os: z_impl_k_mutex_lock: 0x20032370 took mutex 0x20030178, count: 1, orig prio: 0
[00:01:00.475,921] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030178 lock_count: 1
[00:01:00.475,952] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030178: (nil) (prio: -1000)
[00:01:06.882,568] <dbg> os: z_impl_k_mutex_lock: 0x200336f8 took mutex 0x20030e04, count: 1, orig prio: 0
[00:01:06.882,598] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030e04 lock_count: 1
[00:01:06.882,629] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030e04: (nil) (prio: -1000)
[00:01:06.882,659] <dbg> os: z_tick_sleep: thread 0x200336f8 for 32768 ticks
[00:01:06.882,720] <dbg> os: z_impl_k_mutex_lock: 0x20032228 took mutex 0x20030e04, count: 1, orig prio: 7
[00:01:06.882,751] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030e04 lock_count: 1
[00:01:06.882,781] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030e04: (nil) (prio: -1000)
[00:01:07.770,935] <dbg> os: z_impl_k_mutex_lock: 0x20032b88 took mutex 0x20030d64, count: 1, orig prio: 14
[00:01:07.770,965] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030d64 lock_count: 1
[00:01:07.770,996] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030d64: (nil) (prio: -1000)
[00:01:07.771,026] <dbg> os: z_impl_k_mutex_lock: 0x20032b88 took mutex 0x20030d78, count: 1, orig prio: 14
[00:01:07.771,057] <dbg> os: z_impl_k_mutex_unlock: mutex 0x20030d78 lock_count: 1
[00:01:07.771,057] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x20030d78: (nil) (prio: -1000)
[00:01:07.771,087] <dbg> os: z_impl_k_mutex_lock: 0x20032b88 took mutex 0x200301a8, count: 1, orig prio: 14
[00:01:07.771,118] <dbg> os: z_impl_k_mutex_unlock: mutex 0x200301a8 lock_count: 1
[00:01:07.771,118] <dbg> os: z_impl_k_mutex_unlock: new owner of mutex 0x200301a8: (nil) (prio: -1000)
Starting nrf7002dk with CPU frequency: 64 MHz
Bad!!! 
[00:01:07.885,375] <err> os: ***** SECURE FAULT *****
[00:01:07.885,375] <err> os: Address: 0x0
[00:01:07.885,375] <err> os: Attribution unit violation
[00:01:07.885,406] <err> os: r0/a1: 0x00000000 r1/a2: 0x00000000 r2/a3: 0x00000001
[00:01:07.885,437] <err> os: r3/a4: 0x00000000 r12/ip: 0x000beffb r14/lr: 0x0008189b
[00:01:07.885,437] <err> os: xpsr: 0x45000c00
[00:01:07.885,467] <err> os: s[ 0]: 0x200335d0 s[ 1]: 0x00000000 s[ 2]: 0x200335a8 s[ 3]: 0x00042813
[00:01:07.885,467] <err> os: s[ 4]: 0x00000000 s[ 5]: 0x000bcb7b s[ 6]: 0x00000000 s[ 7]: 0x00000000
[00:01:07.885,498] <err> os: s[ 8]: 0x00000002 s[ 9]: 0x00000020 s[10]: 0x00000000 s[11]: 0x00000000
[00:01:07.885,528] <err> os: s[12]: 0x0021e2b5 s[13]: 0x0007f9db s[14]: 0x20033818 s[15]: 0x0007f987
[00:01:07.885,528] <err> os: fpscr: 0x20033818
[00:01:07.885,528] <err> os: Faulting instruction address (r15/pc): 0x00081876
[00:01:07.885,589] <err> os: >>> ZEPHYR FATAL ERROR 41: Unknown error on CPU 0
[00:01:07.885,620] <err> os: Current thread: 0x200336f8 (mp_main)
[00:01:08.084,197] <err> os: Halting system


Which lead me to the suspicion that the network interface is not initialized and "net_if_get_default()" (line 19 in the above function) is returning NULL.

2). So I decided to see if I can do a "net_if_set_default()" via the "active" function:
 
STATIC mp_obj_t wlan_active(size_t n_args, const mp_obj_t *args) {
    wlan_obj_t *self = MP_OBJ_TO_PTR(args[0]);

    if (n_args == 1) {
        return mp_obj_new_bool(self->is_active);
    } else {
        self->is_active = mp_obj_is_true(args[1]);

        if (self->is_active) {
            if (self->iface == NULL) {
                // const struct device *dev = DEVICE_DT_GET(DT_NODELABEL(wifi0));
				// const struct device *dev = DEVICE_DT_GET_ONE(nordic_nrf700x);
				const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_wifi));
				struct net_if *wifi_iface = net_if_lookup_by_dev(dev);

				/* As both are Ethernet, we need to set specific interface*/
				net_if_set_default(wifi_iface);

				net_config_init_app(dev, "Initializing network");

				/* TODO: Add proper synchronization to wait for WPA supplicant initialization */
				k_sleep(K_SECONDS(2));

                if (!device_is_ready(dev)) {
                    mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("Wi-Fi device not ready"));
                }

                struct net_if *iface = net_if_lookup_by_dev(dev);
                if (!iface) {
                    mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("No network interface for Wi-Fi"));
                }

                self->iface = iface;
                net_if_set_default(self->iface);  // make net_if_get_default() work
            }

            // Bring the interface up if needed
            if (!net_if_is_up(self->iface)) {
                net_if_up(self->iface);
            }

        } else {
            if (self->iface && net_if_is_up(self->iface)) {
                net_if_down(self->iface);
            }
        }

        return mp_const_none;
    }
}


But this brings its own predicaments since the project won't build with this function; giving the error:
[16/20] Linking C executable zephyr/zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /Users/tudor/Documents/GitHub/micropython_nRF/ports/zephyr/build/zephyr/zephyr/zephyr_pre0.map 
: && ccache /opt/nordic/ncs/toolchains/b8efef2ad5/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -Os -DNDEBUG -gdwarf-4 -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj tfm/api_ns/interface/lib/s_veneers.o -T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=/Users/tudor/Documents/GitHub/micropython_nRF/ports/zephyr/build/zephyr/zephyr/zephyr_pre0.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/arm/core/libarch__arm__core.a zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a zephyr/arch/arch/arm/core/cortex_m/cmse/libarch__arm__core__cortex_m__cmse.a zephyr/arch/arch/arm/core/mpu/libarch__arm__core__mpu.a zephyr/lib/libc/newlib/liblib__libc__newlib.a zephyr/lib/libc/common/liblib__libc__common.a zephyr/lib/posix/options/liblib__posix__options.a zephyr/lib/net_buf/liblib__net_buf.a zephyr/lib/os/zvfs/liblib__os__zvfs.a zephyr/soc/soc/nrf5340/libsoc__nordic.a zephyr/subsys/fs/libsubsys__fs.a zephyr/subsys/random/libsubsys__random.a zephyr/subsys/net/libsubsys__net.a zephyr/subsys/net/l2/offloaded_netdev/libsubsys__net__l2__offloaded_netdev.a zephyr/subsys/net/l2/ethernet/libsubsys__net__l2__ethernet.a zephyr/subsys/net/l2/wifi/libsubsys__net__l2__wifi.a zephyr/subsys/net/ip/libsubsys__net__ip.a zephyr/subsys/net/lib/config/libsubsys__net__lib__config.a zephyr/subsys/net/lib/dhcpv4/libsubsys__net__lib__dhcpv4.a zephyr/subsys/net/lib/dns/libsubsys__net__lib__dns.a zephyr/subsys/net/conn_mgr/libsubsys__net__conn_mgr.a zephyr/drivers/clock_control/libdrivers__clock_control.a zephyr/drivers/console/libdrivers__console.a zephyr/drivers/counter/libdrivers__counter.a zephyr/drivers/entropy/libdrivers__entropy.a zephyr/drivers/flash/libdrivers__flash.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/mbox/libdrivers__mbox.a zephyr/drivers/pinctrl/libdrivers__pinctrl.a zephyr/drivers/pwm/libdrivers__pwm.a zephyr/drivers/serial/libdrivers__serial.a zephyr/drivers/spi/libdrivers__spi.a zephyr/drivers/timer/libdrivers__timer.a zephyr/drivers/watchdog/libdrivers__watchdog.a modules/nrf/subsys/nrf_security/src/zephyr/libmbedtls_zephyr.a modules/nrf/subsys/net/lib/wifi_ready/libWIFI_READY_LIB.a modules/nrf/subsys/net/l2_wifi_if_conn/lib..__nrf__subsys__net__l2_wifi_if_conn.a modules/nrf/modules/trusted-firmware-m/lib..__nrf__modules__trusted-firmware-m.a modules/nrf/modules/trusted-firmware-m/libtfm_api_nrf.a modules/trusted-firmware-m/libtfm_api.a modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a -L/Users/tudor/Documents/GitHub/micropython_nRF/ports/zephyr/build/zephyr/zephyr libmicropython.a zephyr/kernel/libkernel.a zephyr/arch/common/libisr_tables.a -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mfp16-format=ieee -fuse-ld=bfd -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -Wl,-no-pie -L"/opt/nordic/ncs/toolchains/b8efef2ad5/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi"/lib/thumb/v8-m.main+fp/hard -specs=nano.specs modules/nrf/subsys/nrf_security/src/libmbedtls.a modules/nrf/subsys/nrf_security/src/libmbedx509.a modules/nrf/subsys/nrf_security/src/libmbedcrypto.a modules/nrf/subsys/nrf_security/src/libmbedcrypto_base.a modules/nrf/subsys/nrf_security/src/libnrf_security_utils.a zephyr/kernel/libkernel.a /opt/nordic/ncs/v2.9.1/nrfxlib/crypto/nrf_oberon/lib/cortex-m33/hard-float/liboberon_mbedtls_3.0.15.a /opt/nordic/ncs/v2.9.1/nrfxlib/crypto/nrf_oberon/lib/cortex-m33/hard-float/liboberon_3.0.15.a -lc -L"/opt/nordic/ncs/toolchains/b8efef2ad5/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v8-m.main+fp/hard" -lm -lc -lgcc -lc && cd /Users/tudor/Documents/GitHub/micropython_nRF/ports/zephyr/build/zephyr/zephyr && /opt/homebrew/bin/cmake -E true
/opt/nordic/ncs/toolchains/b8efef2ad5/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: libmicropython.a(modnetwork.c.obj): in function `wlan_active':
/Users/tudor/Documents/GitHub/micropython_nRF/ports/zephyr/../../ports/zephyr/network_wlan.c:165: undefined reference to `__device_dts_ord_135'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FAILED: _sysbuild/sysbuild/images/zephyr-prefix/src/zephyr-stamp/zephyr-build /Users/tudor/Documents/GitHub/micropython_nRF/ports/zephyr/build/_sysbuild/sysbuild/images/zephyr-prefix/src/zephyr-stamp/zephyr-build 
cd /Users/tudor/Documents/GitHub/micropython_nRF/ports/zephyr/build/zephyr && /opt/homebrew/bin/cmake --build .
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /opt/homebrew/bin/cmake --build /Users/tudor/Documents/GitHub/micropython_nRF/ports/zephyr/build


Where network_wlan.c:169: undefined reference to `__device_dts_ord_135' points to this line of code inside the "wlan_active()" function:
net_if_down(self->iface);


A bit of digging (github.com/.../41677) leads to the hypothesis that a few lines above, the definition of the Wifi interface doesn't actually work/ isn't instantiated and returns NULL:
const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_wifi));
struct net_if *wifi_iface = net_if_lookup_by_dev(dev);

Not sure if it makes a difference but: I'm using an Apple M1 MacBook.
I can provide any of the above files (or others) if needed, to be able to solve this mistery. I'm sure it's something trivial, but can't figure out what. -.-

Does anyone have any idea what might be causing these issues and what's the correct way of moving forward to be able to do a correct "wifi scan"? Thank you in advance and I hope you have a wonderful day!

Parents
  • Hi, 

    Try to enable SB_CONFIG_WIFI_NRF70 in the sysbuild.conf as our wifi examples.

    Regards,
    Amanda H.

  • Hello Amanda.

    Thank you for taking the time to look into my case.

    I tried your suggestion and got:

    [756/761] Linking C executable zephyr/zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /Users/tudor/Documents/GitHub/micropython_nRF/ports/zephyr/build/zephyr/zephyr/zephyr_pre0.map 
    : && ccache /opt/nordic/ncs/toolchains/b8efef2ad5/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -Os -DNDEBUG -gdwarf-4 -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  tfm/api_ns/interface/lib/s_veneers.o  -T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/Users/tudor/Documents/GitHub/micropython_nRF/ports/zephyr/build/zephyr/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/libarch__arm__core.a  zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a  zephyr/arch/arch/arm/core/cortex_m/cmse/libarch__arm__core__cortex_m__cmse.a  zephyr/arch/arch/arm/core/mpu/libarch__arm__core__mpu.a  zephyr/lib/libc/newlib/liblib__libc__newlib.a  zephyr/lib/libc/common/liblib__libc__common.a  zephyr/lib/posix/options/liblib__posix__options.a  zephyr/lib/net_buf/liblib__net_buf.a  zephyr/lib/os/zvfs/liblib__os__zvfs.a  zephyr/soc/soc/nrf5340/libsoc__nordic.a  zephyr/subsys/fs/libsubsys__fs.a  zephyr/subsys/random/libsubsys__random.a  zephyr/subsys/net/libsubsys__net.a  zephyr/subsys/net/l2/offloaded_netdev/libsubsys__net__l2__offloaded_netdev.a  zephyr/subsys/net/l2/ethernet/libsubsys__net__l2__ethernet.a  zephyr/subsys/net/l2/wifi/libsubsys__net__l2__wifi.a  zephyr/subsys/net/ip/libsubsys__net__ip.a  zephyr/subsys/net/lib/config/libsubsys__net__lib__config.a  zephyr/subsys/net/lib/dhcpv4/libsubsys__net__lib__dhcpv4.a  zephyr/subsys/net/lib/dns/libsubsys__net__lib__dns.a  zephyr/subsys/net/conn_mgr/libsubsys__net__conn_mgr.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/counter/libdrivers__counter.a  zephyr/drivers/entropy/libdrivers__entropy.a  zephyr/drivers/flash/libdrivers__flash.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/mbox/libdrivers__mbox.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  zephyr/drivers/pwm/libdrivers__pwm.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/spi/libdrivers__spi.a  zephyr/drivers/timer/libdrivers__timer.a  zephyr/drivers/watchdog/libdrivers__watchdog.a  zephyr/drivers/wifi/nrf_wifi/libnrf_wifi.a  modules/nrf/subsys/nrf_security/src/zephyr/libmbedtls_zephyr.a  modules/nrf/subsys/net/lib/wifi_ready/libWIFI_READY_LIB.a  modules/nrf/subsys/net/l2_wifi_if_conn/lib..__nrf__subsys__net__l2_wifi_if_conn.a  modules/nrf/modules/trusted-firmware-m/lib..__nrf__modules__trusted-firmware-m.a  modules/nrf/modules/trusted-firmware-m/libtfm_api_nrf.a  modules/trusted-firmware-m/libtfm_api.a  modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  modules/nrf_wifi/os/libmodules__nrf_wifi__os.a  modules/nrf_wifi/bus/libnrf70-buslib.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L/Users/tudor/Documents/GitHub/micropython_nRF/ports/zephyr/build/zephyr/zephyr  libmicropython.a  zephyr/kernel/libkernel.a  zephyr/arch/common/libisr_tables.a  -mcpu=cortex-m33  -mthumb  -mabi=aapcs  -mfpu=fpv5-sp-d16  -mfloat-abi=hard  -mfp16-format=ieee  -fuse-ld=bfd  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn  -Wl,-no-pie  -L"/opt/nordic/ncs/toolchains/b8efef2ad5/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi"/lib/thumb/v8-m.main+fp/hard  -specs=nano.specs  modules/nrf/subsys/nrf_security/src/libmbedtls.a  modules/nrf/subsys/nrf_security/src/libmbedx509.a  modules/nrf/subsys/nrf_security/src/libmbedcrypto.a  modules/nrf/subsys/nrf_security/src/libmbedcrypto_base.a  modules/nrf/subsys/nrf_security/src/libnrf_security_utils.a  zephyr/kernel/libkernel.a  /opt/nordic/ncs/v2.9.1/nrfxlib/crypto/nrf_oberon/lib/cortex-m33/hard-float/liboberon_mbedtls_3.0.15.a  /opt/nordic/ncs/v2.9.1/nrfxlib/crypto/nrf_oberon/lib/cortex-m33/hard-float/liboberon_3.0.15.a  -lc -L"/opt/nordic/ncs/toolchains/b8efef2ad5/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v8-m.main+fp/hard" -lm -lc -lgcc -lc && cd /Users/tudor/Documents/GitHub/micropython_nRF/ports/zephyr/build/zephyr/zephyr && /opt/homebrew/bin/cmake -E true
    /opt/nordic/ncs/toolchains/b8efef2ad5/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/zephyr_pre0.elf section `rodata' will not fit in region `FLASH'
    /opt/nordic/ncs/toolchains/b8efef2ad5/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/zephyr_pre0.elf section `noinit' will not fit in region `RAM'
    /opt/nordic/ncs/toolchains/b8efef2ad5/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: region `FLASH' overflowed by 132424 bytes
    /opt/nordic/ncs/toolchains/b8efef2ad5/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: region `RAM' overflowed by 125852 bytes
    /opt/nordic/ncs/toolchains/b8efef2ad5/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: modules/nrf/subsys/net/l2_wifi_if_conn/lib..__nrf__subsys__net__l2_wifi_if_conn.a(l2_wifi_conn.c.obj): in function `net_l2_wifi_connect':
    /opt/nordic/ncs/v2.9.1/nrf/subsys/net/l2_wifi_if_conn/l2_wifi_conn.c:115: undefined reference to `net_mgmt_NET_REQUEST_WIFI_CONNECT_STORED'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    FAILED: _sysbuild/sysbuild/images/zephyr-prefix/src/zephyr-stamp/zephyr-build /Users/tudor/Documents/GitHub/micropython_nRF/ports/zephyr/build/_sysbuild/sysbuild/images/zephyr-prefix/src/zephyr-stamp/zephyr-build 
    cd /Users/tudor/Documents/GitHub/micropython_nRF/ports/zephyr/build/zephyr && /opt/homebrew/bin/cmake --build .
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /opt/homebrew/bin/cmake --build /Users/tudor/Documents/GitHub/micropython_nRF/ports/zephyr/build

    I'll see what I can disable to make things fit.

    Edit:

    I'm not sure what else to disable at this point since we already disabled the NFC and BT to make Wifi fit. Ideally we'd have all 3 active in the project. Here are our two .config files, maybe you can spot something that's a memory hog which shouldn't be there. 

    prj.conf:

    CONFIG_BUILD_OUTPUT_BIN=y
    CONFIG_BUILD_OUTPUT_HEX=y
    CONFIG_REBOOT=y
    
    #CONFIG_WERROR=n
    
    #CONFIG_NFC=n
    #CONFIG_NFC_T2T_LIB=n
    
    
    
    
    CONFIG_WIFI=y
    # CONFIG_WIFI_NM=y
    CONFIG_WIFI_NRF70=y
    # CONFIG_WIFI_MGMT=y
    CONFIG_NET_CONNECTION_MANAGER=y
    CONFIG_L2_WIFI_CONNECTIVITY=y
    
    # WPA supplicant
    CONFIG_WIFI_NM_WPA_SUPPLICANT=y
    # CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_INF=y
    CONFIG_WIFI_READY_LIB=y
    
    # Soft AP
    CONFIG_NRF70_AP_MODE=y
    CONFIG_WIFI_NM_WPA_SUPPLICANT_AP=y
    
    
    CONFIG_NET_PKT_RX_COUNT=4
    CONFIG_NET_PKT_TX_COUNT=4
    
    # Below section is the primary contributor to SRAM and is currently
    # tuned for performance, but this will be revisited in the future.
    CONFIG_NET_BUF_RX_COUNT=8
    CONFIG_NET_BUF_TX_COUNT=8
    # TODO: was 183600; reduced to be able to build! 
    CONFIG_HEAP_MEM_POOL_SIZE=77120
    CONFIG_NET_TC_TX_COUNT=1
    
    CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=1
    CONFIG_NET_MAX_CONTEXTS=5
    CONFIG_NET_CONTEXT_SYNC_RECV=y
    
    CONFIG_INIT_STACKS=y
    
    CONFIG_NET_L2_ETHERNET=y
    CONFIG_NET_OFFLOAD=y
    
    # printing of scan results puts pressure on queues in new locking
    # design in net_mgmt. So, use a higher timeout for a crowded
    # environment.
    CONFIG_NET_MGMT_EVENT_QUEUE_TIMEOUT=5000
    
    # Raw scan Options
    CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS=n
    CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS_ONLY=n
    
    CONFIG_WIFI_SCAN_DWELL_TIME_ACTIVE=50
    CONFIG_WIFI_SCAN_DWELL_TIME_PASSIVE=130
    
    CONFIG_NET_CONFIG_SETTINGS=y
    CONFIG_NET_CONFIG_INIT_TIMEOUT=0
    
    CONFIG_NET_SOCKETS_POLL_MAX=10
    
    # Memories
    CONFIG_MAIN_STACK_SIZE=4096
    CONFIG_NET_TX_STACK_SIZE=3072
    CONFIG_NET_RX_STACK_SIZE=3072
    CONFIG_STA_SAMPLE_START_WIFI_THREAD_STACK_SIZE=4096
    
    # # prj.conf
    # CONFIG_BOOTLOADER_MCUBOOT=y
    # CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
    
    
    # Debugging
    CONFIG_STACK_SENTINEL=y
    # CONFIG_DEBUG_COREDUMP=y
    # CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING=y
    # CONFIG_DEBUG_COREDUMP_MEMORY_DUMP_MIN=y
    CONFIG_SHELL_CMDS_RESIZE=n
    
    CONFIG_NET_MGMT_EVENT_INFO=y
    
    # Kernel options
    CONFIG_ENTROPY_GENERATOR=y
    
    # Logging
    CONFIG_LOG=y
    # # Enable verbose logging
    CONFIG_LOG_DEFAULT_LEVEL=4
    CONFIG_LOG_BUFFER_SIZE=4096
    CONFIG_LOG_MODE_DEFERRED=y
    CONFIG_LOG_PROCESS_THREAD=y
    # # Or higher if you're logging a lot
    # CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=2048
    # CONFIG_LOG_PROCESS_THREAD_SLEEP_MS=50
    
    # CONFIG_POSIX_API=y
    # CONFIG_POSIX_CLOCK=y
    
    CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.168.1.1"
    CONFIG_NET_CONFIG_MY_IPV4_NETMASK="255.255.255.0"
    CONFIG_NET_CONFIG_MY_IPV4_GW="192.168.1.1"
    
    # printing of scan results puts pressure on queues in new locking
    # design in net_mgmt. So, use a higher timeout for a crowded
    # environment.
    CONFIG_NET_MGMT_EVENT_QUEUE_TIMEOUT=5000
    
    # Temporarily enable FS support so that linking succeeds.
    CONFIG_FILE_SYSTEM=y
    
    #CONFIG_PSA_STORAGE=n
    #CONFIG_PSA_API=n
    
    CONFIG_STDOUT_CONSOLE=y
    CONFIG_CONSOLE_HANDLER=y
    CONFIG_UART_CONSOLE_DEBUG_SERVER_HOOKS=y
    
    CONFIG_CONSOLE_SUBSYS=y
    CONFIG_CONSOLE_GETCHAR=y
    CONFIG_CONSOLE_GETCHAR_BUFSIZE=258
    CONFIG_CONSOLE_PUTCHAR_BUFSIZE=128
    
    CONFIG_NEWLIB_LIBC=y
    CONFIG_FPU=y
    CONFIG_POLL=y
    
    CONFIG_DEVICE_DT_METADATA=y
    
    # Enable sensor subsystem (doesn't add code if not used).
    # Specific sensors should be enabled per-board.
    CONFIG_SENSOR=y
    
    # Networking config
    CONFIG_NETWORKING=y
    CONFIG_NET_MGMT=y
    CONFIG_NET_MGMT_EVENT=y
    CONFIG_NET_L2_ETHERNET_MGMT=y
    # CONFIG_NET_MGMT_EVENT_STACK_SIZE=4096
    # CONFIG_WPA_SUPP=y
    CONFIG_NET_L2_WIFI_MGMT=y
    CONFIG_NET_IPV4=y
    # CONFIG_NET_IPV6=y
    CONFIG_NET_UDP=y
    CONFIG_NET_TCP=y
    CONFIG_NET_SOCKETS=y
    # CONFIG_NET_HOSTNAME=y
    CONFIG_NET_SOCKETS_POSIX_NAMES=n
    CONFIG_TEST_RANDOM_GENERATOR=y
    
    CONFIG_NET_CONFIG_SETTINGS=y
    CONFIG_NET_CONFIG_INIT_TIMEOUT=3
    # CONFIG_NET_CONFIG_NEED_IPV6=y
    CONFIG_NET_CONFIG_NEED_IPV4=y
    
    # DNS
    CONFIG_DNS_RESOLVER=y
    # CONFIG_DNS_RESOLVER_ADDITIONAL_QUERIES=2
    # CONFIG_DNS_SERVER_IP_ADDRESSES=y
    
    # Static IP addresses
    CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::1"
    CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1"
    CONFIG_NET_CONFIG_MY_IPV4_GW="192.0.2.2"
    CONFIG_DNS_SERVER1="192.0.2.2"
    
    # DHCP configuration. Until DHCP address is assigned,
    # static configuration above is used instead.
    CONFIG_NET_NATIVE=y
    CONFIG_NET_DHCPV4=y
    
    
    
    
    # Diagnostics and debugging
    
    # Required for zephyr.stack_analyze()
    CONFIG_THREAD_ANALYZER=y
    CONFIG_THREAD_ANALYZER_USE_PRINTK=y
    CONFIG_THREAD_NAME=y
    
    # Required for socket.pkt_get_info()
    CONFIG_NET_BUF_POOL_USAGE=y
    
    # Required for zephyr.shell_exec()
    #CONFIG_SHELL=y
    #CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN=n
    
    # Required for zephyr.shell_exec("net iface")
    #CONFIG_NET_SHELL=y
    
    # Uncomment to enable "INFO" level net_buf logging
    #CONFIG_NET_LOG=y
    #CONFIG_NET_DEBUG_NET_BUF=y
    # Change to 4 for "DEBUG" level
    #CONFIG_SYS_LOG_NET_LEVEL=3
    
    # MicroPython options
    CONFIG_MICROPY_CONFIGFILE="mpconfigport_full.h"
    # CONFIG_MICROPY_VFS_FAT=y
    CONFIG_MICROPY_VFS_LFS2=y
    
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_NVS=y
    CONFIG_MPU_ALLOW_FLASH_WRITE=y
    

    nrf7002dk_nrf5340_cpuapp_ns.conf:

    # CONFIG_BT=y
    # CONFIG_BT_DEVICE_NAME_DYNAMIC=y
    # CONFIG_BT_GATT_DYNAMIC_DB=y
    # CONFIG_BT_PERIPHERAL=y
    # CONFIG_BT_CENTRAL=y
    # CONFIG_BT_GATT_CLIENT=y
    # CONFIG_BT_L2CAP_TX_MTU=252
    # CONFIG_BT_BUF_ACL_RX_SIZE=256
    
    CONFIG_MICROPY_HEAP_SIZE=32768
    
    # CONFIG_DYNAMIC_THREAD=y
    CONFIG_THREAD_CUSTOM_DATA=y
    CONFIG_THREAD_MONITOR=y
    CONFIG_THREAD_STACK_INFO=y
    CONFIG_THREAD_NAME=y
    
    CONFIG_TEST_RANDOM_GENERATOR=y
    CONFIG_MICROPY_CONFIGFILE="mpconfigport_full.h"
    
    # Enable Bootloader
    # CONFIG_BOOTLOADER_MCUBOOT=y
    # CONFIG_IMG_MANAGER=y
    # CONFIG_STREAM_FLASH=y
    # CONFIG_DFU_TARGET_MCUBOOT=y
    # CONFIG_IMG_ERASE_PROGRESSIVELY=y
    
    # Enable SMP Server
    # CONFIG_MCUMGR=y
    # CONFIG_MCUMGR_GRP_IMG=y
    
    # # CONFIG_MCUMGR_GRP_IMG dependencies
    # CONFIG_FLASH=y
    # CONFIG_IMG_MANAGER=y
    
    # # CONFIG_IMG_MANAGER dependencies
    # # CONFIG_STREAM_FLASH=y
    
    # # CONFIG_MCUMGR dependencies
    # CONFIG_NET_BUF=y
    # CONFIG_ZCBOR=y
    
    # Required for CONFIG_IMG_MANAGER
    # CONFIG_FLASH_MAP=y
    
    CONFIG_NEWLIB_LIBC=y
    # CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    # CONFIG_CBPRINTF_FP_SUPPORT=y
    
    # # LoRaWAN config
    # CONFIG_LORA_SX126X=y
    # CONFIG_SPI=y
    
    # CONFIG_LORA=y
    
    # Random number generator required for several LoRaWAN services
    CONFIG_ENTROPY_GENERATOR=y
    
    # # LoRaWAN application layer
    # CONFIG_LORAWAN=y
    # CONFIG_LORAMAC_REGION_EU868=y
    # CONFIG_LORAWAN_NVM_SETTINGS=y
    
    # # LoRaWAN services required for FUOTA
    # CONFIG_LORAWAN_SERVICES=y
    # CONFIG_LORAWAN_APP_CLOCK_SYNC=y
    #CONFIG_LORAWAN_REMOTE_MULTICAST=y
    #CONFIG_LORAWAN_FRAG_TRANSPORT=y
    
    # Flash driver to store firmware image
    # CONFIG_FLASH=y
    # # CONFIG_FLASH_MAP=y
    # # CONFIG_FLASH_PAGE_LAYOUT=y
    # CONFIG_STREAM_FLASH=y
    
    CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
    CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU_SPEEDUP=y
    
    # CONFIG_NFC_T2T_NRFXLIB=y
    
    # CONFIG_NFC_NDEF=y
    # CONFIG_NFC_NDEF_MSG=y
    # CONFIG_NFC_NDEF_RECORD=y
    # CONFIG_NFC_NDEF_LE_OOB_REC=y
    # CONFIG_NFC_NDEF_CH_MSG=y
    # CONFIG_NFC_NDEF_TEXT_RECORD=y
    
    # CONFIG_NFC_NDEF_TNEP_RECORD=y
    # CONFIG_NFC_TNEP_TAG=y
    # CONFIG_NFC_NDEF_PARSER=y
    # CONFIG_NFC_NDEF_CH_PARSER=y
    # CONFIG_NFC_NDEF_LE_OOB_REC_PARSER=y
    # CONFIG_NFC_TNEP_CH=y
    
    # CONFIG_HEAP_MEM_POOL_SIZE=8192
    
    CONFIG_ARM_TRUSTZONE_M=y
    CONFIG_BUILD_WITH_TFM=y
    CONFIG_TFM_PROFILE_TYPE_NOT_SET=y
    
    # # Enable MCUmgr and dependencies.
    # CONFIG_NET_BUF=y
    # CONFIG_ZCBOR=y
    # CONFIG_CRC=y
    # CONFIG_MCUMGR=y
    # CONFIG_STREAM_FLASH=y
    # CONFIG_FLASH_MAP=y
    
    # Some command handlers require a large stack.
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
    CONFIG_MAIN_STACK_SIZE=4096
    
    # Ensure an MCUboot-compatible binary is generated.
    # CONFIG_BOOTLOADER_MCUBOOT=y
    
    # Enable flash operations.
    # CONFIG_FLASH=y
    
    # Required by the `taskstat` command.
    # CONFIG_THREAD_MONITOR=y
    
    # # Support for taskstat command
    # CONFIG_MCUMGR_GRP_OS_TASKSTAT=y
    
    # # Enable statistics and statistic names.
    # CONFIG_STATS=y
    # CONFIG_STATS_NAMES=y
    
    # # Enable most core commands.
    # CONFIG_FLASH=y
    # CONFIG_IMG_MANAGER=y
    # CONFIG_MCUMGR_GRP_IMG=y
    # CONFIG_MCUMGR_GRP_OS=y
    # CONFIG_MCUMGR_GRP_STAT=y
    
    # # Enable logging
    # CONFIG_LOG=y
    # CONFIG_MCUBOOT_UTIL_LOG_LEVEL_WRN=y
    
    # # Disable debug logging
    # CONFIG_LOG_MAX_LEVEL=3
    
    CONFIG_WATCHDOG=y
    CONFIG_WDT_DISABLE_AT_BOOT=y
    
    CONFIG_COUNTER=y
    
    CONFIG_ENTROPY_GENERATOR=y
    
    # Enable nordic security backend and PSA APIs
    CONFIG_NRF_SECURITY=y
    CONFIG_MBEDTLS_PSA_CRYPTO_C=y
    
    CONFIG_PSA_WANT_GENERATE_RANDOM=y
    
    # Using hardware crypto accelerator
    CONFIG_PSA_CRYPTO_DRIVER_OBERON=n
    CONFIG_PSA_CRYPTO_DRIVER_CC3XX=y
    
    # Mbedtls configuration
    CONFIG_MBEDTLS_ENABLE_HEAP=y
    CONFIG_MBEDTLS_HEAP_SIZE=8192
    
    CONFIG_NRF_SECURITY=y
    CONFIG_MBEDTLS_LEGACY_CRYPTO_C=y
    CONFIG_PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY=y
    CONFIG_PSA_WANT_RSA_KEY_SIZE_2048=y
    #CONFIG_NORDIC_SECURITY_BACKEND=y
    CONFIG_MBEDTLS=y
    #CONFIG_MBEDTLS_TLS_LIBRARY=y
    CONFIG_MBEDTLS_RSA_C=y
    
    CONFIG_PWM=y
    

  • Hi, 

    Your log indicated two issues:

    1. Image size overload. You can refer to the Memory footprint optimization to reduce the size.

    2. undefined reference to `net_mgmt_NET_REQUEST_WIFI_CONNECT_STORED' which is defined in the nrf/include/net/wifi_mgmt_ext.h. You can try to add "

    #include <net/wifi_mgmt_ext.h>" in the main.c
    -Amanda H.
  • 1. Image size overload. You can refer to the Memory footprint optimization to reduce the size.

    Our project is set up via terminal. Is there a way of generating the memory footprint without making the setup in VS code?

    2. undefined reference to `net_mgmt_NET_REQUEST_WIFI_CONNECT_STORED' which is defined in the nrf/include/net/wifi_mgmt_ext.h. You can try to add "

    The interesting part is that the file that generates the error has that include already put into place. Also, the network_wlan.c file that we're using to implement the wifi interface for micropython has the same include too. It's worth mentioning that both includes have no precompiler defines guarding them.

Reply
  • 1. Image size overload. You can refer to the Memory footprint optimization to reduce the size.

    Our project is set up via terminal. Is there a way of generating the memory footprint without making the setup in VS code?

    2. undefined reference to `net_mgmt_NET_REQUEST_WIFI_CONNECT_STORED' which is defined in the nrf/include/net/wifi_mgmt_ext.h. You can try to add "

    The interesting part is that the file that generates the error has that include already put into place. Also, the network_wlan.c file that we're using to implement the wifi interface for micropython has the same include too. It's worth mentioning that both includes have no precompiler defines guarding them.

Children
No Data
Related