Index: soft/giet_vm/giet_xml/xml_parser.c
===================================================================
--- soft/giet_vm/giet_xml/xml_parser.c	(revision 491)
+++ soft/giet_vm/giet_xml/xml_parser.c	(revision 511)
@@ -13,7 +13,4 @@
 // 3) the mapping directives bor both the tasks and the virtual segments.
 // The corresponding C structures are defined in the "mapping_info.h" file.
-// 
-// This parser also generates the "hard_config.h" and the "giet_vsegs.ld" files,
-// required  to compile the GIET-VM code. 
 ///////////////////////////////////////////////////////////////////////////////////////
 
@@ -34,7 +31,5 @@
 #define MAX_VSPACES    1024
 #define MAX_TASKS      4096
-#define MAX_MWMRS      4096
 #define MAX_VSEGS      4096
-#define MAX_VOBJS      8192
 #define MAX_PROCS      1024
 #define MAX_IRQS       8192
@@ -43,5 +38,5 @@
 #define MAX_PERIPHS    8192
 
-#define XML_PARSER_DEBUG  0
+#define XML_PARSER_DEBUG  1
 
 ///////////////////////////////////////////////////////////////////////////////////
@@ -54,5 +49,4 @@
 mapping_vspace_t *   vspace[MAX_VSPACES];    // vspace array
 mapping_vseg_t *     vseg[MAX_VSEGS];        // vseg array
-mapping_vobj_t *     vobj[MAX_VOBJS];        // vobj array
 mapping_task_t *     task[MAX_TASKS];        // task array
 mapping_proc_t *     proc[MAX_PROCS];        // proc array
@@ -89,8 +83,4 @@
 unsigned int task_index = 0;
 unsigned int task_loc_index = 0;
-
-unsigned int vobj_index = 0;
-unsigned int vobj_loc_index = 0;
-unsigned int vobj_count = 0;
 
 
@@ -104,11 +94,9 @@
 char found_mmc   = 0;
 
+/*
 ////////////////////////////////////////////////////////////////////////
 // These variables are used to generate the hard_config.h file.
 ////////////////////////////////////////////////////////////////////////
 
-unsigned int total_procs      = 0; // total number of processors
-unsigned int nb_procs_max     = 0; // max number of processors per cluster
-unsigned int nb_tasks_max     = 0; // max number of tasks (in all vspaces)
 
 unsigned int tim_channels     = 0; // number of user timers  (per cluster)
@@ -138,18 +126,5 @@
 unsigned int periph_vbase_array[PERIPH_TYPE_MAX_VALUE] 
          = { [0 ... (PERIPH_TYPE_MAX_VALUE - 1)] = 0xFFFFFFFF };
-
-//////////////////////////////////////////////////////////////////////
-// This arrray is useful to build a temporary list of vobj references. 
-// The struct vobj_ref_s is formed by a vspace_name and a vobj_name.
-// This array is used to set the attribute vobj_id of a cp_port
-// once all the vspace have been parsed.
-/////////////////////////////////////////////////////////////////////
-typedef struct vobj_ref_s 
-{
-    char vspace_name[32];
-    char vobj_name[32];
-} vobj_ref_t;
-
-vobj_ref_t * cp_port_vobj_ref[MAX_CP_PORTS];    
+*/
 
 
@@ -285,109 +260,4 @@
 } // end getStringValue()
 
-///////////////////////////////////////////////////////////////////////////////////
-// This function set the vbase addresses for all peripheral types, in order
-// to generate the ldscript file, that contains one single virtual address
-// for peripherals replicated in all clusters, and one virtual addresses for
-// each non replicated peripheral type.
-// 
-// It makes the following checks on the virtual addresses:
-// 
-// - For replicated peripherals the virtual base address must be:
-//   vbase = seg_type_base & 0XFF000000 + (cluster_xy * 0x00010000) & 0x00FF0000
-//
-// - For non-replicated peripherals, the cluster index must be cluster_io.
-///////////////////////////////////////////////////////////////////////////////////
-void set_periph_vbase_array()
-{
-    unsigned int vseg_id;      // vseg global index
-    unsigned int periph_id;    // periph global index
-    unsigned int pseg_id;      // pseg global index
-    unsigned int cluster_id;   // cluster linear index
-    unsigned int cluster_xy;   // cluster topological index
-    unsigned int type;         // peripheral type 
-
-    unsigned int type_mask      = 0xFF000000;
-    unsigned int cluster_mask   = 0x00FF0000;
-    unsigned int vseg_increment = 0x00010000;
-
-#if XML_PARSER_DEBUG
-printf("\n set peripherals vbase array\n");
-#endif
-
-    // scan all vsegs
-    for (vseg_id = 0 ; vseg_id < header->vsegs ; vseg_id++)
-    {
-        // keep only vseg corresponding to a periph        
-        if ( vobj[vseg[vseg_id]->vobj_offset]->type == VOBJ_TYPE_PERI )
-        {
-            pseg_id = vseg[vseg_id]->psegid; 
-
-#if XML_PARSER_DEBUG
-printf(" - found vseg %s associated to pseg %d", vseg[vseg_id]->name, pseg_id );
-#endif
-
-            // scan all periphs to retrieve peripheral type (same psegid)
-            for ( periph_id = 0 ; periph_id < header->periphs ; periph_id++)
-            {
-                if( periph[periph_id]->psegid == pseg_id ) // matching !!!
-                {
-                    cluster_id = pseg[pseg_id]->clusterid;
-                    type       = periph[periph_id]->type;
-
-#if XML_PARSER_DEBUG
-printf(" / matching periph type %d\n", type );
-#endif
-
-                    if ( (type == PERIPH_TYPE_DMA) ||
-                         (type == PERIPH_TYPE_MMC) ||
-                         (type == PERIPH_TYPE_XCU) )   // replicated peripheral
-                    {
-                        cluster_xy = (cluster[cluster_id]->x << header->y_width) +
-                                      cluster[cluster_id]->y;
-
-                        if( (vseg[vseg_id]->vbase & cluster_mask) != 
-                            (vseg_increment * cluster_xy) )
-                        {
-                            printf("[XML ERROR] All replicated peripherals "
-                                   "must have cluster bits = cluster_xy * increment\n");
-                            printf("periph index = %d / periph type = %d / vbase = %x\n",
-                                    periph_id, type, vseg[vseg_id]->vbase);
-                            exit(1);
-                        }
-                        else if ( periph_vbase_array[type] == 0xFFFFFFFF ) // vbase not set
-                        {
-                            periph_vbase_array[type] = vseg[vseg_id]->vbase & type_mask;    
-                        }
-                        else if ((vseg[vseg_id]->vbase & type_mask) != (periph_vbase_array[type]))
-                        {
-                            printf("[XML ERROR] All peripherals with same type"
-                                   " should share the same 8 MSB bits in vbase address\n");
-                            printf("periph index = %d / periph type = %d / vbase = %x\n",
-                                    periph_id, type, vseg[vseg_id]->vbase);
-                            exit(1);
-                        }
-                    }
-                    else                               // non replicated peripheral
-                    {
-                        if ( (cluster[cluster_id]->x == header->x_io) &&  
-                             (cluster[cluster_id]->y == header->y_io) )   
-                        {
-                            periph_vbase_array[type] = vseg[vseg_id]->vbase;    
-                        }
-                        else
-                        {
-                            printf("[XML ERROR] Non replicated peripherals must be in cluster_io\n");
-                            printf(" periph index = %d / periph type = %d / vbase = %x"
-                                   " / pseg index = %d / cluster index = %d\n",
-                                    periph_id, type, vseg[vseg_id]->vbase, pseg_id, cluster_id);
-                            exit(1);
-                        }
-                    }
-                }
-            }
-        }    
-    }
-}  // end set_periph_vbase_array()
-
 ///////////////////////////////////////////////////////////////
 int getClusterId( unsigned int x, unsigned int y )
