> First, when using the UDATA directive, am i supposed to specify the starting > address for the section ? Looks like i am because if i don't, the linker > chooses 0x120, wich is not a very clever decision.... I use UDATA with explicitly named sections, one section for each RAM bank. Here is the appropriate snippet from my default linker control file for the 16F876: // Linker control file for the PIC 16F876 processor. // CODEPAGE NAME=config START=0x2007 END=0x2007 //special processor config word CODEPAGE NAME=code0 START=0 END=0x7FF //code page 0 CODEPAGE NAME=code1 START=0x800 END=0xFFF //code page 1 CODEPAGE NAME=code2 START=0x1000 END=0x17FF //code page 2 CODEPAGE NAME=code3 START=0x1800 END=0x1FFF //code page 3 DATABANK NAME=bank0 START=0x20 END=0x6F //register bank 0 DATABANK NAME=bank1 START=0xA0 END=0xEF //register bank 1 DATABANK NAME=bank2 START=0x110 END=0x16F //register bank 2 DATABANK NAME=bank3 START=0x190 END=0x1EF //register bank 3 SHAREBANK NAME=globalram START=0x70 END=0x7F PROTECTED //global regs, bank 0 SHAREBANK NAME=globalram START=0xF0 END=0xFF PROTECTED //global regs, bank 1 SHAREBANK NAME=globalram START=0x170 END=0x17F PROTECTED //global regs, bank 2 SHAREBANK NAME=globalram START=0x1F0 END=0x1FF PROTECTED //global regs, bank 3 SECTION NAME=.udata_shr RAM=globalram //global memory mapped to all register banks SECTION NAME=.BANK0 RAM=bank0 //for registers explicitly in bank 0 SECTION NAME=.BANK1 RAM=bank1 //for registers explicitly in bank 1 SECTION NAME=.BANK2 RAM=bank2 //for registers explicitly in bank 2 SECTION NAME=.BANK3 RAM=bank3 //for registers explicitly in bank 3 To get variables in bank 0 for example, I do: .bank0 udata This can be done in as many modules as you like, and the variables will be allocated sequentially. Most of the time you don't care where a variable is within a bank, but knowing the bank at assembly time allows for a number of optimizations. In the rare event when a variable needs to be at a particular address, you can put a starting address after UDATA. If you want to see all this in action, take a look at my standard project templates and the HAL project at http://www.embedinc.com/pic. ******************************************************************** Olin Lathrop, embedded systems consultant in Littleton Massachusetts (978) 742-9014, olin@embedinc.com, http://www.embedinc.com -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu