The MeP target has a number of addressing modes and busses. The
near space spans the standard memory space's first 16 megabytes
(24 bits). The
far space spans the entire 32-bit memory space.
based space is a 128-byte region in the memory space that
is addressed relative to the
$tp register. The
space is a 65536-byte region relative to the
$gp register. In
addition to these memory regions, the MeP target has a separate 16-bit
control bus which is specified with
basedattribute is assigned to the
.basedsection, and is accessed with relative to the
tinyattribute assigned variables to the
.tinysection, relative to the
nearattribute are assumed to have addresses that fit in a 24-bit addressing mode. This is the default for large variables (
-mtiny=4is the default) but this attribute can override
-mtiny=for small variables, or override
farattribute are addressed using a full 32-bit address. Since this covers the entire memory space, this allows modules to make no assumptions about where variables might be stored.
ioattribute are used to address memory-mapped peripherals. If an address is specified, the variable is assigned that address, else it is not assigned an address (it is assumed some other module assigns an address). Example:
int timer_count __attribute__((io(0x123)));
cbattribute are used to access the control bus, using special instructions.
addrindicates the control bus address. Example:
int cpu_clock __attribute__((cb(0x123)));