@@ -443,94 +313,18 @@
 }
 
-////////////////////////////////////////////////////////////////////////////////
-int getVobjId(unsigned int vspace_id, char * vobj_name, unsigned int vspace_max) 
-{
-    unsigned int vobj_id;
-    unsigned int vobj_min = vspace[vspace_id]->vobj_offset;
-    unsigned int vobj_max = vobj_min + vspace_max;
-
-    for (vobj_id = vobj_min; vobj_id < vobj_max; vobj_id++) 
-    {
-        if (strcmp(vobj[vobj_id]->name, vobj_name) == 0) return vobj_id;
+///////////////////////////////////////////////////
+int getVsegId( unsigned int vspace_id, char *name )
+{
+    unsigned int vseg_id;
+    unsigned int vseg_min = vspace[vspace_id]->vseg_offset;
+    unsigned int vseg_max = vseg_min + vspace[vspace_id]->vsegs;
+
+    for (vseg_id = vseg_min ; vseg_id < vseg_max ; vseg_id++) 
+    {
+        if (strcmp(vseg[vseg_id]->name, name) == 0) return vseg_id;
     }
     return -1;
 }
 
-///////////////////////////////////////////////////////////
-unsigned int alignTo( unsigned int value, unsigned int pow2 )
-{
-    unsigned int mask = (1 << pow2) - 1;
-    return ( (value + mask) & ~mask);
-}
-
-////////////////////
-void setVsegLength()
-{
-    // for a given vseg identified vseg_index 
-    // scan all contained vobjs to compute the vseg lenth
-
-    unsigned int vobj_id;
-    unsigned int cur_length = 0;
-
-    unsigned int first = vseg[vseg_index]->vobj_offset;
-    unsigned int last  = first + vseg[vseg_index]->vobjs;
-
-    for ( vobj_id = first ; vobj_id < last ; vobj_id++ ) 
-    {
-        if (vobj[vobj_id]->align)
-        {
-            cur_length = alignTo( cur_length, vobj[vobj_id]->align );
-        }
-        cur_length += vobj[vobj_id]->length;
-    }
-    vseg[vseg_index]->length = alignTo( cur_length, 12 );
-}
-
-///////////////////////
-void checkVsegOverlap()
-{
-    // for a given vseg identified by vseg_index, 
-    // check overlap with all vsegs in same vspace,
-    // and check overlap with all global vsegs.
-
-    unsigned int vseg_id;
-    unsigned int prev_vbase;                          // previous vseg vbase
-    unsigned int prev_length;                         // previous vseg length
-
-    unsigned int vbase  = vseg[vseg_index]->vbase;    // new vseg vbase
-    unsigned int length = vseg[vseg_index]->length;   // new vseg length
-  
-    // checking overlap with other vsegs in same vspace
-    if ( header->vspaces > 0 )
-    {
-        unsigned int first = vspace[vspace_index]->vseg_offset;   
-        unsigned int last  = vseg_index;
-    
-        for( vseg_id = first ; vseg_id < last ; vseg_id++ )
-        {
-            prev_vbase  = vseg[vseg_id]->vbase;
-            prev_length = vseg[vseg_id]->length;
-            if ( ((vbase + length) > prev_vbase) && ((prev_vbase + prev_length) > vbase) )
-            { 
-                printf("[XML ERROR] vseg %s in vspace %s overlaps other vseg %s\n",
-                vseg[vseg_index]->name, vspace[vspace_index]->name, vseg[vseg_id]->name );
-                exit(1);
-            }
-        }
-    }
-
-    // checking overlap with existing global vsegs
-    for ( vseg_id = 0 ; vseg_id < header->globals ; vseg_id++ )
-    {
-        prev_vbase  = vseg[vseg_id]->vbase;
-        prev_length = vseg[vseg_id]->length;
-        if ( ((vbase + length) > prev_vbase) && ((prev_vbase + prev_length) > vbase) )
-        { 
-            printf("[XML ERROR] vseg %s in vspace %s overlaps global vseg %s\n",
-            vseg[vseg_index]->name, vspace[vspace_index]->name, vseg[vseg_id]->name );
-            exit(1);
-        }
-    }
-}
 
 //////////////////////////////////////
@@ -645,15 +439,17 @@
 
     ////////// get stackname attribute
-    str = getStringValue(reader, "stackname" , &ok);
-    if (ok) 
-    {
-        int index = getVobjId(vspace_index, str , vobj_loc_index);
+    char* stack_name = getStringValue(reader, "stackname" , &ok);
+    if (ok) 
+    {
+#if XML_PARSER_DEBUG
+printf("      stackname = %s\n", str);
+#endif
+        int index = getVsegId( vspace_index , stack_name );
         if (index >= 0) 
         {
 #if XML_PARSER_DEBUG
-printf("      stackname = %s\n", str);
 printf("      stack_id  = %d\n", index);
 #endif
-            task[task_index]->stack_vobj_id = index;
+            task[task_index]->stack_vseg_id = index;
         }
         else 
@@ -672,15 +468,17 @@
 
     ////////// get heap attribute
-    str = getStringValue(reader, "heapname", &ok);
-    if (ok) 
-    {
-        int index = getVobjId(vspace_index, str, vobj_loc_index);
+    char* heap_name = getStringValue(reader, "heapname", &ok);
+    if (ok) 
+    {
+#if XML_PARSER_DEBUG
+printf("      heapname  = %s\n", str);
+#endif
+        int index = getVsegId( vspace_index , heap_name );
         if (index >= 0) 
         {
 #if XML_PARSER_DEBUG
-printf("      heapname  = %s\n", str);
 printf("      heap_id   = %d\n", index );
 #endif
-            task[task_index]->heap_vobj_id = index;
+            task[task_index]->heap_vseg_id = index;
         }
         else 
@@ -693,5 +491,5 @@
     else 
     {
-        task[task_index]->heap_vobj_id = -1;
+        task[task_index]->heap_vseg_id = -1;
     }
 
@@ -716,144 +514,4 @@
 } // end taskNode()
 
-//////////////////////////////////////
-void vobjNode(xmlTextReaderPtr reader) 
-{
-    unsigned int ok;
-    unsigned int value;
-    char * str;
-
-    if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;
-
-    if (vobj_index >= MAX_VOBJS) 
-    {
-        printf("[XML ERROR] The number of vobjs is larger than %d\n", MAX_VOBJS);
-        exit(1);
-    }
-
-#if XML_PARSER_DEBUG
-printf("      vobj %d\n", vobj_loc_index);
-#endif
-
-    vobj[vobj_index] = (mapping_vobj_t *) malloc(sizeof(mapping_vobj_t));
-
-    ///////// get name attribute
-    str = getStringValue(reader, "name", &ok);
-    if (ok) 
-    {
-#if XML_PARSER_DEBUG
-printf("        name = %s\n", str);
-#endif
-        strncpy(vobj[vobj_index]->name, str, 31);
-    }
-    else 
-    {
-        printf("[XML ERROR] illegal or missing <name> attribute for vobj (%d,%d)\n", 
-                vseg_index, vobj_loc_index);
-        exit(1);
-    }
-
-    //////// get type attribute
-    str = getStringValue(reader, "type", &ok);
-#if XML_PARSER_DEBUG
-printf("        type = %s\n", str);
-#endif
-
-    if      (ok && (strcmp(str, "ELF")      == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_ELF;      }
-    else if (ok && (strcmp(str, "PERI")     == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_PERI;     }
-    else if (ok && (strcmp(str, "BLOB")     == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_BLOB;     }
-    else if (ok && (strcmp(str, "PTAB")     == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_PTAB;     }
-    else if (ok && (strcmp(str, "MWMR")     == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_MWMR;     }
-    else if (ok && (strcmp(str, "LOCK")     == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_LOCK;     }
-    else if (ok && (strcmp(str, "BUFFER")   == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_BUFFER;   }
-    else if (ok && (strcmp(str, "BARRIER")  == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_BARRIER;  }
-    else if (ok && (strcmp(str, "CONST")    == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_CONST;    }
-    else if (ok && (strcmp(str, "MEMSPACE") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_MEMSPACE; }
-    else if (ok && (strcmp(str, "SCHED")    == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_SCHED;    }
-    else if (ok && (strcmp(str, "HEAP")     == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_HEAP;     }
-    else 
-    {
-        printf("[XML ERROR] illegal or missing <type> attribute for vobj (%d,%d)\n", 
-                vspace_index, vobj_loc_index);
-        exit(1);
-    }
-    // some more checking
-    if ( (vobj[vobj_index]->type == VOBJ_TYPE_ELF) ||
-         (vobj[vobj_index]->type == VOBJ_TYPE_PERI) )
-    {
-        assert( (vobj_count == 0) && 
-        "[XML ERROR] an ELF or PERI vobj must be alone in a vseg");
-    }
-        
-
-    ////////// get length attribute 
-    value = getIntValue(reader, "length", &ok);
-    if (ok) 
-    {
-#if XML_PARSER_DEBUG
-printf("        length = %x\n", value);
-#endif
-        vobj[vobj_index]->length = value;
-    }  
-    else {
-        printf("[XML ERROR] illegal or missing <length> attribute for vobj (%d,%d)\n", 
-                vspace_index, vobj_loc_index);
-        exit(1);
-    }
-
-    ////////// get align attribute (optional : 0 if missing)
-    value = getIntValue(reader, "align", &ok);
-    if (ok) 
-    {
-#if XML_PARSER_DEBUG
-printf("        align = %d\n", value);
-#endif
-        vobj[vobj_index]->align = value;
-    }  
-    else 
-    {
-        vobj[vobj_index]->align = 0;
-    }
-
-    ////////// get binpath attribute (optional : "" if missing)
-    str = getStringValue(reader, "binpath", &ok);
-    if (ok) 
-    {
-#if XML_PARSER_DEBUG
-printf("        binpath = %s\n", str);
-#endif
-        strncpy(vobj[vobj_index]->binpath, str, 63);
-    }  
-    else 
-    {
-        vobj[vobj_index]->binpath[0] = 0;
-    }
-
-    ////////// get init attribute (optional, mandatory for mwmr and barrier)
-    value = getIntValue(reader, "init", &ok);
-    if (ok) 
-    {
-#if XML_PARSER_DEBUG
-printf("        init  = %d\n", value);
-#endif
-        vobj[vobj_index]->init = value;
-    }  
-    else 
-    {
-        if ((vobj[vobj_index]->type == VOBJ_TYPE_MWMR) || 
-            (vobj[vobj_index]->type == VOBJ_TYPE_BARRIER) ||
-            (vobj[vobj_index]->type == VOBJ_TYPE_CONST)) 
-        {
-            printf("[XML ERROR] illegal or missing <value> attribute for vobj (%d,%d). \
-                    All MWMR or BARRIER or CONST vobj must have a init value \n", 
-                    vspace_index, vobj_loc_index);
-            exit(1);
-        }
-        vobj[vobj_index]->init = 0;
-    }
-
-    vobj_index++;
-    vobj_count++;
-    vobj_loc_index++;
-} // end vobjNode()
 
 //////////////////////////////////////
@@ -865,6 +523,4 @@
     char * str;
 
-    vobj_count = 0;
-
     if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;
 
@@ -880,18 +536,8 @@
 
     vseg[vseg_index] = (mapping_vseg_t *) malloc(sizeof(mapping_vseg_t));
-
-    ////////// set vobj_offset attribute
-    vseg[vseg_index]->vobj_offset = vobj_index;
-
-#if XML_PARSER_DEBUG
-printf("      vobj_offset = %d\n", vobj_index);
-#endif
 
     ///////// set mapped attribute
     vseg[vseg_index]->mapped = 0;
 
-    //////// set next_vseg attribute
-    vseg[vseg_index]->next_vseg = 0;
-  
     ///////// get name attribute
     str = getStringValue(reader, "name", &ok);
@@ -938,4 +584,18 @@
     }
 
+    ////////// get big attribute (optional : 0 if missing)
+    value = getIntValue(reader, "big", &ok);
+    if (ok) 
+    {
+#if XML_PARSER_DEBUG
+printf("      big         = %d\n", value);
+#endif
+        vseg[vseg_index]->big = value;
+    }  
+    else 
+    {
+        vseg[vseg_index]->big = 0;
+    }
+
     /////////// get vbase attribute
     value = getIntValue(reader, "vbase", &ok);
@@ -950,4 +610,41 @@
     {
         printf("[XML ERROR] illegal or missing <vbase> attribute for vseg (%d,%d)\n", 
+                vspace_index, vseg_loc_index);
+        exit(1);
+    }
+
+    ////////// get length attribute 
+    value = getIntValue(reader, "length", &ok);
+    if (ok)
+    {
+#if XML_PARSER_DEBUG
+printf("      length      = %x\n", value);
+#endif
+        vseg[vseg_index]->length = value;
+    }
+    else 
+    {
+        printf("[XML ERROR] illegal or missing <length> attribute for vseg (%d,%d)\n",
+                vspace_index, vseg_loc_index);
+        exit(1);
+    }
+
+    //////// get type attribute
+    str = getStringValue(reader, "type", &ok);
+
+#if XML_PARSER_DEBUG
+printf("      type        = %s\n", str);
+#endif
+
+    if      (ok && (strcmp(str, "ELF")    == 0)) vseg[vseg_index]->type = VSEG_TYPE_ELF;
+    else if (ok && (strcmp(str, "PERI")   == 0)) vseg[vseg_index]->type = VSEG_TYPE_PERI;
+    else if (ok && (strcmp(str, "BLOB")   == 0)) vseg[vseg_index]->type = VSEG_TYPE_BLOB;
+    else if (ok && (strcmp(str, "PTAB")   == 0)) vseg[vseg_index]->type = VSEG_TYPE_PTAB;
+    else if (ok && (strcmp(str, "BUFFER") == 0)) vseg[vseg_index]->type = VSEG_TYPE_BUFFER;
+    else if (ok && (strcmp(str, "SCHED")  == 0)) vseg[vseg_index]->type = VSEG_TYPE_SCHED;
+    else if (ok && (strcmp(str, "HEAP")   == 0)) vseg[vseg_index]->type = VSEG_TYPE_HEAP;
+    else
+    {
+        printf("[XML ERROR] illegal or missing <type> attribute for vseg (%d,%d)\n",
                 vspace_index, vseg_loc_index);
         exit(1);
@@ -1033,5 +730,68 @@
     }
 
-    ////////// get vobjs in vseg
+    ////////// get binpath attribute (optional : "" if missing)
+    str = getStringValue(reader, "binpath", &ok);
+    if (ok)
+    {
+#if XML_PARSER_DEBUG
+printf("      binpath = %s\n", str);
+#endif
+        strncpy(vseg[vseg_index]->binpath, str, 63);
+    }
+    else
+    {
+        vseg[vseg_index]->binpath[0] = 0;
+    }
+
+    vseg_index++;
+    vseg_loc_index++;
+} // end vsegNode()
+
+////////////////////////////////////////
+void vspaceNode(xmlTextReaderPtr reader) 
+{
+    unsigned int ok;
+
+    vseg_loc_index = 0;
+    task_loc_index = 0;
+
+    if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;
+
+    vspace[vspace_index] = (mapping_vspace_t *) malloc(sizeof(mapping_vspace_t));
+    header->vspaces      = header->vspaces + 1;
+
+    ////////// get name attribute
+    char* vspace_name = getStringValue(reader, "name", &ok);
+    if (ok) 
+    {
+#if XML_PARSER_DEBUG
+printf("\n  vspace = %s\n", vspace_name );
+#endif
+        strncpy( vspace[vspace_index]->name, vspace_name , 31 );
+    }
+    else 
+    {
+        printf("[XML ERROR] illegal or missing <name> attribute for vspace %d\n", 
+                vspace_index);
+        exit(1);
+    }
+
+    ////////// set vseg_offset and task_offset attributes
+    vspace[vspace_index]->vseg_offset = vseg_index;
+    vspace[vspace_index]->task_offset = task_index;
+
+    ////////// initialise vsegs and tasks attributes
+    vspace[vspace_index]->vsegs = 0;
+    vspace[vspace_index]->tasks = 0;
+
+    ////////// get startname attribute
+    char* start_name = getStringValue(reader, "startname", &ok);
+    if (ok == 0) 
+    {
+        printf("[XML ERROR] illegal or missing <startname> attribute for vspace %s\n", 
+                vspace[vspace_index]->name);
+        exit(1);
+    }
+
     int status = xmlTextReaderRead(reader);
     while (status == 1) 
@@ -1039,97 +799,13 @@
         const char * tag = (const char *) xmlTextReaderConstName(reader);
 
-        if      (strcmp(tag, "vobj")     == 0 ) { vobjNode(reader); }
-        else if (strcmp(tag, "#text"  )  == 0 ) { }
-        else if (strcmp(tag, "#comment") == 0 ) { }
-        else if (strcmp(tag, "vseg")     == 0 ) 
-        {
-            vseg[vseg_index]->vobjs = vobj_count;
-            setVsegLength();
-            checkVsegOverlap();
-            vseg_index++;
-            vseg_loc_index++;
-            return;
-        }
-        else 
-        {
-            printf("[XML ERROR] Unknown tag %s", tag);
-            exit(1);
-        }
-        status = xmlTextReaderRead (reader);
-    }
-} // end vsegNode()
-
-////////////////////////////////////////
-void vspaceNode(xmlTextReaderPtr reader) 
-{
-    char * str;
-    unsigned int ok;
-    unsigned int nb_task_vspace = 0;
-
-    vobj_loc_index = 0;
-    vseg_loc_index = 0;
-    task_loc_index = 0;
-
-    if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;
-
-#if XML_PARSER_DEBUG
-printf("\n  vspace %d\n", vspace_index);
-#endif
-
-    vspace[vspace_index] = (mapping_vspace_t *) malloc(sizeof(mapping_vspace_t));
-    header->vspaces      = header->vspaces + 1;
-
-    ////////// get name attribute
-    str = getStringValue(reader, "name", &ok);
-    if (ok) {
-#if XML_PARSER_DEBUG
-printf("  name = %s\n", str);
-#endif
-        strncpy(vspace[vspace_index]->name, str, 31);
-    }
-    else 
-    {
-        printf("[XML ERROR] illegal or missing <name> attribute for vspace %d\n", 
-                vspace_index);
-        exit(1);
-    }
-
-    ////////// set vseg_offset and task_offset attributes
-    vspace[vspace_index]->vseg_offset = vseg_index;
-    vspace[vspace_index]->vobj_offset = vobj_index;
-    vspace[vspace_index]->task_offset = task_index;
-
-#if XML_PARSER_DEBUG
-    printf("  vseg_offset = %d\n", vseg_index);
-    printf("  vobj_offset = %d\n", vobj_index);
-    printf("  task_offset = %d\n", task_index);
-#endif
-
-    ////////// get startname attribute
-    str = getStringValue(reader, "startname", &ok);
-    if (ok) 
-    {
-        //used after parsing the vobjs
-    }
-    else 
-    {
-        printf("[XML ERROR] illegal or missing <startname> attribute for vspace %s\n", 
-                vspace[vspace_index]->name);
-        exit(1);
-    }
-
-    int status = xmlTextReaderRead(reader);
-    while (status == 1) 
-    {
-        const char * tag = (const char *) xmlTextReaderConstName(reader);
-
         if (strcmp(tag, "vseg") == 0) 
         {
             vsegNode(reader);
+            vspace[vspace_index]->vsegs += 1;
         }
         else if (strcmp(tag, "task") == 0) 
         {
             taskNode(reader);
-            nb_task_vspace++;
+            vspace[vspace_index]->tasks += 1;
         }
         else if (strcmp(tag, "#text")    == 0) { }
@@ -1137,13 +813,9 @@
         else if (strcmp(tag, "vspace")   == 0) 
         {
-            vspace[vspace_index]->vobjs = vobj_loc_index; 
-            vspace[vspace_index]->tasks = task_loc_index ;
-            vspace[vspace_index]->vsegs = vseg_loc_index ;
-
-            // get index of the vobj containing the start vector
-            int index = getVobjId(vspace_index, str , vobj_loc_index);
+            // get index of the vseg containing the start vector
+            int index = getVsegId( vspace_index, start_name );
             if (index == -1) 
             {
-                printf("[XML ERROR] vobj containing start vector not found in vspace %s\n",
+                printf("[XML ERROR] vseg containing start vector not found in vspace %s\n",
                         vspace[vspace_index]->name);
                 exit(1);
@@ -1151,28 +823,16 @@
             else 
             {
-                vspace[vspace_index]->start_vobj_id = index;
-#if XML_PARSER_DEBUG
-                printf("      startname = %s\n", str);
-                printf("      start_id  = %d\n", index);
-                printf("  end vspace %d\n\n", vspace_index);
-#endif
+                vspace[vspace_index]->start_vseg_id = index;
             }
 
-            // checking for all tasks that the startid 
-            // is smaller than the number of tasks in vspace
-            int task_id;
-            int task_min = vspace[vspace_index]->task_offset;
-            int task_max = task_min + vspace[vspace_index]->tasks; 
-            for (task_id = task_min; task_id < task_max; task_id++) 
-            {
-                if (task[task_id]->startid >= vspace[vspace_index]->tasks) 
-                {
-                    printf("[XML ERROR] <startid> too large for task (%d,%d)\n", 
-                            vspace_index, task_id );
-                    exit(1);
-                }
-            }
-
-            nb_tasks_max += nb_task_vspace;
+#if XML_PARSER_DEBUG
+printf("      vsegs       = %d\n", vspace[vspace_index]->vsegs );
+printf("      tasks       = %d\n", vspace[vspace_index]->tasks );
+printf("      vseg_offset = %d\n", vspace[vspace_index]->vseg_offset );
+printf("      task_offset = %d\n", vspace[vspace_index]->task_offset );
+printf("      startname   = %s\n", start_name);
+printf("      start_id    = %d\n", index);
+printf("  end vspace %d\n\n", vspace_index);
+#endif
             vspace_index++;
             return;
@@ -1328,5 +988,4 @@
 
     cp_port[cp_port_index] = (mapping_cp_port_t *) malloc(sizeof(mapping_cp_port_t));
-    cp_port_vobj_ref[cp_port_index] = (vobj_ref_t *) malloc(sizeof(vobj_ref_t));
 
     ///////// get direction attribute
@@ -1359,35 +1018,4 @@
     }
 
-    /////////// get vspacename attribute 
-    str = getStringValue(reader, "vspacename", &ok);
-#if XML_PARSER_DEBUG
-printf("      vspacename = %s\n", str);
-#endif
-    if (ok) 
-    {
-        strncpy(cp_port_vobj_ref[cp_port_index]->vspace_name, str, 31);
-    }
-    else 
-    {
-        printf("[XML ERROR] missing <vspacename> for cp_port %d in cluster %d\n",
-                cp_port_index, cluster_index);
-        exit(1);
-    }
-
-    /////////// get vobjname attribute 
-    str = getStringValue(reader, "vobjname", &ok);
-#if XML_PARSER_DEBUG
-printf("      vobjname = %s\n", str);
-#endif
-    if (ok) 
-    {
-        strncpy(cp_port_vobj_ref[cp_port_index]->vobj_name, str, 31);
-    }
-    else 
-    {
-        printf("[XML ERROR] missing <vobjname> for cp_port %d in cluster %d\n",
-                cp_port_index, cluster_index);
-        exit(1);
-    }
     cp_port_index++;
     cp_port_loc_index++;
@@ -1479,156 +1107,17 @@
 printf("      type        = %s\n", str);
 #endif
-        unsigned int error = 0;
-
-        // initialize peripheral subtype
-        periph[periph_index]->subtype = 0xFFFFFFFF;
-
-        // The CMA, FBF, HBA, IOB, IOC, NIC, ROM, SIM, TTY, PIC, DROM peripherals are not
-        // replicated in all clusters but can be instanciated twice. 
-
-        ////////////////////////////
-        if (strcmp(str, "CMA") == 0) 
-        {
-            periph[periph_index]->type = PERIPH_TYPE_CMA;
-            if ( cma_channels < periph[periph_index]->channels )
-            {
-                cma_channels = periph[periph_index]->channels;
-            }
-        }
-        /////////////////////////////////
-        else if (strcmp(str, "FBF") == 0) 
-        {
-            periph[periph_index]->type = PERIPH_TYPE_FBF;
-            use_fbf = 1;
-        }
-        /////////////////////////////////
-        else if (strcmp(str, "IOB") == 0) 
-        {
-            periph[periph_index]->type = PERIPH_TYPE_IOB;
-            use_iob = 1;
-        }
-        /////////////////////////////////
-        else if (strcmp(str, "IOC") == 0) 
-        {
-            char* subtype = getStringValue(reader, "subtype", &ok);
-            if (!ok)
-            {
-                printf("[XML ERROR] IOC peripheral needs a subtype: BDV, HBA or SPI\n");
-                exit(1);
-            } 
-
-            if ( strcmp(subtype, "BDV") == 0 )
-            {
-                periph[periph_index]->type    = PERIPH_TYPE_IOC;
-                periph[periph_index]->subtype = PERIPH_SUBTYPE_BDV;
-                ioc_channels = 1;
-                if ( header->use_ram_disk == 0 ) use_bdv = 1;
-            }
-            else if ( strcmp(subtype, "HBA") == 0 )
-            {
-                periph[periph_index]->type    = PERIPH_TYPE_IOC;
-                periph[periph_index]->subtype = PERIPH_SUBTYPE_HBA;
-                ioc_channels = periph[periph_index]->channels;
-                if ( header->use_ram_disk == 0 ) use_hba = 1;
-            }
-            else if ( strcmp(subtype, "SPI") == 0 )
-            {
-                periph[periph_index]->type    = PERIPH_TYPE_IOC;
-                periph[periph_index]->subtype = PERIPH_SUBTYPE_SPI;
-                ioc_channels = periph[periph_index]->channels;
-                if ( header->use_ram_disk == 0 ) use_spi = 1;
-            }
-            else
-            {
-                printf("[XML ERROR] illegal subtype for IOC peripheral\n");
-                exit(1);
-            }
-        } 
-        /////////////////////////////////
-        else if (strcmp(str, "NIC") == 0) 
-        {
-            periph[periph_index]->type = PERIPH_TYPE_NIC;
-            if ( nic_channels < periph[periph_index]->channels )
-            {
-                nic_channels = periph[periph_index]->channels;
-            }
-        }
-        /////////////////////////////////
-        else if (strcmp(str, "ROM") == 0) 
-        {
-            periph[periph_index]->type = PERIPH_TYPE_ROM;
-        } 
-        /////////////////////////////////
-        else if (strcmp(str, "SIM") == 0) 
-        {
-            periph[periph_index]->type = PERIPH_TYPE_SIM;
-        } 
-        /////////////////////////////////
-        else if (strcmp(str, "TTY") == 0) 
-        {
-            periph[periph_index]->type = PERIPH_TYPE_TTY;
-            if ( tty_channels < periph[periph_index]->channels )
-            {
-                tty_channels = periph[periph_index]->channels;
-            }
-        }
-        /////////////////////////////////
-        else if (strcmp(str, "PIC") == 0) 
-        {
-            periph[periph_index]->type = PERIPH_TYPE_PIC;
-            if ( pic_channels < periph[periph_index]->channels )
-            {
-                pic_channels = periph[periph_index]->channels;
-            }
-            use_pic = 1;
-        }
-
-
-        // The DMA, MMC, XCU peripherals can be replicated in all clusters
-        // but no more than one component of each type per cluster
-
-        /////////////////////////////////
-        else if (strcmp(str, "DMA") == 0) 
-        {
-            periph[periph_index]->type = PERIPH_TYPE_DMA;
-            if (found_dma)  error = 1; 
-            found_dma = 1;
-            if (dma_channels < periph[periph_index]->channels)
-                dma_channels = periph[periph_index]->channels;
-        }
-        //////////////////////////////////
-        else if (strcmp(str, "MMC") == 0) 
-        {
-            periph[periph_index]->type = PERIPH_TYPE_MMC;
-            if (found_mmc)  error = 1; 
-            found_mmc = 1;
-            if ( periph[periph_index]->channels != 1 ) error = 1;
-        }
-        //////////////////////////////////
-        else if (strcmp(str, "XCU") == 0) 
-        {
-            periph[periph_index]->type = PERIPH_TYPE_XCU;
-            if (found_xcu || found_icu || found_timer)  error = 1; 
-            found_xcu    = 1;
-            found_timer  = 1;
-            tim_channels = 32; 
-            use_xcu      = 1;
-
-            if ( periph[periph_index]->channels < 
-                 (header->irq_per_proc * cluster[cluster_index]->procs) )
-            {
-                printf("[XML ERROR] XCU channels smaller than PROCS * IRQ_PER_PROC\n");
-                printf(" - xcu channels = %d\n - nprocs = %d\n - irq_per_proc = %d\n",
-                       periph[periph_index]->channels, 
-                       cluster[cluster_index]->procs, 
-                       header->irq_per_proc );
-                exit(1);
-            }
-        }
-        /////////////////////////////////
-        else if (strcmp(str, "DROM") == 0)
-        {
-            periph[periph_index]->type = PERIPH_TYPE_DROM;
-        }
+        if      (strcmp(str, "CMA" ) == 0) periph[periph_index]->type = PERIPH_TYPE_CMA;
+        else if (strcmp(str, "FBF" ) == 0) periph[periph_index]->type = PERIPH_TYPE_FBF;
+        else if (strcmp(str, "IOB" ) == 0) periph[periph_index]->type = PERIPH_TYPE_IOB;
+        else if (strcmp(str, "IOC" ) == 0) periph[periph_index]->type = PERIPH_TYPE_IOC;
+        else if (strcmp(str, "NIC" ) == 0) periph[periph_index]->type = PERIPH_TYPE_NIC;
+        else if (strcmp(str, "ROM" ) == 0) periph[periph_index]->type = PERIPH_TYPE_ROM;
+        else if (strcmp(str, "SIM" ) == 0) periph[periph_index]->type = PERIPH_TYPE_SIM;
+        else if (strcmp(str, "TTY" ) == 0) periph[periph_index]->type = PERIPH_TYPE_TTY;
+        else if (strcmp(str, "PIC" ) == 0) periph[periph_index]->type = PERIPH_TYPE_PIC;
+        else if (strcmp(str, "DMA" ) == 0) periph[periph_index]->type = PERIPH_TYPE_DMA;
+        else if (strcmp(str, "MMC" ) == 0) periph[periph_index]->type = PERIPH_TYPE_MMC;
+        else if (strcmp(str, "XCU" ) == 0) periph[periph_index]->type = PERIPH_TYPE_XCU;
+        else if (strcmp(str, "DROM") == 0) periph[periph_index]->type = PERIPH_TYPE_DROM;
         else
         {
@@ -1637,17 +1126,31 @@
             exit(1);
         }
-
-        if (error) 
-        {
-            printf("[XML ERROR] illegal peripheral %s in cluster %d\n",
-                    str, cluster_index);
+    }
+
+    ////////// get subtype if IOC
+    if (periph[periph_index]->type == PERIPH_TYPE_IOC )
+    {
+        char* subtype = getStringValue(reader, "subtype", &ok);
+        if (ok)
+        {
+#if XML_PARSER_DEBUG
+printf("      subtype     = %s\n", str);
+#endif
+            if      (strcmp(subtype, "BDV") == 0) 
+            periph[periph_index]->subtype = PERIPH_SUBTYPE_BDV;
+            else if (strcmp(subtype, "HBA") == 0) 
+            periph[periph_index]->subtype = PERIPH_SUBTYPE_HBA;
+            else if (strcmp(subtype, "SPI") == 0) 
+            periph[periph_index]->subtype = PERIPH_SUBTYPE_SPI;
+        }
+        else
+        {
+            printf("[XML ERROR] illegal subtype for IOC peripheral\n");
             exit(1);
         }
     }
-    else 
-    {
-        printf("[XML ERROR] illegal or missing <type> for peripheral  %d in cluster %d\n",
-                periph_loc_index, cluster_index);
-        exit(1);
+    else
+    {
+        periph[periph_index]->subtype = 0XFFFFFFFF;
     }
 
@@ -1836,5 +1339,4 @@
     proc_loc_index++;
     proc_index++;
-    total_procs++;
 } // end procNode()
 
@@ -2027,20 +1529,4 @@
         else if (strcmp(tag, "cluster")  == 0) 
         {
-            ///////// TIMER and ICU peripheral are mandatory when nprocs != 0
-
-            unsigned int procs = cluster[cluster_index]->procs;
-            if ( procs && !found_timer && !found_xcu)
-            {
-                printf("[XML ERROR] missing timer peripheral in cluster %d\n", cluster_index);
-                exit(1);
-            }
-
-            if ( procs && !found_icu && !found_xcu) 
-            {
-                printf("[XML ERROR] missing icu peripheral in cluster %d\n", cluster_index);
-                exit(1);
-            }
-
-            if (nb_procs_max < procs) nb_procs_max = procs;
 
 #if XML_PARSER_DEBUG
@@ -2082,18 +1568,4 @@
             {
                 printf("[XML ERROR] Wrong number of clusters\n");
-                exit(1);
-            }
-
-            // checking TTY terminal for system boot
-            if ( tty_channels == 0 )
-            {
-                printf("[XML ERROR] missing TTY peripheral\n");
-                exit(1);
-            }
-
-            // checking IOC sub-types
-            if ( (use_bdv + use_hba + use_spi) > 1 )
-            {
-                printf("[XML ERROR] all IOC peripherals must have the same type\n");
                 exit(1);
             }
@@ -2182,5 +1654,4 @@
         {
             header->vsegs = vseg_index;
-            header->vobjs = vobj_index;
             header->tasks = task_index;
             return;
@@ -2363,5 +1834,4 @@
     header->psegs     = 0;
     header->vsegs     = 0;
-    header->vobjs     = 0;
     header->tasks     = 0;
     header->procs     = 0;
@@ -2399,12 +1869,16 @@
 
 
-///////////////////////////////////////
-void BuildTable(int fdout, const char * type, unsigned int nb_elem,
-                unsigned int elem_size, char ** table) 
+////////////////////////////////////
+void BuildTable( int          fdout, 
+                 const char * type, 
+                 unsigned int nb_elem,
+                 unsigned int elem_size, 
+                 char ** table ) 
 {
     unsigned int i;
-    // write element
-    for (i = 0; i < nb_elem; i++) {
-        if (elem_size != write(fdout, table[i], elem_size)) {
+    for (i = 0; i < nb_elem; i++) 
+    {
+        if (elem_size != write(fdout, table[i], elem_size)) 
+        {
             printf("function %s: %s(%d) write  error \n", __FUNCTION__, type, i);
             exit(1);
@@ -2459,5 +1933,4 @@
 printf("vspaces   = %d\n", header->vspaces);
 printf("psegs     = %d\n", header->psegs);
-printf("vobjs     = %d\n", header->vobjs);
 printf("vsegs     = %d\n", header->vsegs);
 printf("tasks     = %d\n", header->tasks);
@@ -2484,6 +1957,4 @@
     // write vsegs
     BuildTable(fdout, "vseg", vseg_index, sizeof(mapping_vseg_t), (char **) vseg);
-    // write vobjs
-    BuildTable(fdout, "vobj", vobj_index, sizeof(mapping_vobj_t), (char **) vobj);
     // write tasks array
     BuildTable(fdout, "task", task_index, sizeof(mapping_task_t), (char **) task);
@@ -2504,310 +1975,4 @@
 
 
-///////////////////////////////////////////////////////////////////////////////////
-// this function set the values of vspace_id and vobj_id fields for all cp_ports
-///////////////////////////////////////////////////////////////////////////////////
-void prepareBuild() 
-{
-    unsigned int i;
-    
-    for (i = 0; i < cp_port_index; i++) 
-    {
-        int vspace_id = getVspaceId(cp_port_vobj_ref[i]->vspace_name);
-        if (vspace_id < 0) 
-        {
-            printf("[XML ERROR] illegal  <vspacename> for cp_port %d,\n", i);
-            exit(1);
-        }
-        cp_port[i]->vspaceid = vspace_id;
-
-        int vobj_id = getVobjId( vspace_id, 
-                                 cp_port_vobj_ref[i]->vobj_name, 
-                                 vspace[vspace_id]->vobjs );
-        if (vobj_id >= 0) 
-        {
-
-#if XML_PARSER_DEBUG
-            printf("\ncp_port = %d\n", i);
-            printf("      vspace_name  = %s\n", cp_port_vobj_ref[i]->vspace_name);
-            printf("      vobj_name    = %s\n", cp_port_vobj_ref[i]->vobj_name);
-            printf("      vobj_index   = %d\n", vobj_id);
-#endif
-            cp_port[i]->mwmr_vobj_id = vobj_id;
-
-            assert((vobj[vspace[vspace_id]->vobj_offset + vobj_id]->type == VOBJ_TYPE_MWMR)
-                    && "coproc ports must refer a vobj of type MWMR");
-        }
-        else 
-        {
-            printf("[XML ERROR]  <vobjname> not found for cp_port %d,\n", i);
-            exit(1);
-        }
-    }
-}
-
-//////////////////////////////////////////
-void file_write(int fdout, char * towrite) 
-{
-    unsigned int size = strlen(towrite);
-    if (size != write(fdout, towrite, size)) 
-    {
-        printf("file_write error");
-        exit(1);
-    }
-}
-
-//////////////////////////////////////////////////
-void def_int_write(int fdout, char * def, int num) 
-{
-    char  buf[64];
-    sprintf(buf, "#define\t %s  %d\n", def, num);
-    file_write(fdout, buf);
-}
-
-//////////////////////////////////////////////////
-void def_hex_write(int fdout, char * def, int num) 
-{
-    char  buf[64];
-    sprintf(buf, "#define\t %s  0x%x\n", def, num);
-    file_write(fdout, buf);
-}
-
-///////////////////////////////////
-void  genHd(const char * file_path) 
-{
-    int fdout = open_file(file_path);
-
-    char prol[80];
-    sprintf(prol, "/* Generated from file %s.xml */\n\n",header->name);
-
-    char * ifdef  = "#ifndef _HARD_CONFIG_H\n#define _HARD_CONFIG_H\n\n";
-    char * epil   = "\n#endif //_HARD_CONFIG_H";
-
-    file_write(fdout, prol);
-    file_write(fdout, ifdef);
-
-    def_int_write(fdout, "X_SIZE            ", header->x_size);
-    def_int_write(fdout, "Y_SIZE            ", header->y_size);
-    def_int_write(fdout, "X_WIDTH           ", header->x_width);
-    def_int_write(fdout, "Y_WIDTH           ", header->y_width);
-    def_int_write(fdout, "X_IO              ", header->x_io);
-    def_int_write(fdout, "Y_IO              ", header->y_io);
-
-    file_write(fdout, "\n");
-
-    def_int_write(fdout, "TOTAL_PROCS       ", total_procs);
-    def_int_write(fdout, "NB_PROCS_MAX      ", nb_procs_max);
-    def_int_write(fdout, "NB_TASKS_MAX      ", nb_tasks_max);
-
-    file_write(fdout, "\n");
-
-    def_int_write(fdout, "NB_TIM_CHANNELS   ", tim_channels);
-    def_int_write(fdout, "NB_DMA_CHANNELS   ", dma_channels);
-
-    file_write(fdout, "\n");
-
-    def_int_write(fdout, "NB_TTY_CHANNELS   ", tty_channels);
-    def_int_write(fdout, "NB_IOC_CHANNELS   ", ioc_channels);
-    def_int_write(fdout, "NB_NIC_CHANNELS   ", nic_channels);
-    def_int_write(fdout, "NB_CMA_CHANNELS   ", cma_channels);
-
-    file_write(fdout, "\n");
-
-    def_int_write(fdout, "USE_XICU          ", use_xcu);
-    def_int_write(fdout, "USE_IOB           ", use_iob);
-    def_int_write(fdout, "USE_PIC           ", use_pic);
-    def_int_write(fdout, "USE_FBF           ", use_fbf);
-
-    file_write(fdout, "\n");
-
-    def_int_write(fdout, "USE_IOC_RDK       ", header->use_ram_disk);
-    def_int_write(fdout, "USE_IOC_HBA       ", use_hba);
-    def_int_write(fdout, "USE_IOC_BDV       ", use_bdv);
-    def_int_write(fdout, "USE_IOC_SPI       ", use_spi);
-
-    file_write(fdout, "\n");
-
-    def_int_write(fdout, "IRQ_PER_PROCESSOR ", header->irq_per_proc);
-
-    file_write(fdout, epil);
-
-    close(fdout);
-}
-
-////////////////////////////////////////////////////////
-void ld_write(int fdout, char * seg, unsigned int addr) 
-{
-    char buf[64];
-    sprintf(buf, "%s = 0x%x;\n", seg, addr);
-    file_write(fdout, buf);
-}
-
-//////////////////////////////////
-void genLd(const char * file_path) 
-{
-    int          fdout = open_file(file_path);
-    unsigned int count;
-    unsigned int vseg_id;
-    unsigned int base;      // vseg base
-    unsigned int size;      // vseg size
-
-    char prol[80];
-    sprintf(prol, "/* Generated from file %s.xml */\n\n",header->name);
-
-    file_write(fdout, prol);
-
-    // boot mandatory global vsegs 
-    for (vseg_id = 0 , count = 0 ; vseg_id < header->vsegs ; vseg_id++)
-    {
-        if ( strcmp(vseg[vseg_id]->name, "seg_boot_code") == 0 )
-        {
-            base = vseg[vseg_id]->vbase;
-            size = vobj[vseg[vseg_id]->vobj_offset]->length;
-            ld_write(fdout, "seg_boot_code_base      ", base);
-            ld_write(fdout, "seg_boot_code_size      ", size);
-            count++;
-        }
-        else if ( strcmp(vseg[vseg_id]->name, "seg_boot_data") == 0 )
-        {
-            base = vseg[vseg_id]->vbase;
-            size = vobj[vseg[vseg_id]->vobj_offset]->length;
-            ld_write(fdout, "seg_boot_data_base      ", base);
-            ld_write(fdout, "seg_boot_data_size      ", size);
-            count++;
-        }
-        else if ( strcmp(vseg[vseg_id]->name, "seg_boot_stack") == 0 )
-        {
-            base = vseg[vseg_id]->vbase;
-            size = vobj[vseg[vseg_id]->vobj_offset]->length;
-            ld_write(fdout, "seg_boot_stack_base     ", base);
-            ld_write(fdout, "seg_boot_stack_size     ", size);
-            count++;        
-        }
-        else if ( strcmp(vseg[vseg_id]->name, "seg_boot_mapping") == 0 )
-        {
-            base = vseg[vseg_id]->vbase;
-            size = vobj[vseg[vseg_id]->vobj_offset]->length;
-            ld_write(fdout, "seg_boot_mapping_base   ", base);
-            ld_write(fdout, "seg_boot_mapping_size   ", size);
-            count++;
-        }
-    }
-
-    if ( count != 4 )
-    { 
-        printf ("[XML ERROR] Missing mandatory Boot global vseg : only %d\n", count);
-        printf ("Mandatory segments are :\n");
-        printf (" - seg_boot_code\n");
-        printf (" - seg_boot_data\n");
-        printf (" - seg_boot_stack\n");
-        printf (" - seg_boot_mapping\n");
-        exit(0);
-    }
-
-    file_write(fdout, "\n");
-
-    // kernel mandatory global vsegs 
-    for (vseg_id = 0, count = 0 ; vseg_id < header->vsegs ; vseg_id++)
-    {
-        if ( strcmp(vseg[vseg_id]->name, "seg_kernel_code") == 0 )
-        {
-            base = vseg[vseg_id]->vbase;
-            size = vobj[vseg[vseg_id]->vobj_offset]->length;
-            ld_write(fdout, "seg_kernel_code_base    ", base);
-            ld_write(fdout, "seg_kernel_code_size    ", size);
-            count++;
-        }
-        else if ( strcmp(vseg[vseg_id]->name, "seg_kernel_data") == 0 )
-        {
-            base = vseg[vseg_id]->vbase;
-            size = vobj[vseg[vseg_id]->vobj_offset]->length;
-            ld_write(fdout, "seg_kernel_data_base    ", base);
-            ld_write(fdout, "seg_kernel_data_size    ", size);
-            count++;
-        }
-        else if ( strcmp(vseg[vseg_id]->name, "seg_kernel_uncdata") == 0 )
-        {
-            base = vseg[vseg_id]->vbase;
-            size = vobj[vseg[vseg_id]->vobj_offset]->length;
-            ld_write(fdout, "seg_kernel_uncdata_base ", base);
-            ld_write(fdout, "seg_kernel_uncdata_size ", size);
-            count++;
-        }
-        else if ( strcmp(vseg[vseg_id]->name, "seg_kernel_init") == 0 )
-        {
-            base = vseg[vseg_id]->vbase;
-            size = vobj[vseg[vseg_id]->vobj_offset]->length;
-            ld_write(fdout, "seg_kernel_init_base    ", base);
-            ld_write(fdout, "seg_kernel_init_size    ", size);
-            count++;
-        }
-    }
-    if ( count != 4 )
-    { 
-        printf ("[XML ERROR] Missing mandatory Kernel global vseg : only %d\n", count);
-        printf ("Mandatory segments are :\n");
-        printf (" - seg_kernel_code\n");
-        printf (" - seg_kernel_data\n");
-        printf (" - seg_kernel_uncdata\n");
-        printf (" - seg_kernel_init\n");
-        exit(0);
-    }
-
-    file_write(fdout, "\n");
-
-    // boot and kernel optionnal global vsegs (pseudo ROMs)
-    unsigned int seg_ram_disk_base    = 0xFFFFFFFF;
-    unsigned int seg_ram_disk_size    = 0;
-    unsigned int seg_reset_code_base  = 0xFFFFFFFF;
-    unsigned int seg_reset_code_size  = 0;
-    for (vseg_id = 0 ; vseg_id < header->vsegs ; vseg_id++)
-    {
-        if ( strcmp(vseg[vseg_id]->name, "seg_reset_code") == 0 )
-        {
-            seg_reset_code_base = vseg[vseg_id]->vbase;
-            seg_reset_code_size = vobj[vseg[vseg_id]->vobj_offset]->length;
-        }
-        if ( strcmp(vseg[vseg_id]->name, "seg_ram_disk") == 0 )
-        {
-            seg_ram_disk_base   = vseg[vseg_id]->vbase;
-            seg_ram_disk_size   = vobj[vseg[vseg_id]->vobj_offset]->length;
-        }
-    }
-
-    ld_write(fdout, "seg_reset_code_base     ", seg_reset_code_base);
-    ld_write(fdout, "seg_reset_code_size     ", seg_reset_code_size);
-    ld_write(fdout, "seg_ram_disk_base       ", seg_ram_disk_base);
-    ld_write(fdout, "seg_ram_disk_size       ", seg_ram_disk_size);
-    
-    file_write(fdout, "\n");
-
-    // fill the peripherals base address array 
-    set_periph_vbase_array();
-
-    //  non replicated peripherals
-    ld_write(fdout, "seg_cma_base            ",   periph_vbase_array[PERIPH_TYPE_CMA]);
-    ld_write(fdout, "seg_fbf_base            ",   periph_vbase_array[PERIPH_TYPE_FBF]);
-    ld_write(fdout, "seg_iob_base            ",   periph_vbase_array[PERIPH_TYPE_IOB]);
-    ld_write(fdout, "seg_ioc_base            ",   periph_vbase_array[PERIPH_TYPE_IOC]);
-    ld_write(fdout, "seg_nic_base            ",   periph_vbase_array[PERIPH_TYPE_NIC]);
-    ld_write(fdout, "seg_rom_base            ",   periph_vbase_array[PERIPH_TYPE_ROM]);
-    ld_write(fdout, "seg_sim_base            ",   periph_vbase_array[PERIPH_TYPE_SIM]);
-    ld_write(fdout, "seg_tty_base            ",   periph_vbase_array[PERIPH_TYPE_TTY]);
-    ld_write(fdout, "seg_pic_base            ",   periph_vbase_array[PERIPH_TYPE_PIC]);
-
-    file_write(fdout, "\n");
-
-    // replicated peripherals
-    ld_write(fdout, "seg_dma_base            ",   periph_vbase_array[PERIPH_TYPE_DMA]);
-    ld_write(fdout, "seg_mmc_base            ",   periph_vbase_array[PERIPH_TYPE_MMC]);
-    ld_write(fdout, "seg_xcu_base            ",   periph_vbase_array[PERIPH_TYPE_XCU]);
-
-    file_write(fdout, "\n");
-
-    ld_write(fdout, "vseg_cluster_increment  ",   0x00010000);
-
-    close(fdout);
-}
-
 //////////////////////////////////////////////////////
 char * buildPath(const char * path, const char * name) 
@@ -2824,5 +1989,6 @@
 int main(int argc, char * argv[]) 
 {
-    if (argc < 3) {
+    if (argc < 3) 
+    {
         printf("Usage: xml2bin <input_file_path> <output_path>\n");
         return 1;
@@ -2830,10 +1996,12 @@
 
     struct stat dir_st;
-    if (stat( argv[2], &dir_st)) {
+    if (stat( argv[2], &dir_st)) 
+    {
         perror("bad path");
         exit(1);
     }
 
-    if ((dir_st.st_mode & S_IFDIR) == 0) {
+    if ((dir_st.st_mode & S_IFDIR) == 0) 
+    {
         printf("path is not a dir: %s", argv[2] );
         exit(1);
@@ -2841,6 +2009,4 @@
 
     char * map_path = buildPath(argv[2], "map.bin"); 
-    char * ld_path = buildPath(argv[2], "giet_vsegs.ld"); 
-    char * hd_path = buildPath(argv[2], "hard_config.h"); 
 
     LIBXML_TEST_VERSION;
@@ -2859,8 +2025,5 @@
             { 
                 headerNode(reader);
-                prepareBuild();
                 buildBin(map_path);
-                genHd(hd_path);
-                genLd(ld_path);
             }
             else 
