GENERAL: VARIABLES NOT KEPT IN ORDER
Information in this article applies to:
I am using the ORDER compiler directive in my source code and I have declared several variables that I wish to place in memory in the same order. When I examine the symbol table in the map file, they are not kept in the same order that I declared them in. Why?
The order is not necessarily taken from the variable declarations, but the first use of the variables. For example, in the following files:
extern unsigned char foo; extern unsigned int bar;
#include "header.h" unsigned int bar; unsigned char foo;
foo is stored in memory first followed by bar. This is because the foo variable is referenced first (by the extern declaration).
Make sure that in all declarations and externs your variables are declared in the order you require. An alternative solution is to delare a structure containing the variables you wish to keep in order.
This behaviour is changed in C166 Version 4.05 and later to take the variable order from the variable declarations. You may download the latest updates from the Keil Website.
Last Reviewed: Friday, July 15, 2005
of your data.