#
# Copyright (c) 2020 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
# General config

CONFIG_MOSH_IPERF3=y
CONFIG_MOSH_SOCK=y
CONFIG_MOSH_PING=y
CONFIG_MOSH_CURL=y
CONFIG_MOSH_LINK=y
CONFIG_MOSH_SMS=y
CONFIG_MOSH_GNSS=y
CONFIG_MOSH_LOCATION=y


# Stacks and heaps
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=8192

# System queue is used e.g. by AT monitor and SMS lib
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

# Shell configurations
CONFIG_SHELL=y
CONFIG_SHELL_WILDCARD=n
CONFIG_SHELL_PROMPT_UART="mosh:~$ "
CONFIG_SHELL_ARGC_MAX=40
# Command line buffer is set this large to enable writing of certificates and injecting A-GNSS data on command line.
CONFIG_SHELL_CMD_BUFF_SIZE=3584
# Shell stack has impact for modem shell application, not CONFIG_MAIN_STACK_SIZE
CONFIG_SHELL_STACK_SIZE=9216
# Shell RX buffer needs to be increased to avoid problems with test automation
CONFIG_SHELL_BACKEND_SERIAL_RX_RING_BUFFER_SIZE=512
# LTE shell is unnecessary with Modem Shell
CONFIG_LTE_SHELL=n
# Enable use of vsnprintfcb() for extending mosh_print() format
CONFIG_CBPRINTF_LIBC_SUBSTS=y

CONFIG_MINIMAL_LIBC=n
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_SCANF=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_FPU=y
CONFIG_CJSON_LIB=y

# Getopt
CONFIG_GETOPT_LIB=y
# Need to disable devmem shell since it enforces Zephyr's internal version of getopt
CONFIG_DEVMEM_SHELL=n

# Device power management
CONFIG_PM_DEVICE=y

# Modem info
CONFIG_MODEM_INFO=y

# Modem key management
CONFIG_MODEM_KEY_MGMT=y

# Network
CONFIG_NETWORKING=y
CONFIG_NET_NATIVE=n
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_OFFLOAD=y
CONFIG_NET_SOCKETS_POSIX_NAMES=n
# Native IPv6 is enabled by default, disable it because we don't need it
CONFIG_NET_IPV6=n

CONFIG_POSIX_API=y
CONFIG_PTHREAD_IPC=n # There are issues with posix api if this is set
CONFIG_POSIX_MAX_FDS=10
# Need to be the same as MAX_FDS
CONFIG_NET_SOCKETS_POLL_MAX=10

# Modem library
CONFIG_NRF_MODEM_LIB=y
CONFIG_NRF_MODEM_LIB_SHMEM_TX_SIZE=22528
CONFIG_NRF_MODEM_LIB_SHMEM_RX_SIZE=8192
CONFIG_NRF_MODEM_LIB_ON_FAULT_APPLICATION_SPECIFIC=y

# AT monitor library
CONFIG_AT_MONITOR=y

# Increase AT monitor heap because %NCELLMEAS notifications can be long.
# Note: with legacy NCELLMEAS types, 512 is enough, but with GCI search types
# it could be even longer: theoretical maximum of 4020 bytes.
CONFIG_AT_MONITOR_HEAP_SIZE=4096

# PDN library
CONFIG_PDN=y
CONFIG_PDN_ESM_STRERROR=y

# SMS
CONFIG_SMS=y

# LTE link control
CONFIG_LTE_LINK_CONTROL=y
# Use modem system mode setting by default.
CONFIG_LTE_NETWORK_MODE_DEFAULT=y

CONFIG_LTE_NETWORK_USE_FALLBACK=n

#MOSH is having own commands to enable these at runtime:
CONFIG_LTE_LC_MODEM_SLEEP_NOTIFICATIONS=n
CONFIG_LTE_LC_TAU_PRE_WARNING_NOTIFICATIONS=n

#Minimum values for thresholds:
CONFIG_LTE_LC_TAU_PRE_WARNING_THRESHOLD_MS=10240
CONFIG_LTE_LC_MODEM_SLEEP_NOTIFICATIONS_THRESHOLD_MS=10240

# Configurations useful for debugging and development that user can enable when needed
#CONFIG_LTE_LOCK_PLMN=y
#CONFIG_LTE_LOCK_PLMN_STRING="24488"
#CONFIG_LTE_NETWORK_MODE_LTE_M_GPS=y

CONFIG_DATE_TIME=y

# nRF Cloud A-GNSS, disable this in case you want to enable SUPL below
CONFIG_NRF_CLOUD_AGNSS=y

# SUPL A-GNSS support, needs the nRF9160 SiP SUPL client library from nRF9160 DK product page
#CONFIG_SUPL_CLIENT_LIB=y

# Cellular positioning
CONFIG_LTE_NEIGHBOR_CELLS_MAX=17

# Cellular positioning services
#CONFIG_LOCATION_SERVICE_NRF_CLOUD=n
#CONFIG_LOCATION_SERVICE_HERE=y
#CONFIG_LOCATION_SERVICE_HERE_API_KEY=""

# Library for buttons and LEDs
CONFIG_DK_LIBRARY=y

# FOTA
CONFIG_FLASH=y
CONFIG_REBOOT=y
CONFIG_DFU_TARGET=y
CONFIG_FOTA_DOWNLOAD=y
CONFIG_DOWNLOAD_CLIENT=y
# BOOTLOADER_MCUBOOT reduces usable flash size by half so it's disabled by default
# This means application FOTA is disabled. Modem FOTA works without these.
CONFIG_BOOTLOADER_MCUBOOT=n
CONFIG_IMG_MANAGER=n
CONFIG_IMG_ERASE_PROGRESSIVELY=n

# Settings
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_NVS=y
CONFIG_SETTINGS=y
CONFIG_SETTINGS_NVS=y
CONFIG_NVS_LOG_LEVEL_WRN=y

# Debugging configurations
CONFIG_ASSERT=y
CONFIG_LOG=y
# Keep printk() synchronous
CONFIG_LOG_PRINTK=n
CONFIG_DEBUG_INFO=y
#CONFIG_DEBUG_OPTIMIZATIONS=y
#CONFIG_NO_OPTIMIZATIONS=y
#CONFIG_FORCE_NO_ASSERT=y
CONFIG_ASSERT_VERBOSE=y
#CONFIG_ASSERT_LEVEL=2
#CONFIG_ASSERT_ON_ERRORS=y
#CONFIG_FAULT_DUMP=2
CONFIG_RESET_ON_FATAL_ERROR=n
CONFIG_EXTRA_EXCEPTION_INFO=y
#CONFIG_WATCHDOG=y
CONFIG_SYS_HEAP_RUNTIME_STATS=y
# Enable TF-M logging on UART0
CONFIG_TFM_SECURE_UART0=y
CONFIG_TFM_LOG_LEVEL_SILENCE=n
CONFIG_TFM_EXCEPTION_INFO_DUMP=y
CONFIG_TFM_SPM_LOG_LEVEL_DEBUG=y
