<div><font color="#222222" face="arial, sans-serif">We are currently running RTEMS 4.10.2 on a Coldfire MCF5485EVB board, with a </font><span style="color:rgb(34,34,34);font-family:arial,sans-serif">Transcend 4GB Compact Flash Card installed in respective slot.  </span><span style="color:rgb(34,34,34);font-family:arial,sans-serif">The required manufacturer's firmware has been downloaded onto CPLD in order to access Compact Flash, etc.</span></div>
<div><span style="color:rgb(34,34,34);font-family:arial,sans-serif"><br></span></div><div><font color="#222222" face="arial, sans-serif">The Compact Flash socket is wired on the board to use 16-bit accesses, (both enables tied together), and memory mapped mode only.</font></div>
<div><span style="color:rgb(34,34,34);font-family:arial,sans-serif"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif">We want to use the Compact Flash card for file storage for our application, not for bootup.</span></div>
<div><span style="color:rgb(34,34,34);font-family:arial,sans-serif"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif">I've modified an existing ATA/IDE driver to access Compact Flash card, as directed in RTEMS File System documentation.</span></div>
<div><span style="color:rgb(34,34,34);font-family:arial,sans-serif"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif">The ATA driver initializes and reads Compact Flash card status correctly, and, when Identify Drive command is sent to card, the correct expected data is returned.  </span><span style="color:rgb(34,34,34);font-family:arial,sans-serif">First word is 0x848A, and driver correctly interprets cylinder/head/sector and LBA info - since these values translate into the card's capacity of 4GB.  Logical Block Addressing is used.</span></div>
<div><span style="color:rgb(34,34,34);font-family:arial,sans-serif"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif">The problem we have is, during register and mount process, the file system attempts to read an MBR from the Compact Flash card - however, all zeroes are returned, and the process fails.</span></div>
<div><span style="color:rgb(34,34,34);font-family:arial,sans-serif"><br></span></div><div><font color="#222222" face="arial, sans-serif">When a file is written to CompactFlash card using a PC, it can be listed, etc, so the card appears to be OK.  And because the Identify Device command causes the card to return expected data, </font><span style="color:rgb(34,34,34);font-family:arial,sans-serif">the HW interface from our Coldfire board appears to be OK as well.</span></div>
<div><font color="#222222" face="arial, sans-serif"><br></font></div><div><font color="#222222" face="arial, sans-serif">Relevant parts from rtems.c are included below - a</font><span style="color:rgb(34,34,34);font-family:arial,sans-serif">ny help is greatly appreciated!!</span></div>
<div><font color="#222222" face="arial, sans-serif"><br></font></div><div><font color="#222222" face="arial, sans-serif">thanks</font></div><div><font color="#222222" face="arial, sans-serif">Chris Xenophontos</font></div>
<div><font color="#222222" face="arial, sans-serif"><br></font></div><div><div>#include <stdlib.h></div><div>#include <rtems.h></div><div>#include <bsp.h></div><div>#include <unistd.h></div><div><br>
</div><div>#include <rtems/rtems_bsdnet.h></div><div>#include <rtems/libio.h></div><div>#include <rtems/shellconfig.h>     // added for shell/filesystem support</div><div>#include <rtems/ide_part_table.h></div>
<div>#include "networkconfig.h"</div><div>#include <libchip/ide_ctrl_cfg.h></div><div>#include <libchip/ide_ctrl_io.h></div><div>#include  <libchip/ata.h></div><div>#include <rtems/bdpart.h></div>
<div>#include <rtems/dosfs.h></div><div>#include <rtems/fsmount.h></div><div><br></div><div>rtems_task Init( rtems_task_argument ignored );</div><div>extern int xmain( void );</div><div><br></div><div><br></div>
<div>fstab_t fs_table[] = </div><div>{</div><div>  {</div><div>    "/dev/hda","/mnt/cf", "dosfs",</div><div>    RTEMS_FILESYSTEM_READ_WRITE,</div><div>    FSMOUNT_MNT_OK | FSMOUNT_MNTPNT_CRTERR | FSMOUNT_MNT_FAILED,</div>
<div>    0</div><div>  }</div><div>};</div><div><br></div><div><br></div><div><br></div><div>rtems_task Init( rtems_task_argument ignored )</div><div>{</div><div>    rtems_status_code sc;</div><div>    int rv;</div><div>    size_t abort_index;</div>
<div>   </div><div><div>   /*     * * * *   /</div></div><div><br></div><div>    abort_index = 0;</div><div>  </div><div>    sc = rtems_bdpart_register_from_disk( "/dev/hda" );</div><div><br></div><div>    rv = rtems_fsmount( fs_table, sizeof(fs_table)/sizeof(fs_table[0]), NULL);</div>
<div><br></div><div>    printf( "\n\nrtems_bdpart_register_from_disk status: %d\n", sc );    // returns 27 = IO_ERROR</div><div>    printf(   "\nrtems_fsmount status status:            %d\n", rv );          // return 0</div>
<div><br></div><div><div>   /*     * * * *   /</div></div><div><br></div><div>    sc = rtems_shell_init ( "fstst", 60 * 1024, 150, "/dev/console", 0, 1, 0 );</div><div><br></div><div><div>   /*     * * * *   /</div>
</div><div><br></div><div>    printf( "\nEntering xmain....\n" );</div><div><br></div><div>    xmain();</div><div>};</div><div><br></div><div><div>   /*     * * * *   /</div></div><div><br></div><div>#define TASK_INTLEVEL 0</div>
<div>#define CONFIGURE_INIT</div><div>#define CONFIGURE_INIT_TASK_ATTRIBUTES<span class="Apple-tab-span" style="white-space:pre">           </span>( RTEMS_FLOATING_POINT | RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_ASR | RTEMS_INTERRUPT_LEVEL(TASK_INTLEVEL))</div>
<div><br></div><div>#define CONFIGURE_MAXIMUM_TASKS               20</div><div>/*( SYS_MAX_TASKS + 7 ) */</div><div>#define CONFIGURE_MAXIMUM_TIMERS               3</div><div><br></div><div><br></div><div>#define CONFIGURE_MAXIMUM_SEMAPHORES          20 //12   // 16</div>
<div>#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES      24   //SB_MAX_PIPES=23    //32</div><div>/* #define CONFIGURE_INIT_TASK_STACK_SIZE      2048 */</div><div><br></div><div>#define CONFIGURE_INIT_TASK_STACK_SIZE (10*1024)</div>
<div>#define CONFIGURE_INIT_TASK_PRIORITY   120</div><div>#define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | \</div><div>                                           RTEMS_NO_TIMESLICE | \</div><div>                                           RTEMS_NO_ASR | \</div>
<div>                                           RTEMS_INTERRUPT_LEVEL(0))</div><div><br></div><div>#define ADA_TASKS  0</div><div><br></div><div>#define CONFIGURE_RTEMS_INIT_TASKS_TABLE</div><div><br></div><div>#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER</div>
<div><br></div><div>#define CONFIGURE_MAXIMUM_DRIVERS                   10</div><div>#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER</div><div>#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM</div><div>#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS    30 </div>
<div>#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK</div><div>#define CONFIGURE_FILESYSTEM_DOSFS</div><div><br></div><div>#define CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER</div><div>#define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER</div>
<div>#define CONFIGURE_ATA_DRIVER_TASK_PRIORITY           9</div><div>#define CONFIGURE_BDBUF_MAX_WRITE_BLOCKS             512</div><div>#define CONFIGURE_MICROSECONDS_PER_TICK           10000</div><div>#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS    30</div>
<div><br></div><div>#define CONFIGURE_SHELL_COMMANDS_INIT         // added for shell/filesystem support</div><div>#define CONFIGURE_SHELL_COMMANDS_ALL     // added for shell/filesystem support</div><div><br></div><div>////////////////////////////////////////////////////////////////</div>
<div>#include <rtems/confdefs.h></div><div><br></div><div><br></div></div>