|
px-fwlib 0.10.0
Cross-platform embedded library and documentation for 8/16/32-bit microcontrollers generated with Doxygen 1.9.2
|
RAM saving support for architectures that require methods to store and read constant data in program memory.
File(s):
This utility module attempts to provide a standardised method to store and read constant data in program memory for devices with separate program and data memory spaces, most notably the Microchip AVR architecture.
For a great introduction, read:
Constant data that must be stored in program memory is tagged with the PX_ATTR_PGM attribute.
The suffix "_P" convention is used to indicate that the function reads data stored in program memory, e.g. printf_P() vs. printf(). It is also used to indicate that a source file has been optimised to use const data stored in program memory, e.g. "px_cli_P.c" vs. "px_cli.c".
The "PX_PGM_STR()" macro is used for inline declaration of a string in program memory. See <avr/pgmspace.h> from AVR-Libc
For extra convenience, all-capital macros have been provided to call a program memory function AND inline declare a string in program memory:
This module also has the ability to revert to normal RAM storage for architectures that do not require it, or if PX_PGM_P_USE_RAM is defined.
Example: