# MARKER
CONFIG_GPIO=y
CONFIG_LED=y
CONFIG_ASSERT=y
CONFIG_REBOOT=y
CONFIG_RESET_ON_FATAL_ERROR=y
# CONFIG_MULTITHREADING=y
# CONFIG_SIZE_OPTIMIZATIONS=y

#SAADC
CONFIG_ADC=n
CONFIG_NRFX_SAADC=y
CONFIG_NRFX_TIMER0=y

# Memory protection
CONFIG_THREAD_STACK_INFO=n
CONFIG_THREAD_CUSTOM_DATA=n
CONFIG_FPU=n

# Boot
CONFIG_BOOT_BANNER=n
CONFIG_BOOT_DELAY=0

#I2c
CONFIG_I2C=y

#
CONFIG_MINIMAL_LIBC=y
CONFIG_NEWLIB_LIBC=y
CONFIG_MINIMAL_LIBC_NON_REENTRANT_FUNCTIONS=y

# CJSON
CONFIG_CJSON_LIB=y
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y

# NVS
CONFIG_PM=y
CONFIG_FLASH=y

CONFIG_NVS=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y

# SDCARD
CONFIG_SPI=y
CONFIG_SPI_SLAVE=y
CONFIG_DISK_ACCESS=y
CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_MKFS=y
CONFIG_FAT_FILESYSTEM_ELM=y
CONFIG_SDHC=y
CONFIG_SPI_SDHC=y

CONFIG_DISK_DRIVER_SDMMC=y
CONFIG_DISK_DRIVERS=y
CONFIG_SDMMC_STACK=y
CONFIG_SDMMC_SUBSYS=y
CONFIG_FS_FATFS_NUM_FILES=32
CONFIG_FS_FATFS_NUM_DIRS=8
CONFIG_FS_FATFS_REENTRANT=y
CONFIG_FS_LOG_LEVEL_OFF=y

# Wi-Fi
CONFIG_WIFI=y
# CONFIG_WIFI_NRF70=y
# CONFIG_NRF_WIFI_RPU_RECOVERY=y
# CONFIG_WPA_SUPP=y
# CONFIG_WPA_SUPP_CRYPTO_PSA=y
CONFIG_WIFI_NM_WPA_SUPPLICANT=y
CONFIG_NRF70_AP_MODE=n
CONFIG_NRF70_P2P_MODE=n
CONFIG_NRF70_UTIL=n

# Wi-Fi Credentials
CONFIG_WIFI_CREDENTIALS=y
# CONFIG_WIFI_CREDENTIALS_STATIC=n


# Networking Management API
CONFIG_NET_MGMT=y
CONFIG_NET_MGMT_EVENT=y
CONFIG_NET_MGMT_EVENT_INFO=y
# CONFIG_NET_MGMT_EVENT_STACK_SIZE=4096
CONFIG_NET_CONNECTION_MANAGER=y
# CONFIG_WIFI_MGMT_EXT=y (TODO: check if it is deprecated in ncs v3.0.2)


# Logging
CONFIG_UART_CONSOLE=y
CONFIG_CONSOLE=y
CONFIG_LOG=y
CONFIG_LOG_FUNC_NAME_PREFIX_ERR=y
CONFIG_LOG_MODE_IMMEDIATE=y

# Frame format
CONFIG_CRC=y
CONFIG_REQUIRES_FULL_LIBC=n
CONFIG_MINIMAL_LIBC=y
# CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=2048 maybe deprecated in ncs v3.0.2

# UART
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_SERIAL=y


# System settings
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_NANO=n

# Networking
CONFIG_NETWORKING=y
CONFIG_NET_NATIVE=y # TODO
CONFIG_NET_SOCKETS=y
CONFIG_NET_CONTEXT_RCVTIMEO=y
CONFIG_NET_CONTEXT_SNDTIMEO=y
CONFIG_POSIX_API=y   # CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_SOCKETS_CONNECT_TIMEOUT=3000
CONFIG_POSIX_MAX_FDS=20

CONFIG_NET_L2_ETHERNET=y
CONFIG_NET_IPV4=y
CONFIG_NET_IPV6=n
CONFIG_NET_TCP=y
CONFIG_NET_DHCPV4=y
CONFIG_DNS_RESOLVER=y

# TLS
# STEP 1.1 - Enable the TLS library and security relevant configurations
CONFIG_NET_SOCKETS_SOCKOPT_TLS=y
CONFIG_TLS_CREDENTIALS=y
CONFIG_MBEDTLS_RSA_C=y
CONFIG_MBEDTLS_DHM_C=y

