walnux/boards/avr
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
..
at32uc3 style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
at90usb arch/avr: reworked eliminating unused sections with GCC 2025-05-19 22:29:58 +08:00
atmega boards/avr/atmega: Added Elegoo Mega2560r3 board support 2025-05-31 00:29:18 +08:00
avrdx/breadxavr arch/avr/avrdx: do not copy const variables into RAM 2025-07-10 12:21:40 -03:00