|
| 1 | +# |
| 2 | +# Copyright (c) 2024 Nordic Semiconductor ASA |
| 3 | +# |
| 4 | +# SPDX-License-Identifier: Apache-2.0 |
| 5 | +# |
| 6 | + |
| 7 | +zephyr_library_named(nrf_wifi) |
| 8 | + |
| 9 | +set(OS_AGNOSTIC_BASE ${ZEPHYR_NRF_WIFI_MODULE_DIR}) |
| 10 | +set(FW_BINS_BASE ${ZEPHYR_NRF_WIFI_MODULE_DIR}/zephyr/blobs/wifi_fw_bins) |
| 11 | + |
| 12 | +zephyr_include_directories( |
| 13 | + inc |
| 14 | + src/qspi/inc |
| 15 | + # for net_sprint_ll_addr |
| 16 | + ${ZEPHYR_BASE}/subsys/net/ip |
| 17 | +) |
| 18 | + |
| 19 | +zephyr_include_directories_ifdef(CONFIG_NRF70_OFFLOADED_RAW_TX |
| 20 | + off_raw_tx/inc |
| 21 | +) |
| 22 | + |
| 23 | +zephyr_library_sources_ifdef(CONFIG_NRF70_SR_COEX |
| 24 | + src/coex.c |
| 25 | +) |
| 26 | + |
| 27 | +zephyr_library_sources( |
| 28 | + src/qspi/src/device.c |
| 29 | + src/qspi/src/rpu_hw_if.c |
| 30 | + src/qspi/src/ficr_prog.c |
| 31 | +) |
| 32 | + |
| 33 | +zephyr_library_sources_ifndef(CONFIG_NRF70_OFFLOADED_RAW_TX |
| 34 | + src/fmac_main.c |
| 35 | +) |
| 36 | + |
| 37 | +zephyr_library_sources_ifdef(CONFIG_NRF_WIFI_PATCHES_BUILTIN |
| 38 | + src/fw_load.c |
| 39 | +) |
| 40 | + |
| 41 | +if(NOT CONFIG_NRF70_RADIO_TEST AND NOT CONFIG_NRF70_OFFLOADED_RAW_TX) |
| 42 | + zephyr_library_sources( |
| 43 | + src/net_if.c |
| 44 | +) |
| 45 | +endif() |
| 46 | + |
| 47 | +zephyr_library_sources_ifdef(CONFIG_NET_L2_WIFI_MGMT |
| 48 | + src/wifi_mgmt_scan.c |
| 49 | +) |
| 50 | + |
| 51 | +zephyr_library_sources_ifdef(CONFIG_NRF70_SYSTEM_MODE_COMMON |
| 52 | + src/wifi_mgmt.c |
| 53 | +) |
| 54 | + |
| 55 | +zephyr_library_sources_ifdef(CONFIG_NRF70_OFFLOADED_RAW_TX |
| 56 | + off_raw_tx/src/off_raw_tx_api.c |
| 57 | +) |
| 58 | + |
| 59 | +zephyr_library_sources_ifdef(CONFIG_NRF70_STA_MODE |
| 60 | + src/wpa_supp_if.c |
| 61 | + src/wifi_mgmt.c |
| 62 | +) |
| 63 | + |
| 64 | +# Without WPA supplicant we only support scan |
| 65 | +zephyr_library_sources_ifdef(CONFIG_NRF70_STA_MODE |
| 66 | + src/wpa_supp_if.c) |
| 67 | + |
| 68 | +zephyr_library_sources_ifdef(CONFIG_NRF70_ON_QSPI |
| 69 | + src/qspi/src/qspi_if.c |
| 70 | +) |
| 71 | + |
| 72 | +zephyr_library_sources_ifdef(CONFIG_NRF70_ON_SPI |
| 73 | + src/qspi/src/spi_if.c |
| 74 | +) |
| 75 | + |
| 76 | +zephyr_library_sources_ifdef(CONFIG_NRF70_UTIL |
| 77 | + src/wifi_util.c |
| 78 | +) |
| 79 | + |
| 80 | +zephyr_compile_definitions_ifdef(CONFIG_NRF70_ON_QSPI |
| 81 | +# These are XIP related anomalies and aren't applicable for nRF7002 and cause |
| 82 | +# throughput issues. |
| 83 | + -DNRF53_ERRATA_43_ENABLE_WORKAROUND=0 |
| 84 | + -DNRF52_ERRATA_215_ENABLE_WORKAROUND=0 |
| 85 | +# nRF70 QSPI doesn't use 192MHz clock and most samples use 128MHz, this can cause anomaly 159 |
| 86 | +# but as its rare and not seen in most cases, we can disable it. |
| 87 | +# Alternative is 128MHz CPU should be disabled that impacts Wi-Fi performance. |
| 88 | + -DNRF53_ERRATA_159_ENABLE_WORKAROUND=0 |
| 89 | +) |
| 90 | + |
| 91 | +if (CONFIG_NRF_WIFI_BUILD_ONLY_MODE) |
| 92 | + message(WARNING " |
| 93 | + ------------------------------------------------------------------------ |
| 94 | + Building only the nRF70 driver, skipping firmware patch. |
| 95 | + This is only for building (CI) purposes and will not work on a real device. |
| 96 | + ------------------------------------------------------------------------ |
| 97 | + ") |
| 98 | +elseif(CONFIG_NRF_WIFI_PATCHES_BUILTIN) |
| 99 | + zephyr_blobs_verify(MODULE nrf_wifi REQUIRED) |
| 100 | + # RPU FW patch binaries based on the selected configuration |
| 101 | + if(CONFIG_NRF70_SYSTEM_MODE) |
| 102 | + set(NRF70_PATCH ${FW_BINS_BASE}/default/nrf70.bin) |
| 103 | + elseif(CONFIG_NRF70_RADIO_TEST) |
| 104 | + set(NRF70_PATCH ${FW_BINS_BASE}/radio_test/nrf70.bin) |
| 105 | + elseif(CONFIG_NRF70_SCAN_ONLY) |
| 106 | + set(NRF70_PATCH ${FW_BINS_BASE}/scan_only/nrf70.bin) |
| 107 | + elseif (CONFIG_NRF70_SYSTEM_WITH_RAW_MODES) |
| 108 | + set(NRF70_PATCH ${FW_BINS_BASE}/system_with_raw/nrf70.bin) |
| 109 | + elseif(CONFIG_NRF70_OFFLOADED_RAW_TX) |
| 110 | + set(NRF70_PATCH ${FW_BINS_BASE}/offloaded_raw_tx/nrf70.bin) |
| 111 | + else() |
| 112 | + # Error |
| 113 | + message(FATAL_ERROR "Unsupported nRF70 patch configuration") |
| 114 | + endif() |
| 115 | + |
| 116 | + set(gen_inc_dir ${ZEPHYR_BINARY_DIR}/misc/generated) |
| 117 | + zephyr_include_directories(${gen_inc_dir}) |
| 118 | + set(gen_dir ${gen_inc_dir}/nrf70_fw_patch) |
| 119 | + generate_inc_file_for_target( |
| 120 | + nrf_wifi |
| 121 | + ${NRF70_PATCH} |
| 122 | + ${gen_dir}/nrf70.bin.inc |
| 123 | + ) |
| 124 | +endif() |
0 commit comments