I am working on a project where there are some very tight timing parameters. In one portion of the code, I would like to declare an array of unsigned chars, and specify the address at which they are located. This is needed because later in the code, I access this array from an assembly routine using the Z index registers to point to the array. I'd like the array to be located where the ZLow byte can be set to 0x00, and thus directly loading a value into ZLow will provide the proper offset into the array (NOTE: I'm actually reading a 4-bit value off of PORTB directly into the ZLow register, which should provide the index...this saves a few critical instruction cycles, and this is why I need the array to be placed at, say, 0x0100, or 0x0200, etc).
Any way I can do this? The only two ways I could think of were:
1) Manually declare my variables up until 0x0100, and then declare my arrays (but this is prone to tons of potential problems)
2) Tell gcc to start the .data section at a "better" location, like 0x0100, for this application, and place my arrays as the first thing in memory. However, since the .data is supposed to be static, I would be breaking the rules by accessing static data from another file (I guess I could figure out how much static data I had, subtract this from 0x0100, which would then place my .bss section at 0x0100, but this is dangerous for the same reasons as 1). It would also be potentially wasteful of precious RAM...
Any other ideas out there?
Thanks in advance for the help!