Changeset 511 for soft/giet_vm/giet_xml
- Timestamp:
- Feb 14, 2015, 5:08:13 PM (10 years ago)
- Location:
- soft/giet_vm/giet_xml
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_xml/mapping_info.h
r491 r511 17 17 // variable (can be one). Multi-Writer/Multi-Reader communication channels 18 18 // betwwen tasks are supported. Each vspace contains a variable number 19 // of virtual segments (called vsegs). 19 // of virtual segments (called vsegs). The number of virtual space can be one. 20 20 // 21 21 // 3/ the mapping directives: both tasks on processors, and software objects 22 // (vobjs and vsegs) on the physical memory banks (called psegs). 23 // and a variable number of tasks. The number of virtual space can be one. 22 // (called vsegs) on the physical memory banks (called psegs). 24 23 // 25 24 // The mapping_info data structure is organised as the concatenation of … … 30 29 // - mapping_vspace_t vspace[] 31 30 // - mapping_vseg_t vseg[] 32 // - mapping_vobj_t vobj[]33 31 // - mapping_task_t task[] 34 32 // - mapping_proc_t proc[] … … 48 46 #define MAPPING_VSPACE_SIZE sizeof(mapping_vspace_t) 49 47 #define MAPPING_VSEG_SIZE sizeof(mapping_vseg_t) 50 #define MAPPING_VOBJ_SIZE sizeof(mapping_vobj_t)51 48 #define MAPPING_PSEG_SIZE sizeof(mapping_pseg_t) 52 49 #define MAPPING_TASK_SIZE sizeof(mapping_task_t) … … 66 63 typedef unsigned long long paddr_t; 67 64 68 enum v objType69 { 70 V OBJ_TYPE_ELF = 0, // loadable code/data object of elf files71 V OBJ_TYPE_BLOB = 1, // loadable blob object72 V OBJ_TYPE_PTAB = 2, // page table73 V OBJ_TYPE_PERI = 3, // hardware component74 V OBJ_TYPE_MWMR = 4, // MWMR channel75 V OBJ_TYPE_LOCK = 5, // Lock76 V OBJ_TYPE_BUFFER = 6, // Any "no initialization" objects (stacks...)77 V OBJ_TYPE_BARRIER = 7, // Barrier78 V OBJ_TYPE_CONST = 8, // Constant79 V OBJ_TYPE_MEMSPACE = 9, // Memspace (descriptor must be initialised)80 V OBJ_TYPE_SCHED = 10, // Array of schedulers (one per cluster)81 V OBJ_TYPE_HEAP = 11, // Heap f schedulers (one per cluster)65 enum vsegType 66 { 67 VSEG_TYPE_ELF = 0, // loadable code/data object of elf files 68 VSEG_TYPE_BLOB = 1, // loadable blob object 69 VSEG_TYPE_PTAB = 2, // page table 70 VSEG_TYPE_PERI = 3, // hardware component 71 VSEG_TYPE_MWMR = 4, // MWMR channel 72 VSEG_TYPE_LOCK = 5, // Lock 73 VSEG_TYPE_BUFFER = 6, // Any "no initialization" objects (stacks...) 74 VSEG_TYPE_BARRIER = 7, // Barrier 75 VSEG_TYPE_CONST = 8, // Constant 76 VSEG_TYPE_MEMSPACE = 9, // Memspace (descriptor must be initialised) 77 VSEG_TYPE_SCHED = 10, // Array of schedulers (one per cluster) 78 VSEG_TYPE_HEAP = 11, // Heap f schedulers (one per cluster) 82 79 }; 83 80 … … 149 146 unsigned int globals; // total number of global vsegs 150 147 unsigned int vspaces; // total number of virtual spaces 151 unsigned int psegs; // total number of physical segments (all clusters) 152 unsigned int vsegs; // total number of virtual segments (all vspaces) 153 unsigned int vobjs; // total number of virtual objects (all vspaces) 154 unsigned int tasks; // total number of tasks (all vspaces) 155 unsigned int procs; // total number of procs (all clusters) 156 unsigned int irqs; // total number of irqs (all clusters) 157 unsigned int coprocs; // total number of coprocs (all clusters) 158 unsigned int cp_ports; // total number of cp_ports (all coprocs) 159 unsigned int periphs; // total number of peripherals (all clusters) 160 148 unsigned int psegs; // total number of physical segments 149 unsigned int vsegs; // total number of virtual segments 150 unsigned int tasks; // total number of tasks 151 unsigned int procs; // total number of procs 152 unsigned int irqs; // total number of irqs 153 unsigned int coprocs; // total number of coprocs 154 unsigned int cp_ports; // total number of cp_ports 155 unsigned int periphs; // total number of peripherals 161 156 char name[32]; // mapping name 162 157 } mapping_header_t; … … 170 165 171 166 unsigned int psegs; // number of psegs in cluster 172 unsigned int pseg_offset; // global index of first pseg in psegs set167 unsigned int pseg_offset; // global index of first pseg in psegs 173 168 174 169 unsigned int procs; // number of processors in cluster 175 unsigned int proc_offset; // global index of first proc in procs set170 unsigned int proc_offset; // global index of first proc in procs 176 171 177 172 unsigned int coprocs; // number of coprocessors in cluster 178 unsigned int coproc_offset; // global index of first coproc in coprocs set173 unsigned int coproc_offset; // global index of first coproc in coprocs 179 174 180 175 unsigned int periphs; // number of peripherals in cluster 181 unsigned int periph_offset; // global index of first coproc in periphs set176 unsigned int periph_offset; // global index of first coproc in periphs 182 177 } mapping_cluster_t; 183 178 … … 187 182 { 188 183 char name[32]; // virtual space name 189 unsigned int start_v obj_id; // vobjcontaining start vector index184 unsigned int start_vseg_id; // vseg containing start vector index 190 185 unsigned int vsegs; // number of vsegs in vspace 191 unsigned int vobjs; // number of vobjs in vspace192 186 unsigned int tasks; // number of tasks in vspace 193 187 unsigned int vseg_offset; // global index of first vseg in vspace 194 unsigned int vobj_offset; // global index of first vobj in vspace195 188 unsigned int task_offset; // global index of first task in vspace 196 189 } mapping_vspace_t; … … 201 194 { 202 195 char name[32]; // vseg name (unique in vspace) 196 char binpath[64]; // path for the binary code (if required) 203 197 unsigned int vbase; // base address in virtual space 204 198 paddr_t pbase; // base address in physical space … … 206 200 unsigned int psegid; // physical segment global index 207 201 unsigned int mode; // C-X-W-U flags 208 unsigned int vobjs; // number of vobjs in vseg 209 unsigned int vobj_offset; // global index of first vobj in vseg 210 unsigned int next_vseg; // linked list of vsegs mapped on pseg 202 unsigned int type; // vseg type 211 203 char mapped; // mapped if non zero 212 204 char ident; // identity mapping if non zero … … 235 227 unsigned int proclocid; // processor local index (inside cluster) 236 228 unsigned int trdid; // thread index in vspace 237 unsigned int stack_v obj_id; // global index for vobjcontaining stack238 unsigned int heap_v obj_id; // global index for vobjcontaining heap229 unsigned int stack_vseg_id; // global index for vseg containing stack 230 unsigned int heap_vseg_id; // global index for vseg containing heap 239 231 unsigned int startid; // index in start_vector 240 232 } mapping_task_t; 241 242 243 //////////////////////////////////////////////////////244 typedef struct __attribute__((packed)) mapping_vobj_s245 {246 char name[32]; // vobj name (unique in a vspace)247 char binpath[64]; // path for the binary code ("*.elf")248 unsigned int type; // type of vobj249 unsigned int length; // size (bytes)250 unsigned int align; // required alignement (logarithm of 2)251 unsigned int vbase; // virtual base addresse of the vobj252 unsigned int init; // init value (used by barrier or mwmr channel)253 } mapping_vobj_t;254 233 255 234 … … 276 255 unsigned int direction; // TO_COPROC == 0 / FROM_COPROC == 1 277 256 unsigned int vspaceid; // index of the vspace containing MWMR channel 278 unsigned int mwmr_v obj_id; // global index of vobjcontaining MWMR channel257 unsigned int mwmr_vseg_id; // global index of vseg containing MWMR channel 279 258 } mapping_cp_port_t; 280 259 -
soft/giet_vm/giet_xml/xml_driver.c
r491 r511 21 21 { 22 22 // mnemonics defined in mapping_info.h 23 const char * v obj_type[] =23 const char * vseg_type[] = 24 24 { 25 25 "ELF", // binary code generated by GCC … … 41 41 { 42 42 "RAM", 43 "ROM", // deprecated => use PERI44 43 "PERI", 45 44 }; … … 129 128 unsigned int pseg_id; 130 129 unsigned int vseg_id; 131 unsigned int vobj_id;132 130 unsigned int task_id; 133 131 unsigned int proc_id; … … 141 139 mapping_vspace_t * vspace; 142 140 mapping_vseg_t * vseg; 143 mapping_vobj_t * vobj;144 141 mapping_task_t * task; 145 142 mapping_proc_t * proc; … … 171 168 MAPPING_VSPACE_SIZE * header->vspaces); 172 169 173 // computes the base adresss for vobjs array,174 vobj = (mapping_vobj_t *) ((char *) header +175 MAPPING_HEADER_SIZE +176 MAPPING_CLUSTER_SIZE * header->x_size * header->y_size +177 MAPPING_PSEG_SIZE * header->psegs +178 MAPPING_VSPACE_SIZE * header->vspaces +179 MAPPING_VSEG_SIZE * header->vsegs);180 181 170 // computes the base address for tasks array 182 171 task = (mapping_task_t *) ((char *) header + … … 185 174 MAPPING_PSEG_SIZE * header->psegs + 186 175 MAPPING_VSPACE_SIZE * header->vspaces + 187 MAPPING_VOBJ_SIZE * header->vobjs +188 176 MAPPING_VSEG_SIZE * header->vsegs); 189 177 … … 194 182 MAPPING_PSEG_SIZE * header->psegs + 195 183 MAPPING_VSPACE_SIZE * header->vspaces + 196 MAPPING_VOBJ_SIZE * header->vobjs +197 184 MAPPING_VSEG_SIZE * header->vsegs + 198 185 MAPPING_TASK_SIZE * header->tasks); … … 204 191 MAPPING_PSEG_SIZE * header->psegs + 205 192 MAPPING_VSPACE_SIZE * header->vspaces + 206 MAPPING_VOBJ_SIZE * header->vobjs +207 193 MAPPING_VSEG_SIZE * header->vsegs + 208 194 MAPPING_TASK_SIZE * header->tasks + … … 215 201 MAPPING_PSEG_SIZE * header->psegs + 216 202 MAPPING_VSPACE_SIZE * header->vspaces + 217 MAPPING_VOBJ_SIZE * header->vobjs +218 203 MAPPING_VSEG_SIZE * header->vsegs + 219 204 MAPPING_TASK_SIZE * header->tasks + … … 227 212 MAPPING_PSEG_SIZE * header->psegs + 228 213 MAPPING_VSPACE_SIZE * header->vspaces + 229 MAPPING_VOBJ_SIZE * header->vobjs +230 214 MAPPING_VSEG_SIZE * header->vsegs + 231 215 MAPPING_TASK_SIZE * header->tasks + … … 240 224 MAPPING_PSEG_SIZE * header->psegs + 241 225 MAPPING_VSPACE_SIZE * header->vspaces + 242 MAPPING_VOBJ_SIZE * header->vobjs +243 226 MAPPING_VSEG_SIZE * header->vsegs + 244 227 MAPPING_TASK_SIZE * header->tasks + … … 305 288 port_id++) 306 289 { 307 unsigned int v obj_id = cp_port[port_id].mwmr_vobj_id;290 unsigned int vseg_id = cp_port[port_id].mwmr_vseg_id; 308 291 fprintf(fpout, " <port direction=\"%s\"", port_direction[cp_port[port_id].direction]); 309 292 fprintf(fpout, " vspacename=\"%s\"", vspace[cp_port[port_id].vspaceid].name); 310 fprintf(fpout, " v objname=\"%s\" />\n", vobj[vobj_id].name);293 fprintf(fpout, " vsegname=\"%s\" />\n", vseg[vseg_id].name); 311 294 } 312 295 fprintf(fpout, " </coproc>\n" ); … … 356 339 fprintf(fpout, " <vseg name=\"%s\"", vseg[vseg_id].name); 357 340 fprintf(fpout, " vbase=\"0x%x\"", vseg[vseg_id].vbase); 341 fprintf(fpout, " length=\"0x%x\"", vseg[vseg_id].length); 342 fprintf(fpout, " type=\"%s\"", vseg_type[vseg[vseg_id].type]); 358 343 fprintf(fpout, " mode=\"%s\"", mode_str[vseg[vseg_id].mode]); 344 fprintf(fpout, "\n "); 359 345 fprintf(fpout, " x=\"%d\"", cluster[cluster_id].x); 360 346 fprintf(fpout, " y=\"%d\"", cluster[cluster_id].y); 361 347 fprintf(fpout, " psegname=\"%s\"", pseg[pseg_id].name); 362 if( vseg[vseg_id].ident ) fprintf(fpout, " ident=\"1\""); 363 if( vseg[vseg_id].local ) fprintf(fpout, " local=\"1\""); 348 if( vseg[vseg_id].ident ) 349 fprintf(fpout, " ident=\"1\""); 350 if( vseg[vseg_id].local ) 351 fprintf(fpout, " local=\"1\""); 352 if( vseg[vseg_id].big ) 353 fprintf(fpout, " big=\"1\""); 354 if( vseg[vseg_id].binpath[0] != 0 ) 355 fprintf(fpout, " binpath=\"%s\"", vseg[vseg_id].binpath); 364 356 fprintf(fpout, " >\n"); 365 366 for (vobj_id = vseg[vseg_id].vobj_offset;367 vobj_id < (vseg[vseg_id].vobj_offset + vseg[vseg_id].vobjs);368 vobj_id++)369 {370 fprintf(fpout, " <vobj name=\"%s\"", vobj[vobj_id].name);371 fprintf(fpout, " type=\"%s\"", vobj_type[vobj[vobj_id].type]);372 fprintf(fpout, " length=\"0x%x\"", vobj[vobj_id].length);373 if( vobj[vobj_id].align )374 fprintf(fpout, " align=\"%d\"", vobj[vobj_id].align);375 if( vobj[vobj_id].binpath[0] != 0 )376 fprintf(fpout, " binpath=\"%s\"", vobj[vobj_id].binpath);377 if( (vobj[vobj_id].type == VOBJ_TYPE_BARRIER) ||378 (vobj[vobj_id].type == VOBJ_TYPE_MWMR ) ||379 (vobj[vobj_id].type == VOBJ_TYPE_CONST ) )380 fprintf(fpout, " init=\"%d\"", vobj[vobj_id].init);381 fprintf(fpout, " />\n");382 }383 fprintf(fpout, " </vseg>\n");384 357 } 385 358 fprintf(fpout, " </globalset>\n" ); … … 390 363 for (vspace_id = 0; vspace_id < header->vspaces; vspace_id++) 391 364 { 392 unsigned int v obj_id = vspace[vspace_id].start_vobj_id;365 unsigned int vseg_id = vspace[vspace_id].start_vseg_id; 393 366 fprintf(fpout, " <vspace name = \"%s\" ", vspace[vspace_id].name); 394 fprintf(fpout, " startname = \"%s\" >\n", v obj[vobj_id].name);367 fprintf(fpout, " startname = \"%s\" >\n", vseg[vseg_id].name); 395 368 396 369 //////////////////// vsegs ////////////////////////////////////////////// … … 405 378 fprintf(fpout, " <vseg name=\"%s\"", vseg[vseg_id].name); 406 379 fprintf(fpout, " vbase=\"0x%x\"", vseg[vseg_id].vbase); 380 fprintf(fpout, " length=\"0x%x\"", vseg[vseg_id].length); 381 fprintf(fpout, " type=\"%s\"", vseg_type[vseg[vseg_id].type]); 407 382 fprintf(fpout, " mode=\"%s\"", mode_str[vseg[vseg_id].mode]); 383 fprintf(fpout, "\n "); 408 384 fprintf(fpout, " x=\"%d\"", cluster[cluster_id].x); 409 385 fprintf(fpout, " y=\"%d\"", cluster[cluster_id].y); 410 386 fprintf(fpout, " psegname=\"%s\"", pseg[pseg_id].name); 411 if( vseg[vseg_id].ident ) fprintf(fpout, " ident=\"1\""); 412 if( vseg[vseg_id].local ) fprintf(fpout, " local=\"1\""); 387 if( vseg[vseg_id].ident ) 388 fprintf(fpout, " ident=\"1\""); 389 if( vseg[vseg_id].local ) 390 fprintf(fpout, " local=\"1\""); 391 if( vseg[vseg_id].big ) 392 fprintf(fpout, " big=\"1\""); 393 if( vseg[vseg_id].binpath[0] != 0 ) 394 fprintf(fpout, " binpath=\"%s\"", vseg[vseg_id].binpath); 413 395 fprintf(fpout, " >\n"); 414 415 for (vobj_id = vseg[vseg_id].vobj_offset;416 vobj_id < (vseg[vseg_id].vobj_offset + vseg[vseg_id].vobjs);417 vobj_id++)418 {419 fprintf(fpout, " <vobj name=\"%s\"", vobj[vobj_id].name);420 fprintf(fpout, " type=\"%s\"", vobj_type[vobj[vobj_id].type]);421 fprintf(fpout, " length=\"0x%x\"", vobj[vobj_id].length);422 if( vobj[vobj_id].align )423 fprintf(fpout, " align=\"%d\"", vobj[vobj_id].align);424 if( vobj[vobj_id].binpath[0] != 0 )425 fprintf(fpout, " binpath=\"%s\"", vobj[vobj_id].binpath);426 if( (vobj[vobj_id].type == VOBJ_TYPE_BARRIER) ||427 (vobj[vobj_id].type == VOBJ_TYPE_MWMR ) ||428 (vobj[vobj_id].type == VOBJ_TYPE_CONST ) )429 fprintf(fpout, " init=\"%d\"", vobj[vobj_id].init);430 fprintf(fpout, " />\n");431 }432 fprintf(fpout, " </vseg>\n\n");433 396 } 434 397 … … 439 402 task_id++) 440 403 { 441 unsigned int stack_v obj_id = task[task_id].stack_vobj_id;442 unsigned int heap_v obj_id = task[task_id].heap_vobj_id;404 unsigned int stack_vseg_id = task[task_id].stack_vseg_id; 405 unsigned int heap_vseg_id = task[task_id].heap_vseg_id; 443 406 unsigned int cluster_id = task[task_id].clusterid; 444 407 … … 448 411 fprintf(fpout, " y=\"%d\"", cluster[cluster_id].y); 449 412 fprintf(fpout, " p=\"%d\"", task[task_id].proclocid); 450 fprintf(fpout, " stackname=\"%s\"", vobj[stack_vobj_id].name); 451 if (heap_vobj_id != -1) 452 { 453 fprintf(fpout, " heapname=\"%s\"", vobj[heap_vobj_id].name); 454 } 413 fprintf(fpout, "\n "); 414 fprintf(fpout, " stackname=\"%s\"", vseg[stack_vseg_id].name); 415 if (heap_vseg_id != -1) 416 fprintf(fpout, " heapname=\"%s\"", vseg[heap_vseg_id].name); 455 417 fprintf(fpout, " startid = \"%d\"", task[task_id].startid); 456 418 fprintf(fpout, " />\n"); -
soft/giet_vm/giet_xml/xml_parser.c
r491 r511 13 13 // 3) the mapping directives bor both the tasks and the virtual segments. 14 14 // The corresponding C structures are defined in the "mapping_info.h" file. 15 //16 // This parser also generates the "hard_config.h" and the "giet_vsegs.ld" files,17 // required to compile the GIET-VM code.18 15 /////////////////////////////////////////////////////////////////////////////////////// 19 16 … … 34 31 #define MAX_VSPACES 1024 35 32 #define MAX_TASKS 4096 36 #define MAX_MWMRS 409637 33 #define MAX_VSEGS 4096 38 #define MAX_VOBJS 819239 34 #define MAX_PROCS 1024 40 35 #define MAX_IRQS 8192 … … 43 38 #define MAX_PERIPHS 8192 44 39 45 #define XML_PARSER_DEBUG 040 #define XML_PARSER_DEBUG 1 46 41 47 42 /////////////////////////////////////////////////////////////////////////////////// … … 54 49 mapping_vspace_t * vspace[MAX_VSPACES]; // vspace array 55 50 mapping_vseg_t * vseg[MAX_VSEGS]; // vseg array 56 mapping_vobj_t * vobj[MAX_VOBJS]; // vobj array57 51 mapping_task_t * task[MAX_TASKS]; // task array 58 52 mapping_proc_t * proc[MAX_PROCS]; // proc array … … 89 83 unsigned int task_index = 0; 90 84 unsigned int task_loc_index = 0; 91 92 unsigned int vobj_index = 0;93 unsigned int vobj_loc_index = 0;94 unsigned int vobj_count = 0;95 85 96 86 … … 104 94 char found_mmc = 0; 105 95 96 /* 106 97 //////////////////////////////////////////////////////////////////////// 107 98 // These variables are used to generate the hard_config.h file. 108 99 //////////////////////////////////////////////////////////////////////// 109 100 110 unsigned int total_procs = 0; // total number of processors111 unsigned int nb_procs_max = 0; // max number of processors per cluster112 unsigned int nb_tasks_max = 0; // max number of tasks (in all vspaces)113 101 114 102 unsigned int tim_channels = 0; // number of user timers (per cluster) … … 138 126 unsigned int periph_vbase_array[PERIPH_TYPE_MAX_VALUE] 139 127 = { [0 ... (PERIPH_TYPE_MAX_VALUE - 1)] = 0xFFFFFFFF }; 140 141 ////////////////////////////////////////////////////////////////////// 142 // This arrray is useful to build a temporary list of vobj references. 143 // The struct vobj_ref_s is formed by a vspace_name and a vobj_name. 144 // This array is used to set the attribute vobj_id of a cp_port 145 // once all the vspace have been parsed. 146 ///////////////////////////////////////////////////////////////////// 147 typedef struct vobj_ref_s 148 { 149 char vspace_name[32]; 150 char vobj_name[32]; 151 } vobj_ref_t; 152 153 vobj_ref_t * cp_port_vobj_ref[MAX_CP_PORTS]; 128 */ 154 129 155 130 … … 285 260 } // end getStringValue() 286 261 287 ///////////////////////////////////////////////////////////////////////////////////288 // This function set the vbase addresses for all peripheral types, in order289 // to generate the ldscript file, that contains one single virtual address290 // for peripherals replicated in all clusters, and one virtual addresses for291 // each non replicated peripheral type.292 //293 // It makes the following checks on the virtual addresses:294 //295 // - For replicated peripherals the virtual base address must be:296 // vbase = seg_type_base & 0XFF000000 + (cluster_xy * 0x00010000) & 0x00FF0000297 //298 // - For non-replicated peripherals, the cluster index must be cluster_io.299 ///////////////////////////////////////////////////////////////////////////////////300 void set_periph_vbase_array()301 {302 unsigned int vseg_id; // vseg global index303 unsigned int periph_id; // periph global index304 unsigned int pseg_id; // pseg global index305 unsigned int cluster_id; // cluster linear index306 unsigned int cluster_xy; // cluster topological index307 unsigned int type; // peripheral type308 309 unsigned int type_mask = 0xFF000000;310 unsigned int cluster_mask = 0x00FF0000;311 unsigned int vseg_increment = 0x00010000;312 313 #if XML_PARSER_DEBUG314 printf("\n set peripherals vbase array\n");315 #endif316 317 // scan all vsegs318 for (vseg_id = 0 ; vseg_id < header->vsegs ; vseg_id++)319 {320 // keep only vseg corresponding to a periph321 if ( vobj[vseg[vseg_id]->vobj_offset]->type == VOBJ_TYPE_PERI )322 {323 pseg_id = vseg[vseg_id]->psegid;324 325 #if XML_PARSER_DEBUG326 printf(" - found vseg %s associated to pseg %d", vseg[vseg_id]->name, pseg_id );327 #endif328 329 // scan all periphs to retrieve peripheral type (same psegid)330 for ( periph_id = 0 ; periph_id < header->periphs ; periph_id++)331 {332 if( periph[periph_id]->psegid == pseg_id ) // matching !!!333 {334 cluster_id = pseg[pseg_id]->clusterid;335 type = periph[periph_id]->type;336 337 #if XML_PARSER_DEBUG338 printf(" / matching periph type %d\n", type );339 #endif340 341 if ( (type == PERIPH_TYPE_DMA) ||342 (type == PERIPH_TYPE_MMC) ||343 (type == PERIPH_TYPE_XCU) ) // replicated peripheral344 {345 cluster_xy = (cluster[cluster_id]->x << header->y_width) +346 cluster[cluster_id]->y;347 348 if( (vseg[vseg_id]->vbase & cluster_mask) !=349 (vseg_increment * cluster_xy) )350 {351 printf("[XML ERROR] All replicated peripherals "352 "must have cluster bits = cluster_xy * increment\n");353 printf("periph index = %d / periph type = %d / vbase = %x\n",354 periph_id, type, vseg[vseg_id]->vbase);355 exit(1);356 }357 else if ( periph_vbase_array[type] == 0xFFFFFFFF ) // vbase not set358 {359 periph_vbase_array[type] = vseg[vseg_id]->vbase & type_mask;360 }361 else if ((vseg[vseg_id]->vbase & type_mask) != (periph_vbase_array[type]))362 {363 printf("[XML ERROR] All peripherals with same type"364 " should share the same 8 MSB bits in vbase address\n");365 printf("periph index = %d / periph type = %d / vbase = %x\n",366 periph_id, type, vseg[vseg_id]->vbase);367 exit(1);368 }369 }370 else // non replicated peripheral371 {372 if ( (cluster[cluster_id]->x == header->x_io) &&373 (cluster[cluster_id]->y == header->y_io) )374 {375 periph_vbase_array[type] = vseg[vseg_id]->vbase;376 }377 else378 {379 printf("[XML ERROR] Non replicated peripherals must be in cluster_io\n");380 printf(" periph index = %d / periph type = %d / vbase = %x"381 " / pseg index = %d / cluster index = %d\n",382 periph_id, type, vseg[vseg_id]->vbase, pseg_id, cluster_id);383 exit(1);384 }385 }386 }387 }388 }389 }390 } // end set_periph_vbase_array()391 392 262 /////////////////////////////////////////////////////////////// 393 263 int getClusterId( unsigned int x, unsigned int y ) … … 443 313 } 444 314 445 /////////////////////////////////////////////////// /////////////////////////////446 int getV objId(unsigned int vspace_id, char * vobj_name, unsigned int vspace_max)447 { 448 unsigned int v obj_id;449 unsigned int v obj_min = vspace[vspace_id]->vobj_offset;450 unsigned int v obj_max = vobj_min + vspace_max;451 452 for (v obj_id = vobj_min; vobj_id < vobj_max; vobj_id++)453 { 454 if (strcmp(v obj[vobj_id]->name, vobj_name) == 0) return vobj_id;315 /////////////////////////////////////////////////// 316 int getVsegId( unsigned int vspace_id, char *name ) 317 { 318 unsigned int vseg_id; 319 unsigned int vseg_min = vspace[vspace_id]->vseg_offset; 320 unsigned int vseg_max = vseg_min + vspace[vspace_id]->vsegs; 321 322 for (vseg_id = vseg_min ; vseg_id < vseg_max ; vseg_id++) 323 { 324 if (strcmp(vseg[vseg_id]->name, name) == 0) return vseg_id; 455 325 } 456 326 return -1; 457 327 } 458 328 459 ///////////////////////////////////////////////////////////460 unsigned int alignTo( unsigned int value, unsigned int pow2 )461 {462 unsigned int mask = (1 << pow2) - 1;463 return ( (value + mask) & ~mask);464 }465 466 ////////////////////467 void setVsegLength()468 {469 // for a given vseg identified vseg_index470 // scan all contained vobjs to compute the vseg lenth471 472 unsigned int vobj_id;473 unsigned int cur_length = 0;474 475 unsigned int first = vseg[vseg_index]->vobj_offset;476 unsigned int last = first + vseg[vseg_index]->vobjs;477 478 for ( vobj_id = first ; vobj_id < last ; vobj_id++ )479 {480 if (vobj[vobj_id]->align)481 {482 cur_length = alignTo( cur_length, vobj[vobj_id]->align );483 }484 cur_length += vobj[vobj_id]->length;485 }486 vseg[vseg_index]->length = alignTo( cur_length, 12 );487 }488 489 ///////////////////////490 void checkVsegOverlap()491 {492 // for a given vseg identified by vseg_index,493 // check overlap with all vsegs in same vspace,494 // and check overlap with all global vsegs.495 496 unsigned int vseg_id;497 unsigned int prev_vbase; // previous vseg vbase498 unsigned int prev_length; // previous vseg length499 500 unsigned int vbase = vseg[vseg_index]->vbase; // new vseg vbase501 unsigned int length = vseg[vseg_index]->length; // new vseg length502 503 // checking overlap with other vsegs in same vspace504 if ( header->vspaces > 0 )505 {506 unsigned int first = vspace[vspace_index]->vseg_offset;507 unsigned int last = vseg_index;508 509 for( vseg_id = first ; vseg_id < last ; vseg_id++ )510 {511 prev_vbase = vseg[vseg_id]->vbase;512 prev_length = vseg[vseg_id]->length;513 if ( ((vbase + length) > prev_vbase) && ((prev_vbase + prev_length) > vbase) )514 {515 printf("[XML ERROR] vseg %s in vspace %s overlaps other vseg %s\n",516 vseg[vseg_index]->name, vspace[vspace_index]->name, vseg[vseg_id]->name );517 exit(1);518 }519 }520 }521 522 // checking overlap with existing global vsegs523 for ( vseg_id = 0 ; vseg_id < header->globals ; vseg_id++ )524 {525 prev_vbase = vseg[vseg_id]->vbase;526 prev_length = vseg[vseg_id]->length;527 if ( ((vbase + length) > prev_vbase) && ((prev_vbase + prev_length) > vbase) )528 {529 printf("[XML ERROR] vseg %s in vspace %s overlaps global vseg %s\n",530 vseg[vseg_index]->name, vspace[vspace_index]->name, vseg[vseg_id]->name );531 exit(1);532 }533 }534 }535 329 536 330 ////////////////////////////////////// … … 645 439 646 440 ////////// get stackname attribute 647 str = getStringValue(reader, "stackname" , &ok); 648 if (ok) 649 { 650 int index = getVobjId(vspace_index, str , vobj_loc_index); 441 char* stack_name = getStringValue(reader, "stackname" , &ok); 442 if (ok) 443 { 444 #if XML_PARSER_DEBUG 445 printf(" stackname = %s\n", str); 446 #endif 447 int index = getVsegId( vspace_index , stack_name ); 651 448 if (index >= 0) 652 449 { 653 450 #if XML_PARSER_DEBUG 654 printf(" stackname = %s\n", str);655 451 printf(" stack_id = %d\n", index); 656 452 #endif 657 task[task_index]->stack_v obj_id = index;453 task[task_index]->stack_vseg_id = index; 658 454 } 659 455 else … … 672 468 673 469 ////////// get heap attribute 674 str = getStringValue(reader, "heapname", &ok); 675 if (ok) 676 { 677 int index = getVobjId(vspace_index, str, vobj_loc_index); 470 char* heap_name = getStringValue(reader, "heapname", &ok); 471 if (ok) 472 { 473 #if XML_PARSER_DEBUG 474 printf(" heapname = %s\n", str); 475 #endif 476 int index = getVsegId( vspace_index , heap_name ); 678 477 if (index >= 0) 679 478 { 680 479 #if XML_PARSER_DEBUG 681 printf(" heapname = %s\n", str);682 480 printf(" heap_id = %d\n", index ); 683 481 #endif 684 task[task_index]->heap_v obj_id = index;482 task[task_index]->heap_vseg_id = index; 685 483 } 686 484 else … … 693 491 else 694 492 { 695 task[task_index]->heap_v obj_id = -1;493 task[task_index]->heap_vseg_id = -1; 696 494 } 697 495 … … 716 514 } // end taskNode() 717 515 718 //////////////////////////////////////719 void vobjNode(xmlTextReaderPtr reader)720 {721 unsigned int ok;722 unsigned int value;723 char * str;724 725 if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;726 727 if (vobj_index >= MAX_VOBJS)728 {729 printf("[XML ERROR] The number of vobjs is larger than %d\n", MAX_VOBJS);730 exit(1);731 }732 733 #if XML_PARSER_DEBUG734 printf(" vobj %d\n", vobj_loc_index);735 #endif736 737 vobj[vobj_index] = (mapping_vobj_t *) malloc(sizeof(mapping_vobj_t));738 739 ///////// get name attribute740 str = getStringValue(reader, "name", &ok);741 if (ok)742 {743 #if XML_PARSER_DEBUG744 printf(" name = %s\n", str);745 #endif746 strncpy(vobj[vobj_index]->name, str, 31);747 }748 else749 {750 printf("[XML ERROR] illegal or missing <name> attribute for vobj (%d,%d)\n",751 vseg_index, vobj_loc_index);752 exit(1);753 }754 755 //////// get type attribute756 str = getStringValue(reader, "type", &ok);757 #if XML_PARSER_DEBUG758 printf(" type = %s\n", str);759 #endif760 761 if (ok && (strcmp(str, "ELF") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_ELF; }762 else if (ok && (strcmp(str, "PERI") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_PERI; }763 else if (ok && (strcmp(str, "BLOB") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_BLOB; }764 else if (ok && (strcmp(str, "PTAB") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_PTAB; }765 else if (ok && (strcmp(str, "MWMR") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_MWMR; }766 else if (ok && (strcmp(str, "LOCK") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_LOCK; }767 else if (ok && (strcmp(str, "BUFFER") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_BUFFER; }768 else if (ok && (strcmp(str, "BARRIER") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_BARRIER; }769 else if (ok && (strcmp(str, "CONST") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_CONST; }770 else if (ok && (strcmp(str, "MEMSPACE") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_MEMSPACE; }771 else if (ok && (strcmp(str, "SCHED") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_SCHED; }772 else if (ok && (strcmp(str, "HEAP") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_HEAP; }773 else774 {775 printf("[XML ERROR] illegal or missing <type> attribute for vobj (%d,%d)\n",776 vspace_index, vobj_loc_index);777 exit(1);778 }779 // some more checking780 if ( (vobj[vobj_index]->type == VOBJ_TYPE_ELF) ||781 (vobj[vobj_index]->type == VOBJ_TYPE_PERI) )782 {783 assert( (vobj_count == 0) &&784 "[XML ERROR] an ELF or PERI vobj must be alone in a vseg");785 }786 787 788 ////////// get length attribute789 value = getIntValue(reader, "length", &ok);790 if (ok)791 {792 #if XML_PARSER_DEBUG793 printf(" length = %x\n", value);794 #endif795 vobj[vobj_index]->length = value;796 }797 else {798 printf("[XML ERROR] illegal or missing <length> attribute for vobj (%d,%d)\n",799 vspace_index, vobj_loc_index);800 exit(1);801 }802 803 ////////// get align attribute (optional : 0 if missing)804 value = getIntValue(reader, "align", &ok);805 if (ok)806 {807 #if XML_PARSER_DEBUG808 printf(" align = %d\n", value);809 #endif810 vobj[vobj_index]->align = value;811 }812 else813 {814 vobj[vobj_index]->align = 0;815 }816 817 ////////// get binpath attribute (optional : "" if missing)818 str = getStringValue(reader, "binpath", &ok);819 if (ok)820 {821 #if XML_PARSER_DEBUG822 printf(" binpath = %s\n", str);823 #endif824 strncpy(vobj[vobj_index]->binpath, str, 63);825 }826 else827 {828 vobj[vobj_index]->binpath[0] = 0;829 }830 831 ////////// get init attribute (optional, mandatory for mwmr and barrier)832 value = getIntValue(reader, "init", &ok);833 if (ok)834 {835 #if XML_PARSER_DEBUG836 printf(" init = %d\n", value);837 #endif838 vobj[vobj_index]->init = value;839 }840 else841 {842 if ((vobj[vobj_index]->type == VOBJ_TYPE_MWMR) ||843 (vobj[vobj_index]->type == VOBJ_TYPE_BARRIER) ||844 (vobj[vobj_index]->type == VOBJ_TYPE_CONST))845 {846 printf("[XML ERROR] illegal or missing <value> attribute for vobj (%d,%d). \847 All MWMR or BARRIER or CONST vobj must have a init value \n",848 vspace_index, vobj_loc_index);849 exit(1);850 }851 vobj[vobj_index]->init = 0;852 }853 854 vobj_index++;855 vobj_count++;856 vobj_loc_index++;857 } // end vobjNode()858 516 859 517 ////////////////////////////////////// … … 865 523 char * str; 866 524 867 vobj_count = 0;868 869 525 if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return; 870 526 … … 880 536 881 537 vseg[vseg_index] = (mapping_vseg_t *) malloc(sizeof(mapping_vseg_t)); 882 883 ////////// set vobj_offset attribute884 vseg[vseg_index]->vobj_offset = vobj_index;885 886 #if XML_PARSER_DEBUG887 printf(" vobj_offset = %d\n", vobj_index);888 #endif889 538 890 539 ///////// set mapped attribute 891 540 vseg[vseg_index]->mapped = 0; 892 541 893 //////// set next_vseg attribute894 vseg[vseg_index]->next_vseg = 0;895 896 542 ///////// get name attribute 897 543 str = getStringValue(reader, "name", &ok); … … 938 584 } 939 585 586 ////////// get big attribute (optional : 0 if missing) 587 value = getIntValue(reader, "big", &ok); 588 if (ok) 589 { 590 #if XML_PARSER_DEBUG 591 printf(" big = %d\n", value); 592 #endif 593 vseg[vseg_index]->big = value; 594 } 595 else 596 { 597 vseg[vseg_index]->big = 0; 598 } 599 940 600 /////////// get vbase attribute 941 601 value = getIntValue(reader, "vbase", &ok); … … 950 610 { 951 611 printf("[XML ERROR] illegal or missing <vbase> attribute for vseg (%d,%d)\n", 612 vspace_index, vseg_loc_index); 613 exit(1); 614 } 615 616 ////////// get length attribute 617 value = getIntValue(reader, "length", &ok); 618 if (ok) 619 { 620 #if XML_PARSER_DEBUG 621 printf(" length = %x\n", value); 622 #endif 623 vseg[vseg_index]->length = value; 624 } 625 else 626 { 627 printf("[XML ERROR] illegal or missing <length> attribute for vseg (%d,%d)\n", 628 vspace_index, vseg_loc_index); 629 exit(1); 630 } 631 632 //////// get type attribute 633 str = getStringValue(reader, "type", &ok); 634 635 #if XML_PARSER_DEBUG 636 printf(" type = %s\n", str); 637 #endif 638 639 if (ok && (strcmp(str, "ELF") == 0)) vseg[vseg_index]->type = VSEG_TYPE_ELF; 640 else if (ok && (strcmp(str, "PERI") == 0)) vseg[vseg_index]->type = VSEG_TYPE_PERI; 641 else if (ok && (strcmp(str, "BLOB") == 0)) vseg[vseg_index]->type = VSEG_TYPE_BLOB; 642 else if (ok && (strcmp(str, "PTAB") == 0)) vseg[vseg_index]->type = VSEG_TYPE_PTAB; 643 else if (ok && (strcmp(str, "BUFFER") == 0)) vseg[vseg_index]->type = VSEG_TYPE_BUFFER; 644 else if (ok && (strcmp(str, "SCHED") == 0)) vseg[vseg_index]->type = VSEG_TYPE_SCHED; 645 else if (ok && (strcmp(str, "HEAP") == 0)) vseg[vseg_index]->type = VSEG_TYPE_HEAP; 646 else 647 { 648 printf("[XML ERROR] illegal or missing <type> attribute for vseg (%d,%d)\n", 952 649 vspace_index, vseg_loc_index); 953 650 exit(1); … … 1033 730 } 1034 731 1035 ////////// get vobjs in vseg 732 ////////// get binpath attribute (optional : "" if missing) 733 str = getStringValue(reader, "binpath", &ok); 734 if (ok) 735 { 736 #if XML_PARSER_DEBUG 737 printf(" binpath = %s\n", str); 738 #endif 739 strncpy(vseg[vseg_index]->binpath, str, 63); 740 } 741 else 742 { 743 vseg[vseg_index]->binpath[0] = 0; 744 } 745 746 vseg_index++; 747 vseg_loc_index++; 748 } // end vsegNode() 749 750 //////////////////////////////////////// 751 void vspaceNode(xmlTextReaderPtr reader) 752 { 753 unsigned int ok; 754 755 vseg_loc_index = 0; 756 task_loc_index = 0; 757 758 if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return; 759 760 vspace[vspace_index] = (mapping_vspace_t *) malloc(sizeof(mapping_vspace_t)); 761 header->vspaces = header->vspaces + 1; 762 763 ////////// get name attribute 764 char* vspace_name = getStringValue(reader, "name", &ok); 765 if (ok) 766 { 767 #if XML_PARSER_DEBUG 768 printf("\n vspace = %s\n", vspace_name ); 769 #endif 770 strncpy( vspace[vspace_index]->name, vspace_name , 31 ); 771 } 772 else 773 { 774 printf("[XML ERROR] illegal or missing <name> attribute for vspace %d\n", 775 vspace_index); 776 exit(1); 777 } 778 779 ////////// set vseg_offset and task_offset attributes 780 vspace[vspace_index]->vseg_offset = vseg_index; 781 vspace[vspace_index]->task_offset = task_index; 782 783 ////////// initialise vsegs and tasks attributes 784 vspace[vspace_index]->vsegs = 0; 785 vspace[vspace_index]->tasks = 0; 786 787 ////////// get startname attribute 788 char* start_name = getStringValue(reader, "startname", &ok); 789 if (ok == 0) 790 { 791 printf("[XML ERROR] illegal or missing <startname> attribute for vspace %s\n", 792 vspace[vspace_index]->name); 793 exit(1); 794 } 795 1036 796 int status = xmlTextReaderRead(reader); 1037 797 while (status == 1) … … 1039 799 const char * tag = (const char *) xmlTextReaderConstName(reader); 1040 800 1041 if (strcmp(tag, "vobj") == 0 ) { vobjNode(reader); }1042 else if (strcmp(tag, "#text" ) == 0 ) { }1043 else if (strcmp(tag, "#comment") == 0 ) { }1044 else if (strcmp(tag, "vseg") == 0 )1045 {1046 vseg[vseg_index]->vobjs = vobj_count;1047 setVsegLength();1048 checkVsegOverlap();1049 vseg_index++;1050 vseg_loc_index++;1051 return;1052 }1053 else1054 {1055 printf("[XML ERROR] Unknown tag %s", tag);1056 exit(1);1057 }1058 status = xmlTextReaderRead (reader);1059 }1060 } // end vsegNode()1061 1062 ////////////////////////////////////////1063 void vspaceNode(xmlTextReaderPtr reader)1064 {1065 char * str;1066 unsigned int ok;1067 unsigned int nb_task_vspace = 0;1068 1069 vobj_loc_index = 0;1070 vseg_loc_index = 0;1071 task_loc_index = 0;1072 1073 if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;1074 1075 #if XML_PARSER_DEBUG1076 printf("\n vspace %d\n", vspace_index);1077 #endif1078 1079 vspace[vspace_index] = (mapping_vspace_t *) malloc(sizeof(mapping_vspace_t));1080 header->vspaces = header->vspaces + 1;1081 1082 ////////// get name attribute1083 str = getStringValue(reader, "name", &ok);1084 if (ok) {1085 #if XML_PARSER_DEBUG1086 printf(" name = %s\n", str);1087 #endif1088 strncpy(vspace[vspace_index]->name, str, 31);1089 }1090 else1091 {1092 printf("[XML ERROR] illegal or missing <name> attribute for vspace %d\n",1093 vspace_index);1094 exit(1);1095 }1096 1097 ////////// set vseg_offset and task_offset attributes1098 vspace[vspace_index]->vseg_offset = vseg_index;1099 vspace[vspace_index]->vobj_offset = vobj_index;1100 vspace[vspace_index]->task_offset = task_index;1101 1102 #if XML_PARSER_DEBUG1103 printf(" vseg_offset = %d\n", vseg_index);1104 printf(" vobj_offset = %d\n", vobj_index);1105 printf(" task_offset = %d\n", task_index);1106 #endif1107 1108 ////////// get startname attribute1109 str = getStringValue(reader, "startname", &ok);1110 if (ok)1111 {1112 //used after parsing the vobjs1113 }1114 else1115 {1116 printf("[XML ERROR] illegal or missing <startname> attribute for vspace %s\n",1117 vspace[vspace_index]->name);1118 exit(1);1119 }1120 1121 int status = xmlTextReaderRead(reader);1122 while (status == 1)1123 {1124 const char * tag = (const char *) xmlTextReaderConstName(reader);1125 1126 801 if (strcmp(tag, "vseg") == 0) 1127 802 { 1128 803 vsegNode(reader); 804 vspace[vspace_index]->vsegs += 1; 1129 805 } 1130 806 else if (strcmp(tag, "task") == 0) 1131 807 { 1132 808 taskNode(reader); 1133 nb_task_vspace++;809 vspace[vspace_index]->tasks += 1; 1134 810 } 1135 811 else if (strcmp(tag, "#text") == 0) { } … … 1137 813 else if (strcmp(tag, "vspace") == 0) 1138 814 { 1139 vspace[vspace_index]->vobjs = vobj_loc_index; 1140 vspace[vspace_index]->tasks = task_loc_index ; 1141 vspace[vspace_index]->vsegs = vseg_loc_index ; 1142 1143 // get index of the vobj containing the start vector 1144 int index = getVobjId(vspace_index, str , vobj_loc_index); 815 // get index of the vseg containing the start vector 816 int index = getVsegId( vspace_index, start_name ); 1145 817 if (index == -1) 1146 818 { 1147 printf("[XML ERROR] v objcontaining start vector not found in vspace %s\n",819 printf("[XML ERROR] vseg containing start vector not found in vspace %s\n", 1148 820 vspace[vspace_index]->name); 1149 821 exit(1); … … 1151 823 else 1152 824 { 1153 vspace[vspace_index]->start_vobj_id = index; 1154 #if XML_PARSER_DEBUG 1155 printf(" startname = %s\n", str); 1156 printf(" start_id = %d\n", index); 1157 printf(" end vspace %d\n\n", vspace_index); 1158 #endif 825 vspace[vspace_index]->start_vseg_id = index; 1159 826 } 1160 827 1161 // checking for all tasks that the startid 1162 // is smaller than the number of tasks in vspace 1163 int task_id; 1164 int task_min = vspace[vspace_index]->task_offset; 1165 int task_max = task_min + vspace[vspace_index]->tasks; 1166 for (task_id = task_min; task_id < task_max; task_id++) 1167 { 1168 if (task[task_id]->startid >= vspace[vspace_index]->tasks) 1169 { 1170 printf("[XML ERROR] <startid> too large for task (%d,%d)\n", 1171 vspace_index, task_id ); 1172 exit(1); 1173 } 1174 } 1175 1176 nb_tasks_max += nb_task_vspace; 828 #if XML_PARSER_DEBUG 829 printf(" vsegs = %d\n", vspace[vspace_index]->vsegs ); 830 printf(" tasks = %d\n", vspace[vspace_index]->tasks ); 831 printf(" vseg_offset = %d\n", vspace[vspace_index]->vseg_offset ); 832 printf(" task_offset = %d\n", vspace[vspace_index]->task_offset ); 833 printf(" startname = %s\n", start_name); 834 printf(" start_id = %d\n", index); 835 printf(" end vspace %d\n\n", vspace_index); 836 #endif 1177 837 vspace_index++; 1178 838 return; … … 1328 988 1329 989 cp_port[cp_port_index] = (mapping_cp_port_t *) malloc(sizeof(mapping_cp_port_t)); 1330 cp_port_vobj_ref[cp_port_index] = (vobj_ref_t *) malloc(sizeof(vobj_ref_t));1331 990 1332 991 ///////// get direction attribute … … 1359 1018 } 1360 1019 1361 /////////// get vspacename attribute1362 str = getStringValue(reader, "vspacename", &ok);1363 #if XML_PARSER_DEBUG1364 printf(" vspacename = %s\n", str);1365 #endif1366 if (ok)1367 {1368 strncpy(cp_port_vobj_ref[cp_port_index]->vspace_name, str, 31);1369 }1370 else1371 {1372 printf("[XML ERROR] missing <vspacename> for cp_port %d in cluster %d\n",1373 cp_port_index, cluster_index);1374 exit(1);1375 }1376 1377 /////////// get vobjname attribute1378 str = getStringValue(reader, "vobjname", &ok);1379 #if XML_PARSER_DEBUG1380 printf(" vobjname = %s\n", str);1381 #endif1382 if (ok)1383 {1384 strncpy(cp_port_vobj_ref[cp_port_index]->vobj_name, str, 31);1385 }1386 else1387 {1388 printf("[XML ERROR] missing <vobjname> for cp_port %d in cluster %d\n",1389 cp_port_index, cluster_index);1390 exit(1);1391 }1392 1020 cp_port_index++; 1393 1021 cp_port_loc_index++; … … 1479 1107 printf(" type = %s\n", str); 1480 1108 #endif 1481 unsigned int error = 0; 1482 1483 // initialize peripheral subtype 1484 periph[periph_index]->subtype = 0xFFFFFFFF; 1485 1486 // The CMA, FBF, HBA, IOB, IOC, NIC, ROM, SIM, TTY, PIC, DROM peripherals are not 1487 // replicated in all clusters but can be instanciated twice. 1488 1489 //////////////////////////// 1490 if (strcmp(str, "CMA") == 0) 1491 { 1492 periph[periph_index]->type = PERIPH_TYPE_CMA; 1493 if ( cma_channels < periph[periph_index]->channels ) 1494 { 1495 cma_channels = periph[periph_index]->channels; 1496 } 1497 } 1498 ///////////////////////////////// 1499 else if (strcmp(str, "FBF") == 0) 1500 { 1501 periph[periph_index]->type = PERIPH_TYPE_FBF; 1502 use_fbf = 1; 1503 } 1504 ///////////////////////////////// 1505 else if (strcmp(str, "IOB") == 0) 1506 { 1507 periph[periph_index]->type = PERIPH_TYPE_IOB; 1508 use_iob = 1; 1509 } 1510 ///////////////////////////////// 1511 else if (strcmp(str, "IOC") == 0) 1512 { 1513 char* subtype = getStringValue(reader, "subtype", &ok); 1514 if (!ok) 1515 { 1516 printf("[XML ERROR] IOC peripheral needs a subtype: BDV, HBA or SPI\n"); 1517 exit(1); 1518 } 1519 1520 if ( strcmp(subtype, "BDV") == 0 ) 1521 { 1522 periph[periph_index]->type = PERIPH_TYPE_IOC; 1523 periph[periph_index]->subtype = PERIPH_SUBTYPE_BDV; 1524 ioc_channels = 1; 1525 if ( header->use_ram_disk == 0 ) use_bdv = 1; 1526 } 1527 else if ( strcmp(subtype, "HBA") == 0 ) 1528 { 1529 periph[periph_index]->type = PERIPH_TYPE_IOC; 1530 periph[periph_index]->subtype = PERIPH_SUBTYPE_HBA; 1531 ioc_channels = periph[periph_index]->channels; 1532 if ( header->use_ram_disk == 0 ) use_hba = 1; 1533 } 1534 else if ( strcmp(subtype, "SPI") == 0 ) 1535 { 1536 periph[periph_index]->type = PERIPH_TYPE_IOC; 1537 periph[periph_index]->subtype = PERIPH_SUBTYPE_SPI; 1538 ioc_channels = periph[periph_index]->channels; 1539 if ( header->use_ram_disk == 0 ) use_spi = 1; 1540 } 1541 else 1542 { 1543 printf("[XML ERROR] illegal subtype for IOC peripheral\n"); 1544 exit(1); 1545 } 1546 } 1547 ///////////////////////////////// 1548 else if (strcmp(str, "NIC") == 0) 1549 { 1550 periph[periph_index]->type = PERIPH_TYPE_NIC; 1551 if ( nic_channels < periph[periph_index]->channels ) 1552 { 1553 nic_channels = periph[periph_index]->channels; 1554 } 1555 } 1556 ///////////////////////////////// 1557 else if (strcmp(str, "ROM") == 0) 1558 { 1559 periph[periph_index]->type = PERIPH_TYPE_ROM; 1560 } 1561 ///////////////////////////////// 1562 else if (strcmp(str, "SIM") == 0) 1563 { 1564 periph[periph_index]->type = PERIPH_TYPE_SIM; 1565 } 1566 ///////////////////////////////// 1567 else if (strcmp(str, "TTY") == 0) 1568 { 1569 periph[periph_index]->type = PERIPH_TYPE_TTY; 1570 if ( tty_channels < periph[periph_index]->channels ) 1571 { 1572 tty_channels = periph[periph_index]->channels; 1573 } 1574 } 1575 ///////////////////////////////// 1576 else if (strcmp(str, "PIC") == 0) 1577 { 1578 periph[periph_index]->type = PERIPH_TYPE_PIC; 1579 if ( pic_channels < periph[periph_index]->channels ) 1580 { 1581 pic_channels = periph[periph_index]->channels; 1582 } 1583 use_pic = 1; 1584 } 1585 1586 1587 // The DMA, MMC, XCU peripherals can be replicated in all clusters 1588 // but no more than one component of each type per cluster 1589 1590 ///////////////////////////////// 1591 else if (strcmp(str, "DMA") == 0) 1592 { 1593 periph[periph_index]->type = PERIPH_TYPE_DMA; 1594 if (found_dma) error = 1; 1595 found_dma = 1; 1596 if (dma_channels < periph[periph_index]->channels) 1597 dma_channels = periph[periph_index]->channels; 1598 } 1599 ////////////////////////////////// 1600 else if (strcmp(str, "MMC") == 0) 1601 { 1602 periph[periph_index]->type = PERIPH_TYPE_MMC; 1603 if (found_mmc) error = 1; 1604 found_mmc = 1; 1605 if ( periph[periph_index]->channels != 1 ) error = 1; 1606 } 1607 ////////////////////////////////// 1608 else if (strcmp(str, "XCU") == 0) 1609 { 1610 periph[periph_index]->type = PERIPH_TYPE_XCU; 1611 if (found_xcu || found_icu || found_timer) error = 1; 1612 found_xcu = 1; 1613 found_timer = 1; 1614 tim_channels = 32; 1615 use_xcu = 1; 1616 1617 if ( periph[periph_index]->channels < 1618 (header->irq_per_proc * cluster[cluster_index]->procs) ) 1619 { 1620 printf("[XML ERROR] XCU channels smaller than PROCS * IRQ_PER_PROC\n"); 1621 printf(" - xcu channels = %d\n - nprocs = %d\n - irq_per_proc = %d\n", 1622 periph[periph_index]->channels, 1623 cluster[cluster_index]->procs, 1624 header->irq_per_proc ); 1625 exit(1); 1626 } 1627 } 1628 ///////////////////////////////// 1629 else if (strcmp(str, "DROM") == 0) 1630 { 1631 periph[periph_index]->type = PERIPH_TYPE_DROM; 1632 } 1109 if (strcmp(str, "CMA" ) == 0) periph[periph_index]->type = PERIPH_TYPE_CMA; 1110 else if (strcmp(str, "FBF" ) == 0) periph[periph_index]->type = PERIPH_TYPE_FBF; 1111 else if (strcmp(str, "IOB" ) == 0) periph[periph_index]->type = PERIPH_TYPE_IOB; 1112 else if (strcmp(str, "IOC" ) == 0) periph[periph_index]->type = PERIPH_TYPE_IOC; 1113 else if (strcmp(str, "NIC" ) == 0) periph[periph_index]->type = PERIPH_TYPE_NIC; 1114 else if (strcmp(str, "ROM" ) == 0) periph[periph_index]->type = PERIPH_TYPE_ROM; 1115 else if (strcmp(str, "SIM" ) == 0) periph[periph_index]->type = PERIPH_TYPE_SIM; 1116 else if (strcmp(str, "TTY" ) == 0) periph[periph_index]->type = PERIPH_TYPE_TTY; 1117 else if (strcmp(str, "PIC" ) == 0) periph[periph_index]->type = PERIPH_TYPE_PIC; 1118 else if (strcmp(str, "DMA" ) == 0) periph[periph_index]->type = PERIPH_TYPE_DMA; 1119 else if (strcmp(str, "MMC" ) == 0) periph[periph_index]->type = PERIPH_TYPE_MMC; 1120 else if (strcmp(str, "XCU" ) == 0) periph[periph_index]->type = PERIPH_TYPE_XCU; 1121 else if (strcmp(str, "DROM") == 0) periph[periph_index]->type = PERIPH_TYPE_DROM; 1633 1122 else 1634 1123 { … … 1637 1126 exit(1); 1638 1127 } 1639 1640 if (error) 1641 { 1642 printf("[XML ERROR] illegal peripheral %s in cluster %d\n", 1643 str, cluster_index); 1128 } 1129 1130 ////////// get subtype if IOC 1131 if (periph[periph_index]->type == PERIPH_TYPE_IOC ) 1132 { 1133 char* subtype = getStringValue(reader, "subtype", &ok); 1134 if (ok) 1135 { 1136 #if XML_PARSER_DEBUG 1137 printf(" subtype = %s\n", str); 1138 #endif 1139 if (strcmp(subtype, "BDV") == 0) 1140 periph[periph_index]->subtype = PERIPH_SUBTYPE_BDV; 1141 else if (strcmp(subtype, "HBA") == 0) 1142 periph[periph_index]->subtype = PERIPH_SUBTYPE_HBA; 1143 else if (strcmp(subtype, "SPI") == 0) 1144 periph[periph_index]->subtype = PERIPH_SUBTYPE_SPI; 1145 } 1146 else 1147 { 1148 printf("[XML ERROR] illegal subtype for IOC peripheral\n"); 1644 1149 exit(1); 1645 1150 } 1646 1151 } 1647 else 1648 { 1649 printf("[XML ERROR] illegal or missing <type> for peripheral %d in cluster %d\n", 1650 periph_loc_index, cluster_index); 1651 exit(1); 1152 else 1153 { 1154 periph[periph_index]->subtype = 0XFFFFFFFF; 1652 1155 } 1653 1156 … … 1836 1339 proc_loc_index++; 1837 1340 proc_index++; 1838 total_procs++;1839 1341 } // end procNode() 1840 1342 … … 2027 1529 else if (strcmp(tag, "cluster") == 0) 2028 1530 { 2029 ///////// TIMER and ICU peripheral are mandatory when nprocs != 02030 2031 unsigned int procs = cluster[cluster_index]->procs;2032 if ( procs && !found_timer && !found_xcu)2033 {2034 printf("[XML ERROR] missing timer peripheral in cluster %d\n", cluster_index);2035 exit(1);2036 }2037 2038 if ( procs && !found_icu && !found_xcu)2039 {2040 printf("[XML ERROR] missing icu peripheral in cluster %d\n", cluster_index);2041 exit(1);2042 }2043 2044 if (nb_procs_max < procs) nb_procs_max = procs;2045 1531 2046 1532 #if XML_PARSER_DEBUG … … 2082 1568 { 2083 1569 printf("[XML ERROR] Wrong number of clusters\n"); 2084 exit(1);2085 }2086 2087 // checking TTY terminal for system boot2088 if ( tty_channels == 0 )2089 {2090 printf("[XML ERROR] missing TTY peripheral\n");2091 exit(1);2092 }2093 2094 // checking IOC sub-types2095 if ( (use_bdv + use_hba + use_spi) > 1 )2096 {2097 printf("[XML ERROR] all IOC peripherals must have the same type\n");2098 1570 exit(1); 2099 1571 } … … 2182 1654 { 2183 1655 header->vsegs = vseg_index; 2184 header->vobjs = vobj_index;2185 1656 header->tasks = task_index; 2186 1657 return; … … 2363 1834 header->psegs = 0; 2364 1835 header->vsegs = 0; 2365 header->vobjs = 0;2366 1836 header->tasks = 0; 2367 1837 header->procs = 0; … … 2399 1869 2400 1870 2401 /////////////////////////////////////// 2402 void BuildTable(int fdout, const char * type, unsigned int nb_elem, 2403 unsigned int elem_size, char ** table) 1871 //////////////////////////////////// 1872 void BuildTable( int fdout, 1873 const char * type, 1874 unsigned int nb_elem, 1875 unsigned int elem_size, 1876 char ** table ) 2404 1877 { 2405 1878 unsigned int i; 2406 // write element 2407 for (i = 0; i < nb_elem; i++) { 2408 if (elem_size != write(fdout, table[i], elem_size)) { 1879 for (i = 0; i < nb_elem; i++) 1880 { 1881 if (elem_size != write(fdout, table[i], elem_size)) 1882 { 2409 1883 printf("function %s: %s(%d) write error \n", __FUNCTION__, type, i); 2410 1884 exit(1); … … 2459 1933 printf("vspaces = %d\n", header->vspaces); 2460 1934 printf("psegs = %d\n", header->psegs); 2461 printf("vobjs = %d\n", header->vobjs);2462 1935 printf("vsegs = %d\n", header->vsegs); 2463 1936 printf("tasks = %d\n", header->tasks); … … 2484 1957 // write vsegs 2485 1958 BuildTable(fdout, "vseg", vseg_index, sizeof(mapping_vseg_t), (char **) vseg); 2486 // write vobjs2487 BuildTable(fdout, "vobj", vobj_index, sizeof(mapping_vobj_t), (char **) vobj);2488 1959 // write tasks array 2489 1960 BuildTable(fdout, "task", task_index, sizeof(mapping_task_t), (char **) task); … … 2504 1975 2505 1976 2506 ///////////////////////////////////////////////////////////////////////////////////2507 // this function set the values of vspace_id and vobj_id fields for all cp_ports2508 ///////////////////////////////////////////////////////////////////////////////////2509 void prepareBuild()2510 {2511 unsigned int i;2512 2513 for (i = 0; i < cp_port_index; i++)2514 {2515 int vspace_id = getVspaceId(cp_port_vobj_ref[i]->vspace_name);2516 if (vspace_id < 0)2517 {2518 printf("[XML ERROR] illegal <vspacename> for cp_port %d,\n", i);2519 exit(1);2520 }2521 cp_port[i]->vspaceid = vspace_id;2522 2523 int vobj_id = getVobjId( vspace_id,2524 cp_port_vobj_ref[i]->vobj_name,2525 vspace[vspace_id]->vobjs );2526 if (vobj_id >= 0)2527 {2528 2529 #if XML_PARSER_DEBUG2530 printf("\ncp_port = %d\n", i);2531 printf(" vspace_name = %s\n", cp_port_vobj_ref[i]->vspace_name);2532 printf(" vobj_name = %s\n", cp_port_vobj_ref[i]->vobj_name);2533 printf(" vobj_index = %d\n", vobj_id);2534 #endif2535 cp_port[i]->mwmr_vobj_id = vobj_id;2536 2537 assert((vobj[vspace[vspace_id]->vobj_offset + vobj_id]->type == VOBJ_TYPE_MWMR)2538 && "coproc ports must refer a vobj of type MWMR");2539 }2540 else2541 {2542 printf("[XML ERROR] <vobjname> not found for cp_port %d,\n", i);2543 exit(1);2544 }2545 }2546 }2547 2548 //////////////////////////////////////////2549 void file_write(int fdout, char * towrite)2550 {2551 unsigned int size = strlen(towrite);2552 if (size != write(fdout, towrite, size))2553 {2554 printf("file_write error");2555 exit(1);2556 }2557 }2558 2559 //////////////////////////////////////////////////2560 void def_int_write(int fdout, char * def, int num)2561 {2562 char buf[64];2563 sprintf(buf, "#define\t %s %d\n", def, num);2564 file_write(fdout, buf);2565 }2566 2567 //////////////////////////////////////////////////2568 void def_hex_write(int fdout, char * def, int num)2569 {2570 char buf[64];2571 sprintf(buf, "#define\t %s 0x%x\n", def, num);2572 file_write(fdout, buf);2573 }2574 2575 ///////////////////////////////////2576 void genHd(const char * file_path)2577 {2578 int fdout = open_file(file_path);2579 2580 char prol[80];2581 sprintf(prol, "/* Generated from file %s.xml */\n\n",header->name);2582 2583 char * ifdef = "#ifndef _HARD_CONFIG_H\n#define _HARD_CONFIG_H\n\n";2584 char * epil = "\n#endif //_HARD_CONFIG_H";2585 2586 file_write(fdout, prol);2587 file_write(fdout, ifdef);2588 2589 def_int_write(fdout, "X_SIZE ", header->x_size);2590 def_int_write(fdout, "Y_SIZE ", header->y_size);2591 def_int_write(fdout, "X_WIDTH ", header->x_width);2592 def_int_write(fdout, "Y_WIDTH ", header->y_width);2593 def_int_write(fdout, "X_IO ", header->x_io);2594 def_int_write(fdout, "Y_IO ", header->y_io);2595 2596 file_write(fdout, "\n");2597 2598 def_int_write(fdout, "TOTAL_PROCS ", total_procs);2599 def_int_write(fdout, "NB_PROCS_MAX ", nb_procs_max);2600 def_int_write(fdout, "NB_TASKS_MAX ", nb_tasks_max);2601 2602 file_write(fdout, "\n");2603 2604 def_int_write(fdout, "NB_TIM_CHANNELS ", tim_channels);2605 def_int_write(fdout, "NB_DMA_CHANNELS ", dma_channels);2606 2607 file_write(fdout, "\n");2608 2609 def_int_write(fdout, "NB_TTY_CHANNELS ", tty_channels);2610 def_int_write(fdout, "NB_IOC_CHANNELS ", ioc_channels);2611 def_int_write(fdout, "NB_NIC_CHANNELS ", nic_channels);2612 def_int_write(fdout, "NB_CMA_CHANNELS ", cma_channels);2613 2614 file_write(fdout, "\n");2615 2616 def_int_write(fdout, "USE_XICU ", use_xcu);2617 def_int_write(fdout, "USE_IOB ", use_iob);2618 def_int_write(fdout, "USE_PIC ", use_pic);2619 def_int_write(fdout, "USE_FBF ", use_fbf);2620 2621 file_write(fdout, "\n");2622 2623 def_int_write(fdout, "USE_IOC_RDK ", header->use_ram_disk);2624 def_int_write(fdout, "USE_IOC_HBA ", use_hba);2625 def_int_write(fdout, "USE_IOC_BDV ", use_bdv);2626 def_int_write(fdout, "USE_IOC_SPI ", use_spi);2627 2628 file_write(fdout, "\n");2629 2630 def_int_write(fdout, "IRQ_PER_PROCESSOR ", header->irq_per_proc);2631 2632 file_write(fdout, epil);2633 2634 close(fdout);2635 }2636 2637 ////////////////////////////////////////////////////////2638 void ld_write(int fdout, char * seg, unsigned int addr)2639 {2640 char buf[64];2641 sprintf(buf, "%s = 0x%x;\n", seg, addr);2642 file_write(fdout, buf);2643 }2644 2645 //////////////////////////////////2646 void genLd(const char * file_path)2647 {2648 int fdout = open_file(file_path);2649 unsigned int count;2650 unsigned int vseg_id;2651 unsigned int base; // vseg base2652 unsigned int size; // vseg size2653 2654 char prol[80];2655 sprintf(prol, "/* Generated from file %s.xml */\n\n",header->name);2656 2657 file_write(fdout, prol);2658 2659 // boot mandatory global vsegs2660 for (vseg_id = 0 , count = 0 ; vseg_id < header->vsegs ; vseg_id++)2661 {2662 if ( strcmp(vseg[vseg_id]->name, "seg_boot_code") == 0 )2663 {2664 base = vseg[vseg_id]->vbase;2665 size = vobj[vseg[vseg_id]->vobj_offset]->length;2666 ld_write(fdout, "seg_boot_code_base ", base);2667 ld_write(fdout, "seg_boot_code_size ", size);2668 count++;2669 }2670 else if ( strcmp(vseg[vseg_id]->name, "seg_boot_data") == 0 )2671 {2672 base = vseg[vseg_id]->vbase;2673 size = vobj[vseg[vseg_id]->vobj_offset]->length;2674 ld_write(fdout, "seg_boot_data_base ", base);2675 ld_write(fdout, "seg_boot_data_size ", size);2676 count++;2677 }2678 else if ( strcmp(vseg[vseg_id]->name, "seg_boot_stack") == 0 )2679 {2680 base = vseg[vseg_id]->vbase;2681 size = vobj[vseg[vseg_id]->vobj_offset]->length;2682 ld_write(fdout, "seg_boot_stack_base ", base);2683 ld_write(fdout, "seg_boot_stack_size ", size);2684 count++;2685 }2686 else if ( strcmp(vseg[vseg_id]->name, "seg_boot_mapping") == 0 )2687 {2688 base = vseg[vseg_id]->vbase;2689 size = vobj[vseg[vseg_id]->vobj_offset]->length;2690 ld_write(fdout, "seg_boot_mapping_base ", base);2691 ld_write(fdout, "seg_boot_mapping_size ", size);2692 count++;2693 }2694 }2695 2696 if ( count != 4 )2697 {2698 printf ("[XML ERROR] Missing mandatory Boot global vseg : only %d\n", count);2699 printf ("Mandatory segments are :\n");2700 printf (" - seg_boot_code\n");2701 printf (" - seg_boot_data\n");2702 printf (" - seg_boot_stack\n");2703 printf (" - seg_boot_mapping\n");2704 exit(0);2705 }2706 2707 file_write(fdout, "\n");2708 2709 // kernel mandatory global vsegs2710 for (vseg_id = 0, count = 0 ; vseg_id < header->vsegs ; vseg_id++)2711 {2712 if ( strcmp(vseg[vseg_id]->name, "seg_kernel_code") == 0 )2713 {2714 base = vseg[vseg_id]->vbase;2715 size = vobj[vseg[vseg_id]->vobj_offset]->length;2716 ld_write(fdout, "seg_kernel_code_base ", base);2717 ld_write(fdout, "seg_kernel_code_size ", size);2718 count++;2719 }2720 else if ( strcmp(vseg[vseg_id]->name, "seg_kernel_data") == 0 )2721 {2722 base = vseg[vseg_id]->vbase;2723 size = vobj[vseg[vseg_id]->vobj_offset]->length;2724 ld_write(fdout, "seg_kernel_data_base ", base);2725 ld_write(fdout, "seg_kernel_data_size ", size);2726 count++;2727 }2728 else if ( strcmp(vseg[vseg_id]->name, "seg_kernel_uncdata") == 0 )2729 {2730 base = vseg[vseg_id]->vbase;2731 size = vobj[vseg[vseg_id]->vobj_offset]->length;2732 ld_write(fdout, "seg_kernel_uncdata_base ", base);2733 ld_write(fdout, "seg_kernel_uncdata_size ", size);2734 count++;2735 }2736 else if ( strcmp(vseg[vseg_id]->name, "seg_kernel_init") == 0 )2737 {2738 base = vseg[vseg_id]->vbase;2739 size = vobj[vseg[vseg_id]->vobj_offset]->length;2740 ld_write(fdout, "seg_kernel_init_base ", base);2741 ld_write(fdout, "seg_kernel_init_size ", size);2742 count++;2743 }2744 }2745 if ( count != 4 )2746 {2747 printf ("[XML ERROR] Missing mandatory Kernel global vseg : only %d\n", count);2748 printf ("Mandatory segments are :\n");2749 printf (" - seg_kernel_code\n");2750 printf (" - seg_kernel_data\n");2751 printf (" - seg_kernel_uncdata\n");2752 printf (" - seg_kernel_init\n");2753 exit(0);2754 }2755 2756 file_write(fdout, "\n");2757 2758 // boot and kernel optionnal global vsegs (pseudo ROMs)2759 unsigned int seg_ram_disk_base = 0xFFFFFFFF;2760 unsigned int seg_ram_disk_size = 0;2761 unsigned int seg_reset_code_base = 0xFFFFFFFF;2762 unsigned int seg_reset_code_size = 0;2763 for (vseg_id = 0 ; vseg_id < header->vsegs ; vseg_id++)2764 {2765 if ( strcmp(vseg[vseg_id]->name, "seg_reset_code") == 0 )2766 {2767 seg_reset_code_base = vseg[vseg_id]->vbase;2768 seg_reset_code_size = vobj[vseg[vseg_id]->vobj_offset]->length;2769 }2770 if ( strcmp(vseg[vseg_id]->name, "seg_ram_disk") == 0 )2771 {2772 seg_ram_disk_base = vseg[vseg_id]->vbase;2773 seg_ram_disk_size = vobj[vseg[vseg_id]->vobj_offset]->length;2774 }2775 }2776 2777 ld_write(fdout, "seg_reset_code_base ", seg_reset_code_base);2778 ld_write(fdout, "seg_reset_code_size ", seg_reset_code_size);2779 ld_write(fdout, "seg_ram_disk_base ", seg_ram_disk_base);2780 ld_write(fdout, "seg_ram_disk_size ", seg_ram_disk_size);2781 2782 file_write(fdout, "\n");2783 2784 // fill the peripherals base address array2785 set_periph_vbase_array();2786 2787 // non replicated peripherals2788 ld_write(fdout, "seg_cma_base ", periph_vbase_array[PERIPH_TYPE_CMA]);2789 ld_write(fdout, "seg_fbf_base ", periph_vbase_array[PERIPH_TYPE_FBF]);2790 ld_write(fdout, "seg_iob_base ", periph_vbase_array[PERIPH_TYPE_IOB]);2791 ld_write(fdout, "seg_ioc_base ", periph_vbase_array[PERIPH_TYPE_IOC]);2792 ld_write(fdout, "seg_nic_base ", periph_vbase_array[PERIPH_TYPE_NIC]);2793 ld_write(fdout, "seg_rom_base ", periph_vbase_array[PERIPH_TYPE_ROM]);2794 ld_write(fdout, "seg_sim_base ", periph_vbase_array[PERIPH_TYPE_SIM]);2795 ld_write(fdout, "seg_tty_base ", periph_vbase_array[PERIPH_TYPE_TTY]);2796 ld_write(fdout, "seg_pic_base ", periph_vbase_array[PERIPH_TYPE_PIC]);2797 2798 file_write(fdout, "\n");2799 2800 // replicated peripherals2801 ld_write(fdout, "seg_dma_base ", periph_vbase_array[PERIPH_TYPE_DMA]);2802 ld_write(fdout, "seg_mmc_base ", periph_vbase_array[PERIPH_TYPE_MMC]);2803 ld_write(fdout, "seg_xcu_base ", periph_vbase_array[PERIPH_TYPE_XCU]);2804 2805 file_write(fdout, "\n");2806 2807 ld_write(fdout, "vseg_cluster_increment ", 0x00010000);2808 2809 close(fdout);2810 }2811 2812 1977 ////////////////////////////////////////////////////// 2813 1978 char * buildPath(const char * path, const char * name) … … 2824 1989 int main(int argc, char * argv[]) 2825 1990 { 2826 if (argc < 3) { 1991 if (argc < 3) 1992 { 2827 1993 printf("Usage: xml2bin <input_file_path> <output_path>\n"); 2828 1994 return 1; … … 2830 1996 2831 1997 struct stat dir_st; 2832 if (stat( argv[2], &dir_st)) { 1998 if (stat( argv[2], &dir_st)) 1999 { 2833 2000 perror("bad path"); 2834 2001 exit(1); 2835 2002 } 2836 2003 2837 if ((dir_st.st_mode & S_IFDIR) == 0) { 2004 if ((dir_st.st_mode & S_IFDIR) == 0) 2005 { 2838 2006 printf("path is not a dir: %s", argv[2] ); 2839 2007 exit(1); … … 2841 2009 2842 2010 char * map_path = buildPath(argv[2], "map.bin"); 2843 char * ld_path = buildPath(argv[2], "giet_vsegs.ld");2844 char * hd_path = buildPath(argv[2], "hard_config.h");2845 2011 2846 2012 LIBXML_TEST_VERSION; … … 2859 2025 { 2860 2026 headerNode(reader); 2861 prepareBuild();2862 2027 buildBin(map_path); 2863 genHd(hd_path);2864 genLd(ld_path);2865 2028 } 2866 2029 else
Note: See TracChangeset
for help on using the changeset viewer.