Index: /soft/giet_vm/giet_boot/boot.c
===================================================================
--- /soft/giet_vm/giet_boot/boot.c	(revision 589)
+++ /soft/giet_vm/giet_boot/boot.c	(revision 590)
@@ -132,19 +132,11 @@
 ////////////////////////////////////////////////////////////////////////////
 
-// FAT internal representation for boot code  
-__attribute__((section(".kdata")))
-fat32_fs_t  _fat   __attribute__((aligned(512)));
-
 // Temporaty buffer used to load one complete .elf file  
 __attribute__((section(".kdata")))
-char  _boot_elf_buffer[GIET_ELF_BUFFER_SIZE] __attribute__((aligned(512)));
+unsigned char  _boot_elf_buffer[GIET_ELF_BUFFER_SIZE] __attribute__((aligned(64)));
 
 // Physical memory allocators array (one per cluster)
 __attribute__((section(".kdata")))
 pmem_alloc_t  boot_pmem_alloc[X_SIZE][Y_SIZE];
-
-// Distributed kernel heap (one per cluster)
-// __attribute__((section(".kdata")))
-// kernel_heap_t       kernel_heap[X_SIZE][Y_SIZE];
 
 // Schedulers virtual base addresses array (one per processor)
@@ -1336,51 +1328,12 @@
 void boot_mapping_init()
 {
-    // open file "map.bin"
-    int fd_id = _fat_open( 0, "map.bin", 0 );    // no IRQ / no creation
-
-    if ( fd_id == -1 )
+    // load map.bin file into buffer
+    if ( _fat_load_no_cache( "map.bin",
+                             SEG_BOOT_MAPPING_BASE,
+                             SEG_BOOT_MAPPING_SIZE ) )
     {
         _printf("\n[BOOT ERROR] : map.bin file not found \n");
         _exit();
     }
-
-#if BOOT_DEBUG_MAPPING
-_printf("\n[BOOT] map.bin file successfully open at cycle %d\n", 
-        _get_proctime() );
-#endif
-
-    // get "map.bin" file size (from fat) and check it
-    unsigned int size    = _fat.fd[fd_id].file_size;
-
-    if ( size > SEG_BOOT_MAPPING_SIZE )
-    {
-        _printf("\n[BOOT ERROR] : segment too small for map.bin file\n");
-        _exit();
-    }
-
-#if BOOT_DEBUG_MAPPING
-_printf("\n[BOOT] map.bin buf_pbase = %x / buf_size = %x / file_size = %x\n",
-        SEG_BOOT_MAPPING_BASE , SEG_BOOT_MAPPING_SIZE , size );
-#endif
-
-    // load "map.bin" file into buffer
-    unsigned int nblocks = size >> 9;
-    unsigned int offset  = size & 0x1FF;
-    if ( offset ) nblocks++;
-
-    unsigned int ok = _fat_read( 0,        // No IRQ
-                                 fd_id, 
-                                 (unsigned int*)SEG_BOOT_MAPPING_BASE, 
-                                 nblocks,       
-                                 0 );      // offset
-    if ( ok == -1 )
-    {
-        _printf("\n[BOOT ERROR] : unable to load map.bin file \n");
-        _exit();
-    }
-
-#if BOOT_DEBUG_MAPPING
-_printf("\n[BOOT] map.bin file successfully loaded at cycle %d\n", _get_proctime() );
-#endif
 
     // check mapping signature, number of clusters, number of vspaces  
@@ -1391,5 +1344,5 @@
          (header->vspaces   > GIET_NB_VSPACE_MAX)    )
     {
-        _printf("\n[BOOT ERROR] Illegal mapping signature: %x\n", header->signature );
+        _printf("\n[BOOT ERROR] Illegal mapping : signature = %x\n", header->signature );
         _exit();
     }
