X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCmem.c;h=1e062c549b36fdfcd32946568376e81959e61a96;hb=d2da99feec099aa224e1db53bc5a1ed42ed51ec9;hp=dc0982b44137381faf5189e571f0a864e171194a;hpb=7faa2c7f7e56d31567f05ae41a0c431f9bced6de;p=fw%2Fsdcc diff --git a/src/SDCCmem.c b/src/SDCCmem.c index dc0982b4..1e062c54 100644 --- a/src/SDCCmem.c +++ b/src/SDCCmem.c @@ -9,6 +9,7 @@ memmap *xstack = NULL; /* xternal stack data */ memmap *istack = NULL; /* internal stack */ memmap *code = NULL; /* code segment */ memmap *data = NULL; /* internal data upto 128 */ +memmap *pdata = NULL; /* paged external data */ memmap *xdata = NULL; /* external data */ memmap *xidata = NULL; /* the initialized xdata */ memmap *xinit = NULL; /* the initializers for xidata */ @@ -175,6 +176,22 @@ initMem () overlay = NULL; } + /* Xternal paged segment ; + SFRSPACE - NO + FAR-SPACE - YES + PAGED - YES + DIRECT-ACCESS - NO + BIT-ACCESS - NO + CODE-ACESS - NO + DEBUG-NAME - 'P' + POINTER-TYPE - PPOINTER + */ + if (PDATA_NAME) { + pdata = allocMap (0, 1, 1, 0, 0, 0, options.xstack_loc, PDATA_NAME, 'P', PPOINTER); + } else { + pdata = NULL; + } + /* Xternal Data segment - SFRSPACE - NO FAR-SPACE - YES @@ -189,7 +206,7 @@ initMem () xidata = allocMap (0, 1, 0, 0, 0, 0, 0, XIDATA_NAME, 'F', FPOINTER); xinit = allocMap (0, 1, 0, 0, 0, 1, 0, XINIT_NAME, 'C', CPOINTER); - /* Inderectly addressed internal data segment + /* Indirectly addressed internal data segment SFRSPACE - NO FAR-SPACE - NO PAGED - NO @@ -203,7 +220,7 @@ initMem () idata = allocMap (0, 0, 0, 0, 0, 0, options.idata_loc, IDATA_NAME, 'G', IPOINTER); } else { - idata=NULL; + idata = NULL; } /* Static segment (code for variables ); @@ -327,21 +344,21 @@ allocGlobal (symbol * sym) then put it in the interrupt service array */ if (FUNC_ISISR (sym->type) && !options.noiv && (FUNC_INTNO (sym->type) != INTNO_UNSPEC)) - { - if (interrupts[FUNC_INTNO (sym->type)]) - werror (E_INT_DEFINED, - FUNC_INTNO (sym->type), - interrupts[FUNC_INTNO (sym->type)]->name); - else - interrupts[FUNC_INTNO (sym->type)] = sym; - - /* automagically extend the maximum interrupts */ - if (FUNC_INTNO (sym->type) >= maxInterrupts) - maxInterrupts = FUNC_INTNO (sym->type) + 1; - } + { + if (interrupts[FUNC_INTNO (sym->type)]) + werror (E_INT_DEFINED, + FUNC_INTNO (sym->type), + interrupts[FUNC_INTNO (sym->type)]->name); + else + interrupts[FUNC_INTNO (sym->type)] = sym; + + /* automagically extend the maximum interrupts */ + if (FUNC_INTNO (sym->type) >= maxInterrupts) + maxInterrupts = FUNC_INTNO (sym->type) + 1; + } /* if it is not compiler defined */ if (!sym->cdef) - allocIntoSeg (sym); + allocIntoSeg (sym); return; } @@ -375,9 +392,10 @@ allocGlobal (symbol * sym) return; } + if(!TARGET_IS_PIC16 || (TARGET_IS_PIC16 && sym->level)) /* register storage class ignored changed to FIXED */ - if (SPEC_SCLS (sym->etype) == S_REGISTER) - SPEC_SCLS (sym->etype) = S_FIXED; + if (SPEC_SCLS (sym->etype) == S_REGISTER) + SPEC_SCLS (sym->etype) = S_FIXED; /* if data specified then */ if (SPEC_SCLS (sym->etype) == S_DATA) @@ -392,6 +410,7 @@ allocGlobal (symbol * sym) /* if it is fixed, then allocate depending on the */ /* current memory model, same for automatics */ if (SPEC_SCLS (sym->etype) == S_FIXED || + (TARGET_IS_PIC16 && (SPEC_SCLS (sym->etype) == S_REGISTER) && (sym->level==0)) || SPEC_SCLS (sym->etype) == S_AUTO) { if (port->mem.default_globl_map != xdata) { /* set the output class */ @@ -416,9 +435,9 @@ allocGlobal (symbol * sym) // should we move this to the initialized data segment? if (port->genXINIT && sym->ival && (sym->level==0) && !SPEC_ABSA(sym->etype)) { - SPEC_OCLS(sym->etype)=xidata; + SPEC_OCLS(sym->etype)=xidata; } else { - SPEC_OCLS (sym->etype) = xdata; + SPEC_OCLS (sym->etype) = xdata; } allocIntoSeg (sym); return; @@ -432,6 +451,14 @@ allocGlobal (symbol * sym) return; } + if (SPEC_SCLS (sym->etype) == S_PDATA) + { + SPEC_OCLS (sym->etype) = pdata; + sym->iaccess = 1; + allocIntoSeg (sym); + return; + } + if (SPEC_SCLS (sym->etype) == S_EEPROM) { SPEC_OCLS (sym->etype) = eeprom; @@ -461,7 +488,7 @@ allocParms (value * val) it as a local variable by adding it to the first block we see in the body */ if (IS_REGPARM (lval->etype)) - continue; + continue; /* mark it as my parameter */ lval->sym->ismyparm = 1; @@ -470,20 +497,20 @@ allocParms (value * val) /* if automatic variables r 2b stacked */ if (options.stackAuto || IFFUNC_ISREENT (currFunc->type)) - { + { - if (lval->sym) - lval->sym->onStack = 1; + if (lval->sym) + lval->sym->onStack = 1; /* choose which stack 2 use */ /* use xternal stack */ if (options.useXstack) { - /* PENDING: stack direction support */ - SPEC_OCLS (lval->etype) = SPEC_OCLS (lval->sym->etype) = xstack; - SPEC_STAK (lval->etype) = SPEC_STAK (lval->sym->etype) = lval->sym->stack = - xstackPtr - getSize (lval->type); - xstackPtr -= getSize (lval->type); + /* PENDING: stack direction support */ + SPEC_OCLS (lval->etype) = SPEC_OCLS (lval->sym->etype) = xstack; + SPEC_STAK (lval->etype) = SPEC_STAK (lval->sym->etype) = lval->sym->stack = + xstackPtr - getSize (lval->type); + xstackPtr -= getSize (lval->type); } else { /* use internal stack */ @@ -621,7 +648,7 @@ allocLocal (symbol * sym) /* this is automatic */ - /* if it to be placed on the stack */ + /* if it's to be placed on the stack */ if (options.stackAuto || reentrant) { sym->onStack = 1; if (options.useXstack) { @@ -816,6 +843,7 @@ allocVariables (symbol * symChain) if (csym && csym->level == sym->level) werror (E_DUPLICATE_TYPEDEF, sym->name); + SPEC_EXTR (sym->etype) = 0; addSym (TypedefTab, sym, sym->name, sym->level, sym->block, 0); continue; /* go to the next one */ } @@ -830,15 +858,15 @@ allocVariables (symbol * symChain) /* if this is a function or a pointer to function */ /* then args processing */ if (funcInChain (csym->type)) - { - processFuncArgs (csym); - - /* if register bank specified then update maxRegBank */ - if (maxRegBank < FUNC_REGBANK (csym->type)) - maxRegBank = FUNC_REGBANK (csym->type); - /*JCF: Mark the register bank as used*/ - RegBankUsed[FUNC_REGBANK(csym->type)]=1; - } + { + processFuncArgs (csym); + + /* if register bank specified then update maxRegBank */ + if (maxRegBank < FUNC_REGBANK (csym->type)) + maxRegBank = FUNC_REGBANK (csym->type); + /*JCF: Mark the register bank as used*/ + RegBankUsed[FUNC_REGBANK(csym->type)]=1; + } /* if this is a extern variable then change the */ /* level to zero temporarily */