Hi Rob! > Memory allocation is primarily the concern of the > compiler.
Right. But it can't do that job better than the device files permit :-) > As far as I know (I've discussed this with Kyle a long time > ago) it doesn't make a difference for the compiler how RAM > is specified with pragma data. The compiler combines > adjacent chucks to contiguous blocks. Therefore it is > important that the compiler required variables (_pic_accum > and _pic_isr_w, which must be in shared memory) are located > such that memory fragmentation is avoided when possible. If the compiler automatically combines areas that are independently declared but touch each other, that's cool. On most of the popular 16f chips, there is space for 96 bytes of ram from 0x20 to 0x7f, where implemented cells are at the upper end and the upmost 16 bytes are shared. So addresses 0x7e and 0x7f should be used by the compiler, makes up to 94 continuous bytes from 0x20 to 0x7d. Here's two examples where this is not the case: PIC16F57 / 59: Unshared ram cells are 0x10-0x1f, 0x30-0x3f, 0x50-0x5f... while the shared cells lie below them at 0x0a-0x0f. So here the compiler should use the lowest addresses 0x0a and 0x0b, while 0x0c-0x0f should be declared as unshared. PIC16F76 / 77: It is true there are 96 bytes from 0x20 to 0x7f with the upper 16 bytes shared. But this is not the biggest chunk. There are address ranges 0x110-0x17f and 0x190-0x1ff, one of which would give 112 continuous bytes when combined with the shared memory. So here it would be best not to declare "shared as unshared" from 0x70 to 0x7d with the compiler bytes 0x7e,0x7f, but use the range e.g. 0x170 to 0x17d. If any of this is too complicated, I'm perfectly happy with every extra byte in any chunk size. Right now I'm a bit unhappy with the situation on a pic12f615, on which 25% of the ram is shared ;-) Greets, Kiste -- You received this message because you are subscribed to the Google Groups "jallib" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jallib?hl=en.
