Changeset 477


Ignore:
Timestamp:
Jan 1, 2015, 6:46:46 PM (9 years ago)
Author:
alain
Message:

Cosmetic: simplify the map.bin file checking.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_boot/boot.c

    r464 r477  
    172172__attribute__((section (".bootdata")))
    173173unsigned int           _tty_rx_full[NB_TTY_CHANNELS];
     174#if BOOT_DEBUG_MAPPING
     175unsigned int  word;
     176unsigned int  line;
     177unsigned int* pointer = (unsigned int*)SEG_BOOT_MAPPING_BASE;
     178_puts("\n[BOOT] First block of mapping");
     179for ( line = 0 ; line < 8 ; line++ )
     180{
     181    for ( word = 0 ; word < 8 ; word++ )
     182    {
     183        _puts(" | ");
     184        _putx( *(pointer + word) );
     185    }
     186    _puts(" |\n");
     187    pointer = pointer + 8;
     188}
     189#endif
    174190
    175191__attribute__((section (".bootdata")))
     
    178194
    179195
    180 /////////////////////////////////////////////////////////////////////
    181 // This function checks consistence beween the  mapping_info data
    182 // structure (soft), and the giet_config file (hard).
    183 /////////////////////////////////////////////////////////////////////
    184 void boot_mapping_check()
    185 {
    186     mapping_header_t * header = (mapping_header_t *)SEG_BOOT_MAPPING_BASE;
    187 
    188     // checking mapping availability
    189     if (header->signature != IN_MAPPING_SIGNATURE)
    190     {
    191         _puts("\n[BOOT ERROR] Illegal mapping signature: ");
    192         _putx(header->signature);
    193         _puts("\n");
    194         _exit();
    195     }
    196 
    197     // checking number of clusters
    198     if ( (header->x_size  != X_SIZE)  ||
    199          (header->y_size  != Y_SIZE)  ||
    200          (header->x_width != X_WIDTH) ||
    201          (header->y_width != Y_WIDTH) )
    202     {
    203         _puts("\n[BOOT ERROR] Incoherent X_SIZE or Y_SIZE ");
    204         _puts("\n             - In hard_config:  X_SIZE = ");
    205         _putd( X_SIZE );
    206         _puts(" / Y_SIZE = ");
    207         _putd( Y_SIZE );
    208         _puts(" / X_WIDTH = ");
    209         _putd( X_WIDTH );
    210         _puts(" / Y_WIDTH = ");
    211         _putd( Y_WIDTH );
    212         _puts("\n             - In mapping_info: x_size = ");
    213         _putd( header->x_size );
    214         _puts(" / y_size = ");
    215         _putd( header->y_size );
    216         _puts(" / x_width = ");
    217         _putd( header->x_width );
    218         _puts(" / y_width = ");
    219         _putd( header->y_width );
    220         _puts("\n");
    221         _exit();
    222     }
    223     // checking number of virtual spaces
    224     if (header->vspaces > GIET_NB_VSPACE_MAX)
    225     {
    226         _puts("\n[BOOT ERROR] : number of vspaces > GIET_NB_VSPACE_MAX\n");
    227         _puts("\n");
    228         _exit();
    229     }
    230 
    231 #if BOOT_DEBUG_MAPPING
    232 _puts("\n - x_size    = ");
    233 _putd( header->x_size );
    234 _puts("\n - y_size    = ");
    235 _putd( header->y_size );
    236 _puts("\n - procs     = ");
    237 _putd( header->procs );
    238 _puts("\n - periphs   = ");
    239 _putd( header->periphs );
    240 _puts("\n - vspaces   = ");
    241 _putd( header->vspaces );
    242 _puts("\n - tasks     = ");
    243 _putd( header->tasks );
    244 _puts("\n");
    245 _puts("\n - size of header  = ");
    246 _putd( MAPPING_HEADER_SIZE );
    247 _puts("\n - size of cluster = ");
    248 _putd( MAPPING_CLUSTER_SIZE );
    249 _puts("\n - size of pseg    = ");
    250 _putd( MAPPING_PSEG_SIZE );
    251 _puts("\n - size of proc    = ");
    252 _putd( MAPPING_PROC_SIZE );
    253 _puts("\n - size of vspace  = ");
    254 _putd( MAPPING_VSPACE_SIZE );
    255 _puts("\n - size of vseg    = ");
    256 _putd( MAPPING_VSEG_SIZE );
    257 _puts("\n - size of vobj    = ");
    258 _putd( MAPPING_VOBJ_SIZE );
    259 _puts("\n - size of task    = ");
    260 _putd( MAPPING_TASK_SIZE );
    261 _puts("\n");
    262 
    263 unsigned int cluster_id;
    264 mapping_cluster_t * cluster = _get_cluster_base(header);
    265 for( cluster_id = 0; cluster_id < X_SIZE*Y_SIZE ; cluster_id++)
    266 {
    267     _puts("\n - cluster[");
    268     _putd( cluster[cluster_id].x );
    269     _puts(",");
    270     _putd( cluster[cluster_id].y );
    271     _puts("]\n   procs   = ");
    272     _putd( cluster[cluster_id].procs );
    273     _puts("\n   psegs   = ");
    274     _putd( cluster[cluster_id].psegs );
    275     _puts("\n   periphs = ");
    276     _putd( cluster[cluster_id].periphs );
    277     _puts("\n");
    278 }
    279 #endif
    280 
    281 } // end boot_mapping_check()
    282196
    283197//////////////////////////////////////////////////////////////////////////////
     
    16181532    }
    16191533
     1534#if BOOT_DEBUG_MAPPING
     1535_puts("\n[BOOT] map.bin buffer pbase = ");
     1536_putx( SEG_BOOT_MAPPING_BASE );
     1537_puts(" / buffer size = ");
     1538_putx( SEG_BOOT_MAPPING_SIZE );
     1539_puts(" / file size = ");
     1540_putx( size );
     1541_puts("\n");
     1542#endif
     1543
    16201544    // load "map.bin" file into buffer
    16211545    unsigned int nblocks = size >> 9;
     
    16331557        _exit();
    16341558    }
     1559
     1560#if BOOT_DEBUG_MAPPING
     1561_puts("\n[BOOT] map.bin file successfully loaded at cycle ");
     1562_putd(_get_proctime());
     1563_puts("\n");
     1564#endif
     1565
     1566    // check mapping signature, number of clusters, number of vspaces 
     1567    mapping_header_t * header = (mapping_header_t *)SEG_BOOT_MAPPING_BASE;
     1568    if ( (header->signature != IN_MAPPING_SIGNATURE) ||
     1569         (header->x_size    != X_SIZE)               ||
     1570         (header->y_size    != Y_SIZE)               ||
     1571         (header->vspaces   > GIET_NB_VSPACE_MAX)    )
     1572    {
     1573
     1574#if BOOT_DEBUG_MAPPING
     1575unsigned int  word;
     1576unsigned int  line;
     1577unsigned int* pointer = (unsigned int*)SEG_BOOT_MAPPING_BASE;
     1578_puts("\n[BOOT] First block of mapping\n");
     1579for ( line = 0 ; line < 8 ; line++ )
     1580{
     1581    for ( word = 0 ; word < 8 ; word++ )
     1582    {
     1583        _puts(" | ");
     1584        _putx( *(pointer + word) );
     1585    }
     1586    _puts(" |\n");
     1587    pointer = pointer + 8;
     1588}
     1589#endif
     1590        _puts("\n[BOOT ERROR] Illegal mapping signature: ");
     1591        _putx(header->signature);
     1592        _puts("\n");
     1593        _exit();
     1594    }
     1595
     1596#if BOOT_DEBUG_MAPPING
     1597_puts("\n[BOOT] map.bin file checked at cycle ");
     1598_putd(_get_proctime());
     1599_puts("\n");
     1600#endif
     1601
     1602    // close file "map.bin"
    16351603    _fat_close( fd_id );
    16361604   
    1637     // close file "map.bin"
    1638     boot_mapping_check();
    1639 
    16401605} // end boot_mapping_init()
    16411606
Note: See TracChangeset for help on using the changeset viewer.