@@ -1401,5 +1354,5 @@
 for ( line = 0 ; line < 8 ; line++ )
 {
-    _printf(" | %x | %x | %x | %x | %x | %x | %x | %x |\n",
+    _printf(" | %X | %X | %X | %X | %X | %X | %X | %X |\n",
             *(pointer + 0),
             *(pointer + 1),
@@ -1415,11 +1368,4 @@
 #endif
 
-#if BOOT_DEBUG_MAPPING
-_printf("\n[BOOT] map.bin file checked at cycle %d\n", _get_proctime() );
-#endif
-
-    // close file "map.bin"
-    _fat_close( fd_id );
-    
 } // end boot_mapping_init()
 
@@ -1517,42 +1463,12 @@
     Elf32_Ehdr* elf_header_ptr = NULL;  //  avoid a warning
 
-    int fd_id = 0;                      //  avoid a warning
-
-    // only P[0,0,0] load file from FAT
+    // only P[0,0,0] load file 
     if ( (cxy == 0) && (p == 0) )
     {
-        // open .elf file
-        fd_id = _fat_open( 0 , pathname , 0 );  // no IRQ / no creation
-
-        if ( fd_id < 0 )
-        {
-            _printf("\n[BOOT ERROR] load_one_elf_file() : %s not found\n", 
-                    pathname );
-            _exit();
-        }
-
-        // check buffer size versus file size
-        if ( _fat.fd[fd_id].file_size > GIET_ELF_BUFFER_SIZE )
-        {
-            _printf("\n[BOOT ERROR] in load_one_elf_file() : %s / size = %x "
-                    "larger than GIET_ELF_BUFFER_SIZE = %x\n",
-                    pathname , _fat.fd[fd_id].file_size , GIET_ELF_BUFFER_SIZE );
-            _exit();
-        }
-
-        // compute number of sectors
-        unsigned int nbytes   = _fat.fd[fd_id].file_size;
-        unsigned int nsectors = nbytes>>9;
-        if( nbytes & 0x1FF) nsectors++;
-
-        // load file to elf buffer
-        if( _fat_read( 0,                    // no IRQ
-                       fd_id, 
-                       _boot_elf_buffer,
-                       nsectors,
-                       0 ) != nsectors )     // offset
-        {
-            _printf("\n[BOOT ERROR] load_one_elf_file() : unexpected EOF for %s\n",
-                    pathname );
+        if ( _fat_load_no_cache( pathname,
+                                 (unsigned int)_boot_elf_buffer,
+                                 GIET_ELF_BUFFER_SIZE ) )
+        {
+            _printf("\n[BOOT ERROR] in load_one_elf_file() : %s\n", pathname );
             _exit();
         }
@@ -1656,6 +1572,8 @@
                     {
                         _printf("\n[BOOT ERROR] in load_one_elf_file() : vseg %s "
-                                "is to small for loadable segment %x in file %s\n",
-                                vseg[vseg_id].name , seg_vaddr , pathname );
+                                "is too small for segment %x\n"
+                                "  file = %s / vseg_size = %x / seg_file_size = %x\n",
+                                vseg[vseg_id].name , seg_vaddr , pathname,
+                                seg_size , seg_filesz );
                         _exit();
                     }
@@ -1708,10 +1626,7 @@
     //////////////////////////////////////////////
 
-    // only P[0,0,0] close the file
+    // only P[0,0,0] signals completion
     if ( (cxy == 0) && (p == 0) )
     {
-        // close .elf file
-        _fat_close( fd_id );
-
         _printf("\n[BOOT] File %s loaded at cycle %d\n", 
                 pathname , _get_proctime() );
@@ -1885,5 +1800,5 @@
 
         // initialises the FAT
-        _fat_init( 0 );          // no IRQ
+        _fat_init( 0 );          // don't use Inode-Tree, Fat-Cache, etc.
 
         _printf("\n[BOOT] FAT initialised at cycle %d\n", _get_proctime() );
