#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

if ARCH_FAMILY_AVR
comment "AVR Configuration Options"

choice
	prompt "Toolchain"
	default AVR_WINAVR_TOOLCHAIN if TOOLCHAIN_WINDOWS
	default AVR_BUILDROOT_TOOLCHAIN if HOST_LINUX
	default AVR_CROSSPACK_TOOLCHAIN if HOST_MACOS

config AVR_WINAVR_TOOLCHAIN
	bool "WinAVR"
	depends on TOOLCHAIN_WINDOWS
	select CYGWIN_WINTOOL if WINDOWS_CYGWIN
	---help---
		For Cygwin development environment on Windows machines, you
		can use WinAVR: http://sourceforge.net/projects/winavr/files/

		WARNING: There is an incompatible version of cygwin.dll in
		the WinAVR/bin directory! Make sure that the path to the
		correct cygwin.dll file precedes the path to the WinAVR
		binaries!

config AVR_ATMEL_AVR_TOOLCHAIN
	bool "Atmel AVR Toolchain"
	depends on TOOLCHAIN_WINDOWS
	select CYGWIN_WINTOOL if WINDOWS_CYGWIN
	---help---
		Atmel provides GNU Toolchain for AVR development. It can
		be obtained by installing Atmel Studio 6 and later or
		as standalone package from Atmel.

config AVR_LINUXGCC_TOOLCHAIN
	bool "Linux GCC"
	depends on HOST_LINUX
	select ARCH_TOOLCHAIN_GCC
	---help---
		For Linux, there are widely available avr-gcc packages. On
		Ubuntu, use: sudo apt-get install gcc-avr gdb-avr avr-libc

		Note that unlike other toolchains, this one is marked
		with ARCH_TOOLCHAIN_GCC which in turn enables other GCC-
		and GNU-specific optimizations. One of them is removal
		of unused code sections by the linker.

		Linker script for the board must take this into account
		and flag unreferenced sections that need to be present
		in the compiled binary with a KEEP statement. Most notably,
		this applies to .vectors section.

config AVR_CROSSPACK_TOOLCHAIN
	bool "CrossPack-AVR"
	depends on HOST_MACOS
	---help---
		For macOS, the AVR CrossPack toolchain is supported:
		http://www.obdev.at/products/crosspack/index.html

config AVR_BUILDROOT_TOOLCHAIN
	bool "Buildroot"
	---help---
		There is a DIY buildroot version for the AVR boards here:
		http://sourceforge.net/projects/nuttx/files/buildroot/. See
		the following section for details on building this toolchain.

endchoice # Toolchain

config AVR_HAS_MEMX_PTR
	bool "Enable in-flash static const strings"
	depends on AVR_ATMEL_AVR_TOOLCHAIN || AVR_LINUXGCC_TOOLCHAIN
	default y if ARCH_DEBUG_H
	default n
	---help---
		Enabling this option activates IOBJ and IPTR qualifiers
		for pointers in the source code. Compiler will then be allowed
		to place constants into program memory without copying it to RAM,
		reducing amount of RAM needed to hold static data.

		The compiler then extends pointers with these qualifiers enabled
		to 24bit length with highest bit set for data that reside in RAM.
		Based on this bit, it will then read the data using instructions
		appropriate for the underlying storage. As such, there is
		a performance tradeoff.

		Additionally, if this is enabled, all constant strings used
		for debugging and assertion are placed into program memory,
		corresponding routines are then able to get them directly
		from there.

		Note that this doesn't allow the application to use program memory
		pointers in arbitrary interaction with the kernel. Not all API
		functions have these qualifiers added to their parameters.


config AVR_HAS_RAMPZ
	bool

endif # ARCH_FAMILY_AVR
