Small data sections
David Brown
david at westcontrol.com
Tue Jun 26 11:58:59 UTC 2007
Just a passing thought...
Some gcc targets support the concept of "small data section". This is
particularly important for 32-bit RISC cpus (like the PPC), were an
addressing mode of the form "Rx + 16bit" can fit in one instruction,
while an absolute 32-bit address takes a lot of messing around to get
the address into a register and then doing the real load or store. On a
ColdFire, which has absolute long addressing modes, it is not nearly as
important.
However, there are a couple of reasons why small data sections could
still be very interesting for ColdFires. One is that (Ax + 16bit)
addressing mode requires 2 instruction words instead of 3 - a minor
gain, which must be weighed against the loss of the base pointer
(typically A5). The other is that many ColdFires have a certain amount
of internal RAM, and there can be very significant speed gains by
putting small data there. I am working on a program using a 5234 at the
moment, and I see that access to the sdram can be very slow (relative to
the core). I already have the stack at the top of the internal ram, but
have plenty of space for more data. I can always use the "section"
attribute to put specific data into the internal ram, but it would be
*very* convenient if all small data went into its own section
automatically, leaving larger buffers and arrays in the main ram. It
would still save significant run time even if addressed using absolute
long addressing - although to be *really* cunning, the internal ram
could be placed at the very top or very bottom of memory, and accessed
using absolute short addressing.
mvh.,
David
More information about the coldfire-gnu-discuss
mailing list