device/include/mcs51/cc2430.h: added
[fw/sdcc] / src / SDCCmem.c
index ed4c4204022e0e0a80d23b16f72914202f87b4c7..3be821aecc8012fe238d1ea340260d2e6f5f9c65 100644 (file)
@@ -16,6 +16,7 @@ memmap *xinit = NULL;           /* the initializers for xidata */
 memmap *idata = NULL;           /* internal data upto 256      */
 memmap *bit = NULL;             /* bit addressable space       */
 memmap *statsg = NULL;          /* the constant data segment   */
+memmap *c_abs = NULL;           /* constant absolute data      */
 memmap *sfr = NULL;             /* register space              */
 memmap *reg = NULL;             /* register space              */
 memmap *sfrbit = NULL;          /* sfr bit space               */
@@ -148,6 +149,18 @@ initMem ()
    */
   statsg = allocMap (0, 1, 0, 0, 0, 1, 0, STATIC_NAME, 'D', CPOINTER);
 
+  /* Constant Absolute Data segment (for variables );
+     SFRSPACE       -   NO
+     FAR-SPACE      -   YES
+     PAGED          -   NO
+     DIRECT-ACCESS  -   NO
+     BIT-ACCESS     -   NO
+     CODE-ACCESS    -   YES
+     DEBUG-NAME     -   'D'
+     POINTER-TYPE   -   CPOINTER
+   */
+  c_abs = allocMap (0, 1, 0, 0, 0, 1, 0, CABS_NAME, 'D', CPOINTER);
+
   /* Data segment - internal storage segment ;
      SFRSPACE       -   NO
      FAR-SPACE      -   NO
@@ -330,7 +343,11 @@ allocDefault (symbol * sym)
       if (sym->_isparm)
         return FALSE;
       /* if code change to constant */
-      SPEC_OCLS (sym->etype) = statsg;
+      if (sym->ival && (sym->level==0) && SPEC_ABSA(sym->etype)) {
+        SPEC_OCLS(sym->etype) = c_abs;
+      } else {
+        SPEC_OCLS (sym->etype) = statsg;
+      }
       break;
     case S_XDATA:
       // should we move this to the initialized data segment?