walnux/arch/avr/Kconfig
Kerogit d9269112ee arch/avr/avrdx: do not copy const variables into RAM
AVR uses Hardward architecture with separate address space for program
memory (flash) and data memory (RAM). Normal program flow can only
access data memory which means that all variables - including const
variables - have to be copied into RAM to be accessible. (This happens
automatically during startup.)

It is possible to work around this limitation in software but that
can have severe impact on performance and/or API complexity. It is hardly
feasible to change NuttX interfaces in a way that would allow to make use
of this workaround.

On newer AVR families, there is an alternative option enabled by this patch.
These chips map part of their program memory (a 32kB window) into data
memory address space. This patch leverages this feature and adds support
for placing const variables into the mapped window. No copy to RAM is done
for them.

Const variables are therefore loaded directly from flash (not consuming
RAM) while still being available to be used by any NuttX interface.

Linker script of breadxavr board is changed to make use of these changes.

Tested by verifying string addresses - parameters in printf call
in a custom application (and also by running the application and verifying
its output.)

Documentation tested by build.

Signed-off-by: Kerogit <kr.git@kerogit.eu>
2025-07-10 12:21:40 -03:00

85 lines
1.7 KiB
Text

#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
if ARCH_AVR
choice
prompt "Atmel AVR chip selection"
default ARCH_CHIP_AT32UC3
config ARCH_CHIP_ATMEGA
bool "ATMega family"
select ARCH_FAMILY_AVR
select MM_SMALL
---help---
Atmel ATMega family of 8-bit AVRs.
config ARCH_CHIP_AT90USB
bool "AT90USB family"
select ARCH_FAMILY_AVR
select MM_SMALL
---help---
Atmel AT90USB family of 8-bit AVRs.
config ARCH_CHIP_AVRDX
bool "AVR 32/64/128 DA/DB core"
select ARCH_FAMILY_AVR
select MM_SMALL
select ARCH_HAVE_TICKLESS
select AVR_HAVE_FLMAP
---help---
Atmel/Microchip AVR 32/64/128 DA/DB core family.
config ARCH_CHIP_AT32UC3
bool "AVR32 AT32UC3* family"
select ARCH_FAMILY_AVR32
---help---
Atmel AT32UC3A/B/C family of 32-bit AVR32s.
config ARCH_CHIP_AVR_CUSTOM
bool "Custom AVR chip"
select ARCH_CHIP_CUSTOM
---help---
Select this option if there is no directory for the chip under arch/avr/src/.
endchoice
config ARCH_FAMILY_AVR
bool
default n
select ARCH_HAVE_STACKCHECK
select ARCH_LDST_16BIT_NOT_ATOMIC
config ARCH_FAMILY_AVR32
bool
default n
config ARCH_FAMILY
string
default "avr" if ARCH_FAMILY_AVR
default "avr32" if ARCH_FAMILY_AVR32
config ARCH_CHIP
string
default "atmega" if ARCH_CHIP_ATMEGA
default "avrdx" if ARCH_CHIP_AVRDX
default "at90usb" if ARCH_CHIP_AT90USB
default "at32uc3" if ARCH_CHIP_AT32UC3
source "arch/avr/src/common/Kconfig"
if ARCH_FAMILY_AVR
source "arch/avr/src/avr/Kconfig"
source "arch/avr/src/at90usb/Kconfig"
source "arch/avr/src/atmega/Kconfig"
source "arch/avr/src/avrdx/Kconfig"
endif
if ARCH_FAMILY_AVR32
source "arch/avr/src/avr32/Kconfig"
source "arch/avr/src/at32uc3/Kconfig"
endif
endif # ARCH_AVR