
#pragma Directive
Motorola
Mixing C and Assembly Language
For More Information On This Product,
Go to: www.freescale.com
5-23
extending the C language. Users now have complete freedom in specifying both the
run-time and load-time counters for any static or global object. These directives may be
used with either code or data.
This flexibility is achieved by allowing the user to modify any of eight counter strings
maintained by the compiler — two for each memory space: x, y, l and p. When an object is
or defined, the current values of those counter strings are bound to that object.
Syntax for the pragma directive is
#pragma
counter_string argument
C function or data storage definition
#pragma
counter_string
where
1. The two
#pragma
statements must encase the entire definition.
2.
counter_string
in the first #pragma specifies which phase (run or load time) and
memory space is to be affected. It can be
x_run
,
y_run
,
l_run
,
p_run
,
x_load
,
y_load
,
l_load
, or
p_load
. The memory model used in the C compiler should
match the memory model specified by
counter_string
. Note that the
p_run
and
p_load counter_strings
will always have an effect.
3. The argument in the first
#pragma
is the string that will be passed as either the
runtime or load-time argument to the org assembler directive. This address, which
is optional, is of the form
x:address_value
where x is the counter associated with
the
x
,
y
,
l
, or
p
memory, and
address_value
is the value to be initially assigned to
that counter. As an example,
p:$300
might be used for the counter string
p_load
.
4. The C function or data storage definition is a declaration that reserves storage.
5. The second counter_string should be the same as the first
counter_string
and will
return the memory specification to the default setting.
If and only if
the memory space of the counter string in the #pragma directive matches the
memory model of the C compiler
, then the compiler will insert an assembly org statement
of the form:
(1)
org
a:runtime_address,b:loadtime_address
or
(2)
org
a:runtime_address
F
Freescale Semiconductor, Inc.
n
.