# STEP 1.2 - Enable support for server name indication (SNI)
CONFIG_MBEDTLS_SSL_SERVER_NAME_INDICATION=y

# Memory
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_MAIN_STACK_SIZE=4096
# Decreased from 10240 to 4096

CONFIG_NET_TCP_WORKQ_STACK_SIZE=4096
CONFIG_NET_TX_STACK_SIZE=4096
CONFIG_NET_RX_STACK_SIZE=4096

CONFIG_NET_BUF_RX_COUNT=16
CONFIG_NET_BUF_TX_COUNT=20
CONFIG_NET_BUF_FIXED_DATA_SIZE=y
CONFIG_NET_BUF_DATA_SIZE=512
CONFIG_NRF70_RX_NUM_BUFS=16
CONFIG_NRF70_MAX_TX_AGGREGATION=4 
#mau have to use

# HTTP
CONFIG_HTTP_CLIENT=y


# RPC for ble
CONFIG_BOARD_ENABLE_CPUNET=y

CONFIG_NRF_RPC=y
CONFIG_NRF_RPC_CBOR=y
CONFIG_NRF_RPC_THREAD_STACK_SIZE=6144

#PARTITION
CONFIG_TFM_LOG_LEVEL_SILENCE=y

CONFIG_PM_PARTITION_SIZE_TFM=0x1fe00
CONFIG_PM_PARTITION_SIZE_NVS_STORAGE=0x2000

CONFIG_BOARD_ENABLE_CPUNET=y
CONFIG_NORDIC_QSPI_NOR=y
CONFIG_FLASH=y

CONFIG_NRF_WIFI_PATCHES_EXT_FLASH_STORE=y
CONFIG_NRF_WIFI_FW_FLASH_CHUNK_SIZE=8192

CONFIG_STREAM_FLASH=y
CONFIG_IMG_MANAGER=y

CONFIG_FLASH_MAP=y
CONFIG_MCUBOOT_IMG_MANAGER=y
CONFIG_IMG_ENABLE_IMAGE_CHECK=y

CONFIG_IMG_ERASE_PROGRESSIVELY=y
CONFIG_STREAM_FLASH_ERASE=y
CONFIG_FLASH_AREA_CHECK_INTEGRITY=y

CONFIG_IMG_BLOCK_BUF_SIZE=512

CONFIG_MCUBOOT_USE_ALL_AVAILABLE_RAM=y

CONFIG_SOC_NRF53_CPUNET_ENABLE=y


# To avoid RAM overflow issues
CONFIG_HEAP_MEM_POOL_IGNORE_MIN=n
CONFIG_NRF_WIFI_CTRL_HEAP_SIZE=30000
CONFIG_NRF_WIFI_DATA_HEAP_SIZE=66080
CONFIG_HEAP_MEM_POOL_SIZE=15600

# CONFIG_HEAP_MEM_POOL_SIZE=37000
# CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y
# CONFIG_NRF_WIFI_CTRL_HEAP_SIZE=20000
# CONFIG_NRF_WIFI_DATA_HEAP_SIZE=40000

# DEV ACADEMY OPTIONS which were not set already
CONFIG_NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE=5200
CONFIG_L2_WIFI_CONNECTIVITY=y
# CONFIG_L2_WIFI_CONNECTIVITY_AUTO_CONNECT=n
CONFIG_MBEDTLS=y
# TODO:
# CONFIG_MBEDTLS_ENABLE_HEAP=y # this is causing ram overflow
CONFIG_MBEDTLS_TLS_LIBRARY=y
CONFIG_NRF_SECURITY=y   


# Optional
# CONFIG_PM_PARTITION_REGION_NVS_STORAGE_EXTERNAL=y
# CONFIG_WIFI_NM_WPA_SUPPLICANT_INF_MON=y

# CONFIG_WIFI_CREDENTIALS_STATIC=y
# CONFIG_WIFI_CREDENTIALS_STATIC_SSID="wifi_test"
# CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="aarnav1999"


# For enabling storing of credentials in NVS
# CONFIG_FLASH_PAGE_LAYOUT=y
# CONFIG_SETTINGS=y
# CONFIG_SETTINGS_NVS=y

CONFIG_WIFI_LOG_LEVEL_DBG=y
CONFIG_NET_L2_WIFI_MGMT_LOG_LEVEL_DBG=y
