GCC: ALIGNMENT PROBLEM WITH VARIABLES WITH GNU
Information in this article applies to:
I have declared just a few variables in my application, but the data space seems to be quickly used up. When I define the following variables, it appears that there are big gaps in the memory layout:
int ival; short sval; long lval;
What is the reason for that?
The GNU compiler has an alignment problem with uninitialized data. There are two possible work-arounds:
Note: There have been many different variants of the GCC compiler for ARM devices. Modern versions of Keil still support the GCC compiler, but now uses the GNU Arm Embedded Toolchain. To use this toolchain with Keil, see GCC: Using a GNU GCC Compiler Toolchain in the IDE.
Last Reviewed: Thursday, August 9, 2018
of your data.